jg-agent-hq 4.0.0 → 4.0.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/CHANGELOG.md +5 -0
- package/api/README.md +3 -3
- package/dist/providers/claude/agents/agents.d.ts +4 -1
- package/dist/providers/claude/agents/agents.js +5 -2
- package/dist/providers/codex/adapter.js +7 -5
- package/dist/providers/codex/codex.js +4 -0
- package/dist/providers/codex/types.d.ts +7 -0
- package/dist/providers/codex/types.js +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.0.1
|
|
4
|
+
|
|
5
|
+
- Report an interactive Claude session that waits on a question or permission prompt as waiting. Claude Code lists it as `waiting`, which was recorded as an unknown state and reported as a disappearance.
|
|
6
|
+
- Never observe an ephemeral Codex session, which Codex doesn't save, such as a helper session Codex starts itself. It no longer appears in session states.
|
|
7
|
+
|
|
3
8
|
## 4.0.0
|
|
4
9
|
|
|
5
10
|
- Run Codex sessions on Codex's shared app-server daemon, which also hosts terminal sessions, through `codex app-server proxy`. A keepalive notices a stopped daemon: affected sessions become uncertain, nothing is resent, and the next Codex read reconnects. Extra skill roots now travel with the threads HQ starts instead of changing every session on the daemon.
|
package/api/README.md
CHANGED
|
@@ -323,8 +323,8 @@ Items expose only normalized presentation fields. User/agent text, commands and
|
|
|
323
323
|
|
|
324
324
|
Every session has a live state: `running`, `waiting` (on the operator), `idle`, `closed`, `failed` or `unknown`. A managed session reports it from its HQ record. A session another client drives is observed and listed with `ownership: 'external'`; HQ sends it no input. Hand it over with `thread-adopt` once it is closed in its terminal, which Codex reports as unloaded.
|
|
325
325
|
|
|
326
|
-
- **Codex.** The shared daemon broadcasts every thread's status. HQ records the states of sessions inside the allowed workspaces, reading each session's workspace once, and their items stay readable with `items`. Observation runs while the Codex connection is open; the connection opens on the first Codex request.
|
|
327
|
-
- **Claude.** While the runtime runs, HQ runs `claude agents --json` every 5 seconds, each run limited to 10 seconds and 65,536 bytes of output, and joins its entries to Claude discovery by `sessionId`. `busy` is running, `blocked`
|
|
326
|
+
- **Codex.** The shared daemon broadcasts every thread's status. HQ records the states of sessions inside the allowed workspaces, reading each session's workspace once, and their items stay readable with `items`. An ephemeral session, which Codex doesn't save, such as a helper session Codex starts itself, is never observed. Observation runs while the Codex connection is open; the connection opens on the first Codex request.
|
|
327
|
+
- **Claude.** While the runtime runs, HQ runs `claude agents --json` every 5 seconds, each run limited to 10 seconds and 65,536 bytes of output, and joins its entries to Claude discovery by `sessionId`. `busy` is running, `waiting` (an interactive session's question or permission prompt) and `blocked` (a background session) are waiting, and `idle` is idle; an entry missing from a run is closed. A failed, late, oversized or malformed run changes nothing. Sessions HQ manages keep their managed records.
|
|
328
328
|
|
|
329
329
|
`{ kind: 'session-states', afterSequence?, limit? }` returns state transitions in sequence order after `afterSequence` (default 0), at most `limit` per page (default 32, maximum 128), with `hasMore`. Continue after the last returned `sequence`. Each transition has `sequence`, `provider`, nullable `nativeId`, nullable `threadId` (managed sessions only), `ownership`, nullable `previousState`, `state`, `reason` and `recordedAt`.
|
|
330
330
|
|
|
@@ -593,7 +593,7 @@ The operation matrix describes the implemented native interfaces and their expli
|
|
|
593
593
|
| Reports and recovery | Six final reports matched complete native outcomes byte for byte. A 46,464-byte report was found through indexed search and read in two chunks. After removing all eight qualification transcripts, offline recovery retained those reports and the host preference; tasks were paused and providers stayed idle. | Native transcripts, repository files and authentication remain separate recovery responsibilities. |
|
|
594
594
|
| Optional skills | All fourteen explicit workflows ran in both providers, including verified delegation and standalone use. Skill-based parent returns ran in both directions. An unissued grant was rejected without creating its request. | Later approvals remain required. Claude signed publication used a disposable bare remote; the qualified Codex sandbox denied Git metadata writes. |
|
|
595
595
|
| Shared Codex daemon | Codex 0.164.0: a terminal `codex` session ran on the shared daemon and appeared in `thread/list`. Without subscribing, HQ saw its `thread/status/changed`; after rejoining with `thread/resume`, HQ received the terminal's live turn and item notifications. A thread HQ created appeared in the terminal's `codex resume` picker, and closing HQ's connection left the daemon and the terminal session running. The daemon confirmed HQ's interrupt and close. Per-thread skill roots, dynamic agent tools and output schemas worked on HQ threads, while another client's catalog and thread never saw the roots. Sessions read their own thread ID from `CODEX_THREAD_ID`. | A terminal started with `-c` overrides runs its thread in its own process (`source: cli`): it is listed, but a second writer is refused, so it cannot be followed live. The restart check ran against a separate app-server on its own socket rather than the shared daemon, which was serving other work: within one keepalive interval the session became uncertain and nothing was resent. A session Codex reloads from disk loses its capability roots. |
|
|
596
|
-
| Claude active sessions | Claude Code 2.1.310 answered `claude agents --json` in 0.16 s. Interactive entries carry `status` (`busy`, `idle`) and `pid`; background entries carry `id` and `state` (`blocked`). Sessions HQ starts in structured mode are listed as interactive under their HQ name and disappear after close.
|
|
596
|
+
| Claude active sessions | Claude Code 2.1.310 answered `claude agents --json` in 0.16 s. Interactive entries carry `status` (`busy`, `waiting`, `idle`) and `pid`; background entries carry `id` and `state` (`blocked`). Sessions HQ starts in structured mode are listed as interactive under their HQ name and disappear after close. | The list describes running processes only; history still comes from transcripts. |
|
|
597
597
|
| Host coverage | Linux x86_64 package checks passed on Node 24.15.0 and 24.22.1. Integrated delegation ran on the floor; identity, native interaction and recovery also ran on 24.22.1. | No macOS host was available for this run. Windows is outside the declared host contract. |
|
|
598
598
|
|
|
599
599
|
The integrated delegation, identity and recovery checks used gpt-6.1-sol with medium effort and claude-opus-5-5 with medium effort in disposable workspaces on 2026-10-23. The shared-daemon and Claude active-session checks ran on 2026-10-25 with the installed CLIs' default models in disposable workspaces. The [Node release index](https://nodejs.org/dist/index.json) identified 24.22.1 as the current LTS patch at qualification time. Local checks do not establish a published npm release or a deployed website.
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { ISessionState } from '../../../contracts/index.js';
|
|
2
2
|
import { type IClaudeAgent } from './types.js';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Maps a native report to the shared session state: an interactive session reports `waiting` on a
|
|
5
|
+
* question or permission prompt, and a background one `blocked`.
|
|
6
|
+
*/
|
|
4
7
|
export declare const toAgentState: (agent: IClaudeAgent) => ISessionState;
|
|
5
8
|
/**
|
|
6
9
|
* Polls `claude agents --json` while the runtime runs and records the complete list of active
|
|
@@ -4,12 +4,15 @@ import { resolveWorkspaceTarget } from '../../../runtime/state/index.js';
|
|
|
4
4
|
import { AGENTS_DEADLINE_MS, AGENTS_OUTPUT_BYTES, AGENTS_POLL_INTERVAL_MS } from './constants.js';
|
|
5
5
|
import { ClaudeAgentsSchema } from './types.js';
|
|
6
6
|
const run = promisify(execFile);
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Maps a native report to the shared session state: an interactive session reports `waiting` on a
|
|
9
|
+
* question or permission prompt, and a background one `blocked`.
|
|
10
|
+
*/
|
|
8
11
|
export const toAgentState = (agent) => {
|
|
9
12
|
const reported = agent.status ?? agent.state;
|
|
10
13
|
return reported === 'busy'
|
|
11
14
|
? 'running'
|
|
12
|
-
: reported === 'blocked'
|
|
15
|
+
: reported === 'waiting' || reported === 'blocked'
|
|
13
16
|
? 'waiting'
|
|
14
17
|
: reported === 'idle'
|
|
15
18
|
? 'idle'
|
|
@@ -17,7 +17,7 @@ export const createCodexProviderFactory = (extraSkillRoots) => ({
|
|
|
17
17
|
id: 'codex',
|
|
18
18
|
async create(context) {
|
|
19
19
|
const native = await createCodexProvider(extraSkillRoots, context.agentTools);
|
|
20
|
-
// whether each
|
|
20
|
+
// whether each session is observed, read once: Codex saves it and it's inside an allowed workspace
|
|
21
21
|
const allowedSessions = new Map();
|
|
22
22
|
let observations = Promise.resolve();
|
|
23
23
|
const observeSession = (nativeId, state) => {
|
|
@@ -25,10 +25,12 @@ export const createCodexProviderFactory = (extraSkillRoots) => ({
|
|
|
25
25
|
.then(async () => {
|
|
26
26
|
let isAllowed = allowedSessions.get(nativeId);
|
|
27
27
|
if (isAllowed === undefined) {
|
|
28
|
-
const thread = await native.
|
|
29
|
-
isAllowed =
|
|
30
|
-
.
|
|
31
|
-
|
|
28
|
+
const thread = await native.readObservedThread(nativeId);
|
|
29
|
+
isAllowed =
|
|
30
|
+
!thread.isEphemeral &&
|
|
31
|
+
(await resolveWorkspaceTarget(thread.workspaceRoot, context.allowedRoots)
|
|
32
|
+
.then(() => true)
|
|
33
|
+
.catch(() => false));
|
|
32
34
|
if (allowedSessions.size >= 1024)
|
|
33
35
|
allowedSessions.delete(allowedSessions.keys().next().value);
|
|
34
36
|
allowedSessions.set(nativeId, isAllowed);
|
|
@@ -351,6 +351,10 @@ export const createCodexProvider = async (extraSkillRoots = [], agentTools) => {
|
|
|
351
351
|
const result = parseNative(z.object({ thread: NativeThreadSchema.refine((thread) => thread.id === nativeId) }), await connection.request('thread/read', { threadId: nativeId, includeTurns: false }));
|
|
352
352
|
return toThreadSummary(result.thread);
|
|
353
353
|
},
|
|
354
|
+
async readObservedThread(nativeId) {
|
|
355
|
+
const { thread } = parseNative(z.object({ thread: NativeThreadSchema.refine((thread) => thread.id === nativeId) }), await connection.request('thread/read', { threadId: nativeId, includeTurns: false }));
|
|
356
|
+
return { workspaceRoot: thread.cwd, isEphemeral: thread.ephemeral === true };
|
|
357
|
+
},
|
|
354
358
|
async listTurns(nativeId, limit, cursor) {
|
|
355
359
|
const page = parseNative(NativeTurnPageSchema, await connection.request('thread/turns/list', {
|
|
356
360
|
threadId: nativeId,
|
|
@@ -11,6 +11,7 @@ export declare const NativeThreadSchema: z.ZodObject<{
|
|
|
11
11
|
forkedFromId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
12
|
cwd: z.ZodString;
|
|
13
13
|
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
14
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
14
15
|
createdAt: z.ZodNumber;
|
|
15
16
|
updatedAt: z.ZodNumber;
|
|
16
17
|
status: z.ZodObject<{
|
|
@@ -49,6 +50,7 @@ export declare const NativeThreadPageSchema: z.ZodObject<{
|
|
|
49
50
|
forkedFromId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
51
|
cwd: z.ZodString;
|
|
51
52
|
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
|
+
ephemeral: z.ZodOptional<z.ZodBoolean>;
|
|
52
54
|
createdAt: z.ZodNumber;
|
|
53
55
|
updatedAt: z.ZodNumber;
|
|
54
56
|
status: z.ZodObject<{
|
|
@@ -191,6 +193,11 @@ export type ICodexProvider = {
|
|
|
191
193
|
readonly isAvailable: boolean;
|
|
192
194
|
listThreads(workspaceRoot: string, limit: number, cursor?: string, search?: string): Promise<INativePage<IThreadSummary>>;
|
|
193
195
|
readThread(nativeId: string): Promise<IThreadSummary>;
|
|
196
|
+
/** @returns A session's workspace and whether Codex doesn't save it, which decide observation. */
|
|
197
|
+
readObservedThread(nativeId: string): Promise<{
|
|
198
|
+
workspaceRoot: string;
|
|
199
|
+
isEphemeral: boolean;
|
|
200
|
+
}>;
|
|
194
201
|
listTurns(nativeId: string, limit: number, cursor?: string): Promise<INativePage<ITurnSummary>>;
|
|
195
202
|
listItems(nativeId: string, limit: number, cursor?: string, turnId?: string, evidence?: boolean): Promise<INativePage<IHistoryItem>>;
|
|
196
203
|
readUsage(): Promise<IUsageSnapshot>;
|
|
@@ -8,6 +8,8 @@ export const NativeThreadSchema = z.object({
|
|
|
8
8
|
forkedFromId: z.string().min(1).max(4096).nullable().optional(),
|
|
9
9
|
cwd: z.string().min(1).max(4096),
|
|
10
10
|
name: z.string().nullable().optional(),
|
|
11
|
+
// a session Codex doesn't save, such as the helper sessions it starts itself
|
|
12
|
+
ephemeral: z.boolean().optional(),
|
|
11
13
|
createdAt: z.number().int().safe(),
|
|
12
14
|
updatedAt: z.number().int().safe(),
|
|
13
15
|
status: z.object({
|