agent-afk 5.315.3 → 5.316.1

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.
@@ -0,0 +1,19 @@
1
+ import type { Message } from '../types/message-types.js';
2
+ import type { TraceSink, TraceWriter } from '../trace/index.js';
3
+ export interface GateBlockCall {
4
+ blockedTool: string;
5
+ followingTools: string[];
6
+ }
7
+ export interface GateRecoveryFields {
8
+ gateBlocks?: number;
9
+ gateBlockCalls?: GateBlockCall[];
10
+ gateRecoveryNote?: string;
11
+ }
12
+ export interface GateBlockCounter {
13
+ count: number;
14
+ calls?: GateBlockCall[];
15
+ }
16
+ export declare function makeGateBlockTraceWriter(inner: TraceSink | undefined, counter: GateBlockCounter | undefined): TraceSink | undefined;
17
+ export declare function makeGateBlockTraceOwner(inner: TraceWriter | undefined, counter: GateBlockCounter | undefined): TraceWriter | undefined;
18
+ export declare function hasRecoveredFromGate(response: Message, aborted: boolean): boolean;
19
+ export declare function gateRecoveryNote(counter: GateBlockCounter): string;
@@ -1,4 +1,5 @@
1
1
  import type { TraceWriter } from '../trace/index.js';
2
+ import type { GateRecoveryFields } from './scheduler-gate-recovery.js';
2
3
  import type { AgentSession } from '../session/agent-session.js';
3
4
  import type { AgentConfig } from '../types.js';
4
5
  import type { Telegraf } from 'telegraf';
@@ -31,7 +32,7 @@ export interface SchedulerOptions {
31
32
  }
32
33
  export type TelemetryTrigger = 'cron' | 'sessionstart' | 'pull';
33
34
  type TelemetryStatus = 'success' | 'error' | 'skipped' | 'blocked';
34
- export interface TelemetryRecord {
35
+ export interface TelemetryRecord extends GateRecoveryFields {
35
36
  taskId: string;
36
37
  command: string;
37
38
  trigger: TelemetryTrigger;
@@ -45,7 +46,6 @@ export interface TelemetryRecord {
45
46
  name?: string;
46
47
  doneUnverified?: boolean;
47
48
  attempts?: number;
48
- gateBlocks?: number;
49
49
  }
50
50
  export interface TaskCompletionDetails {
51
51
  responseText?: string;
@@ -1,3 +1,4 @@
1
+ import { type GateBlockCounter } from './scheduler-gate-recovery.js';
1
2
  import type { IdleDetector } from './idle-detector.js';
2
3
  import type { AgentSession } from '../session/agent-session.js';
3
4
  import type { MemoryStore } from '../memory/index.js';
@@ -30,9 +31,7 @@ export interface AgentTaskContext {
30
31
  queueDir: string;
31
32
  idleDetector: IdleDetector;
32
33
  now: () => number;
33
- spawnSession: (task: ScheduledTask, trigger: TelemetryTrigger, gateBlockCounter?: {
34
- count: number;
35
- }) => Promise<{
34
+ spawnSession: (task: ScheduledTask, trigger: TelemetryTrigger, gateBlockCounter?: GateBlockCounter) => Promise<{
36
35
  session: AgentSession;
37
36
  memoryStore: MemoryStore;
38
37
  stateStore: StateStore;
@@ -3,15 +3,14 @@ import { McpManager } from '../mcp/index.js';
3
3
  import { AgentSession } from '../session/agent-session.js';
4
4
  import { StateStore } from '../state/state-store.js';
5
5
  import type { TraceWriter } from '../trace/index.js';
6
+ import { type GateBlockCounter } from './scheduler-gate-recovery.js';
6
7
  import type { AgentConfig } from '../types.js';
7
8
  export interface DaemonSpawnOptions {
8
9
  sessionConfig?: Partial<AgentConfig>;
9
10
  sessionFactory?: (config: AgentConfig, ownedTraceWriter?: TraceWriter) => AgentSession;
10
11
  trigger?: 'cron' | 'sessionstart' | 'pull';
11
12
  taskCwd?: string;
12
- gateBlockCounter?: {
13
- count: number;
14
- };
13
+ gateBlockCounter?: GateBlockCounter;
15
14
  }
16
15
  export declare function daemonTraceLabel(taskId: string): string;
17
16
  export declare function _resetDaemonDefaultCwdCache(): void;
@@ -22,9 +22,14 @@ 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;
32
+ hostname?: string;
28
33
  _now?: () => number;
29
34
  log?: (msg: string) => void;
30
35
  }): Promise<GhReadiness>;
@@ -33,6 +38,10 @@ export type ExecWithInputFn = (file: string, args: string[], input: string) => P
33
38
  stdout: string;
34
39
  stderr: string;
35
40
  }>;
41
+ export declare function defaultExecWithInput(file: string, args: string[], input: string): Promise<{
42
+ stdout: string;
43
+ stderr: string;
44
+ }>;
36
45
  export interface PostPrCommentOpts {
37
46
  pr: string;
38
47
  body: string;
@@ -0,0 +1,13 @@
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 validateIssueUrl(value: string, repo: string): string;
13
+ export declare function createIssue(opts: CreateIssueOpts, execFn?: ExecWithInputFn): Promise<string>;
@@ -1,2 +1,3 @@
1
+ export declare const TOOL_LANE_INDENT = " ";
1
2
  export declare function joinOverlayLines(lines: string[]): string;
2
3
  export declare function indentForScrollback(lines: readonly string[]): readonly string[];
@@ -6,3 +6,9 @@ export declare function capToMeasure(width: number): number;
6
6
  export declare function resolveProseMeasure(): number | null;
7
7
  export declare function capToProseMeasure(width: number): number;
8
8
  export declare function contentMargin(termWidth?: number): string;
9
+ export interface ContentBand {
10
+ readonly margin: string;
11
+ readonly marginCols: number;
12
+ readonly width: number;
13
+ }
14
+ export declare function contentBand(cols: number): ContentBand;
@@ -1,4 +1,11 @@
1
1
  import { type BugEnvironment } from './bug.body.js';
2
- import type { SlashCommand, SlashContext } from '../types.js';
2
+ import { type BugFileDeps } from './bug.file.js';
3
+ import type { SlashCommand, SlashContext, SlashResult } from '../types.js';
3
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>;
4
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, maxRows?: number, columns?: number): 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>;
@@ -0,0 +1,4 @@
1
+ import { type ContentBand } from './render/measure.js';
2
+ export declare function compositorBand(stdout: {
3
+ readonly columns?: number;
4
+ }): ContentBand;
@@ -1,3 +1,3 @@
1
1
  import type { ChromeRows } from './terminal-compositor.frame.layout.js';
2
- export declare function buildFrameLines(chrome: ChromeRows, trimmedOverlay: string[], renderGap: boolean, dropdownRows: string[], hintRow: string | null, inputLine: string): string[];
3
- export declare function buildPickerFrameLines(chrome: ChromeRows, trimmedOverlay: string[], renderGap: boolean, pickerRows: string[]): string[];
2
+ export declare function buildFrameLines(chrome: ChromeRows, trimmedOverlay: string[], renderGap: boolean, dropdownRows: string[], hintRow: string | null, inputLine: string, margin?: string): string[];
3
+ export declare function buildPickerFrameLines(chrome: ChromeRows, trimmedOverlay: string[], renderGap: boolean, pickerRows: string[], margin?: string): string[];
@@ -7,5 +7,6 @@ export declare function eraseAndPaintRow(row: number, line?: string): string;
7
7
  export declare function buildBandMeta(logicalLines: readonly string[], width: number): BandRowMeta[];
8
8
  export declare function scrollbackFlushLines(rows: readonly string[], meta: readonly BandRowMeta[] | undefined, count: number): string[];
9
9
  export declare function snapFlushCountToLogicalBoundary(meta: readonly BandRowMeta[] | undefined, count: number, total: number): number;
10
- export declare function buildScrollbackArchiveEscape(lines: readonly string[], anchorFloor: number, bottomRow: number, width: number): string;
10
+ export declare function buildScrollbackArchiveEscape(inputLines: readonly string[], anchorFloor: number, bottomRow: number, width: number): string;
11
11
  export declare function formatTipRow(text: string, cols: number, label?: string): string;
12
+ export declare function centerArchiveRows(lines: readonly string[], cols: number): readonly string[];