@cleocode/caamp 2026.10.8 → 2026.10.9
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/atomic.d.ts +184 -0
- package/dist/atomic.js +20 -0
- package/dist/{chunk-2FQWBKEG.js → chunk-2RZGY4XT.js} +54 -166
- package/dist/chunk-2RZGY4XT.js.map +1 -0
- package/dist/{chunk-HDZYZTR2.js → chunk-5INWYMO4.js} +1 -8
- package/dist/{chunk-HDZYZTR2.js.map → chunk-5INWYMO4.js.map} +1 -1
- package/dist/{chunk-ZL6FLO2H.js → chunk-5UAFS46N.js} +9 -5
- package/dist/{chunk-ZL6FLO2H.js.map → chunk-5UAFS46N.js.map} +1 -1
- package/dist/chunk-D6CWC4BX.js +195 -0
- package/dist/chunk-D6CWC4BX.js.map +1 -0
- package/dist/chunk-IYSZL7N7.js +1239 -0
- package/dist/chunk-IYSZL7N7.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/cli.js +8 -6
- package/dist/cli.js.map +1 -1
- package/dist/hooks-HDXLOEX2.js +61 -0
- package/dist/hooks-HDXLOEX2.js.map +1 -0
- package/dist/hooks.d.ts +812 -0
- package/dist/{hooks-FHFZZENR.js → hooks.js} +8 -3
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +5 -916
- package/dist/index.js +15 -10
- package/dist/index.js.map +1 -1
- package/dist/{injector-FDRZD2DB.js → injector-3SMMI2FO.js} +5 -3
- package/dist/injector-3SMMI2FO.js.map +1 -0
- package/package.json +15 -7
- package/providers/hook-mappings.json +6 -2
- package/dist/chunk-2FQWBKEG.js.map +0 -1
- package/dist/chunk-YCAANESR.js +0 -294
- package/dist/chunk-YCAANESR.js.map +0 -1
- /package/dist/{hooks-FHFZZENR.js.map → atomic.js.map} +0 -0
- /package/dist/{injector-FDRZD2DB.js.map → chunk-PZ5AY32C.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { InstructionDeliveryFinding, CaampInjectionAction, GlobalInstructionStalenessReport, GlobalInstructionSyncResult, InstructionDelivery } from '@cleocode/contracts/caamp-markers';
|
|
2
2
|
import { PackageArtifactBudgets, PackageArtifactRequirement, PackageArtifactFile, PackageFilesEntry, PackageArtifactInventory, PackageArtifactPolicy, PackageArtifactValidation } from '@cleocode/contracts/package-artifact';
|
|
3
3
|
import { WorktreeHandle } from '@cleocode/cant';
|
|
4
|
+
export { FileLockOptions, JsonConfigParseError, assertNotTornRead, updateJsonConfigFile, withFileLock } from './atomic.js';
|
|
5
|
+
export { CANONICAL_HOOK_EVENTS, CanonicalEventDefinition, CanonicalHookEvent, CrossProviderMatrix, HOOK_CATEGORIES, HookCategory, HookHandlerType, HookMapping, HookSupportResult, HookSystemType, NormalizedHookEvent, ProviderHookProfile, ProviderHookSummary, buildHookMatrix, getAllCanonicalEvents, getCanonicalEvent, getCanonicalEventsByCategory, getCommonEvents, getHookConfigPath, getHookMappingsVersion, getHookSupport, getHookSystemType, getMappedProviderIds, getProviderHookProfile, getProviderOnlyEvents, getProviderSummary, getProvidersForEvent, getSupportedEvents, getUnsupportedEvents, resolveNativeEvent, supportsHook, toCanonical, toNative, toNativeBatch, translateToAll } from './hooks.js';
|
|
4
6
|
import { PlatformPaths, SystemInfo } from '@cleocode/paths';
|
|
5
7
|
export { PlatformPaths, SystemInfo } from '@cleocode/paths';
|
|
6
8
|
import { SkillGateScanResult, SkillGatePolicyDecision, SkillGateFederationResult, SkillGateFederationInput } from '@cleocode/contracts';
|
|
9
|
+
import '@cleocode/contracts/project-hook-delivery.js';
|
|
10
|
+
import '@cleocode/contracts/tools/atomic';
|
|
7
11
|
|
|
8
12
|
/**
|
|
9
13
|
* Priority tier identifier stored in registry.json.
|
|
@@ -3147,179 +3151,6 @@ declare function writeConfig(filePath: string, format: ConfigFormat, key: string
|
|
|
3147
3151
|
*/
|
|
3148
3152
|
declare function removeConfig(filePath: string, format: ConfigFormat, key: string, serverName: string): Promise<boolean>;
|
|
3149
3153
|
|
|
3150
|
-
/**
|
|
3151
|
-
* Atomic file writes and cross-process file locking.
|
|
3152
|
-
*
|
|
3153
|
-
* CAAMP mutates files that are shared by *every* project on the machine — most
|
|
3154
|
-
* critically `~/.agents/AGENTS.md`, which every `cleo init`, `cleo upgrade` and
|
|
3155
|
-
* `cleo doctor` run rewrites regardless of which project it was invoked from.
|
|
3156
|
-
* A plain `writeFile` on such a path is `open(O_TRUNC)` followed by one or more
|
|
3157
|
-
* `write(2)` calls: two processes interleaving there can leave a caller reading
|
|
3158
|
-
* a half-written file, and a reader racing a writer can observe a truncated
|
|
3159
|
-
* one.
|
|
3160
|
-
*
|
|
3161
|
-
* Two primitives remove that class of failure:
|
|
3162
|
-
*
|
|
3163
|
-
* - `writeFileAtomic` — the canonical tmp-then-rename primitive from
|
|
3164
|
-
* `@cleocode/core/tools/fs.js`. `rename(2)` within a filesystem is atomic, so
|
|
3165
|
-
* a concurrent reader sees either the whole old file or the whole new one,
|
|
3166
|
-
* never a mixture. It is re-exported here for callers already importing this
|
|
3167
|
-
* module; the definition lives in core, per the tools-vs-skills boundary.
|
|
3168
|
-
* - {@link withFileLock} — serialise a whole read-modify-write cycle across
|
|
3169
|
-
* processes via an `O_EXCL` guard file, so two writers cannot both read the
|
|
3170
|
-
* pre-state and then clobber each other's result. Generalised from the
|
|
3171
|
-
* bespoke copy that lived inline in `lock-utils.ts` (now a caller).
|
|
3172
|
-
*
|
|
3173
|
-
* @task T12051
|
|
3174
|
-
*/
|
|
3175
|
-
/**
|
|
3176
|
-
* Options controlling {@link withFileLock}.
|
|
3177
|
-
*
|
|
3178
|
-
* @public
|
|
3179
|
-
*/
|
|
3180
|
-
interface FileLockOptions {
|
|
3181
|
-
/**
|
|
3182
|
-
* Number of acquisition attempts before throwing.
|
|
3183
|
-
*
|
|
3184
|
-
* @defaultValue 400
|
|
3185
|
-
*/
|
|
3186
|
-
retries?: number;
|
|
3187
|
-
/**
|
|
3188
|
-
* Delay between attempts, in milliseconds.
|
|
3189
|
-
*
|
|
3190
|
-
* @defaultValue 25
|
|
3191
|
-
*/
|
|
3192
|
-
delayMs?: number;
|
|
3193
|
-
/**
|
|
3194
|
-
* Age at which an existing guard file is treated as abandoned and removed.
|
|
3195
|
-
*
|
|
3196
|
-
* @defaultValue 30000
|
|
3197
|
-
*/
|
|
3198
|
-
staleMs?: number;
|
|
3199
|
-
}
|
|
3200
|
-
/**
|
|
3201
|
-
* Run `fn` while holding an exclusive cross-process lock on `targetPath`.
|
|
3202
|
-
*
|
|
3203
|
-
* The lock is a `<targetPath>.lock` guard file created with `O_EXCL`, which is
|
|
3204
|
-
* atomic on POSIX and on Windows. A guard left behind by a crashed process is
|
|
3205
|
-
* reclaimed once it exceeds `staleMs`.
|
|
3206
|
-
*
|
|
3207
|
-
* The guard is always released, including when `fn` throws.
|
|
3208
|
-
*
|
|
3209
|
-
* @param targetPath - Path being protected (the guard is a sibling of it)
|
|
3210
|
-
* @param fn - Work to perform while holding the lock
|
|
3211
|
-
* @param options - Retry, delay and staleness tuning
|
|
3212
|
-
* @returns Whatever `fn` returns
|
|
3213
|
-
* @throws Error if the lock cannot be acquired within `retries` attempts
|
|
3214
|
-
*
|
|
3215
|
-
* @example
|
|
3216
|
-
* ```typescript
|
|
3217
|
-
* const action = await withFileLock(agentsMd, async () => {
|
|
3218
|
-
* const before = await readFile(agentsMd, "utf-8");
|
|
3219
|
-
* await writeFileAtomic(agentsMd, transform(before));
|
|
3220
|
-
* return "updated";
|
|
3221
|
-
* });
|
|
3222
|
-
* ```
|
|
3223
|
-
*
|
|
3224
|
-
* @public
|
|
3225
|
-
*/
|
|
3226
|
-
declare function withFileLock<T>(targetPath: string, fn: () => Promise<T>, options?: FileLockOptions): Promise<T>;
|
|
3227
|
-
/**
|
|
3228
|
-
* Throw if a read looks like it landed inside another process's
|
|
3229
|
-
* truncate-then-write window.
|
|
3230
|
-
*
|
|
3231
|
-
* `writeFileAtomic` makes *our* writes indivisible, but callers outside this
|
|
3232
|
-
* package still rewrite instruction files with a plain `writeFile`, which is
|
|
3233
|
-
* `open(O_TRUNC)` followed by `write(2)`. A read landing between those two
|
|
3234
|
-
* returns an empty string for a file that is not empty on disk. Reconciling
|
|
3235
|
-
* from that observation would replace every byte of the user's content with a
|
|
3236
|
-
* lone CAAMP block.
|
|
3237
|
-
*
|
|
3238
|
-
* Failing closed is the right trade: the caller retries or reports, and the
|
|
3239
|
-
* file is left exactly as it was.
|
|
3240
|
-
*
|
|
3241
|
-
* @param filePath - Path that was read, for the error message
|
|
3242
|
-
* @param content - What the read returned
|
|
3243
|
-
* @param sizeOnDisk - `stat().size` for the same path
|
|
3244
|
-
* @throws Error when `content` is empty but `sizeOnDisk` is greater than zero
|
|
3245
|
-
*
|
|
3246
|
-
* @example
|
|
3247
|
-
* ```typescript
|
|
3248
|
-
* const text = await readFile(p, "utf-8");
|
|
3249
|
-
* if (text.length === 0) assertNotTornRead(p, text, (await stat(p)).size);
|
|
3250
|
-
* ```
|
|
3251
|
-
*
|
|
3252
|
-
* @public
|
|
3253
|
-
*/
|
|
3254
|
-
declare function assertNotTornRead(filePath: string, content: string, sizeOnDisk: number): void;
|
|
3255
|
-
/**
|
|
3256
|
-
* A JSON config file could not be parsed, so it was left untouched.
|
|
3257
|
-
*
|
|
3258
|
-
* @remarks
|
|
3259
|
-
* Thrown by {@link updateJsonConfigFile} instead of treating the file as empty.
|
|
3260
|
-
* The pre-T12385 provider adapters caught the parse error and started from
|
|
3261
|
-
* `{}`, so a torn read of `~/.claude/settings.json` (Claude Code rewriting it
|
|
3262
|
-
* at the same moment) replaced the user's permissions, env, model and hooks
|
|
3263
|
-
* with CLEO's entries alone.
|
|
3264
|
-
*
|
|
3265
|
-
* @example
|
|
3266
|
-
* ```typescript
|
|
3267
|
-
* try {
|
|
3268
|
-
* await updateJsonConfigFile(path, (config) => false);
|
|
3269
|
-
* } catch (err) {
|
|
3270
|
-
* if (err instanceof JsonConfigParseError) console.error(err.filePath);
|
|
3271
|
-
* }
|
|
3272
|
-
* ```
|
|
3273
|
-
*
|
|
3274
|
-
* @public
|
|
3275
|
-
*/
|
|
3276
|
-
declare class JsonConfigParseError extends Error {
|
|
3277
|
-
/** Path of the file that failed to parse. */
|
|
3278
|
-
readonly filePath: string;
|
|
3279
|
-
/**
|
|
3280
|
-
* @param filePath - Path of the file that failed to parse
|
|
3281
|
-
* @param reason - Parser message
|
|
3282
|
-
*/
|
|
3283
|
-
constructor(filePath: string, reason: string);
|
|
3284
|
-
}
|
|
3285
|
-
/**
|
|
3286
|
-
* Read-modify-write a JSON object file under the cross-process lock, writing
|
|
3287
|
-
* atomically, and never replacing an unparseable file.
|
|
3288
|
-
*
|
|
3289
|
-
* @remarks
|
|
3290
|
-
* Composes the two existing primitives — {@link withFileLock} and core's
|
|
3291
|
-
* `writeFileAtomic` — for provider config files such as
|
|
3292
|
-
* `~/.claude/settings.json` that the provider itself also rewrites (T12385):
|
|
3293
|
-
*
|
|
3294
|
-
* - The whole read → mutate → write cycle holds the `<file>.lock` guard, so
|
|
3295
|
-
* two CLEO writers cannot both read the pre-state and clobber each other.
|
|
3296
|
-
* - The write is tmp-then-rename, so a concurrent reader (including the
|
|
3297
|
-
* provider) sees the whole old file or the whole new one.
|
|
3298
|
-
* - A missing file starts from `{}`. A file that exists but is empty on read
|
|
3299
|
-
* while non-empty on disk, is not valid JSON, or is not a JSON object throws
|
|
3300
|
-
* ({@link assertNotTornRead} / {@link JsonConfigParseError}) and the file is
|
|
3301
|
-
* left byte-identical.
|
|
3302
|
-
*
|
|
3303
|
-
* @param filePath - JSON file to update
|
|
3304
|
-
* @param mutate - Edits the parsed object in place; returns `true` when it
|
|
3305
|
-
* changed something that must be written
|
|
3306
|
-
* @returns Whether the file was written
|
|
3307
|
-
* @throws {@link JsonConfigParseError} when the existing file cannot be parsed
|
|
3308
|
-
* as a JSON object; the file is not modified
|
|
3309
|
-
*
|
|
3310
|
-
* @example
|
|
3311
|
-
* ```typescript
|
|
3312
|
-
* const wrote = await updateJsonConfigFile(settingsPath, (settings) => {
|
|
3313
|
-
* if (settings.enabled === true) return false;
|
|
3314
|
-
* settings.enabled = true;
|
|
3315
|
-
* return true;
|
|
3316
|
-
* });
|
|
3317
|
-
* ```
|
|
3318
|
-
*
|
|
3319
|
-
* @public
|
|
3320
|
-
*/
|
|
3321
|
-
declare function updateJsonConfigFile(filePath: string, mutate: (config: Record<string, unknown>) => boolean): Promise<boolean>;
|
|
3322
|
-
|
|
3323
3154
|
/**
|
|
3324
3155
|
* Skill installer - canonical + symlink model
|
|
3325
3156
|
*
|
|
@@ -4132,748 +3963,6 @@ declare function getAllHarnesses(): Harness[];
|
|
|
4132
3963
|
*/
|
|
4133
3964
|
declare function resolveDefaultTargetProviders(options?: ResolveDefaultTargetProvidersOptions): Provider[];
|
|
4134
3965
|
|
|
4135
|
-
/**
|
|
4136
|
-
* All hook event categories (8 total).
|
|
4137
|
-
* @public
|
|
4138
|
-
*/
|
|
4139
|
-
declare const HOOK_CATEGORIES: readonly ["agent", "context", "memory", "pipeline", "prompt", "session", "task", "tool"];
|
|
4140
|
-
/** Union type of valid hook category strings. */
|
|
4141
|
-
type HookCategory = (typeof HOOK_CATEGORIES)[number];
|
|
4142
|
-
/**
|
|
4143
|
-
* All canonical hook events (31 total: 16 provider, 15 domain).
|
|
4144
|
-
*
|
|
4145
|
-
* This replaces the previously hardcoded tuple in types.ts.
|
|
4146
|
-
* Single source of truth: providers/hook-mappings.json
|
|
4147
|
-
* @public
|
|
4148
|
-
*/
|
|
4149
|
-
declare const CANONICAL_HOOK_EVENTS: readonly ["ConfigChange", "Notification", "PermissionRequest", "PostCompact", "PostModel", "PostToolUse", "PostToolUseFailure", "PreCompact", "PreModel", "PreToolUse", "PromptSubmit", "ResponseComplete", "SessionEnd", "SessionStart", "SubagentStart", "SubagentStop", "ApprovalExpired", "ApprovalGranted", "ApprovalRequested", "MemoryDecisionStored", "MemoryLearningStored", "MemoryObserved", "MemoryPatternStored", "PipelineManifestAppended", "PipelineStageCompleted", "SessionEnded", "SessionStarted", "TaskBlocked", "TaskCompleted", "TaskCreated", "TaskStarted"];
|
|
4150
|
-
/** Union type of all canonical hook event names. */
|
|
4151
|
-
type CanonicalHookEvent = (typeof CANONICAL_HOOK_EVENTS)[number];
|
|
4152
|
-
|
|
4153
|
-
/**
|
|
4154
|
-
* CAAMP Hooks Normalizer - Type Definitions
|
|
4155
|
-
*
|
|
4156
|
-
* Defines the canonical CAAMP hook event taxonomy and provider mapping types.
|
|
4157
|
-
* CAAMP provides a unified hook interface across all providers — consumers
|
|
4158
|
-
* use canonical event names, and the normalizer translates to/from
|
|
4159
|
-
* provider-native names.
|
|
4160
|
-
*/
|
|
4161
|
-
|
|
4162
|
-
/**
|
|
4163
|
-
* Definition of a canonical hook event including its category and behavior.
|
|
4164
|
-
*
|
|
4165
|
-
* @remarks
|
|
4166
|
-
* Each canonical event has a category for grouping, a human-readable description,
|
|
4167
|
-
* and a `canBlock` flag indicating whether a hook handler can prevent the
|
|
4168
|
-
* associated action from proceeding.
|
|
4169
|
-
*
|
|
4170
|
-
* @public
|
|
4171
|
-
*/
|
|
4172
|
-
interface CanonicalEventDefinition {
|
|
4173
|
-
/** The lifecycle category this event belongs to (e.g. `"session"`, `"tool"`). */
|
|
4174
|
-
category: HookCategory;
|
|
4175
|
-
/** Human-readable description of when this event fires. */
|
|
4176
|
-
description: string;
|
|
4177
|
-
/** Whether a hook handler can block or cancel the associated action. */
|
|
4178
|
-
canBlock: boolean;
|
|
4179
|
-
}
|
|
4180
|
-
/**
|
|
4181
|
-
* The type of hook system a provider uses.
|
|
4182
|
-
*
|
|
4183
|
-
* @remarks
|
|
4184
|
-
* - `"config"` — hooks defined in a configuration file (e.g. Claude Code `.claude/settings.json`)
|
|
4185
|
-
* - `"plugin"` — hooks implemented via a plugin/extension system
|
|
4186
|
-
* - `"none"` — provider does not support hooks
|
|
4187
|
-
*
|
|
4188
|
-
* @public
|
|
4189
|
-
*/
|
|
4190
|
-
type HookSystemType = 'config' | 'plugin' | 'none';
|
|
4191
|
-
/**
|
|
4192
|
-
* The mechanism a provider uses to execute hook handlers.
|
|
4193
|
-
*
|
|
4194
|
-
* @remarks
|
|
4195
|
-
* - `"command"` — shell command execution
|
|
4196
|
-
* - `"http"` — HTTP webhook callback
|
|
4197
|
-
* - `"prompt"` — LLM prompt injection
|
|
4198
|
-
* - `"agent"` — sub-agent delegation
|
|
4199
|
-
* - `"plugin"` — native plugin API call
|
|
4200
|
-
*
|
|
4201
|
-
* @public
|
|
4202
|
-
*/
|
|
4203
|
-
type HookHandlerType = 'command' | 'http' | 'prompt' | 'agent' | 'plugin';
|
|
4204
|
-
/**
|
|
4205
|
-
* Mapping of a single canonical event to a provider's native representation.
|
|
4206
|
-
*
|
|
4207
|
-
* @remarks
|
|
4208
|
-
* Each entry in a provider's hook profile maps one canonical event to the
|
|
4209
|
-
* provider's native event name. If `supported` is `false`, the provider
|
|
4210
|
-
* does not fire this event. Optional `notes` capture caveats or limitations.
|
|
4211
|
-
*
|
|
4212
|
-
* @public
|
|
4213
|
-
*/
|
|
4214
|
-
interface HookMapping {
|
|
4215
|
-
/** The provider-native event name, or `null` if the event has no native equivalent. */
|
|
4216
|
-
nativeName: string | null;
|
|
4217
|
-
/** Whether this canonical event is supported by the provider. */
|
|
4218
|
-
supported: boolean;
|
|
4219
|
-
/**
|
|
4220
|
-
* Optional notes about support limitations or behavioral differences.
|
|
4221
|
-
*
|
|
4222
|
-
* @defaultValue `undefined`
|
|
4223
|
-
*/
|
|
4224
|
-
notes?: string;
|
|
4225
|
-
}
|
|
4226
|
-
/**
|
|
4227
|
-
* Complete hook profile for a single provider.
|
|
4228
|
-
*
|
|
4229
|
-
* @remarks
|
|
4230
|
-
* Describes the provider's hook system type, configuration location, supported
|
|
4231
|
-
* handler types, and the full mapping of canonical events to native names.
|
|
4232
|
-
* This is the primary data structure loaded from `providers/hook-mappings.json`.
|
|
4233
|
-
*
|
|
4234
|
-
* @public
|
|
4235
|
-
*/
|
|
4236
|
-
interface ProviderHookProfile {
|
|
4237
|
-
/** The type of hook system the provider uses (`"config"`, `"plugin"`, or `"none"`). */
|
|
4238
|
-
hookSystem: HookSystemType;
|
|
4239
|
-
/** Filesystem path template to the provider's hook configuration file, or `null`. */
|
|
4240
|
-
hookConfigPath: string | null;
|
|
4241
|
-
/** The configuration format used for hooks (e.g. `"json"`, `"yaml"`), or `null`. */
|
|
4242
|
-
hookFormat: string | null;
|
|
4243
|
-
/** The handler execution mechanisms this provider supports. */
|
|
4244
|
-
handlerTypes: HookHandlerType[];
|
|
4245
|
-
/** Whether the provider's hook system is considered experimental or unstable. */
|
|
4246
|
-
experimental: boolean;
|
|
4247
|
-
/** Mapping of every canonical event to this provider's native representation. */
|
|
4248
|
-
mappings: Record<CanonicalHookEvent, HookMapping>;
|
|
4249
|
-
/** Native event names that exist only in this provider with no canonical equivalent. */
|
|
4250
|
-
providerOnlyEvents: string[];
|
|
4251
|
-
}
|
|
4252
|
-
/**
|
|
4253
|
-
* A fully resolved hook event with both canonical and native names.
|
|
4254
|
-
*
|
|
4255
|
-
* @remarks
|
|
4256
|
-
* Returned by batch translation functions. Contains all the context needed
|
|
4257
|
-
* to register or invoke a hook handler: the canonical name for CAAMP logic,
|
|
4258
|
-
* the native name for provider-specific calls, and metadata about category
|
|
4259
|
-
* and blocking behavior.
|
|
4260
|
-
*
|
|
4261
|
-
* @public
|
|
4262
|
-
*/
|
|
4263
|
-
interface NormalizedHookEvent {
|
|
4264
|
-
/** The CAAMP canonical event name. */
|
|
4265
|
-
canonical: CanonicalHookEvent;
|
|
4266
|
-
/** The provider-native event name. */
|
|
4267
|
-
native: string;
|
|
4268
|
-
/** The provider this event was resolved for. */
|
|
4269
|
-
providerId: string;
|
|
4270
|
-
/** The lifecycle category of this event. */
|
|
4271
|
-
category: HookCategory;
|
|
4272
|
-
/** Whether a handler for this event can block the associated action. */
|
|
4273
|
-
canBlock: boolean;
|
|
4274
|
-
}
|
|
4275
|
-
/**
|
|
4276
|
-
* Result of querying whether a provider supports a specific canonical event.
|
|
4277
|
-
*
|
|
4278
|
-
* @remarks
|
|
4279
|
-
* Returned by `getHookSupport()`. Includes the native name translation
|
|
4280
|
-
* and any notes about support limitations. When `supported` is `false`,
|
|
4281
|
-
* `native` will be `null`.
|
|
4282
|
-
*
|
|
4283
|
-
* @public
|
|
4284
|
-
*/
|
|
4285
|
-
interface HookSupportResult {
|
|
4286
|
-
/** The canonical event that was queried. */
|
|
4287
|
-
canonical: CanonicalHookEvent;
|
|
4288
|
-
/** Whether the provider supports this event. */
|
|
4289
|
-
supported: boolean;
|
|
4290
|
-
/** The provider-native event name, or `null` if unsupported. */
|
|
4291
|
-
native: string | null;
|
|
4292
|
-
/**
|
|
4293
|
-
* Optional notes about support caveats.
|
|
4294
|
-
*
|
|
4295
|
-
* @defaultValue `undefined`
|
|
4296
|
-
*/
|
|
4297
|
-
notes?: string;
|
|
4298
|
-
}
|
|
4299
|
-
/**
|
|
4300
|
-
* Aggregated hook support summary for a single provider.
|
|
4301
|
-
*
|
|
4302
|
-
* @remarks
|
|
4303
|
-
* Provides a high-level view of a provider's hook capabilities including
|
|
4304
|
-
* counts, coverage percentage, and lists of supported/unsupported events.
|
|
4305
|
-
* Useful for CLI display and provider comparison features.
|
|
4306
|
-
*
|
|
4307
|
-
* @public
|
|
4308
|
-
*/
|
|
4309
|
-
interface ProviderHookSummary {
|
|
4310
|
-
/** The provider identifier. */
|
|
4311
|
-
providerId: string;
|
|
4312
|
-
/** The type of hook system the provider uses. */
|
|
4313
|
-
hookSystem: HookSystemType;
|
|
4314
|
-
/** Whether the provider's hook system is experimental. */
|
|
4315
|
-
experimental: boolean;
|
|
4316
|
-
/** Number of canonical events this provider supports. */
|
|
4317
|
-
supportedCount: number;
|
|
4318
|
-
/** Total number of canonical events in the taxonomy. */
|
|
4319
|
-
totalCanonical: number;
|
|
4320
|
-
/** List of canonical events this provider supports. */
|
|
4321
|
-
supported: CanonicalHookEvent[];
|
|
4322
|
-
/** List of canonical events this provider does not support. */
|
|
4323
|
-
unsupported: CanonicalHookEvent[];
|
|
4324
|
-
/** Native events unique to this provider with no canonical mapping. */
|
|
4325
|
-
providerOnly: string[];
|
|
4326
|
-
/** Percentage of canonical events supported (0-100). */
|
|
4327
|
-
coverage: number;
|
|
4328
|
-
}
|
|
4329
|
-
/**
|
|
4330
|
-
* Cross-provider hook support matrix comparing multiple providers.
|
|
4331
|
-
*
|
|
4332
|
-
* @remarks
|
|
4333
|
-
* Built by `buildHookMatrix()`. Provides a two-dimensional view of which
|
|
4334
|
-
* canonical events are supported by which providers, with native name
|
|
4335
|
-
* translations. Used to render comparison tables in the CLI.
|
|
4336
|
-
*
|
|
4337
|
-
* @public
|
|
4338
|
-
*/
|
|
4339
|
-
interface CrossProviderMatrix {
|
|
4340
|
-
/** The canonical events included in this matrix (rows). */
|
|
4341
|
-
events: CanonicalHookEvent[];
|
|
4342
|
-
/** The provider IDs included in this matrix (columns). */
|
|
4343
|
-
providers: string[];
|
|
4344
|
-
/** Nested record mapping each canonical event to each provider's hook mapping. */
|
|
4345
|
-
matrix: Record<CanonicalHookEvent, Record<string, HookMapping>>;
|
|
4346
|
-
}
|
|
4347
|
-
|
|
4348
|
-
/**
|
|
4349
|
-
* CAAMP Hooks Normalizer
|
|
4350
|
-
*
|
|
4351
|
-
* Translates between CAAMP canonical hook events and provider-native
|
|
4352
|
-
* event names. Provides query functions for hook support, cross-provider
|
|
4353
|
-
* comparison, and event normalization.
|
|
4354
|
-
*
|
|
4355
|
-
* This module follows the same pattern as `src/core/mcp/transforms.ts` —
|
|
4356
|
-
* a translation layer that lets consumers use one canonical interface
|
|
4357
|
-
* while CAAMP handles provider-specific differences.
|
|
4358
|
-
*/
|
|
4359
|
-
|
|
4360
|
-
/**
|
|
4361
|
-
* Get the canonical event definition (category, description, canBlock).
|
|
4362
|
-
*
|
|
4363
|
-
* @remarks
|
|
4364
|
-
* Looks up the definition from the hook mappings data file. The returned
|
|
4365
|
-
* object contains the event's category, human-readable description, and
|
|
4366
|
-
* whether handlers can block the associated action.
|
|
4367
|
-
*
|
|
4368
|
-
* @param event - The canonical event name to look up.
|
|
4369
|
-
* @returns The event definition containing category, description, and canBlock flag.
|
|
4370
|
-
*
|
|
4371
|
-
* @example
|
|
4372
|
-
* ```typescript
|
|
4373
|
-
* import { getCanonicalEvent } from "./normalizer.js";
|
|
4374
|
-
*
|
|
4375
|
-
* const def = getCanonicalEvent("PreToolUse");
|
|
4376
|
-
* console.log(def.category); // "tool"
|
|
4377
|
-
* console.log(def.canBlock); // true
|
|
4378
|
-
* ```
|
|
4379
|
-
*
|
|
4380
|
-
* @public
|
|
4381
|
-
*/
|
|
4382
|
-
declare function getCanonicalEvent(event: CanonicalHookEvent): CanonicalEventDefinition;
|
|
4383
|
-
/**
|
|
4384
|
-
* Get all canonical event definitions.
|
|
4385
|
-
*
|
|
4386
|
-
* @remarks
|
|
4387
|
-
* Returns the complete map of canonical event names to their definitions.
|
|
4388
|
-
* Useful for iterating over the full taxonomy or building UI displays
|
|
4389
|
-
* of all available events.
|
|
4390
|
-
*
|
|
4391
|
-
* @returns A record mapping every canonical event name to its definition.
|
|
4392
|
-
*
|
|
4393
|
-
* @example
|
|
4394
|
-
* ```typescript
|
|
4395
|
-
* import { getAllCanonicalEvents } from "./normalizer.js";
|
|
4396
|
-
*
|
|
4397
|
-
* const events = getAllCanonicalEvents();
|
|
4398
|
-
* for (const [name, def] of Object.entries(events)) {
|
|
4399
|
-
* console.log(`${name}: ${def.description}`);
|
|
4400
|
-
* }
|
|
4401
|
-
* ```
|
|
4402
|
-
*
|
|
4403
|
-
* @public
|
|
4404
|
-
*/
|
|
4405
|
-
declare function getAllCanonicalEvents(): Record<CanonicalHookEvent, CanonicalEventDefinition>;
|
|
4406
|
-
/**
|
|
4407
|
-
* Get canonical events filtered by category.
|
|
4408
|
-
*
|
|
4409
|
-
* @remarks
|
|
4410
|
-
* Filters the canonical event list to only those belonging to the specified
|
|
4411
|
-
* category. Useful for displaying events grouped by lifecycle phase
|
|
4412
|
-
* (e.g. all `"tool"` events or all `"session"` events).
|
|
4413
|
-
*
|
|
4414
|
-
* @param category - The hook category to filter by (e.g. `"session"`, `"tool"`).
|
|
4415
|
-
* @returns Array of canonical event names that belong to the specified category.
|
|
4416
|
-
*
|
|
4417
|
-
* @example
|
|
4418
|
-
* ```typescript
|
|
4419
|
-
* import { getCanonicalEventsByCategory } from "./normalizer.js";
|
|
4420
|
-
*
|
|
4421
|
-
* const toolEvents = getCanonicalEventsByCategory("tool");
|
|
4422
|
-
* // ["PreToolUse", "PostToolUse", "PostToolUseFailure"]
|
|
4423
|
-
* ```
|
|
4424
|
-
*
|
|
4425
|
-
* @public
|
|
4426
|
-
*/
|
|
4427
|
-
declare function getCanonicalEventsByCategory(category: HookCategory): CanonicalHookEvent[];
|
|
4428
|
-
/**
|
|
4429
|
-
* Get the full hook profile for a provider.
|
|
4430
|
-
*
|
|
4431
|
-
* @remarks
|
|
4432
|
-
* Returns the complete hook configuration for a provider including its
|
|
4433
|
-
* hook system type, config path, handler types, and all event mappings.
|
|
4434
|
-
* Returns `undefined` if the provider has no hook mappings defined.
|
|
4435
|
-
*
|
|
4436
|
-
* @param providerId - The provider identifier (e.g. `"claude-code"`, `"gemini-cli"`).
|
|
4437
|
-
* @returns The provider's hook profile, or `undefined` if not found.
|
|
4438
|
-
*
|
|
4439
|
-
* @example
|
|
4440
|
-
* ```typescript
|
|
4441
|
-
* import { getProviderHookProfile } from "./normalizer.js";
|
|
4442
|
-
*
|
|
4443
|
-
* const profile = getProviderHookProfile("claude-code");
|
|
4444
|
-
* if (profile) {
|
|
4445
|
-
* console.log(profile.hookSystem); // "config"
|
|
4446
|
-
* console.log(profile.experimental); // false
|
|
4447
|
-
* }
|
|
4448
|
-
* ```
|
|
4449
|
-
*
|
|
4450
|
-
* @public
|
|
4451
|
-
*/
|
|
4452
|
-
declare function getProviderHookProfile(providerId: string): ProviderHookProfile | undefined;
|
|
4453
|
-
/**
|
|
4454
|
-
* Get all provider IDs that have hook mappings.
|
|
4455
|
-
*
|
|
4456
|
-
* @remarks
|
|
4457
|
-
* Returns the list of provider identifiers present in the hook mappings
|
|
4458
|
-
* data file. This reflects all providers for which CAAMP has hook
|
|
4459
|
-
* translation data, regardless of whether they support any events.
|
|
4460
|
-
*
|
|
4461
|
-
* @returns Array of provider ID strings.
|
|
4462
|
-
*
|
|
4463
|
-
* @example
|
|
4464
|
-
* ```typescript
|
|
4465
|
-
* import { getMappedProviderIds } from "./normalizer.js";
|
|
4466
|
-
*
|
|
4467
|
-
* const ids = getMappedProviderIds();
|
|
4468
|
-
* // ["claude-code", "gemini-cli", "cursor", "kimi", ...]
|
|
4469
|
-
* ```
|
|
4470
|
-
*
|
|
4471
|
-
* @public
|
|
4472
|
-
*/
|
|
4473
|
-
declare function getMappedProviderIds(): string[];
|
|
4474
|
-
/**
|
|
4475
|
-
* Translate a CAAMP canonical event name to the provider's native name.
|
|
4476
|
-
*
|
|
4477
|
-
* @remarks
|
|
4478
|
-
* This is the primary forward-translation function. Given a canonical
|
|
4479
|
-
* event and a provider ID, it returns the provider-specific event name
|
|
4480
|
-
* that should be used when configuring hooks for that provider.
|
|
4481
|
-
* Returns `null` if the provider is unknown or does not support the event.
|
|
4482
|
-
*
|
|
4483
|
-
* @param canonical - The CAAMP canonical event name to translate.
|
|
4484
|
-
* @param providerId - The target provider identifier.
|
|
4485
|
-
* @returns The native event name, or `null` if unsupported.
|
|
4486
|
-
*
|
|
4487
|
-
* @example
|
|
4488
|
-
* ```typescript
|
|
4489
|
-
* import { toNative } from "./normalizer.js";
|
|
4490
|
-
*
|
|
4491
|
-
* toNative("PreToolUse", "claude-code"); // "PreToolUse"
|
|
4492
|
-
* toNative("PreToolUse", "gemini-cli"); // "BeforeTool"
|
|
4493
|
-
* toNative("PreToolUse", "cursor"); // "preToolUse"
|
|
4494
|
-
* toNative("PreToolUse", "kimi"); // null
|
|
4495
|
-
* ```
|
|
4496
|
-
*
|
|
4497
|
-
* @public
|
|
4498
|
-
*/
|
|
4499
|
-
declare function toNative(canonical: CanonicalHookEvent, providerId: string): string | null;
|
|
4500
|
-
/**
|
|
4501
|
-
* Translate a provider-native event name to the CAAMP canonical name.
|
|
4502
|
-
*
|
|
4503
|
-
* @remarks
|
|
4504
|
-
* This is the reverse-translation function. Scans all event mappings
|
|
4505
|
-
* for the given provider to find a canonical match for the native name.
|
|
4506
|
-
* Returns `null` if no mapping is found or the provider is unknown.
|
|
4507
|
-
*
|
|
4508
|
-
* @param nativeName - The provider-native event name to look up.
|
|
4509
|
-
* @param providerId - The provider identifier to search within.
|
|
4510
|
-
* @returns The canonical event name, or `null` if no mapping exists.
|
|
4511
|
-
*
|
|
4512
|
-
* @example
|
|
4513
|
-
* ```typescript
|
|
4514
|
-
* import { toCanonical } from "./normalizer.js";
|
|
4515
|
-
*
|
|
4516
|
-
* toCanonical("BeforeTool", "gemini-cli"); // "PreToolUse"
|
|
4517
|
-
* toCanonical("stop", "cursor"); // "ResponseComplete"
|
|
4518
|
-
* toCanonical("UserPromptSubmit", "claude-code"); // "PromptSubmit"
|
|
4519
|
-
* ```
|
|
4520
|
-
*
|
|
4521
|
-
* @public
|
|
4522
|
-
*/
|
|
4523
|
-
declare function toCanonical(nativeName: string, providerId: string): CanonicalHookEvent | null;
|
|
4524
|
-
/**
|
|
4525
|
-
* Batch-translate multiple canonical events to native names for a provider.
|
|
4526
|
-
*
|
|
4527
|
-
* @remarks
|
|
4528
|
-
* Translates an array of canonical events in a single call, returning
|
|
4529
|
-
* only the events that the provider actually supports. Each result
|
|
4530
|
-
* includes category and blocking metadata. Unsupported events are
|
|
4531
|
-
* silently excluded from the output.
|
|
4532
|
-
*
|
|
4533
|
-
* @param canonicals - Array of canonical event names to translate.
|
|
4534
|
-
* @param providerId - The target provider identifier.
|
|
4535
|
-
* @returns Array of normalized events (only supported ones included).
|
|
4536
|
-
*
|
|
4537
|
-
* @example
|
|
4538
|
-
* ```typescript
|
|
4539
|
-
* import { toNativeBatch } from "./normalizer.js";
|
|
4540
|
-
*
|
|
4541
|
-
* const events = toNativeBatch(
|
|
4542
|
-
* ["PreToolUse", "PostToolUse", "ConfigChange"],
|
|
4543
|
-
* "claude-code",
|
|
4544
|
-
* );
|
|
4545
|
-
* // Returns NormalizedHookEvent[] for supported events only
|
|
4546
|
-
* ```
|
|
4547
|
-
*
|
|
4548
|
-
* @public
|
|
4549
|
-
*/
|
|
4550
|
-
declare function toNativeBatch(canonicals: CanonicalHookEvent[], providerId: string): NormalizedHookEvent[];
|
|
4551
|
-
/**
|
|
4552
|
-
* Check if a provider supports a specific canonical hook event.
|
|
4553
|
-
*
|
|
4554
|
-
* @remarks
|
|
4555
|
-
* A quick boolean check that avoids returning the full mapping details.
|
|
4556
|
-
* Returns `false` if the provider is unknown or the event is not supported.
|
|
4557
|
-
*
|
|
4558
|
-
* @param canonical - The canonical event name to check.
|
|
4559
|
-
* @param providerId - The provider identifier to check against.
|
|
4560
|
-
* @returns `true` if the provider supports this canonical event, `false` otherwise.
|
|
4561
|
-
*
|
|
4562
|
-
* @example
|
|
4563
|
-
* ```typescript
|
|
4564
|
-
* import { supportsHook } from "./normalizer.js";
|
|
4565
|
-
*
|
|
4566
|
-
* supportsHook("PreToolUse", "claude-code"); // true
|
|
4567
|
-
* supportsHook("PreToolUse", "kimi"); // false
|
|
4568
|
-
* ```
|
|
4569
|
-
*
|
|
4570
|
-
* @public
|
|
4571
|
-
*/
|
|
4572
|
-
declare function supportsHook(canonical: CanonicalHookEvent, providerId: string): boolean;
|
|
4573
|
-
/**
|
|
4574
|
-
* Get full hook support details for a canonical event on a provider.
|
|
4575
|
-
*
|
|
4576
|
-
* @remarks
|
|
4577
|
-
* Returns a structured result with the native name translation and any
|
|
4578
|
-
* notes about support limitations. Unlike `supportsHook()`, this always
|
|
4579
|
-
* returns a result object even when the provider is unknown (with
|
|
4580
|
-
* `supported: false`).
|
|
4581
|
-
*
|
|
4582
|
-
* @param canonical - The canonical event name to query.
|
|
4583
|
-
* @param providerId - The provider identifier to query against.
|
|
4584
|
-
* @returns Support result including native name and optional notes.
|
|
4585
|
-
*
|
|
4586
|
-
* @example
|
|
4587
|
-
* ```typescript
|
|
4588
|
-
* import { getHookSupport } from "./normalizer.js";
|
|
4589
|
-
*
|
|
4590
|
-
* const result = getHookSupport("PreToolUse", "claude-code");
|
|
4591
|
-
* console.log(result.supported); // true
|
|
4592
|
-
* console.log(result.native); // "PreToolUse"
|
|
4593
|
-
* ```
|
|
4594
|
-
*
|
|
4595
|
-
* @public
|
|
4596
|
-
*/
|
|
4597
|
-
declare function getHookSupport(canonical: CanonicalHookEvent, providerId: string): HookSupportResult;
|
|
4598
|
-
/**
|
|
4599
|
-
* Get all supported canonical events for a provider.
|
|
4600
|
-
*
|
|
4601
|
-
* @remarks
|
|
4602
|
-
* Filters the full canonical event list to only those that the provider
|
|
4603
|
-
* supports. Returns an empty array if the provider is unknown.
|
|
4604
|
-
*
|
|
4605
|
-
* @param providerId - The provider identifier to query.
|
|
4606
|
-
* @returns Array of canonical event names the provider supports.
|
|
4607
|
-
*
|
|
4608
|
-
* @example
|
|
4609
|
-
* ```typescript
|
|
4610
|
-
* import { getSupportedEvents } from "./normalizer.js";
|
|
4611
|
-
*
|
|
4612
|
-
* const events = getSupportedEvents("claude-code");
|
|
4613
|
-
* // ["SessionStart", "SessionEnd", "PreToolUse", ...]
|
|
4614
|
-
* ```
|
|
4615
|
-
*
|
|
4616
|
-
* @public
|
|
4617
|
-
*/
|
|
4618
|
-
declare function getSupportedEvents(providerId: string): CanonicalHookEvent[];
|
|
4619
|
-
/**
|
|
4620
|
-
* Get all unsupported canonical events for a provider.
|
|
4621
|
-
*
|
|
4622
|
-
* @remarks
|
|
4623
|
-
* Returns the complement of `getSupportedEvents()`. If the provider is
|
|
4624
|
-
* unknown, all canonical events are returned since none are supported.
|
|
4625
|
-
*
|
|
4626
|
-
* @param providerId - The provider identifier to query.
|
|
4627
|
-
* @returns Array of canonical event names the provider does not support.
|
|
4628
|
-
*
|
|
4629
|
-
* @example
|
|
4630
|
-
* ```typescript
|
|
4631
|
-
* import { getUnsupportedEvents } from "./normalizer.js";
|
|
4632
|
-
*
|
|
4633
|
-
* const missing = getUnsupportedEvents("kimi");
|
|
4634
|
-
* // Returns all canonical events (kimi has no hook support)
|
|
4635
|
-
* ```
|
|
4636
|
-
*
|
|
4637
|
-
* @public
|
|
4638
|
-
*/
|
|
4639
|
-
declare function getUnsupportedEvents(providerId: string): CanonicalHookEvent[];
|
|
4640
|
-
/**
|
|
4641
|
-
* Get providers that support a specific canonical event.
|
|
4642
|
-
*
|
|
4643
|
-
* @remarks
|
|
4644
|
-
* Scans all provider mappings and returns the IDs of those that support
|
|
4645
|
-
* the given canonical event. Useful for determining which providers can
|
|
4646
|
-
* be targeted when configuring a specific hook.
|
|
4647
|
-
*
|
|
4648
|
-
* @param canonical - The canonical event name to search for.
|
|
4649
|
-
* @returns Array of provider IDs that support this event.
|
|
4650
|
-
*
|
|
4651
|
-
* @example
|
|
4652
|
-
* ```typescript
|
|
4653
|
-
* import { getProvidersForEvent } from "./normalizer.js";
|
|
4654
|
-
*
|
|
4655
|
-
* const providers = getProvidersForEvent("PreToolUse");
|
|
4656
|
-
* // ["claude-code", "gemini-cli", "cursor"]
|
|
4657
|
-
* ```
|
|
4658
|
-
*
|
|
4659
|
-
* @public
|
|
4660
|
-
*/
|
|
4661
|
-
declare function getProvidersForEvent(canonical: CanonicalHookEvent): string[];
|
|
4662
|
-
/**
|
|
4663
|
-
* Get canonical events common to all specified providers.
|
|
4664
|
-
*
|
|
4665
|
-
* @remarks
|
|
4666
|
-
* Computes the intersection of supported events across multiple providers.
|
|
4667
|
-
* Returns only events that every listed provider supports. Useful for
|
|
4668
|
-
* determining which hooks can be configured uniformly across a set of
|
|
4669
|
-
* target providers.
|
|
4670
|
-
*
|
|
4671
|
-
* @param providerIds - Array of provider IDs to intersect.
|
|
4672
|
-
* @returns Array of canonical events supported by all specified providers.
|
|
4673
|
-
*
|
|
4674
|
-
* @example
|
|
4675
|
-
* ```typescript
|
|
4676
|
-
* import { getCommonEvents } from "./normalizer.js";
|
|
4677
|
-
*
|
|
4678
|
-
* const common = getCommonEvents(["claude-code", "gemini-cli"]);
|
|
4679
|
-
* // Returns only events both providers support
|
|
4680
|
-
* ```
|
|
4681
|
-
*
|
|
4682
|
-
* @public
|
|
4683
|
-
*/
|
|
4684
|
-
declare function getCommonEvents(providerIds: string[]): CanonicalHookEvent[];
|
|
4685
|
-
/**
|
|
4686
|
-
* Get a summary of hook support for a provider.
|
|
4687
|
-
*
|
|
4688
|
-
* @remarks
|
|
4689
|
-
* Builds an aggregated view of a provider's hook capabilities including
|
|
4690
|
-
* counts, coverage percentage, and categorized event lists. Returns
|
|
4691
|
-
* `undefined` if the provider has no hook mappings. Used by the CLI
|
|
4692
|
-
* `hooks show` command for provider overviews.
|
|
4693
|
-
*
|
|
4694
|
-
* @param providerId - The provider identifier to summarize.
|
|
4695
|
-
* @returns The hook support summary, or `undefined` if the provider is not found.
|
|
4696
|
-
*
|
|
4697
|
-
* @example
|
|
4698
|
-
* ```typescript
|
|
4699
|
-
* import { getProviderSummary } from "./normalizer.js";
|
|
4700
|
-
*
|
|
4701
|
-
* const summary = getProviderSummary("claude-code");
|
|
4702
|
-
* if (summary) {
|
|
4703
|
-
* console.log(`${summary.coverage}% coverage`);
|
|
4704
|
-
* console.log(`${summary.supportedCount}/${summary.totalCanonical} events`);
|
|
4705
|
-
* }
|
|
4706
|
-
* ```
|
|
4707
|
-
*
|
|
4708
|
-
* @public
|
|
4709
|
-
*/
|
|
4710
|
-
declare function getProviderSummary(providerId: string): ProviderHookSummary | undefined;
|
|
4711
|
-
/**
|
|
4712
|
-
* Build a cross-provider hook support matrix.
|
|
4713
|
-
*
|
|
4714
|
-
* @remarks
|
|
4715
|
-
* Constructs a two-dimensional matrix showing which canonical events are
|
|
4716
|
-
* supported by which providers, with native name translations. When no
|
|
4717
|
-
* provider IDs are specified, all mapped providers are included. Used by
|
|
4718
|
-
* the CLI `hooks matrix` command for comparison tables.
|
|
4719
|
-
*
|
|
4720
|
-
* @param providerIds - Optional array of provider IDs to include. Defaults to all mapped providers.
|
|
4721
|
-
* @returns The cross-provider matrix with events, providers, and mapping data.
|
|
4722
|
-
*
|
|
4723
|
-
* @example
|
|
4724
|
-
* ```typescript
|
|
4725
|
-
* import { buildHookMatrix } from "./normalizer.js";
|
|
4726
|
-
*
|
|
4727
|
-
* const matrix = buildHookMatrix(["claude-code", "gemini-cli"]);
|
|
4728
|
-
* for (const event of matrix.events) {
|
|
4729
|
-
* for (const provider of matrix.providers) {
|
|
4730
|
-
* console.log(`${event} @ ${provider}: ${matrix.matrix[event][provider].supported}`);
|
|
4731
|
-
* }
|
|
4732
|
-
* }
|
|
4733
|
-
* ```
|
|
4734
|
-
*
|
|
4735
|
-
* @public
|
|
4736
|
-
*/
|
|
4737
|
-
declare function buildHookMatrix(providerIds?: string[]): CrossProviderMatrix;
|
|
4738
|
-
/**
|
|
4739
|
-
* Get the hook system type for a provider.
|
|
4740
|
-
*
|
|
4741
|
-
* @remarks
|
|
4742
|
-
* Returns the provider's hook system type: `"config"` for file-based hooks,
|
|
4743
|
-
* `"plugin"` for extension-based hooks, or `"none"` if the provider does
|
|
4744
|
-
* not support hooks. Returns `"none"` for unknown providers.
|
|
4745
|
-
*
|
|
4746
|
-
* @param providerId - The provider identifier to query.
|
|
4747
|
-
* @returns The hook system type (`"config"`, `"plugin"`, or `"none"`).
|
|
4748
|
-
*
|
|
4749
|
-
* @example
|
|
4750
|
-
* ```typescript
|
|
4751
|
-
* import { getHookSystemType } from "./normalizer.js";
|
|
4752
|
-
*
|
|
4753
|
-
* getHookSystemType("claude-code"); // "config"
|
|
4754
|
-
* getHookSystemType("unknown"); // "none"
|
|
4755
|
-
* ```
|
|
4756
|
-
*
|
|
4757
|
-
* @public
|
|
4758
|
-
*/
|
|
4759
|
-
declare function getHookSystemType(providerId: string): HookSystemType;
|
|
4760
|
-
/**
|
|
4761
|
-
* Get the resolved hook config path for a provider.
|
|
4762
|
-
*
|
|
4763
|
-
* @remarks
|
|
4764
|
-
* Resolves the provider's hook configuration file path by expanding
|
|
4765
|
-
* registry template variables (e.g. `~` to the home directory). Returns
|
|
4766
|
-
* `null` if the provider has no hook config path defined or is unknown.
|
|
4767
|
-
*
|
|
4768
|
-
* @param providerId - The provider identifier to query.
|
|
4769
|
-
* @returns The resolved filesystem path, or `null` if not available.
|
|
4770
|
-
*
|
|
4771
|
-
* @example
|
|
4772
|
-
* ```typescript
|
|
4773
|
-
* import { getHookConfigPath } from "./normalizer.js";
|
|
4774
|
-
*
|
|
4775
|
-
* const path = getHookConfigPath("claude-code");
|
|
4776
|
-
* // "/home/user/.claude/settings.json" (resolved from template)
|
|
4777
|
-
* ```
|
|
4778
|
-
*
|
|
4779
|
-
* @public
|
|
4780
|
-
*/
|
|
4781
|
-
declare function getHookConfigPath(providerId: string): string | null;
|
|
4782
|
-
/**
|
|
4783
|
-
* Get provider-only events (native events with no canonical mapping).
|
|
4784
|
-
*
|
|
4785
|
-
* @remarks
|
|
4786
|
-
* Some providers define hook events that have no equivalent in the CAAMP
|
|
4787
|
-
* canonical taxonomy. This function returns those provider-specific event
|
|
4788
|
-
* names. Returns an empty array for unknown providers.
|
|
4789
|
-
*
|
|
4790
|
-
* @param providerId - The provider identifier to query.
|
|
4791
|
-
* @returns Array of native event names unique to this provider.
|
|
4792
|
-
*
|
|
4793
|
-
* @example
|
|
4794
|
-
* ```typescript
|
|
4795
|
-
* import { getProviderOnlyEvents } from "./normalizer.js";
|
|
4796
|
-
*
|
|
4797
|
-
* const extras = getProviderOnlyEvents("claude-code");
|
|
4798
|
-
* // Returns any events specific to Claude Code with no canonical equivalent
|
|
4799
|
-
* ```
|
|
4800
|
-
*
|
|
4801
|
-
* @public
|
|
4802
|
-
*/
|
|
4803
|
-
declare function getProviderOnlyEvents(providerId: string): string[];
|
|
4804
|
-
/**
|
|
4805
|
-
* Translate a canonical event to native names across multiple providers.
|
|
4806
|
-
*
|
|
4807
|
-
* @remarks
|
|
4808
|
-
* Performs a fan-out translation of a single canonical event to all
|
|
4809
|
-
* specified providers simultaneously. The result record only includes
|
|
4810
|
-
* providers that actually support the event — unsupported providers
|
|
4811
|
-
* are silently excluded.
|
|
4812
|
-
*
|
|
4813
|
-
* @param canonical - The canonical event name to translate.
|
|
4814
|
-
* @param providerIds - Array of provider IDs to translate for.
|
|
4815
|
-
* @returns Record mapping provider IDs to their native event names (supported only).
|
|
4816
|
-
*
|
|
4817
|
-
* @example
|
|
4818
|
-
* ```typescript
|
|
4819
|
-
* import { translateToAll } from "./normalizer.js";
|
|
4820
|
-
*
|
|
4821
|
-
* const result = translateToAll("PreToolUse", ["claude-code", "gemini-cli", "kimi"]);
|
|
4822
|
-
* // { "claude-code": "PreToolUse", "gemini-cli": "BeforeTool" }
|
|
4823
|
-
* // (kimi excluded — unsupported)
|
|
4824
|
-
* ```
|
|
4825
|
-
*
|
|
4826
|
-
* @public
|
|
4827
|
-
*/
|
|
4828
|
-
declare function translateToAll(canonical: CanonicalHookEvent, providerIds: string[]): Record<string, string>;
|
|
4829
|
-
/**
|
|
4830
|
-
* Find the best canonical match for a native event name across all providers.
|
|
4831
|
-
*
|
|
4832
|
-
* @remarks
|
|
4833
|
-
* Scans every provider's mappings to find canonical events that match the
|
|
4834
|
-
* given native name. Useful when you have a native name but do not know
|
|
4835
|
-
* which provider it belongs to. Multiple results are possible if different
|
|
4836
|
-
* providers use the same native name for different canonical events.
|
|
4837
|
-
*
|
|
4838
|
-
* @param nativeName - The provider-native event name to resolve.
|
|
4839
|
-
* @returns Array of matches, each containing the provider ID and canonical event name.
|
|
4840
|
-
*
|
|
4841
|
-
* @example
|
|
4842
|
-
* ```typescript
|
|
4843
|
-
* import { resolveNativeEvent } from "./normalizer.js";
|
|
4844
|
-
*
|
|
4845
|
-
* const matches = resolveNativeEvent("BeforeTool");
|
|
4846
|
-
* // [{ providerId: "gemini-cli", canonical: "PreToolUse" }]
|
|
4847
|
-
* ```
|
|
4848
|
-
*
|
|
4849
|
-
* @public
|
|
4850
|
-
*/
|
|
4851
|
-
declare function resolveNativeEvent(nativeName: string): Array<{
|
|
4852
|
-
providerId: string;
|
|
4853
|
-
canonical: CanonicalHookEvent;
|
|
4854
|
-
}>;
|
|
4855
|
-
/**
|
|
4856
|
-
* Get the version of the hook mappings data.
|
|
4857
|
-
*
|
|
4858
|
-
* @remarks
|
|
4859
|
-
* Returns the semver version string from the hook mappings JSON file.
|
|
4860
|
-
* This can be used to check compatibility or display the data version
|
|
4861
|
-
* in diagnostic output.
|
|
4862
|
-
*
|
|
4863
|
-
* @returns The semver version string of the loaded hook mappings data.
|
|
4864
|
-
*
|
|
4865
|
-
* @example
|
|
4866
|
-
* ```typescript
|
|
4867
|
-
* import { getHookMappingsVersion } from "./normalizer.js";
|
|
4868
|
-
*
|
|
4869
|
-
* const version = getHookMappingsVersion();
|
|
4870
|
-
* console.log(`Hook mappings v${version}`);
|
|
4871
|
-
* ```
|
|
4872
|
-
*
|
|
4873
|
-
* @public
|
|
4874
|
-
*/
|
|
4875
|
-
declare function getHookMappingsVersion(): string;
|
|
4876
|
-
|
|
4877
3966
|
/**
|
|
4878
3967
|
* Global provider instruction delivery — the ONE regenerator and its cheap
|
|
4879
3968
|
* staleness check.
|
|
@@ -9946,4 +9035,4 @@ declare function parseSource(input: string): ParsedSource;
|
|
|
9946
9035
|
*/
|
|
9947
9036
|
declare function isMarketplaceScoped(input: string): boolean;
|
|
9948
9037
|
|
|
9949
|
-
export { type AskToolStatus, type AuditFinding, type AuditResult, type AuditRule, type AuditSeverity, type BatchInstallOptions, type BatchInstallResult, type BlockInsertPosition,
|
|
9038
|
+
export { type AskToolStatus, type AuditFinding, type AuditResult, type AuditRule, type AuditSeverity, type BatchInstallOptions, type BatchInstallResult, type BlockInsertPosition, CLEO_ARTIFACT_BUDGETS, CLEO_ARTIFACT_REQUIREMENTS, type CaampBlock, type CaampLockFile, type CantProfileCounts, type CantProfileEntry, type CantValidationDiagnostic, type ConfigFormat, type CtDispatchMatrix, type CtManifest, type CtManifestSkill, type CtProfileDefinition, type CtSkillEntry, type CtValidationIssue, type CtValidationResult, DEFAULT_EXCLUSIVITY_MODE, type DedupeResult, type DetectionCacheOptions, type DetectionResult, EXCLUSIVITY_MODE_ENV_VAR, EmbeddedDeliveryDowngradeError, type EnsureProviderInstructionFileOptions, type EnsureProviderInstructionFileResult, type EnsureProviderRuleFileOptions, type EnsureProviderRuleFileResult, type ExclusivityMode, type GatedSkillInstallOptions, type GatedSkillInstallResult, type GlobalInstructionOptions, type GlobalOptions, HITL_REQUEST_FALLBACK, type Harness, type HarnessScope, type HitlRequestFallback, HomeInstructionFileError, type HookEvent, type InjectionCheckResult, type InjectionStatus, type InjectionTemplate, type InstallMcpServerOptions, type InstallMcpServerResult, type InstallSkillOptions, type InstructionUpdateSummary, type KnownProviderAgentFolderId, type LockEntry, MarketplaceClient, type MarketplaceResult, type MarketplaceSearchResult, type MarketplaceSkill, type McpConfigFormat, type McpDetectionEntry, type McpScope, type McpServerConfig, type McpServerEntriesByProvider, type McpServerEntry, type McpTransportType, type NormalizeResult, type NormalizedRecommendationCriteria, PROVIDER_ASK_TOOLS, type ParsedSource, PiHarness, PiRequiredError, type Provider, type ProviderAskTool, type ProviderCapabilities, type ProviderHarnessCapability, type ProviderHooksCapability, type ProviderMcpCapability, type ProviderPriority, type ProviderSkillsCapability, type ProviderSpawnCapability, type ProviderStatus, RECOMMENDATION_ERROR_CODES, type RankedSkillRecommendation, type RecommendSkillsResult, type RecommendationCriteriaInput, type RecommendationErrorCode, type RecommendationOptions, type RecommendationReason, type RecommendationReasonCode, type RecommendationScoreBreakdown, type RecommendationValidationIssue, type RecommendationValidationResult, type RecommendationWeights, type ReconcileResult, type RegistryHarnessKind, type RegistryHookCatalog, type RegistryHookFormat, type RemoveMcpServerOptions, type RemoveMcpServerResult, type RepairResult, type ResolveDefaultTargetProvidersOptions, type ResolvedProviderAskTool, type ResolvedSkillSource, type SkillBatchOperation, type SkillEntry, type SkillGateModules, SkillInstallError, type SkillInstallErrorCode, type SkillInstallErrorDetails, type SkillInstallGateOptions, type SkillInstallGateReport, type SkillInstallResult, type SkillIntegrityResult, type SkillIntegrityStatus, type SkillLibrary, type SkillLibraryDispatchMatrix, type SkillLibraryEntry, type SkillLibraryManifest, type SkillLibraryManifestSkill, type SkillLibraryProfile, type SkillLibraryValidationIssue, type SkillLibraryValidationResult, type SkillMetadata, type SkillRowData, type SkillRowSourceType, type SkillSourceProgress, type SkillsPrecedence, type SourceType, type SpawnAdapter, type SpawnMechanism, type SpawnOptions, type SpawnResult, type SubagentHandle, type SubagentResult, type SubagentTask, type SyncGlobalInstructionsOptions, type TransportType, type ValidateCantProfileResult, type ValidationIssue, type ValidationResult, type WriteAgentFileOptions, type WriteAgentFileResult, _resetPlatformPathsCache, assertCleoShippedBuildShape, blockPattern, buildBlock, buildInjectionContent, buildLibraryFromFiles, buildSkillsMap, catalog, catalogEntryFromManifest, checkAllInjections, checkAllSkillIntegrity, checkAllSkillUpdates, checkGlobalInstructionStaleness, checkInjection, checkSkillIntegrity, checkSkillUpdate, classifyPackageFilesEntry, clearRegisteredLibrary, dedupeFile, dedupeFiles, deepMerge, detectAllProviders, detectMcpInstallations, detectProjectProviders, detectProvider, discoverSkill, discoverSkills, ensureAllProviderInstructionFiles, ensureDir, ensureProviderInstructionFile, ensureProviderRuleFile, formatSkillRecommendations, generateInjectionContent, generateSkillsSection, getAgentsConfigPath, getAgentsHome, getAgentsInstructFile, getAgentsLinksDir, getAgentsMcpDir, getAgentsMcpServersPath, getAgentsSpecDir, getAgentsWikiDir, getAllHarnesses, getAllProviders, getCommonHookEvents, getEffectiveSkillsPaths, getExclusivityMode, getHarnessFor, getInstalledProviders, getInstructionFiles, getLockFilePath, getNestedValue, getPlatformLocations, getPlatformPaths, getPrimaryHarness, getPrimaryProvider, getProjectAgentsDir, getProvider, getProviderAgentFolder, getProviderAskTool, getProviderCapabilities, getProviderCount, getProviderInstructionReferences, getProvidersByHookEvent, getProvidersByInstructFile, getProvidersByPriority, getProvidersBySkillsPrecedence, getProvidersBySpawnCapability, getProvidersByStatus, getRegistryVersion, getSpawnCapableProviders, getSystemInfo, getTrackedSkills, groupByInstructFile, inferSkillSourceType, inject, injectAll, installBatchWithRollback, installMcpServer, installResolvedSkill, installSkill, installSkillFromSource, instructionFileCascade, isCaampOwnedSkill, isEmbeddedDelivery, isExclusivityMode, isHomeProject, isMarketplaceScoped, isQuiet, isVerbose, listAllMcpServers, listCanonicalSkills, listMcpServers, loadLibraryFromModule, mergeBlockBodies, normalizeMarkers, normalizeRecommendationCriteria, parseBlocks, parseCaampBlocks, parseInjectionContent, parseSkillFile, parseSource, providerSupports, providerSupportsById, rankSkills, readConfig, recommendSkills, reconcile, recordSkillInstall, registerSkillLibrary, registerSkillLibraryFromPath, removeConfig, removeInjection, removeMcpServer, removeMcpServerFromAll, removeSkill, removeSkillFromLock, repairContent, repairInstructionFiles, replaceDirectoryFromSource, resetDetectionCache, resetExclusivityModeOverride, resetRegistry, resolveAlias, resolveDefaultTargetProviders, resolveGlobalInstructionPath, resolveInstructionDelivery, resolveMcpConfigPath, resolveProviderSkillsDirs, resolveRegistryTemplatePath, resolveSkillSource, runSkillInstallGate, scanDirectory, scanFile, scoreSkillRecommendation, searchSkills, selectProvidersByMinimumPriority, setExclusivityMode, setQuiet, setVerbose, shouldOverrideSkill, stageSkillCopy, swapIntoPlace, syncGlobalInstructions, toSarif, tokenizeCriteriaValue, updateInstructionsSingleOperation, validateInstructionIntegrity, validatePackageArtifact, validateRecommendationCriteria, validateSkill, writeAgentFileToAllProviders, writeConfig };
|