agent-afk 6.2.0 → 6.2.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.
@@ -41,7 +41,6 @@ export interface TouchHeartbeatOptions {
41
41
  }
42
42
  export declare function touchPresenceHeartbeat(sessionId: string, options?: TouchHeartbeatOptions): Promise<void>;
43
43
  export declare function patchPresenceFile(sessionId: string, patch: (record: PresenceFileInfo) => void): Promise<void>;
44
- export declare function setPresenceAfk(sessionId: string, afk: boolean): Promise<void>;
45
44
  export declare function setPresenceBlocked(sessionId: string, blocked: boolean): Promise<void>;
46
45
  export declare function updatePresenceCwd(sessionId: string, cwd: string): Promise<void>;
47
46
  export declare function removePresenceFile(sessionId: string): Promise<void>;
@@ -1,4 +1,4 @@
1
1
  export declare const ROUTING_DIRECTIVE = "[skill-routing: active]\n\nRoute recurring work through registered skills instead of rolling ad-hoc solutions:\n\n- Before non-trivial implementation (multi-file edits, new features, config/build changes \u2014 anything that writes) \u2192 `/ground-state` first. Do NOT substitute inline `git status`/`get_runtime_state` \u2014 the skill triangulates git + infra + prior-session memory in parallel, which the inline checks miss. If `/ground-state` dispatch fails (depth limit, unavailable), fall back to inline checks AND note the coverage gap.\n- Bugs, failing tests, or regressions \u2192 `/diagnose`\n- High-stakes sub-agent output that will drive edits or commits \u2192 `/shadow-verify` before acting\n- Refactor needing parallel waves \u2192 `/parallelize`\n- Parallel or dependent multi-task work \u2192 `compose` tool (DAG of subagent nodes; minimize the longest dependency chain)\n- Greenfield feature where a written spec would genuinely help (novel scope, multi-day work, or external stakeholders involved) \u2192 `/mint`\n\nDo NOT reach for `/mint` for: bug fixes (use `/diagnose`), refactors with known shape, single-feature edits, work already spec'd in chat, or anything where the spec/approve pause would feel like ceremony. Implement directly in those cases.\n\nDefault to parallel execution. When a task decomposes into 2+ independent sub-tasks, dispatch them in a single compose wave or parallel agent calls -- do not run them one after another. Sequential dispatch is reserved for chains where an earlier output materially shapes the later prompt.\n\nCommon composed sequences \u2014 reach for these when the task shape matches:\n\n- Bug with failing test and non-trivial fix \u2192 `/diagnose` \u2192 `/shadow-verify` on the proposed fix\n- Refactor needing parallel waves \u2192 plan \u2192 `/parallelize` \u2192 build waves\n- Diagnose + fix in parallel \u2192 `compose` with two independent nodes\n- Research \u2192 implement \u2192 verify pipeline \u2192 `compose` with edges: research\u2192implement\u2192verify\n- Multiple independent investigations \u2192 `compose` with N nodes, no edges\n\nReach for context-isolated investigators when the task is exploratory:\n\n- Map an unfamiliar module before editing \u2192 `/gather` or `/research`\n- Re-derive a load-bearing claim independently \u2192 `/shadow-verify`\n- Audit a diff before merge \u2192 `/review`\n- Generate alternatives before committing to a plan \u2192 `/devils-advocate`\n\nOr dispatch a raw `agent` call when no skill matches but the work is parallelizable, verification-heavy, or would otherwise consume substantial inline context.\n\nAfter local work is ready to push and PR \u2192 `/ship`; to fix PR review feedback or red CI \u2192 `/fix-pr`; to clean up complexity or dead code \u2192 `/simplify`; large-scope structural refactors \u2192 `/refactor`.\n\nSkip orchestration for: single-line edits, trivial Q&A, and direct tool calls the user explicitly requested. The goal is leverage, not ceremony. If a skill would add overhead without adding value, don't invoke it.\n\nDefault to acting autonomously. `ask_question` is a last resort, not a first move \u2014 every question blocks on the operator, who is often away from keyboard.\n\nBefore you ask, you MUST exhaust the tools you have: read the files, check git, search the codebase and docs, inspect runtime state. If any tool can get you the answer, use the tool \u2014 never ask the operator for something you can discover yourself. When a wrong guess would be cheap or reversible, make a reasonable assumption, proceed, and state the assumption instead of asking.\n\n**Answerability \u2014 a question only helps if a human will actually answer it:**\n\n`surface` (from `get_runtime_state`, view `\"self\"`) is a partial signal, not a guarantee:\n- `daemon`, or any session started by a scheduler, cron job, or another agent, has no human watching \u2014 never block on `ask_question` here.\n- `cli` is ambiguous: the interactive REPL and the Telegram bot can reach a human, but one-shot `chat` runs and sub-agent forks report the same `cli` and have no elicitation handler \u2014 there `ask_question` returns `{ action: 'decline' }` instantly.\n- Even when a handler exists, the operator is usually away, so a blocking question can stall until the turn aborts.\n\nSo treat `ask_question` as best-effort: a `decline` or `cancel` result means \"no answer is coming,\" not a failure to abort the task on. When you cannot be sure a human will answer, instead of asking:\n1. **Proceed on a stated assumption** \u2014 pick the most reasonable interpretation, act on it, and record the assumption in your Done/Blocked terminal state for async review.\n2. **Emit a Blocked artifact** \u2014 if no safe assumption exists and proceeding would be irreversible, end the turn with a **Blocked** terminal state naming exactly what the operator must supply before the next run.\n\nReserve `ask_question` for the narrow set of things no tool can resolve: a genuinely ambiguous requirement whose readings lead to materially different work, a decision with significant or irreversible consequences, or context that lives only in the operator's head (a preference, a secret, an external constraint):\n\n- Question types: `text` (open-ended), `confirm` (yes/no), `choice` (single pick from list), `multi_choice` (multi-pick), `number` (numeric with optional bounds). When `allow_custom: true`, the result may include `custom_value` instead of `value` \u2014 check `content.custom_value !== undefined` to detect a free-form answer.\n- Ask one focused question at a time. Do NOT ask multiple questions in a single call, and do NOT stack several ask_question calls across a turn \u2014 fold the genuine unknowns into the single most decision-relevant question.\n- Do NOT use when the user has already provided sufficient context \u2014 infer and proceed instead.\n- The result `action` will be `accept` (answered), `cancel` (user interrupted), `decline` (no handler), or `skip` (optional question skipped).\n- `allow_custom` (choice/multi_choice only): opt-in to a free-form entry affordance. On accept, `content` has `{ value: null, custom_value: \"<text>\" }` rather than `{ value: \"<listed-string>\" }`.\n- After a `cancel` or `decline`, do not loop and re-ask. Either proceed on a stated assumption (reversible work) or end with a **Blocked** terminal state naming exactly what the operator must supply (irreversible work).";
2
- export declare const END_OF_TURN_DIRECTIVE = "[end-of-turn protocol]\n\nEvery turn must end in one externally identifiable terminal state. AFK users need inspectable artifacts, not ceremony. Write each bullet as a single sentence.\n\n**Done**\n- What was done: <one-sentence summary>\n- Evidence: <durable location \u2014 file path, commit SHA, trace path, test output, or memory key; never transcript-only>\n- What changed: <world-state delta>\n- Deferred: <anything still pending, with why; or \"none\">\n- Not checked: <what you did not verify that a reader could reasonably assume you did; always include, using \"nothing material\" when true>\n- Undo: <how to reverse this turn's changes, or \"irreversible\" plus what cannot be reversed; include only if this turn changed something outside the conversation, such as files, commits, pushes, messages, or external systems; omit this bullet otherwise>\n- If files were written or edited but no `git commit` ran, say so explicitly \u2014 name the uncommitted paths and why (e.g. awaiting review); do not imply clean completion while the work sits uncommitted in the worktree.\n\n**Blocked**\n- What blocks: <the blocker>\n- What must change to unblock: <the unblock condition; never a command your own tools could have run, since you should have run it>\n- What has already been done: <progress so far>\n\n**Asking**\n- Question: <one precise question>\n- Assumption it resolves: <what answering clarifies>\n- Once answered: <what you will do>\n\n**Interrupted**\n- What you were doing: <the in-progress task>\n- Where state was saved: <location>\n- What resumption requires: <prerequisites>\n\nBefore emitting a terminal state, consider whether this session produced knowledge reusable across future sessions \u2014 a decision with rationale, a surprising debugging learning, a user preference or correction, or a non-obvious project convention. If so, call `memory_update` (target: \"fact\") before the terminal-state block. Do not force a write when there is nothing genuinely new \u2014 many sessions have nothing worth persisting, and that is fine.\n\nNever end a turn mid-loop without one of these. The terminal-state heading must be the last block of the response, with no trailing prose after it.";
2
+ export declare const END_OF_TURN_DIRECTIVE = "[end-of-turn protocol]\n\nEvery turn must end in one externally identifiable terminal state. AFK users need inspectable artifacts, not ceremony. Write each bullet as a single sentence.\n\n**Done**\n- What was done: <one-sentence summary>\n- Evidence: <durable location \u2014 file path, commit SHA, trace path, test output, or memory key; never transcript-only>\n- What changed: <world-state delta>\n- Deferred: <anything still pending, with why; or \"none\">\n- Assumptions: <any assumption you proceeded on after a declined or cancelled ask_question, plus the rationale; omit this bullet when no assumptions were made>\n- Not checked: <what you did not verify that a reader could reasonably assume you did; always include, using \"nothing material\" when true>\n- Undo: <how to reverse this turn's changes, or \"irreversible\" plus what cannot be reversed; include only if this turn changed something outside the conversation, such as files, commits, pushes, messages, or external systems; omit this bullet otherwise>\n- If files were written or edited but no `git commit` ran, say so explicitly \u2014 name the uncommitted paths and why (e.g. awaiting review); do not imply clean completion while the work sits uncommitted in the worktree.\n\n**Blocked**\n- What blocks: <the blocker>\n- What must change to unblock: <the unblock condition; never a command your own tools could have run, since you should have run it>\n- What has already been done: <progress so far>\n\n**Asking**\n- Question: <one precise question>\n- Assumption it resolves: <what answering clarifies>\n- Once answered: <what you will do>\n\n**Interrupted**\n- What you were doing: <the in-progress task>\n- Where state was saved: <location>\n- What resumption requires: <prerequisites>\n\nBefore emitting a terminal state, consider whether this session produced knowledge reusable across future sessions \u2014 a decision with rationale, a surprising debugging learning, a user preference or correction, or a non-obvious project convention. If so, call `memory_update` (target: \"fact\") before the terminal-state block. Do not force a write when there is nothing genuinely new \u2014 many sessions have nothing worth persisting, and that is fine.\n\nNever end a turn mid-loop without one of these. The terminal-state heading must be the last block of the response, with no trailing prose after it.";
3
3
  export type PromptSurface = 'repl' | 'telegram' | 'one-shot';
4
4
  export declare function assembleSystemPrompt(base: string | undefined, autoRouting: boolean, surface?: PromptSurface): string | undefined;
@@ -14,7 +14,6 @@ export declare class AcpError extends Error {
14
14
  export interface HandlerOptions {
15
15
  model: AgentModelInput;
16
16
  maxTurns: number;
17
- dangerouslySkipPermissions?: boolean;
18
17
  cancelGraceMs?: number;
19
18
  }
20
19
  export interface ServerContext {
@@ -1,9 +1,8 @@
1
1
  import type { AcpSessionHandle } from './acp.session.js';
2
- import type { AcpClientPeer, AcpPermissionGate, SessionUpdate, StopReason, ToolCallStart, TranslatorState } from './acp.wire.js';
2
+ import type { AcpClientPeer, SessionUpdate, StopReason, ToolCallStart, TranslatorState } from './acp.wire.js';
3
3
  export interface ActiveTurn {
4
4
  abort: AbortController;
5
5
  cancelled: boolean;
6
- ending?: boolean;
7
6
  done: Promise<void>;
8
7
  }
9
8
  export interface LiveSession {
@@ -11,7 +10,6 @@ export interface LiveSession {
11
10
  cwd: string;
12
11
  handle?: AcpSessionHandle;
13
12
  translator: TranslatorState;
14
- gate?: AcpPermissionGate;
15
13
  active?: ActiveTurn;
16
14
  closing: boolean;
17
15
  wireMcp?: string;
@@ -5,7 +5,6 @@ export interface AcpServerOptions {
5
5
  maxTurns: number;
6
6
  input: Readable;
7
7
  output: Writable;
8
- dangerouslySkipPermissions?: boolean;
9
8
  log?: (line: string) => void;
10
9
  cancelGraceMs?: number;
11
10
  shutdownDeadlineMs?: number;
@@ -9,7 +9,6 @@ import { AcpSessionResources } from './acp.session.resources.js';
9
9
  export interface AcpSessionOptions {
10
10
  model: AgentModelInput;
11
11
  maxTurns: number;
12
- dangerouslySkipPermissions?: boolean;
13
12
  cwd?: string;
14
13
  canUseTool?: CanUseTool;
15
14
  childCanUseTool?: ChildCanUseToolFactory;
@@ -1,7 +1,13 @@
1
1
  import path from 'node:path';
2
2
  export type PathFlavor = typeof path.posix;
3
+ export declare function delegationSuffix(toolName: string): string;
3
4
  export declare function isContained(root: string, abs: string, p?: PathFlavor): boolean;
4
5
  export declare function driveless(raw: string, p?: PathFlavor): boolean;
5
6
  export declare function relocatesChildren(toolName: string, input: Record<string, unknown>, cwd: string | undefined, p?: PathFlavor): boolean;
6
7
  export declare function dependsOnCallerCwd(input: Record<string, unknown>, p?: PathFlavor): boolean;
7
8
  export declare function outsidePaths(toolName: string, input: Record<string, unknown>, cwd: string | undefined, callerCwd?: string, p?: PathFlavor): string[];
9
+ export declare const GIT_MARKER = "(git internals)";
10
+ export declare const CONFIG_MARKER = "(project config that runs commands)";
11
+ export declare const AGENT_MARKER = "(agent instructions or definitions)";
12
+ export declare function sensitiveMarker(raw: string, base: string | undefined, p?: PathFlavor): string;
13
+ export declare function sensitiveMarkers(toolName: string, input: Record<string, unknown>, base: string | undefined, p?: PathFlavor): string[];
@@ -1,6 +1,3 @@
1
- import type { CanUseTool } from '../../agent/types/sdk-types.js';
2
- import type { ChildToolOrigin } from '../../agent/tools/nesting.can-use-tool.js';
3
- import type { ElicitationHandler } from '../../agent/elicitation-router.js';
4
1
  import type { ResponseMetadata } from '../../agent/types/message-types.js';
5
2
  export type { CanUseTool } from '../../agent/types/sdk-types.js';
6
3
  export type JsonValue = null | boolean | number | string | JsonValue[] | {
@@ -206,26 +203,6 @@ export interface SessionNotification {
206
203
  sessionId: string;
207
204
  update: SessionUpdate;
208
205
  }
209
- export type PermissionOptionKind = 'allow_once' | 'allow_always' | 'reject_once' | 'reject_always';
210
- export interface PermissionOption {
211
- optionId: string;
212
- name: string;
213
- kind: PermissionOptionKind;
214
- }
215
- export interface RequestPermissionRequest {
216
- sessionId: string;
217
- toolCall: ToolCallUpdate;
218
- options: PermissionOption[];
219
- }
220
- export type RequestPermissionOutcome = {
221
- outcome: 'selected';
222
- optionId: string;
223
- } | {
224
- outcome: 'cancelled';
225
- };
226
- export interface RequestPermissionResponse {
227
- outcome: RequestPermissionOutcome;
228
- }
229
206
  export interface TranslatorToolState {
230
207
  name: string;
231
208
  input?: JsonValue;
@@ -249,18 +226,3 @@ export interface FinishedTurn {
249
226
  updates: SessionUpdate[];
250
227
  stopReason: StopReason;
251
228
  }
252
- export interface AcpPermissionOptions {
253
- skip: boolean;
254
- emitToolCall(update: ToolCallStart): Promise<void>;
255
- onCancelled(): void;
256
- cwd?: string;
257
- turnActive?(): boolean;
258
- }
259
- export interface AcpPermissionGate {
260
- canUseTool: CanUseTool;
261
- elicitationHandler?: ElicitationHandler;
262
- cancelAll(): void;
263
- wouldAsk?(toolName: string, input: Record<string, unknown>): boolean;
264
- forChild?(origin: ChildToolOrigin | undefined): CanUseTool;
265
- endTurn?(): Promise<void>;
266
- }
@@ -32,7 +32,6 @@ export interface ChatActionOptions {
32
32
  post?: string;
33
33
  postPr?: string;
34
34
  permissionMode?: PermissionMode;
35
- dangerouslySkipPermissions?: boolean;
36
35
  }
37
36
  export declare function resolvePostTargets(post: string | undefined): PostTarget[];
38
37
  export declare function resolveModelOptions(options: Pick<ChatActionOptions, 'thinking' | 'effort' | 'maxBudgetUsd' | 'taskBudget' | 'maxOutputTokens'>): {
@@ -29,7 +29,6 @@ export interface ChatSessionSetupParams {
29
29
  mcpManager: McpManager | undefined;
30
30
  resumeConfig: Record<string, unknown>;
31
31
  permissionMode: PermissionMode | undefined;
32
- dangerouslySkipPermissions: boolean | undefined;
33
32
  maxTurns: number;
34
33
  temperature: number | undefined;
35
34
  baseUrl: string | undefined;
@@ -36,7 +36,6 @@ export interface CliOptions {
36
36
  resume?: string;
37
37
  continue?: boolean;
38
38
  debug?: boolean;
39
- dangerouslySkipPermissions?: boolean;
40
39
  permissionMode?: PermissionMode;
41
40
  worktree?: string | true;
42
41
  worktreeAutoname?: boolean;
@@ -4,6 +4,5 @@ export interface SharedChatOptionOverrides {
4
4
  themeDescriptionSuffix?: string;
5
5
  worktreeDescription?: string;
6
6
  worktreeBaseDescriptionSuffix?: string;
7
- dangerouslySkipPermissionsDescription?: string;
8
7
  }
9
8
  export declare function applySharedChatOptions(cmd: Command, overrides?: SharedChatOptionOverrides): Command;