jg-agent-hq 12.0.1 → 13.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 13.0.0
4
+
5
+ - Accept managed-session names of 1 through 64 characters for create, adopt, rename and managed-thread responses. Export `MAX_THREAD_NAME_LENGTH` from `jg-agent-hq/contracts`; suggestions and atomic collision suffixes use the same limit. The lowercase ASCII alphabet, first-character rule, case-insensitive uniqueness and immutable identities are unchanged.
6
+ - This is a breaking producer-contract change: 12.x consumers with strict 32-character response schemas reject longer names. Upgrade runtime and consumers together.
7
+ - Keep the 12.0.1 storage schema, action key and host `user_version` unchanged. Existing names are retained. Before downgrading to 12.x, inventory managed sessions through bounded pages and explicitly shorten every name longer than 32, resolving collisions through supported rename actions. See [package downgrade](docs/recovery.md#package-downgrade).
8
+
3
9
  ## 12.0.1
4
10
 
5
11
  - Refresh the cached metadata of an observed Codex session on `thread/name/updated` and reconnect, so a terminal rename or cleared name reaches `active-sessions`. Metadata-only changes preserve the session's activity time and append no state transition; active-list reads still make no native calls.
package/README.md CHANGED
@@ -77,7 +77,9 @@ Durable state includes `action.key`, which must stay private and accompany its S
77
77
 
78
78
  Text and skill inputs can attach up to 8 workspace files by path and media type, 16 MiB in all and 256 KiB per text file. The runtime verifies their content hashes again before queued delivery. Output schemas use native Codex turn parameters or Claude's structured-session flag; complete validated results and known token usage remain available on selected receipts after reconnect. Live previews stay bounded and explicitly mark truncation. See [file inputs and complete results](api/README.md#file-inputs-and-complete-results).
79
79
 
80
- Use `suggest-thread-name --topic "Build usage" --state-root <directory>` for an editable label. Creation adds a short ordinal suffix when a name is occupied. Actions and relationships retain immutable IDs.
80
+ Use `suggest-thread-name --topic "Build usage" --state-root <directory>` for an editable label of up to 64 characters. Creation adds an ordinal suffix when a name is occupied, keeping the complete label within that limit. `MAX_THREAD_NAME_LENGTH` from `jg-agent-hq/contracts` is the public limit. Actions and relationships retain immutable IDs.
81
+
82
+ Version 13 retains the 12.0.1 storage schema and action key without migration or reset, and leaves existing names intact. Upgrade runtime and consumers together: older strict response schemas reject names longer than 32 characters. Before a package downgrade, explicitly shorten every longer managed name through supported actions, resolving collisions. See [package downgrade](docs/recovery.md#package-downgrade).
81
83
 
82
84
  Use `skills --workspace-root <directory> --state-root <directory>` to browse the native skill catalog a session started in that folder would have, with `--provider` (default `codex`), and add `--thread-id <id>` for a controlled session's own catalog. A skill input resolves its exact invocation from that catalog before it is sent. Missing native metadata is explicitly unavailable. The CLI loads all skill content and retains its permissions and invocation rules.
83
85
 
package/api/README.md CHANGED
@@ -19,7 +19,7 @@ Intentional Node API failures use `Exception` from `jg-exception`. The [error re
19
19
 
20
20
  - Requests and responses: `HqRequestSchema`, `IHqRequest`, `IHqRequestInput`, `HqResponseSchema`, `IHqResponse`, `IHqResponseOf`, `RuntimeStatusSchema`, `IRuntimeStatus`, `IpcRequestSchema`, `IpcResponseSchema` and `IIpcResponse`; see [read commands](#read-commands).
21
21
  - Errors: `ErrorKindSchema`, `IErrorKind`, `PUBLIC_ERROR_CODES` and `PUBLIC_ERROR_MESSAGES`; see the [public error messages](../errors/README.md#public-error-messages).
22
- - Limits: `DEFAULT_PAGE_SIZE` and `MAX_PAGE_SIZE` for pages, `MAX_WORKSPACE_ROOTS` for one `threads` read, `MAX_ACTION_BYTES` for an action envelope, `MAX_WAIT_MS` for receipt waits and long-polls, and `MAX_ITEM_TEXT_LENGTH`, `MAX_ITEM_IMAGES` and `MAX_ITEM_IMAGE_BYTES` for items.
22
+ - Limits: `DEFAULT_PAGE_SIZE` and `MAX_PAGE_SIZE` for pages, `MAX_WORKSPACE_ROOTS` for one `threads` read, `MAX_THREAD_NAME_LENGTH` for complete managed-session names, `MAX_ACTION_BYTES` for an action envelope, `MAX_WAIT_MS` for receipt waits and long-polls, and `MAX_ITEM_TEXT_LENGTH`, `MAX_ITEM_IMAGES` and `MAX_ITEM_IMAGE_BYTES` for items.
23
23
  - Providers and models: `ProviderIdSchema`, `IProviderId`, `ProviderCapabilitySchema`, `IProviderCapability`, `ProviderCapabilitySetSchema`, `IProviderCapabilitySet`, `ProviderCapabilitiesSchema`, `IProviderCapabilities`, `ProviderStatusSchema`, `IProviderStatus`, `ProviderModelSchema`, `IProviderModel`, `ProviderModelsRequestSchema`, `IProviderModelsRequest`, `ProviderModelPageSchema` and `IProviderModelPage`; see [providers and capabilities](#providers-and-capabilities).
24
24
  - Sessions and history: `ThreadsPageSchema`, `IThreadsPage`, `ThreadSummarySchema`, `IThreadSummary`, `SessionTerminalSchema`, `ISessionTerminal`, `ActiveSessionsSchema`, `IActiveSessions`, `HistoryItemSchema`, `IHistoryItem`, `HistoryFileSchema`, `IHistoryFile`, `ItemDetailSchema`, `IItemDetail`, `ItemImageSchema`, `IItemImage`, `ItemImageMediaTypeSchema`, `IItemImageMediaType`, `LiveItemsSchema`, `NativeLineageSchema` and `INativeLineage`; see [session discovery](#session-discovery).
25
25
  - Session states: `SessionStateSchema`, `ISessionState`, `SessionTransitionReasonSchema`, `ISessionTransitionReason`, `SessionTransitionSchema`, `ISessionTransition`, `SessionTransitionPageSchema`, `ObservationPaceSchema` and `IObservationPace`; see [session states](#session-states).
@@ -263,7 +263,9 @@ Send `{ kind: 'action', action: { id, runtimeEpoch, command } }`. Generate one U
263
263
 
264
264
  Message and queue input is a closed union: `{ kind: 'text', text }` or `{ kind: 'skill', skillId, arguments }`. Text is nonempty and at most 65,536 characters; skill arguments may be empty and cap at 16,384 characters. The envelope's UTF-8 limit still applies. A selected skill is resolved through the target thread's current native catalog before admission. Unavailable, missing or disabled selections cannot dispatch. Normal text needs no catalog read. Steering retains its `text` field and exact active-turn target.
265
265
 
266
- Names use lowercase ASCII letters, digits and hyphens, start with a letter or digit, and have at most 32 characters. Names are unique without regard to case in one state directory. Creation and adoption resolve collisions atomically with ordinal suffixes such as `build-usage-2`, truncating the base to keep the complete name within 32 characters. Explicit rename rejects an occupied or pending name. Provider/native-session pairs remain unique. At most 32 native sessions are controlled concurrently; close idle sessions to release capacity. Native discovery remains independent of that limit. Confirm that other native CLI controllers are closed before adoption, resume or recovery. An unloaded native status cannot prove another CLI has stopped. The runtime provides exclusive coordination within one canonical state directory; it does not impose a global lock on independent CLIs. Recovery is permitted only after the producing runtime has stopped and its ownership evidence has been inspected.
266
+ Names use lowercase ASCII letters, digits and hyphens, start with a letter or digit, and have at most 64 characters, the public `MAX_THREAD_NAME_LENGTH` from `jg-agent-hq/contracts`. The same bound applies to create, adopt, rename and managed-thread responses. Names are unique without regard to case in one state directory. Creation and adoption resolve collisions atomically with ordinal suffixes such as `build-usage-2`, truncating the base to keep the complete name within 64 characters. Explicit rename rejects an occupied or pending name. Provider/native-session pairs remain unique. At most 32 native sessions are controlled concurrently; close idle sessions to release capacity. Native discovery remains independent of that limit. Confirm that other native CLI controllers are closed before adoption, resume or recovery. An unloaded native status cannot prove another CLI has stopped. The runtime provides exclusive coordination within one canonical state directory; it does not impose a global lock on independent CLIs. Recovery is permitted only after the producing runtime has stopped and its ownership evidence has been inspected.
267
+
268
+ Version 13 expands the producer contract: a 12.x consumer's strict 32-character schema rejects a response containing a longer managed name. Run matching runtime and consumer releases. Storage remains compatible with 12.0.1, but a package downgrade first requires shortening all longer managed names with supported rename actions and resolving collisions; see [package downgrade](../docs/recovery.md#package-downgrade).
267
269
 
268
270
  Codex may keep an idle native thread loaded after `thread/unsubscribe`, as when a terminal still holds it. An explicitly confirmed resume may reacquire that thread when its known managed control is inactive and managed, without settings overrides. Active native threads, uncertain managed ownership and already controlled idle sessions remain blocked. Other adoption and recovery checks are unchanged.
269
271
 
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { ACTION_PHASES, MAX_ACTION_BYTES } from '../constants.js';
2
+ import { ACTION_PHASES, MAX_ACTION_BYTES, MAX_THREAD_NAME_LENGTH } from '../constants.js';
3
3
  import { ProviderIdSchema } from '../providers/index.js';
4
4
  import { SessionSettingsSchema, TurnSettingsSchema } from '../configuration/index.js';
5
5
  import { MessageInputSchema, NativeSkillInputSchema } from '../skills/index.js';
@@ -15,7 +15,10 @@ export const PreparedInputSchema = z.object({
15
15
  });
16
16
  // explicit local intent; native RPC methods and arbitrary configuration are never accepted
17
17
  const ThreadIdSchema = z.uuid();
18
- const NameSchema = z.string().regex(/^[a-z0-9][a-z0-9-]{0,31}$/);
18
+ const NameSchema = z
19
+ .string()
20
+ .max(MAX_THREAD_NAME_LENGTH)
21
+ .regex(/^[a-z0-9][a-z0-9-]*$/);
19
22
  const TextSchema = z.string().min(1).max(65_536);
20
23
  const ActiveTargetFields = { threadId: ThreadIdSchema, expectedTurnId: NativeIdSchema };
21
24
  export const ActionCommandSchema = z.discriminatedUnion('kind', [
@@ -1,6 +1,7 @@
1
1
  export declare const DEFAULT_PAGE_SIZE = 32;
2
2
  export declare const MAX_PAGE_SIZE = 128;
3
3
  export declare const MAX_WORKSPACE_ROOTS = 64;
4
+ export declare const MAX_THREAD_NAME_LENGTH = 64;
4
5
  export declare const MAX_ACTION_BYTES = 32768;
5
6
  export declare const MAX_WAIT_MS = 30000;
6
7
  export declare const ACTION_PHASES: readonly ["create", "resume", "name", "turn", "steer", "interrupt", "clean", "close", "delete", "reply"];
@@ -3,6 +3,8 @@ export const DEFAULT_PAGE_SIZE = 32;
3
3
  export const MAX_PAGE_SIZE = 128;
4
4
  // the most folders one `threads` read lists, so its cursor carries every source's continuation
5
5
  export const MAX_WORKSPACE_ROOTS = 64;
6
+ // the complete editable managed-session label, including any collision suffix
7
+ export const MAX_THREAD_NAME_LENGTH = 64;
6
8
  // the largest action envelope HQ admits, in UTF-8 bytes of its JSON
7
9
  export const MAX_ACTION_BYTES = 32_768;
8
10
  // the longest a receipt wait or a long-poll waits for a change, in milliseconds
@@ -1,4 +1,4 @@
1
- export { ACTION_PHASES, DEFAULT_PAGE_SIZE, MAX_ITEM_IMAGE_BYTES, MAX_ITEM_IMAGES, MAX_ITEM_TEXT_LENGTH, MAX_ACTION_BYTES, MAX_PAGE_SIZE, MAX_WAIT_MS, MAX_WORKSPACE_ROOTS, PUBLIC_ERROR_CODES, PUBLIC_ERROR_MESSAGES, } from './constants.js';
1
+ export { ACTION_PHASES, DEFAULT_PAGE_SIZE, MAX_ITEM_IMAGE_BYTES, MAX_ITEM_IMAGES, MAX_ITEM_TEXT_LENGTH, MAX_ACTION_BYTES, MAX_PAGE_SIZE, MAX_THREAD_NAME_LENGTH, MAX_WAIT_MS, MAX_WORKSPACE_ROOTS, PUBLIC_ERROR_CODES, PUBLIC_ERROR_MESSAGES, } from './constants.js';
2
2
  export { HqRequestSchema, SessionTerminalSchema, ThreadSummarySchema, ActiveSessionsSchema, ThreadsPageSchema, HistoryFileSchema, HistoryItemSchema, ItemImageMediaTypeSchema, ItemDetailSchema, ItemImageSchema, LiveItemsSchema, UsageWindowSchema, UsageSnapshotSchema, UsageCreditsSchema, UsageResetCreditsSchema, UsageWindowScopeSchema, RuntimeStatusSchema, HqResponseSchema, ErrorKindSchema, IpcRequestSchema, IpcResponseSchema, } from './types.js';
3
3
  export { ProviderIdSchema, ProviderCapabilitySchema, ProviderCapabilitySetSchema, ProviderCapabilitiesSchema, ProviderStatusSchema, } from './providers/index.js';
4
4
  export type { IProviderId, IProviderCapability, IProviderCapabilitySet, IProviderCapabilities, IProviderStatus, } from './providers/index.js';
@@ -1,5 +1,5 @@
1
1
  // constants
2
- export { ACTION_PHASES, DEFAULT_PAGE_SIZE, MAX_ITEM_IMAGE_BYTES, MAX_ITEM_IMAGES, MAX_ITEM_TEXT_LENGTH, MAX_ACTION_BYTES, MAX_PAGE_SIZE, MAX_WAIT_MS, MAX_WORKSPACE_ROOTS, PUBLIC_ERROR_CODES, PUBLIC_ERROR_MESSAGES, } from './constants.js';
2
+ export { ACTION_PHASES, DEFAULT_PAGE_SIZE, MAX_ITEM_IMAGE_BYTES, MAX_ITEM_IMAGES, MAX_ITEM_TEXT_LENGTH, MAX_ACTION_BYTES, MAX_PAGE_SIZE, MAX_THREAD_NAME_LENGTH, MAX_WAIT_MS, MAX_WORKSPACE_ROOTS, PUBLIC_ERROR_CODES, PUBLIC_ERROR_MESSAGES, } from './constants.js';
3
3
  // wire contracts
4
4
  export { HqRequestSchema, SessionTerminalSchema, ThreadSummarySchema, ActiveSessionsSchema, ThreadsPageSchema, HistoryFileSchema, HistoryItemSchema, ItemImageMediaTypeSchema, ItemDetailSchema, ItemImageSchema, LiveItemsSchema, UsageWindowSchema, UsageSnapshotSchema, UsageCreditsSchema, UsageResetCreditsSchema, UsageWindowScopeSchema, RuntimeStatusSchema, HqResponseSchema, ErrorKindSchema, IpcRequestSchema, IpcResponseSchema, } from './types.js';
5
5
  // provider identity and capability discovery
@@ -1,12 +1,13 @@
1
+ import { MAX_THREAD_NAME_LENGTH } from '../../contracts/index.js';
1
2
  /** Suggests a short, editable ASCII label without treating it as a session identity. */
2
3
  export const suggestThreadName = (topic) => topic
3
4
  .toLowerCase()
4
5
  .replace(/[^a-z0-9]+/g, '-')
5
6
  .replace(/^-+|-+$/g, '')
6
- .slice(0, 32)
7
+ .slice(0, MAX_THREAD_NAME_LENGTH)
7
8
  .replace(/-+$/g, '') || 'session';
8
9
  /** Adds an ordinal while keeping the complete label within the native-facing limit. */
9
10
  export const suffixThreadName = (name, ordinal) => {
10
11
  const suffix = `-${ordinal}`;
11
- return `${name.slice(0, 32 - suffix.length).replace(/-+$/g, '')}${suffix}`;
12
+ return `${name.slice(0, MAX_THREAD_NAME_LENGTH - suffix.length).replace(/-+$/g, '')}${suffix}`;
12
13
  };
package/docs/recovery.md CHANGED
@@ -24,6 +24,12 @@ Recover repositories and native files separately. Source paths are retained as e
24
24
 
25
25
  Roll back by restoring an earlier snapshot into a new recovery workspace; never overwrite the current state root. A snapshot from another schema is refused with an error naming the package version that wrote it, so restore it with that version. Rollback accepts losing every change made after that snapshot, including host changes and later runtime receipts. Reconcile native ownership before enabling work.
26
26
 
27
+ ## Package downgrade
28
+
29
+ Version 13.0.0 uses the same storage schema as 12.0.1, including the existing action key and host `user_version`; startup accepts that schema without migration or reset. The writing package version is diagnostic. Snapshot capture and restore retain longer managed names under the same schema.
30
+
31
+ The expanded name contract is still a breaking change for older consumers: 12.x strict schemas reject managed names longer than 32 characters. Before installing 12.x, pause new session creation and naming actions, inventory every managed session using bounded `managed-threads` pages for each workspace, and use 13.x supported `thread-rename` actions to shorten each longer name. Resolve occupied or pending-name conflicts and verify the complete inventory contains no name longer than 32 before switching runtime and consumers together. Renaming retains the managed and native identities. Do not edit the database or stamp, reset storage, or replay session creation to make a downgrade work. Keep the existing database and `action.key` together.
32
+
27
33
  ## Off-machine durability
28
34
 
29
35
  The development helper examples/shared-storage.ts demonstrates a host-owned application table, maintenance, capture and offline restore using public exports. Capture already returns verified metadata, so the helper avoids an immediate extra full-database inspection. Its application transaction commits independently of capture. Inspect the restored values before starting a recovered runtime with explicitly chosen roots.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jg-agent-hq",
3
- "version": "12.0.1",
3
+ "version": "13.0.0",
4
4
  "description": "Native Claude Code and Codex session control, history, usage and recoverable local storage for Node.js apps.",
5
5
  "type": "module",
6
6
  "license": "MIT",