agent-afk 5.79.0 → 5.80.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.
- package/dist/agent/awareness/index.d.ts +2 -1
- package/dist/agent/awareness/presence.d.ts +12 -0
- package/dist/agent/process-liveness.d.ts +3 -0
- package/dist/bundled-plugins/awa-bundled/skills/ship/SKILL.md +14 -1
- package/dist/cli.mjs +446 -446
- package/dist/index.mjs +161 -161
- package/dist/telegram.mjs +212 -212
- package/package.json +1 -1
|
@@ -3,4 +3,5 @@ export { buildRuntimeSnapshot, parseView, formatEnvironmentFragment, } from './r
|
|
|
3
3
|
export { buildRuntimeStateSource, type RuntimeSourceDeps, } from './runtime-source.js';
|
|
4
4
|
export { getRuntimeStateTool, AWARENESS_TOOL_NAMES, createGetRuntimeStateHandler, wrapDispatcherWithRuntimeState, } from './tool.js';
|
|
5
5
|
export { gatherWorkspace } from './workspace-source.js';
|
|
6
|
-
export { writePresenceFile, removePresenceFile, removePresenceFileSync, readPresenceFiles, type PresenceFileInfo, type PresenceRecord, } from './presence.js';
|
|
6
|
+
export { writePresenceFile, removePresenceFile, removePresenceFileSync, readPresenceFiles, readLivePresenceFiles, touchPresenceHeartbeat, PRESENCE_SCHEMA_VERSION, type PresenceFileInfo, type PresenceRecord, type PresenceLiveness, type ReadLivePresenceOptions, } from './presence.js';
|
|
7
|
+
export { isProcessAlive, classifyPidLiveness, type ProcessLiveness, } from '../process-liveness.js';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { RuntimeWorkspace } from './types.js';
|
|
2
2
|
import type { TraceActor } from '../session/session-identity.js';
|
|
3
|
+
import { type ProcessLiveness } from '../process-liveness.js';
|
|
4
|
+
export declare const PRESENCE_SCHEMA_VERSION = 1;
|
|
3
5
|
export interface PresenceFileInfo {
|
|
4
6
|
sessionId: string;
|
|
5
7
|
surface: string;
|
|
@@ -13,13 +15,23 @@ export interface PresenceFileInfo {
|
|
|
13
15
|
workspace: RuntimeWorkspace;
|
|
14
16
|
pid: number;
|
|
15
17
|
afk?: boolean;
|
|
18
|
+
schemaVersion?: number;
|
|
19
|
+
heartbeatAt?: string;
|
|
16
20
|
}
|
|
21
|
+
export type PresenceLiveness = ProcessLiveness;
|
|
17
22
|
export interface PresenceRecord extends PresenceFileInfo {
|
|
18
23
|
path: string;
|
|
24
|
+
liveness: PresenceLiveness;
|
|
25
|
+
heartbeatAgeMs: number | null;
|
|
19
26
|
}
|
|
20
27
|
export declare function writePresenceFile(info: PresenceFileInfo): Promise<void>;
|
|
28
|
+
export declare function touchPresenceHeartbeat(sessionId: string): Promise<void>;
|
|
21
29
|
export declare function setPresenceAfk(sessionId: string, afk: boolean): Promise<void>;
|
|
22
30
|
export declare function updatePresenceCwd(sessionId: string, cwd: string): Promise<void>;
|
|
23
31
|
export declare function removePresenceFile(sessionId: string): Promise<void>;
|
|
24
32
|
export declare function removePresenceFileSync(sessionId: string): void;
|
|
25
33
|
export declare function readPresenceFiles(): Promise<PresenceRecord[]>;
|
|
34
|
+
export interface ReadLivePresenceOptions {
|
|
35
|
+
maxHeartbeatAgeMs?: number;
|
|
36
|
+
}
|
|
37
|
+
export declare function readLivePresenceFiles(options?: ReadLivePresenceOptions): Promise<PresenceRecord[]>;
|
|
@@ -123,7 +123,19 @@ gh pr create \
|
|
|
123
123
|
|
|
124
124
|
PR bodies are markdown: they routinely carry backticks (inline code), `$(...)`, and quotes. **Never** inline the body as `--body "$(cat <<'EOF' … EOF)"` — the shell parses backticks/`$(` inside the command substitution before `gh` ever runs, so the call fails (or worse, opens the PR with a truncated/garbled body and you don't notice). `--body-file` reads the file verbatim: no shell quoting, no escaping. Only `--title` stays inline — keep it a single plain line with no backticks.
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
**Phase 9 — Reclaim the worktree.**
|
|
127
|
+
Skip entirely unless the work you just shipped lives under `.afk-worktrees/` (check the invocation cwd from Phase 1 — if the path has no `.afk-worktrees/` segment, there is nothing to reclaim; go straight to the PR URL).
|
|
128
|
+
|
|
129
|
+
A worktree is scaffolding, not an artifact. Once Phase 8 succeeds the branch is pushed and the PR holds the work, so the checkout has no remaining job. Do not leave it for the background sweep — the sweep never reaps a *locked* tree, and a preserved commits-ahead tree is exactly the kind that gets locked, so "the sweep will get it" is false for the common case.
|
|
130
|
+
|
|
131
|
+
Two cases, and they behave differently:
|
|
132
|
+
|
|
133
|
+
- **A worktree you (or a sub-agent) created for this work, that you are NOT currently inside** — reclaim it now, using the `worktree` tool rather than `git worktree` in bash. Two refusals to expect, in this order: a **locked** tree must be `release`d first (`remove` refuses a locked tree, so the order is mandatory, not stylistic), and a tree with **commits ahead of base** is refused unless you pass `force: true`. After a successful push that `force` is safe and correct: the tool never deletes the branch ref, so the commits remain on the branch *and* on the remote — you are discarding a directory, not history. Do not pass `force` before the push has landed.
|
|
134
|
+
- **The worktree you are running in (your own cwd)** — **do not remove it.** Deleting your own working directory strands every subsequent tool call on a path that no longer exists, and `/ship` still has output to produce. Session-end cleanup already removes a clean worktree on exit. Say so instead, in one line: which branch carries the work, and that the checkout is reclaimed when the session ends.
|
|
135
|
+
|
|
136
|
+
Never delete the branch as part of this phase — the open PR depends on that ref.
|
|
137
|
+
|
|
138
|
+
Return the PR URL to the user, plus a one-line worktree disposition (`reclaimed <path>` / `preserved <path> — reclaimed at session end` / omit if not in a worktree). Done.
|
|
127
139
|
|
|
128
140
|
---
|
|
129
141
|
|
|
@@ -131,3 +143,4 @@ Return the PR URL to the user. Done.
|
|
|
131
143
|
- `/ground-state` unavailable → skip Phase 1 with a loud warning; do not proceed silently.
|
|
132
144
|
- `gh` CLI not authenticated → abort Phase 8 with the exact `gh auth login` command.
|
|
133
145
|
- Detached HEAD or shallow clone → abort at Phase 1; these are edge cases `/ship` should not try to auto-recover.
|
|
146
|
+
- Worktree reclaim fails in Phase 9 → the PR is already open and that is the deliverable; report the failure and the path, never retry-loop or walk back the PR.
|