jg-agent-hq 10.9.3 → 11.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 +12 -0
- package/README.md +1 -1
- package/api/README.md +27 -26
- package/dist/cli/cli.js +1 -0
- package/dist/contracts/types.d.ts +6 -2
- package/dist/contracts/types.js +4 -1
- package/dist/providers/claude/adapter.js +4 -2
- package/dist/providers/claude/claude.d.ts +16 -2
- package/dist/providers/claude/claude.js +22 -3
- package/dist/providers/claude/control/index.d.ts +1 -0
- package/dist/providers/claude/control/index.js +2 -0
- package/dist/providers/claude/rpc.d.ts +7 -2
- package/dist/providers/claude/rpc.js +6 -4
- package/dist/providers/codex/adapter.js +1 -1
- package/dist/providers/registry/registry.js +2 -2
- package/dist/providers/types.d.ts +5 -2
- package/dist/runtime/runtime.js +14 -2
- package/dist/skills/skills.d.ts +7 -4
- package/dist/skills/skills.js +44 -23
- package/dist/store/control/control.model.js +16 -2
- package/dist/store/types.d.ts +6 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 11.0.1
|
|
4
|
+
|
|
5
|
+
- Credit an explicit skill the operator sends from a browser to the operator. A browser submission recorded a fingerprint only for text, so a skill's message linked to its action as a programmatic `host-action` with an unknown origin, and a client showed the operator's own skill as sent by its host. The skill's prepared invocation, the `$name args` or `/name args` the session received, now becomes the submission's fingerprint once its action is admitted, so the message reads back as `authenticated-host-action` from the operator. Skills sent before this version keep their recorded provenance.
|
|
6
|
+
|
|
7
|
+
## 11.0.0
|
|
8
|
+
|
|
9
|
+
- Read the skill catalog of a folder without a session. `skills` now takes `provider` and `workspaceRoot`, with `threadId` optional: with it, the request reads that controlled session's catalog as before, and refuses a session of another provider or folder with JG_AGENT_HQ_REQUEST_INVALID; without it, the request reads the catalog a session started in the folder would have. Codex lists the folder, and Claude reads the initialization command list of a session-less read process started there, without a user prompt or model turn. A skill has the same ID in both catalogs, so a folder's catalog can pick a skill for a session's first input.
|
|
10
|
+
- Breaking: a `skills` request must name `provider` and `workspaceRoot`; one with only `threadId` is invalid. The CLI's `skills` takes `--workspace-root`, with `--provider` defaulting to `codex` and `--thread-id` optional.
|
|
11
|
+
- Breaking: `IAgentProvider.readSkills` takes `(workspaceRoot, nativeId, call)`, with `nativeId` undefined for a folder's inventory, in the order `readConfiguration` uses.
|
|
12
|
+
- Start every folder-scoped Claude read process, configuration reads included, with the trusted additional directories sessions get, so a folder read sees the commands a session there sees.
|
|
13
|
+
- Store nothing new: the schema and existing databases are unchanged.
|
|
14
|
+
|
|
3
15
|
## 10.9.3
|
|
4
16
|
|
|
5
17
|
- Clear a finished turn's saved items from the live window without waiting on a client's history read. A saved item used to stay `awaiting-flush` until some `items` read happened to cover it, so a session nobody read while it worked kept its items, and a client that read only its newest pages later showed them after the newest items. When a turn ends, the runtime now reads that turn's history itself, newest first and at most 8 pages of 128, until none of its finished items remain, and once more 2 seconds later when some do, since Codex's saved state can trail its turn's end. A failed read leaves them to the next history read, as before.
|
package/README.md
CHANGED
|
@@ -85,7 +85,7 @@ Text and skill inputs can attach up to 8 workspace files by path and media type,
|
|
|
85
85
|
|
|
86
86
|
Use `suggest-thread-name --topic "Build usage" --state-root <directory>` for an editable label and `managed-thread-name --name build-usage --state-root <directory>` to resolve it. Creation adds a short ordinal suffix when a name is occupied. Actions and relationships retain immutable IDs.
|
|
87
87
|
|
|
88
|
-
Use `skills --
|
|
88
|
+
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. `skill-preview --thread-id <id> --skill-id <id> --arguments "auto exact-plan" --state-root <directory>` shows the exact invocation without sending it. Missing native metadata is explicitly unavailable. The CLI loads all skill content and retains its permissions and invocation rules.
|
|
89
89
|
|
|
90
90
|
Use `jg-agent-hq request --state-root <directory>` with a closed HQ command on stdin for action and control reads. The [API reference](api/README.md) describes action envelopes, receipts and reconnect reads.
|
|
91
91
|
|
package/api/README.md
CHANGED
|
@@ -129,28 +129,29 @@ Third-party adapter failures use JG_AGENT_HQ_PROVIDER_FAILED, retaining safe dia
|
|
|
129
129
|
|
|
130
130
|
Import `HqRequestSchema`, `HqResponseSchema` and their inferred types from `jg-agent-hq/contracts`. Requests are closed contracts. Responses tolerate additive fields. Provider fields use `ProviderIdSchema`, a bounded lowercase identifier. `codex` and `claude` are built in; trusted Node factories can add providers. Status returns a bounded `providers` array of `{ provider, state, version }`, where state is `idle`, `ready` or `unavailable`. Reading status does not start a provider. The diagnostic version/user-agent string may be null and never decides compatibility.
|
|
131
131
|
|
|
132
|
-
| Command | Required fields | Result
|
|
133
|
-
| ----------------------------- | -------------------------------------------------------- |
|
|
134
|
-
| `status` | None | Runtime epoch, host PID, start time, worker availability and native transport availability
|
|
135
|
-
| `capabilities` | `provider`; optional managed `threadId` | Provider/session-scoped support, input/configuration schemas and unavailable reasons
|
|
136
|
-
| `models` | `provider` | Paged native model identities, effort choices, fast support and defaults when observed
|
|
137
|
-
| `configuration` | `provider`, `workspaceRoot`; optional managed `threadId` | Known effective native settings and paged agent/profile choices
|
|
138
|
-
| `
|
|
139
|
-
| `
|
|
140
|
-
| `
|
|
141
|
-
| `
|
|
142
|
-
| `
|
|
143
|
-
| `
|
|
144
|
-
| `
|
|
145
|
-
| `item-
|
|
146
|
-
| `
|
|
147
|
-
| `
|
|
148
|
-
| `
|
|
149
|
-
| `mcp-
|
|
150
|
-
| `
|
|
151
|
-
| `
|
|
152
|
-
| `
|
|
153
|
-
| `
|
|
132
|
+
| Command | Required fields | Result |
|
|
133
|
+
| ----------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
134
|
+
| `status` | None | Runtime epoch, host PID, start time, worker availability and native transport availability |
|
|
135
|
+
| `capabilities` | `provider`; optional managed `threadId` | Provider/session-scoped support, input/configuration schemas and unavailable reasons |
|
|
136
|
+
| `models` | `provider` | Paged native model identities, effort choices, fast support and defaults when observed |
|
|
137
|
+
| `configuration` | `provider`, `workspaceRoot`; optional managed `threadId` | Known effective native settings and paged agent/profile choices |
|
|
138
|
+
| `skills` | `provider`, `workspaceRoot`; optional managed `threadId` | The paged native skill catalog of the session, or of the folder; see [Native skill catalog](#native-skill-catalog) |
|
|
139
|
+
| `stop` | None | Accepted shutdown and runtime epoch |
|
|
140
|
+
| `threads` | `provider`, `workspaceRoot` | Paged native discovery; optional `search` |
|
|
141
|
+
| `sessions` | `provider`, `workspaceRoot` | Byte-bounded discovery with exact IDs; optional `search` |
|
|
142
|
+
| `thread` | `provider`, `workspaceRoot`, `nativeId` | One native thread's metadata |
|
|
143
|
+
| `turns` | Same target fields | Paged native turn metadata without hydrating items |
|
|
144
|
+
| `items` | Same target fields | Newest-first persisted native items; optional `turnId`, `textLimit` and `nativeItemId` |
|
|
145
|
+
| `item-detail` | Same target fields, `turnId`, `nativeItemId` | One item with its command, tool call, file diffs and images, or null |
|
|
146
|
+
| `item-image` | Same target fields, `turnId`, `nativeItemId`, `index` | One image of an item as `{ mediaType, data }`, its bytes in base64 |
|
|
147
|
+
| `session-evidence` | Same target fields | Newest-first bounded evidence, exact references and full normalized text continuation |
|
|
148
|
+
| `account` | `provider` | Safe native account metadata with explicit unavailable observations |
|
|
149
|
+
| `mcp-servers` | Managed `threadId` | Paged configured native MCP server identity, connection and auth metadata |
|
|
150
|
+
| `mcp-tools` / `mcp-resources` | Managed `threadId`, `serverName` | Paged native descriptions; no resource content is fetched |
|
|
151
|
+
| `provider-actions` | `provider` | Paged global action metadata, including authentication receipts |
|
|
152
|
+
| `login` | `actionId` | Live authentication presentation or known terminal state |
|
|
153
|
+
| `usage` | `provider` | Actual subscription observations |
|
|
154
|
+
| `locks` | None | The machine's jg-locks locks and their holders; see [machine locks](#machine-locks) |
|
|
154
155
|
|
|
155
156
|
Paged commands accept `limit` (default 32, maximum 128) and an opaque `cursor`. Continue with exactly the same command, target, filters and limit. The cursor binds those fields to the provider continuation. Codex requests threads by last activity (`updated_at`), descending, with descending turns and descending items. Claude orders discovery by last activity, the later of a transcript's modification time and its newest record, then native UUID, descending, turns by native chain position ascending and items by native chain position descending. Workspace authorization is rechecked for each request, independently of cursor validation, before selected-thread items are fetched.
|
|
156
157
|
|
|
@@ -170,7 +171,7 @@ Threads expose native state, the live session `state` described under [session s
|
|
|
170
171
|
|
|
171
172
|
Text chunks contain at most 32,768 UTF-8 bytes and shrink when escaping or metadata consumes the response budget. Cursors bind all query fields and the content of a partially consumed native page. Changed content, changed query scope or a changed Claude chain revision uses CURSOR_INVALID; start a fresh read rather than joining different evidence. New native pages use the provider's continuation, not an immutable transcript snapshot. Newly arriving or removed history may therefore require a fresh discovery/evidence read. Authorization is rechecked on every request before content access, and no alternate raw-file path bypasses a denial.
|
|
172
173
|
|
|
173
|
-
`HistoryItemSchema` and evidence fragments expose `provenance: { origin, source, nativeInputId, nativeInputSha256, actionId, contentBoundary: 'untrusted', grantsAuthority: false }`. Origins are operator, agent, tool, system or unknown. Native assistant/tool kinds establish only their observed category. A native user role, quoted operator text or an imported message cannot establish an operator. HQ correlates a submitted input only when its exact native message/client identity, thread/turn and `nativeInputSha256` match the acknowledged action ledger. A provider's user message carries `nativeInputSha256`, the SHA-256 of the text its native input sent: a Codex message's first text part, or a Claude record's string content or first text block, with a slash command or skill, which Claude records as command markup, read back as the `/name args` it sent. It is hashed before the parts the same input added after the text, such as a skill or attached files, and before a page cuts the text, so those messages correlate too. Programmatic host submissions have source `host-action` and unknown actor. An authenticated browser submission additionally requires the same selected thread and text fingerprint, yielding `authenticated-host-action` and operator provenance. A message without a native input identity, or whose sent text differs from the action's, stays unknown. Provenance remains historical evidence and grants no current approval, execution authority or tool permission; quotations remain inside its untrusted content boundary.
|
|
174
|
+
`HistoryItemSchema` and evidence fragments expose `provenance: { origin, source, nativeInputId, nativeInputSha256, actionId, contentBoundary: 'untrusted', grantsAuthority: false }`. Origins are operator, agent, tool, system or unknown. Native assistant/tool kinds establish only their observed category. A native user role, quoted operator text or an imported message cannot establish an operator. HQ correlates a submitted input only when its exact native message/client identity, thread/turn and `nativeInputSha256` match the acknowledged action ledger. A provider's user message carries `nativeInputSha256`, the SHA-256 of the text its native input sent: a Codex message's first text part, or a Claude record's string content or first text block, with a slash command or skill, which Claude records as command markup, read back as the `/name args` it sent. It is hashed before the parts the same input added after the text, such as a skill or attached files, and before a page cuts the text, so those messages correlate too. Programmatic host submissions have source `host-action` and unknown actor. An authenticated browser submission additionally requires the same selected thread and text fingerprint, yielding `authenticated-host-action` and operator provenance. An explicit skill's fingerprint is its prepared invocation, the `$name args` or `/name args` the session received, which the browser submission takes once its action is admitted. A message without a native input identity, or whose sent text differs from the action's, stays unknown. Provenance remains historical evidence and grants no current approval, execution authority or tool permission; quotations remain inside its untrusted content boundary.
|
|
174
175
|
|
|
175
176
|
Codex uses its native descending item API with unloaded thread metadata. It never reads Codex transcript files. Claude uses indexed current-chain byte locations, exact UUID lookups and separate bounded seeks per selected kind. Its cold index uses 64 MiB batches and a 30-second operation budget; selected evidence reads parse at most 4 MiB of records beyond the first. Continuation revalidates and rereads one bounded native page to detect content changes rather than caching transcript bodies. Work and memory per read are bounded independently of history growth; reconstructing a large body may reread that source page. No conversation-body cache is maintained.
|
|
176
177
|
|
|
@@ -311,15 +312,15 @@ Partial text uses temporary live identities until the final native message UUID
|
|
|
311
312
|
|
|
312
313
|
## Native skill catalog
|
|
313
314
|
|
|
314
|
-
`skills` accepts `threadId`, optional `search`, `limit` (default 32, maximum 128) and `cursor`.
|
|
315
|
+
`skills` accepts `provider`, `workspaceRoot`, an optional managed `threadId`, optional `search`, `limit` (default 32, maximum 128) and `cursor`. The folder must be inside the allowed roots. With `threadId` it reads that controlled session's catalog, and the session must run for that provider in that folder, or the request fails with JG_AGENT_HQ_REQUEST_INVALID; it never adopts or resumes an external session. Without `threadId` it reads the catalog a session started in the folder would have, with no session: Codex lists the folder, and Claude starts a session-less read process there with the trusted additional directories, reads its initialization command list and closes it, without a user prompt or model turn. A skill's ID is derived from its provider, name and path, so a folder's catalog and a session started there give the same skill the same ID while the skills don't change, and an ID from the folder's catalog can name a skill for that session's input. Codex uses native `skills/list` for the workspace, plus the skills in the operator's Codex extra roots; Claude uses the native initialization command list, which includes explicit-only skills. Its refresh endpoint omits those skills, so HQ does not use it. Close and explicitly resume the session to refresh Claude's catalog. Inactive or unsupported sessions report `unavailable`, with no successful-empty fallback. Native discovery errors produce `partial` and an `unavailableCount`. `observedAt` records when the native inventory was observed; it stays fixed for a Claude session and is null when unavailable. `invocationPrefix` is the text that starts a skill invocation in the provider's native input, `/` for Claude and `$` for Codex, and is null when unavailable; a provider adapter supplies it with its inventory in `IProviderSkills`, from `readSkills(workspaceRoot, nativeId, call)`, which reads the folder's inventory when `nativeId` is undefined.
|
|
315
316
|
|
|
316
317
|
Rows contain an opaque `id`, native `name`, `description`, nullable `argumentHint`, `kind`, `path`, `scope`, `prerequisites` and `requiresExplicitInvocation`, plus native availability as `isEnabled`. Codex supplies skill identity, source/scope, enabled state and declared tool prerequisites. Claude supplies native command names, descriptions, argument hints and a built-in marker when available. Missing fields are null or `kind: 'unavailable'`; HQ does not inspect skill files to infer them. The one exception is Codex extra roots, which native discovery does not list: HQ reads each skill's single-line `name` and `description` frontmatter from `<root>/<directory>/SKILL.md`, reports it with scope `host`, skips linked directories and files, and counts unreadable entries in `unavailableCount`. A native skill with the same name takes precedence. Declared prerequisites are metadata, not proof that an integration is connected. Invocation rules remain with the CLI, including explicit-only skills.
|
|
317
318
|
|
|
318
|
-
Both native inventory interfaces are unpaged. HQ accepts at most 4,096 native rows and 1 MiB of normalized catalog metadata per read, then provides stable ID seek pages guarded by the complete inventory revision and query. A changed inventory invalidates continuation. Only metadata is read, never skill bodies or complete conversation histories. Concurrent reads
|
|
319
|
+
Both native inventory interfaces are unpaged. HQ accepts at most 4,096 native rows and 1 MiB of normalized catalog metadata per read, then provides stable ID seek pages guarded by the complete inventory revision and query. A changed inventory invalidates continuation. Only metadata is read, never skill bodies or complete conversation histories. Concurrent reads of the same session, or of the same provider's folder, share their in-flight native request; Codex results are not retained as an HQ cache. Claude's native initialization metadata remains attached to its owned connection until that session closes. Native refresh and discovery caches remain provider-owned.
|
|
319
320
|
|
|
320
321
|
`skill-preview` accepts `threadId`, `skillId` and `arguments`. Its result is `ready`, `missing`, `disabled` or `unavailable`, with the selected metadata and exact text only when ready. Codex previews `$name arguments` and receives an explicit native skill selection containing its native name/path alongside that text. Claude previews `/name arguments` and performs native slash-command loading. Native same-name precedence applies. Preview never sends user input. Explicit message and queue actions share the established action ledger, ownership checks and delivery/uncertainty rules. They grant no tool permissions and do not expand the invoked workflow's authority.
|
|
321
322
|
|
|
322
|
-
Trusted runtime construction also accepts `codexExtraSkillRoots?: string[]` and `claudeAdditionalDirectories?: string[]`. Paths must resolve to existing absolute directories. Codex receives them as capability roots of each thread HQ starts, so other sessions on the shared daemon, including terminal sessions, never see them. Forks inherit them. A session Codex later reloads from disk loses native discovery of those skills, while explicit invocation through the HQ catalog still works, because it names the skill file. Claude
|
|
323
|
+
Trusted runtime construction also accepts `codexExtraSkillRoots?: string[]` and `claudeAdditionalDirectories?: string[]`. Paths must resolve to existing absolute directories. Codex receives them as capability roots of each thread HQ starts, so other sessions on the shared daemon, including terminal sessions, never see them. Forks inherit them. A session Codex later reloads from disk loses native discovery of those skills, while explicit invocation through the HQ catalog still works, because it names the skill file. Claude sessions and every folder-scoped read process receive native `--add-dir` arguments, which also grant native file access to those directories. These inputs belong to the operator and cannot be changed through IPC commands. The installed `serve` command exposes repeated `--codex-extra-skill-root` and `--claude-additional-directory` flags. No global skill installation or coding-instruction change is performed.
|
|
323
324
|
|
|
324
325
|
`codexDaemonLauncher?: string[]`, also trusted, names a command and its arguments that run `codex app-server daemon start`, such as `['systemd-run', '--user', '--scope', '--quiet', '--collect']`. HQ runs the start through it, while the proxy still runs directly. Codex's daemon detaches into its own session, but on Linux it stays in the cgroup of whatever started it, so a host that runs as a systemd service and starts the daemon itself would take the daemon, and the work of every terminal session on it, down whenever the service stops. A new scope gives the daemon a lifetime of its own. The installed `serve` command doesn't expose it.
|
|
325
326
|
|
package/dist/cli/cli.js
CHANGED
|
@@ -115,7 +115,9 @@ export declare const HqRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
115
115
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
116
116
|
cursor: z.ZodOptional<z.ZodString>;
|
|
117
117
|
kind: z.ZodLiteral<"skills">;
|
|
118
|
-
|
|
118
|
+
provider: z.ZodString;
|
|
119
|
+
workspaceRoot: z.ZodString;
|
|
120
|
+
threadId: z.ZodOptional<z.ZodUUID>;
|
|
119
121
|
search: z.ZodOptional<z.ZodString>;
|
|
120
122
|
}, z.core.$strict>, z.ZodObject<{
|
|
121
123
|
kind: z.ZodLiteral<"skill-preview">;
|
|
@@ -3322,7 +3324,9 @@ export declare const IpcRequestSchema: z.ZodObject<{
|
|
|
3322
3324
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
3323
3325
|
cursor: z.ZodOptional<z.ZodString>;
|
|
3324
3326
|
kind: z.ZodLiteral<"skills">;
|
|
3325
|
-
|
|
3327
|
+
provider: z.ZodString;
|
|
3328
|
+
workspaceRoot: z.ZodString;
|
|
3329
|
+
threadId: z.ZodOptional<z.ZodUUID>;
|
|
3326
3330
|
search: z.ZodOptional<z.ZodString>;
|
|
3327
3331
|
}, z.core.$strict>, z.ZodObject<{
|
|
3328
3332
|
kind: z.ZodLiteral<"skill-preview">;
|
package/dist/contracts/types.js
CHANGED
|
@@ -77,9 +77,12 @@ export const HqRequestSchema = z.discriminatedUnion('kind', [
|
|
|
77
77
|
.max(MAX_ITEM_IMAGES - 1),
|
|
78
78
|
}),
|
|
79
79
|
z.strictObject({ kind: z.literal('usage'), provider: TargetFields.provider }),
|
|
80
|
+
// a managed session's catalog with threadId, else the one a session started in the folder gets
|
|
80
81
|
z.strictObject({
|
|
81
82
|
kind: z.literal('skills'),
|
|
82
|
-
|
|
83
|
+
provider: TargetFields.provider,
|
|
84
|
+
workspaceRoot: TargetFields.workspaceRoot,
|
|
85
|
+
threadId: z.uuid().optional(),
|
|
83
86
|
search: z.string().max(1024).optional(),
|
|
84
87
|
...PageFields,
|
|
85
88
|
}),
|
|
@@ -14,7 +14,7 @@ import { createClaudeControl } from './control/index.js';
|
|
|
14
14
|
export const createClaudeProviderFactory = (store, additionalDirectories) => ({
|
|
15
15
|
id: 'claude',
|
|
16
16
|
async create(context) {
|
|
17
|
-
const reader = createClaudeProvider(store);
|
|
17
|
+
const reader = createClaudeProvider(store, additionalDirectories);
|
|
18
18
|
const authentication = createClaudeAuthentication();
|
|
19
19
|
const control = createClaudeControl(additionalDirectories);
|
|
20
20
|
control.setEvents(context.events);
|
|
@@ -241,7 +241,9 @@ export const createClaudeProviderFactory = (store, additionalDirectories) => ({
|
|
|
241
241
|
readMcpServers: (nativeId, limit, cursor) => control.readMcpServers(nativeId, limit, cursor),
|
|
242
242
|
readMcpTools: (nativeId, serverName) => control.readMcpTools(nativeId, serverName),
|
|
243
243
|
readMcpResources: (nativeId) => control.readMcpResources(nativeId),
|
|
244
|
-
readSkills: (nativeId) =>
|
|
244
|
+
readSkills: (workspaceRoot, nativeId, call) => nativeId === undefined
|
|
245
|
+
? reader.readWorkspaceSkills(workspaceRoot, call.signal)
|
|
246
|
+
: control.readSkills(nativeId),
|
|
245
247
|
formatSkill: (skill, argumentsText) => `/${skill.name}${argumentsText ? ` ${argumentsText}` : ''}`,
|
|
246
248
|
async startThread(requestId, workspaceRoot, settings, call) {
|
|
247
249
|
const result = await control.startThread(requestId, workspaceRoot, settings, call.signal);
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { IHqResponse, IUsageSnapshot, IProviderModelsRequest, IProviderModelPage, IConfigurationRequest } from '../../contracts/index.js';
|
|
2
2
|
import type { IStore } from '../../store/index.js';
|
|
3
3
|
import type { IHistoryRequest } from '../../sessions/index.js';
|
|
4
|
+
import type { IProviderSkills } from '../types.js';
|
|
4
5
|
/**
|
|
5
|
-
* Lazily connects read-only Claude capabilities; Codex needs no Claude installation.
|
|
6
|
+
* Lazily connects read-only Claude capabilities; Codex needs no Claude installation. A read in a
|
|
7
|
+
* folder starts with the additional directories sessions get.
|
|
8
|
+
* @param store The store transcript reads use.
|
|
9
|
+
* @param additionalDirectories The directories every session and folder read adds.
|
|
6
10
|
* @returns The read adapter with independent usage and transcript availability.
|
|
7
11
|
*/
|
|
8
|
-
export declare const createClaudeProvider: (store: IStore) => {
|
|
12
|
+
export declare const createClaudeProvider: (store: IStore, additionalDirectories: string[]) => {
|
|
9
13
|
/**
|
|
10
14
|
* Drops account-derived observations and the read connection after native sign-out.
|
|
11
15
|
* @returns Confirmation that subsequent observations use a fresh native connection.
|
|
@@ -70,6 +74,16 @@ export declare const createClaudeProvider: (store: IStore) => {
|
|
|
70
74
|
observedAt: number;
|
|
71
75
|
source: "native";
|
|
72
76
|
}>;
|
|
77
|
+
/**
|
|
78
|
+
* Reads the commands a session started in the folder would list, explicit-only skills
|
|
79
|
+
* included, from a read lane with no user prompt or model turn.
|
|
80
|
+
* @returns The native inventory with unavailable fields left explicit; the lane is closed
|
|
81
|
+
* before returning.
|
|
82
|
+
* @throws
|
|
83
|
+
* - JG_AGENT_HQ_CLAUDE_FAILED: The Claude integration failed
|
|
84
|
+
* - JG_AGENT_HQ_TRANSPORT_FAILED: The HQ transport failed
|
|
85
|
+
*/
|
|
86
|
+
readWorkspaceSkills(workspaceRoot: string, signal?: AbortSignal): Promise<IProviderSkills>;
|
|
73
87
|
/**
|
|
74
88
|
* Reads fresh native account metadata in a disposable read lane.
|
|
75
89
|
* @returns Safe account metadata after confirmed read-lane cleanup.
|
|
@@ -8,15 +8,19 @@ import { toClaudeUsageSnapshot } from './transformers.js';
|
|
|
8
8
|
import { readClaudeModels } from './models/index.js';
|
|
9
9
|
import { toClaudeConfiguration } from './configuration/index.js';
|
|
10
10
|
import { toClaudeAccount } from './accounts/index.js';
|
|
11
|
+
import { toClaudeSkills } from './control/index.js';
|
|
11
12
|
// the session-less read process closes after this long without a read, and reopens on the next one
|
|
12
13
|
const METADATA_IDLE_SECONDS = 300;
|
|
13
14
|
// a usage result read this recently answers the next read without asking Claude again
|
|
14
15
|
const USAGE_KEPT_MS = 60_000;
|
|
15
16
|
/**
|
|
16
|
-
* Lazily connects read-only Claude capabilities; Codex needs no Claude installation.
|
|
17
|
+
* Lazily connects read-only Claude capabilities; Codex needs no Claude installation. A read in a
|
|
18
|
+
* folder starts with the additional directories sessions get.
|
|
19
|
+
* @param store The store transcript reads use.
|
|
20
|
+
* @param additionalDirectories The directories every session and folder read adds.
|
|
17
21
|
* @returns The read adapter with independent usage and transcript availability.
|
|
18
22
|
*/
|
|
19
|
-
export const createClaudeProvider = (store) => {
|
|
23
|
+
export const createClaudeProvider = (store, additionalDirectories) => {
|
|
20
24
|
let connection;
|
|
21
25
|
let opening;
|
|
22
26
|
const metadataReads = new Set();
|
|
@@ -131,7 +135,7 @@ export const createClaudeProvider = (store) => {
|
|
|
131
135
|
code: 'JG_AGENT_HQ_CLAUDE_FAILED',
|
|
132
136
|
data: { kind: 'agent-unavailable' },
|
|
133
137
|
});
|
|
134
|
-
const starting = createClaudeRpc(() => { }, undefined, workspaceRoot, signal);
|
|
138
|
+
const starting = createClaudeRpc(() => { }, undefined, workspaceRoot === undefined ? undefined : { workspaceRoot, additionalDirectories }, signal);
|
|
135
139
|
metadataReads.add(starting);
|
|
136
140
|
let native;
|
|
137
141
|
let hasUnconfirmedStartup = false;
|
|
@@ -212,6 +216,21 @@ export const createClaudeProvider = (store) => {
|
|
|
212
216
|
async readConfiguration(command, signal) {
|
|
213
217
|
return withReadConnection(command.workspaceRoot, signal, async (native) => toClaudeConfiguration(await native.requestControl({ subtype: 'get_settings' }), native.initialization.agents, native.initialization.current_permission_mode, undefined, false, undefined, {}, command));
|
|
214
218
|
},
|
|
219
|
+
/**
|
|
220
|
+
* Reads the commands a session started in the folder would list, explicit-only skills
|
|
221
|
+
* included, from a read lane with no user prompt or model turn.
|
|
222
|
+
* @returns The native inventory with unavailable fields left explicit; the lane is closed
|
|
223
|
+
* before returning.
|
|
224
|
+
* @throws
|
|
225
|
+
* - JG_AGENT_HQ_CLAUDE_FAILED: The Claude integration failed
|
|
226
|
+
* - JG_AGENT_HQ_TRANSPORT_FAILED: The HQ transport failed
|
|
227
|
+
*/
|
|
228
|
+
async readWorkspaceSkills(workspaceRoot, signal) {
|
|
229
|
+
return withReadConnection(workspaceRoot, signal, async (native) => ({
|
|
230
|
+
...toClaudeSkills({ skills: native.initialization.commands }),
|
|
231
|
+
observedAt: native.initializedAt,
|
|
232
|
+
}));
|
|
233
|
+
},
|
|
215
234
|
/**
|
|
216
235
|
* Reads fresh native account metadata in a disposable read lane.
|
|
217
236
|
* @returns Safe account metadata after confirmed read-lane cleanup.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ISessionSettings } from '../../contracts/index.js';
|
|
2
2
|
/**
|
|
3
|
-
* Opens an idle native structured lane without a user prompt or inference
|
|
3
|
+
* Opens an idle native structured lane without a user prompt or inference: a session's, or a
|
|
4
|
+
* session-less read lane, which a folder-scoped read starts in its folder with the additional
|
|
5
|
+
* directories sessions get, so it sees the commands a session started there would.
|
|
4
6
|
* @returns An owned control connection; normal CLI configuration remains enabled.
|
|
5
7
|
* @throws
|
|
6
8
|
* - JG_AGENT_HQ_CLAUDE_FAILED: The Claude integration failed
|
|
@@ -15,7 +17,10 @@ export declare const createClaudeRpc: (invalidate: (reason: "account" | "limits"
|
|
|
15
17
|
settings?: ISessionSettings;
|
|
16
18
|
receive(message: unknown): void;
|
|
17
19
|
lateResponse(id: string, result: unknown, error: unknown): void;
|
|
18
|
-
},
|
|
20
|
+
}, lane?: {
|
|
21
|
+
workspaceRoot: string;
|
|
22
|
+
additionalDirectories: string[];
|
|
23
|
+
}, signal?: AbortSignal) => Promise<{
|
|
19
24
|
version: string | null;
|
|
20
25
|
initialization: {
|
|
21
26
|
claude_code_version?: string | null | undefined;
|
|
@@ -16,13 +16,15 @@ const EnvelopeSchema = z.object({
|
|
|
16
16
|
request_id: z.string().optional(),
|
|
17
17
|
});
|
|
18
18
|
/**
|
|
19
|
-
* Opens an idle native structured lane without a user prompt or inference
|
|
19
|
+
* Opens an idle native structured lane without a user prompt or inference: a session's, or a
|
|
20
|
+
* session-less read lane, which a folder-scoped read starts in its folder with the additional
|
|
21
|
+
* directories sessions get, so it sees the commands a session started there would.
|
|
20
22
|
* @returns An owned control connection; normal CLI configuration remains enabled.
|
|
21
23
|
* @throws
|
|
22
24
|
* - JG_AGENT_HQ_CLAUDE_FAILED: The Claude integration failed
|
|
23
25
|
* - JG_AGENT_HQ_CAPABILITY_UNAVAILABLE: The HQ capability is unavailable
|
|
24
26
|
*/
|
|
25
|
-
export const createClaudeRpc = async (invalidate, control,
|
|
27
|
+
export const createClaudeRpc = async (invalidate, control, lane, signal) => {
|
|
26
28
|
let sequence = 0;
|
|
27
29
|
const late = new Set();
|
|
28
30
|
const pending = new Map();
|
|
@@ -62,7 +64,7 @@ export const createClaudeRpc = async (invalidate, control, workspaceRoot, signal
|
|
|
62
64
|
...control.additionalDirectories.flatMap((directory) => ['--add-dir', directory]),
|
|
63
65
|
...toClaudeSessionFlags(control.settings ?? {}),
|
|
64
66
|
]
|
|
65
|
-
: []),
|
|
67
|
+
: (lane?.additionalDirectories.flatMap((directory) => ['--add-dir', directory]) ?? [])),
|
|
66
68
|
], (message) => {
|
|
67
69
|
const parsed = EnvelopeSchema.safeParse(message);
|
|
68
70
|
if (!parsed.success)
|
|
@@ -119,7 +121,7 @@ export const createClaudeRpc = async (invalidate, control, workspaceRoot, signal
|
|
|
119
121
|
invalidate('account');
|
|
120
122
|
else if (envelope.type === 'rate_limit_event')
|
|
121
123
|
invalidate('limits');
|
|
122
|
-
}, fail, control?.workspaceRoot ?? workspaceRoot);
|
|
124
|
+
}, fail, control?.workspaceRoot ?? lane?.workspaceRoot);
|
|
123
125
|
/**
|
|
124
126
|
* Matches one native control acknowledgement and retains bounded late-response identity.
|
|
125
127
|
* @returns The native success payload, which may be absent for acknowledgement-only controls.
|
|
@@ -354,7 +354,7 @@ export const createCodexProviderFactory = (extraSkillRoots, daemonLauncher) => (
|
|
|
354
354
|
readMcpServers: (nativeId, limit, cursor) => native.readMcpServers(nativeId, limit, cursor),
|
|
355
355
|
readMcpTools: (nativeId, serverName) => native.readMcpTools(nativeId, serverName),
|
|
356
356
|
readMcpResources: (nativeId, serverName) => native.readMcpResources(nativeId, serverName),
|
|
357
|
-
readSkills: (
|
|
357
|
+
readSkills: (workspaceRoot) => native.readSkills(workspaceRoot),
|
|
358
358
|
formatSkill: (skill, argumentsText) => `$${skill.name}${argumentsText ? ` ${argumentsText}` : ''}`,
|
|
359
359
|
startThread: async (requestId, workspaceRoot, settings) => toProviderThread(await native.startThread(requestId, workspaceRoot, settings)),
|
|
360
360
|
resumeThread: async (requestId, nativeId, _workspaceRoot, _name, settings, call) => toProviderThread(await native.resumeThread(requestId, nativeId, settings, call.signal)),
|
|
@@ -415,8 +415,8 @@ export const createProviderRegistry = (registrations, allowedRoots, runtimeEpoch
|
|
|
415
415
|
rejectProviderResponse();
|
|
416
416
|
return result;
|
|
417
417
|
}),
|
|
418
|
-
readSkills: (
|
|
419
|
-
const result = await adapter.readSkills(
|
|
418
|
+
readSkills: (workspaceRoot, nativeId) => invoke(async (call) => {
|
|
419
|
+
const result = await adapter.readSkills(workspaceRoot, nativeId, call);
|
|
420
420
|
if (Buffer.byteLength(JSON.stringify(result)) > 1_048_576)
|
|
421
421
|
capabilityUnavailable();
|
|
422
422
|
return ProviderSkillsSchema.parse(result);
|
|
@@ -200,8 +200,11 @@ export type IAgentProvider = {
|
|
|
200
200
|
readMcpTools(nativeId: string, serverName: string, call: IProviderCall): Promise<IProviderMcpTools>;
|
|
201
201
|
/** @returns Bounded native resource metadata, or an explicit unsupported state. */
|
|
202
202
|
readMcpResources(nativeId: string, serverName: string, call: IProviderCall): Promise<IProviderMcpResources>;
|
|
203
|
-
/**
|
|
204
|
-
|
|
203
|
+
/**
|
|
204
|
+
* @returns The bounded native skill inventory of the selected session, or without one the
|
|
205
|
+
* inventory a session started in the folder gets.
|
|
206
|
+
*/
|
|
207
|
+
readSkills(workspaceRoot: string, nativeId: string | undefined, call: IProviderCall): Promise<IProviderSkills>;
|
|
205
208
|
/** @returns The exact native invocation spelling from validated inventory metadata. */
|
|
206
209
|
formatSkill(skill: ISkill, argumentsText: string): string;
|
|
207
210
|
/** @returns The exact created native session identity and workspace. */
|
package/dist/runtime/runtime.js
CHANGED
|
@@ -242,8 +242,20 @@ export const createAgentHq = async (options) => {
|
|
|
242
242
|
result: await (await providers.get(command.provider)).readConfiguration({ ...command, workspaceRoot }, thread?.nativeId ?? undefined),
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
|
-
case 'skills':
|
|
246
|
-
|
|
245
|
+
case 'skills': {
|
|
246
|
+
const workspaceRoot = await resolveWorkspaceTarget(command.workspaceRoot, allowedRoots);
|
|
247
|
+
// a session's catalog answers only for the provider and folder the session runs in
|
|
248
|
+
const thread = command.threadId ? await projection.getThread(command.threadId) : null;
|
|
249
|
+
if (command.threadId &&
|
|
250
|
+
(!thread ||
|
|
251
|
+
thread.provider !== command.provider ||
|
|
252
|
+
thread.workspaceRoot !== workspaceRoot))
|
|
253
|
+
throw new Exception('The HQ request is invalid', {
|
|
254
|
+
code: 'JG_AGENT_HQ_REQUEST_INVALID',
|
|
255
|
+
data: { kind: 'invalid-request' },
|
|
256
|
+
});
|
|
257
|
+
return { kind: command.kind, result: await skills.list({ ...command, workspaceRoot }) };
|
|
258
|
+
}
|
|
247
259
|
case 'skill-preview':
|
|
248
260
|
return {
|
|
249
261
|
kind: command.kind,
|
package/dist/skills/skills.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type IMessageInput, type INativeSkillInput, type ISkillPage, type ISkillPreview } from '../contracts/index.js';
|
|
1
|
+
import { type IMessageInput, type INativeSkillInput, type ISkillPage, type ISkillPreview, type IProviderId } from '../contracts/index.js';
|
|
2
2
|
import type { createProviderRegistry } from '../providers/registry/index.js';
|
|
3
3
|
import type { IStore } from '../store/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* Reads bounded native inventories without interpreting skill files or installing workflows.
|
|
6
|
-
* @returns
|
|
6
|
+
* @returns Session and folder discovery, exact previews and explicit input preparation.
|
|
7
7
|
*/
|
|
8
8
|
export declare const createSkills: (registry: ReturnType<typeof createProviderRegistry>, store: IStore, roots: string[]) => {
|
|
9
9
|
/** Stops new reads joining an observation started before a native change. */
|
|
@@ -18,7 +18,8 @@ export declare const createSkills: (registry: ReturnType<typeof createProviderRe
|
|
|
18
18
|
*/
|
|
19
19
|
previewName(threadId: string, name: string, skillArguments: string): Promise<ISkillPreview>;
|
|
20
20
|
/**
|
|
21
|
-
* Pages
|
|
21
|
+
* Pages a managed session's native inventory, or with no session the one a session started in
|
|
22
|
+
* the folder gets, with a content revision guard; an inventory change invalidates continuation.
|
|
22
23
|
* @returns One bounded page, or explicit unavailable state without a successful empty fallback.
|
|
23
24
|
* @throws
|
|
24
25
|
* - JG_AGENT_HQ_TARGET_FORBIDDEN: The HQ target is outside the allowed workspaces
|
|
@@ -26,7 +27,9 @@ export declare const createSkills: (registry: ReturnType<typeof createProviderRe
|
|
|
26
27
|
* - JG_AGENT_HQ_STORE_FAILED: The HQ store failed
|
|
27
28
|
*/
|
|
28
29
|
list(command: {
|
|
29
|
-
|
|
30
|
+
provider: IProviderId;
|
|
31
|
+
workspaceRoot: string;
|
|
32
|
+
threadId?: string;
|
|
30
33
|
limit: number;
|
|
31
34
|
cursor?: string;
|
|
32
35
|
search?: string;
|
package/dist/skills/skills.js
CHANGED
|
@@ -23,40 +23,58 @@ const toSkillPreview = (formatSkill, skill, skillArguments) => {
|
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
25
|
* Reads bounded native inventories without interpreting skill files or installing workflows.
|
|
26
|
-
* @returns
|
|
26
|
+
* @returns Session and folder discovery, exact previews and explicit input preparation.
|
|
27
27
|
*/
|
|
28
28
|
export const createSkills = (registry, store, roots) => {
|
|
29
29
|
const pending = new Map();
|
|
30
30
|
/**
|
|
31
|
-
* Coalesces a native metadata read and enforces the catalog budget before paging.
|
|
31
|
+
* Coalesces a native metadata read and enforces the catalog budget before paging. A session's
|
|
32
|
+
* catalog needs a managed session that isn't inactive; a folder's needs no session.
|
|
32
33
|
* @returns Current metadata, or null when the native inventory cannot be used.
|
|
33
34
|
* @throws
|
|
34
35
|
* - JG_AGENT_HQ_TARGET_FORBIDDEN: The HQ target is outside the allowed workspaces
|
|
35
36
|
* - JG_AGENT_HQ_STORE_FAILED: The HQ store failed
|
|
36
37
|
*/
|
|
37
|
-
const scan = async (
|
|
38
|
-
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
const scan = async (target) => {
|
|
39
|
+
let source;
|
|
40
|
+
if ('threadId' in target) {
|
|
41
|
+
const thread = await store.getThread(target.threadId);
|
|
42
|
+
if (!thread)
|
|
43
|
+
return null;
|
|
44
|
+
await resolveWorkspaceTarget(thread.workspaceRoot, roots);
|
|
45
|
+
if (thread.ownership !== 'managed' ||
|
|
46
|
+
!thread.runtimeEpoch ||
|
|
47
|
+
!thread.nativeId ||
|
|
48
|
+
thread.state === 'inactive')
|
|
49
|
+
return null;
|
|
50
|
+
source = {
|
|
51
|
+
key: `thread:${target.threadId}`,
|
|
52
|
+
provider: thread.provider,
|
|
53
|
+
workspaceRoot: thread.workspaceRoot,
|
|
54
|
+
nativeId: thread.nativeId,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const workspaceRoot = await resolveWorkspaceTarget(target.workspaceRoot, roots);
|
|
59
|
+
source = {
|
|
60
|
+
key: `workspace:${target.provider}:${workspaceRoot}`,
|
|
61
|
+
provider: target.provider,
|
|
62
|
+
workspaceRoot,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
let operation = pending.get(source.key);
|
|
48
66
|
if (!operation) {
|
|
49
67
|
if (pending.size >= 32)
|
|
50
68
|
return null;
|
|
51
69
|
operation = (async () => {
|
|
52
|
-
const adapter = await registry.get(
|
|
70
|
+
const adapter = await registry.get(source.provider);
|
|
53
71
|
return {
|
|
54
|
-
provider:
|
|
55
|
-
inventory: await adapter.readSkills(
|
|
72
|
+
provider: source.provider,
|
|
73
|
+
inventory: await adapter.readSkills(source.workspaceRoot, source.nativeId),
|
|
56
74
|
formatSkill: adapter.formatSkill,
|
|
57
75
|
};
|
|
58
76
|
})();
|
|
59
|
-
pending.set(
|
|
77
|
+
pending.set(source.key, operation);
|
|
60
78
|
}
|
|
61
79
|
try {
|
|
62
80
|
const { provider, inventory, formatSkill } = await operation;
|
|
@@ -78,8 +96,8 @@ export const createSkills = (registry, store, roots) => {
|
|
|
78
96
|
return null;
|
|
79
97
|
}
|
|
80
98
|
finally {
|
|
81
|
-
if (pending.get(
|
|
82
|
-
pending.delete(
|
|
99
|
+
if (pending.get(source.key) === operation)
|
|
100
|
+
pending.delete(source.key);
|
|
83
101
|
}
|
|
84
102
|
};
|
|
85
103
|
return {
|
|
@@ -96,7 +114,7 @@ export const createSkills = (registry, store, roots) => {
|
|
|
96
114
|
* - JG_AGENT_HQ_STORE_FAILED: The HQ store failed
|
|
97
115
|
*/
|
|
98
116
|
async previewName(threadId, name, skillArguments) {
|
|
99
|
-
const result = await scan(threadId);
|
|
117
|
+
const result = await scan({ threadId });
|
|
100
118
|
if (!result)
|
|
101
119
|
return { state: 'unavailable', skill: null, text: null };
|
|
102
120
|
const matches = result.skills.filter((skill) => skill.name === name);
|
|
@@ -105,7 +123,8 @@ export const createSkills = (registry, store, roots) => {
|
|
|
105
123
|
return toSkillPreview(result.formatSkill, matches[0], skillArguments);
|
|
106
124
|
},
|
|
107
125
|
/**
|
|
108
|
-
* Pages
|
|
126
|
+
* Pages a managed session's native inventory, or with no session the one a session started in
|
|
127
|
+
* the folder gets, with a content revision guard; an inventory change invalidates continuation.
|
|
109
128
|
* @returns One bounded page, or explicit unavailable state without a successful empty fallback.
|
|
110
129
|
* @throws
|
|
111
130
|
* - JG_AGENT_HQ_TARGET_FORBIDDEN: The HQ target is outside the allowed workspaces
|
|
@@ -128,7 +147,9 @@ export const createSkills = (registry, store, roots) => {
|
|
|
128
147
|
});
|
|
129
148
|
}
|
|
130
149
|
}
|
|
131
|
-
const result = await scan(command.threadId
|
|
150
|
+
const result = await scan(command.threadId
|
|
151
|
+
? { threadId: command.threadId }
|
|
152
|
+
: { provider: command.provider, workspaceRoot: command.workspaceRoot });
|
|
132
153
|
if (!result)
|
|
133
154
|
return {
|
|
134
155
|
state: 'unavailable',
|
|
@@ -174,7 +195,7 @@ export const createSkills = (registry, store, roots) => {
|
|
|
174
195
|
* - JG_AGENT_HQ_STORE_FAILED: The HQ store failed
|
|
175
196
|
*/
|
|
176
197
|
async preview(threadId, skillId, skillArguments) {
|
|
177
|
-
const result = await scan(threadId);
|
|
198
|
+
const result = await scan({ threadId });
|
|
178
199
|
if (!result)
|
|
179
200
|
return { state: 'unavailable', skill: null, text: null };
|
|
180
201
|
const skill = result.skills.find((skill) => skill.id === skillId);
|
|
@@ -263,10 +263,24 @@ export class ControlModel {
|
|
|
263
263
|
.prepare('UPDATE hq_action SET thread_id = ?, provider = ? WHERE id = ?')
|
|
264
264
|
.run(targetId, this.__thread(targetId).provider, action.id);
|
|
265
265
|
const inputText = command.kind === 'steer' ? command.text : prepared.input?.text;
|
|
266
|
-
if (inputText !== undefined && ['message', 'queue', 'steer'].includes(command.kind))
|
|
266
|
+
if (inputText !== undefined && ['message', 'queue', 'steer'].includes(command.kind)) {
|
|
267
|
+
const inputSha256 = createHash('sha256').update(inputText).digest('hex');
|
|
267
268
|
this.__database
|
|
268
269
|
.prepare('UPDATE hq_action SET input_sha256 = ? WHERE id = ?')
|
|
269
|
-
.run(
|
|
270
|
+
.run(inputSha256, action.id);
|
|
271
|
+
/*
|
|
272
|
+
* An explicit skill's text exists only once it's prepared, so a browser submission of one
|
|
273
|
+
* learns its fingerprint here. Its receipt's native action ID is a random UUID that browser
|
|
274
|
+
* admission hands only to its own dispatch, so the action holding it is the one the operator
|
|
275
|
+
* submitted, sent to the thread the browser selected.
|
|
276
|
+
*/
|
|
277
|
+
if ((command.kind === 'message' || command.kind === 'queue') &&
|
|
278
|
+
command.input.kind === 'skill')
|
|
279
|
+
this.__database
|
|
280
|
+
.prepare(`UPDATE hq_browser_action SET native_input_sha256 = ?
|
|
281
|
+
WHERE json_extract(receipt, '$.nativeActionId') = ? AND native_thread_id = ? AND native_input_sha256 IS NULL`)
|
|
282
|
+
.run(inputSha256, action.id, command.threadId);
|
|
283
|
+
}
|
|
270
284
|
this.__database.exec('SAVEPOINT admission');
|
|
271
285
|
let dispatchActionId = action.id;
|
|
272
286
|
try {
|
package/dist/store/types.d.ts
CHANGED
|
@@ -418,7 +418,9 @@ export declare const StoreCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
418
418
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
419
419
|
cursor: z.ZodOptional<z.ZodString>;
|
|
420
420
|
kind: z.ZodLiteral<"skills">;
|
|
421
|
-
|
|
421
|
+
provider: z.ZodString;
|
|
422
|
+
workspaceRoot: z.ZodString;
|
|
423
|
+
threadId: z.ZodOptional<z.ZodUUID>;
|
|
422
424
|
search: z.ZodOptional<z.ZodString>;
|
|
423
425
|
}, z.core.$strict>, z.ZodObject<{
|
|
424
426
|
kind: z.ZodLiteral<"skill-preview">;
|
|
@@ -1820,7 +1822,9 @@ export declare const StoreRequestSchema: z.ZodObject<{
|
|
|
1820
1822
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
1821
1823
|
cursor: z.ZodOptional<z.ZodString>;
|
|
1822
1824
|
kind: z.ZodLiteral<"skills">;
|
|
1823
|
-
|
|
1825
|
+
provider: z.ZodString;
|
|
1826
|
+
workspaceRoot: z.ZodString;
|
|
1827
|
+
threadId: z.ZodOptional<z.ZodUUID>;
|
|
1824
1828
|
search: z.ZodOptional<z.ZodString>;
|
|
1825
1829
|
}, z.core.$strict>, z.ZodObject<{
|
|
1826
1830
|
kind: z.ZodLiteral<"skill-preview">;
|
package/package.json
CHANGED