@hasna/skills 0.9.10 → 0.9.12

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/README.md CHANGED
@@ -134,6 +134,19 @@ refuse without a configuration write. Enrollment uses a short-lived native
134
134
  app-server and makes hooks eligible for new Codex processes. Existing sessions
135
135
  retain their own configuration; use their native hook controls to refresh them.
136
136
 
137
+ When an explicit discovery review includes the full Codex configuration file,
138
+ the exact native trust writes change that file's byte hash. Enrollment verifies
139
+ those writes and completes its journal with `bindingRefreshRequired: true`.
140
+ This reports native trust eligibility only: ordinary managed context remains
141
+ blocked, and the discovery policy is unchanged. Review the current full file
142
+ again and plan `skills hook install --agent codex --discovery-inputs <review>
143
+ --command <same-absolute-command> --json`. Verify that the plan changes only the
144
+ discovery policy, then repeat with `--apply`. Keep the same command and native
145
+ home. The ordinary bridge must then pass, and a fresh `skills hook trust
146
+ --agent codex --json` must report zero planned changes and
147
+ `bindingRefreshRequired: false`. Verify context in a new native session after
148
+ these checks; an enrollment receipt does not prove context was consumed.
149
+
137
150
  If an interrupted journal's policy later changed only in reviewed Claude
138
151
  discovery roots/sources, `skills hook trust reconcile --agent codex --journal
139
152
  <path> --review-claude-discovery <evidence-reference> --json` can preview that
@@ -147,6 +160,39 @@ the same command with `--recovery-plan-digest <reviewed-digest>` to record the
147
160
  receipt. Any unreviewed change refuses. This mode preserves the policy and
148
161
  native configuration and cannot be combined with `--supersede-binding`.
149
162
 
163
+ If another reviewed producer appended a user hook after the interrupted write,
164
+ add `--review-native-hook-additions <private-review.json>`. This is a separate
165
+ explicit review; a producer receipt alone never authorizes recovery. The review
166
+ must be an absolute, owner-only regular file with these exact fields:
167
+
168
+ - `version: 1`, `kind: "native-hook-additions"`, a nonempty `reason`, and a
169
+ `producerEvidence` reference to the independently reviewed producer operation.
170
+ - `journalIntentSha256`, `policySha256`, `configCurrentSha256`, and
171
+ `hooksCurrentSha256` pin the complete current inputs and immutable intent.
172
+ - `producerBefore` contains `configPath`, `configSha256`, `hooksPath`, and
173
+ `hooksSha256`. These owner-only backup files must reproduce exactly the
174
+ completed original trust write and the original hook declarations.
175
+ - `additions` contains one or more `{ event, nativeHook }` records. `event` is
176
+ `UserPromptSubmit`, `SessionStart`, or `SubagentStart`. `nativeHook` contains
177
+ exactly the native inventory fields `key`, `eventName`, `handlerType`,
178
+ `command`, `matcher`, `timeoutSec`, `async`, `statusMessage`,
179
+ `additionalContextLimit`, `sourcePath`, `source`, `pluginId`, `isManaged`,
180
+ `currentHash`, `enabled`, and `trustStatus`.
181
+
182
+ Only appended single-command groups from the same user hook file are supported:
183
+ no matcher, asynchronous handler, custom status/context limit, plugin source,
184
+ duplicate command, replacement or reordering. The added hooks must already be
185
+ enabled and trusted in the actual native inventory. Every original hook and
186
+ unrelated configuration byte remains verified. Combine this flag with
187
+ `--review-claude-discovery` only when that independent policy transition is also
188
+ present. The package provenance flags, private preview, exact
189
+ `--recovery-plan-digest`, and subsequent explicit binding refresh are still
190
+ required. Reconciliation writes only its journal receipt.
191
+
192
+ When updating the Codex binding afterward, Skills replaces its single hook
193
+ group in place so neighboring hooks retain their native indexes and trust
194
+ identities. Ambiguous duplicate or mixed Skills groups refuse installation.
195
+
150
196
  Each supported agent gets one small `skills-cli` native skill containing CLI
151
197
  instructions, without a copied catalogue. Claude's native Skill tool admits
152
198
  that bridge after other copies are retired. Prompt guards verify the owned
@@ -340,6 +386,25 @@ directory within your home, add `--allow-root-aliases` to hook installation and
340
386
  native migration. The plan records and rechecks the exact link and target;
341
387
  links inside skill contents or configuration files remain refused.
342
388
 
389
+ Cooperating installers can use the root package's
390
+ `planClaudeStopHookUpdate({ expectedSettingsSha256, replacement })`, then
391
+ `applyAgentIntegration(plan)`, to write an explicitly authorized Claude settings
392
+ replacement changing only `hooks.Stop`, together with every existing discovery
393
+ witness for that file. Every other field and hook must retain the same value;
394
+ this includes discovery configuration and display/model preferences.
395
+ The caller must authorize its own exact change; this API does not grant approval
396
+ to change another owner's hooks. It checks the current native bridge, inventory,
397
+ policy, executable witnesses and root aliases, preserves each witness mode, and
398
+ verifies the consumer guard after applying. A concurrent edit or pre-existing
399
+ drift refuses renewal. Failed post-write checks compensate only unchanged writes,
400
+ retaining private backups. A `null` plan means no Skills policy exists; malformed
401
+ or untrusted policy throws instead. This local integration operation requires no
402
+ hosted credential, does not reload an existing agent, and cannot adopt a stale
403
+ policy after another installer has already changed settings.
404
+ Settings and policy are separate files: this is a guarded sequence with
405
+ compensation, not a cross-file atomic commit. A concurrent hook can fail closed
406
+ during installation. A successful update does not reload an existing session.
407
+
343
408
  At session start, the hook authenticates and refreshes the profile. Prompt hooks
344
409
  select complete skill instructions from that verified cache using explicit
345
410
  `$skill` references, profile keywords, paths and always-required selections.
@@ -1965,3 +2030,18 @@ operation did not execute. The client does not retry or issue a status read
1965
2030
  automatically: explicitly call `get` with the same request ID to reconcile.
1966
2031
  Aborting locally does not establish server cancellation. An already-aborted
1967
2032
  signal refuses before calling the transport.
2033
+
2034
+ ### Authoring destination checks
2035
+
2036
+ Payload writers reject known native skill folders, physical aliases of the account's native roots, and configured home discovery roots (including OpenCode `skills.paths`) before creating directories. Malformed or unresolved native registrations fail closed and require the existing Skills discovery review. Changing the authoring data directory does not hide the account's native policy.
2037
+
2038
+ Other authoring tools can use the same read-only guard from the package root:
2039
+
2040
+ ```ts
2041
+ import { assertPortableAuthoringPath } from "@hasna/skills";
2042
+
2043
+ assertPortableAuthoringPath(destination, { homeDir: accountHome });
2044
+ // Only now create or change the private authoring destination.
2045
+ ```
2046
+
2047
+ `homeDir` defaults to the current account home. Missing destination descendants are supported. The check reads configuration without loading plugins, fetching skills, or creating directories; it throws on refusal. It is a pre-write check, not a reservation against concurrent configuration or symlink changes. Call it again immediately before each later write. Native inventory and migration remain available for preserving existing copies.