@hasna/skills 0.10.83 → 0.10.89

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.
Files changed (35) hide show
  1. package/README.md +166 -15
  2. package/bin/index.js +5829 -2913
  3. package/bin/mcp.js +1766 -835
  4. package/bin/migrate.js +1 -1
  5. package/bin/server.js +1 -1
  6. package/bin/worker.js +1 -1
  7. package/dist/cli/commands/agent-integration.d.ts +55 -0
  8. package/dist/cli/commands/context.d.ts +8 -0
  9. package/dist/cli/commands/runtime-launcher.d.ts +4 -9
  10. package/dist/index.js +3039 -1531
  11. package/dist/lib/agent-adapters.d.ts +5 -2
  12. package/dist/lib/agent-discovery.d.ts +22 -4
  13. package/dist/lib/agent-hermes.d.ts +7 -1
  14. package/dist/lib/agent-integration.d.ts +31 -2
  15. package/dist/lib/agent-opencode.d.ts +4 -0
  16. package/dist/lib/claude-hook-disable.d.ts +32 -0
  17. package/dist/lib/claude-settings-witness.d.ts +28 -0
  18. package/dist/lib/codex-settings-witness.d.ts +20 -0
  19. package/dist/lib/guarded-agent-config.d.ts +3 -0
  20. package/dist/lib/hook-diagnostics.d.ts +3 -1
  21. package/dist/lib/narrowed-witness-ledger.d.ts +24 -0
  22. package/dist/lib/native-discovery-roots.d.ts +8 -0
  23. package/dist/lib/native-drift-receipt.d.ts +55 -0
  24. package/dist/lib/opencode-hook-protocol.d.ts +5 -0
  25. package/dist/lib/profile-client.d.ts +1 -0
  26. package/dist/lib/selection-cache.d.ts +47 -2
  27. package/dist/lib/selection-resolver.d.ts +13 -1
  28. package/dist/lib/session-background-renewal.d.ts +118 -0
  29. package/dist/lib/session-reconciliation.d.ts +82 -2
  30. package/dist/lib/skill-context.d.ts +50 -1
  31. package/dist/lib/skill-relevance.d.ts +95 -0
  32. package/dist/runtime-prerequisites.js +570 -165
  33. package/dist/sdk/index.js +2629 -1396
  34. package/docs/plugin-admission.md +132 -3
  35. package/package.json +1 -1
package/bin/migrate.js CHANGED
@@ -25,7 +25,7 @@ import { join as join5 } from "path";
25
25
  // package.json
26
26
  var package_default = {
27
27
  name: "@hasna/skills",
28
- version: "0.10.83",
28
+ version: "0.10.89",
29
29
  description: "Skills library for AI coding agents",
30
30
  type: "module",
31
31
  bin: {
package/bin/server.js CHANGED
@@ -24140,7 +24140,7 @@ restoreLaunchCwd();
24140
24140
  // package.json
24141
24141
  var package_default = {
24142
24142
  name: "@hasna/skills",
24143
- version: "0.10.83",
24143
+ version: "0.10.89",
24144
24144
  description: "Skills library for AI coding agents",
24145
24145
  type: "module",
24146
24146
  bin: {
package/bin/worker.js CHANGED
@@ -24143,7 +24143,7 @@ import { randomUUID as randomUUID6 } from "crypto";
24143
24143
  // package.json
24144
24144
  var package_default = {
24145
24145
  name: "@hasna/skills",
24146
- version: "0.10.83",
24146
+ version: "0.10.89",
24147
24147
  description: "Skills library for AI coding agents",
24148
24148
  type: "module",
24149
24149
  bin: {
@@ -1,2 +1,57 @@
1
1
  import type { Command } from "commander";
2
+ import { type IntegrationAgent } from "../../lib/agent-integration.js";
3
+ /**
4
+ * Characters one managed hook's additionalContext carries at most (owner
5
+ * request 2026-10-30: one prompt received 10-60 KB of skill bodies). The cap
6
+ * covers the whole injected text: skill bodies get the cap less a fixed
7
+ * reserve for the loading policy, notices and `skills load` offers, and the
8
+ * assembled text is clamped to the cap. A body that does not fit is offered as
9
+ * its `skills load` command instead of being injected. Operators may lower it
10
+ * with SKILLS_HOOK_CONTEXT_MAX_CHARS in the agent's environment, never raise it:
11
+ * a larger value keeps the default. The native hook command line that
12
+ * `skills hook install` writes is unchanged.
13
+ */
14
+ export declare const MANAGED_HOOK_CONTEXT_MAX_CHARS = 12000;
15
+ /** Skill bodies one managed hook injects at most; SKILLS_HOOK_CONTEXT_MAX_SKILLS can only lower it. */
16
+ export declare const MANAGED_HOOK_CONTEXT_MAX_SKILLS = 2;
17
+ /** Part of the cap kept for the policy, notices and up to ten load offers. */
18
+ export declare const MANAGED_HOOK_CONTEXT_RESERVE_CHARS = 2500;
19
+ /**
20
+ * A managed hook injects an unnamed prompt match only for a phrase of at least
21
+ * this many words. A one-word trigger says little about a turn's subject, more
22
+ * so in long text ("effect", "rollback", "handoff"), and several of them don't
23
+ * add up to a phrase, so such a match is offered as a load command instead
24
+ * (FAO-00144). SKILLS_HOOK_PROMPT_MIN_PHRASE_WORDS can only raise it.
25
+ */
26
+ export declare const MANAGED_HOOK_PROMPT_MIN_PHRASE_WORDS = 2;
27
+ /** A subagent's start carries no prompt to match against, so its parent's skills are offered, not injected. */
28
+ export declare const MANAGED_HOOK_INHERITED_BODIES = 0;
29
+ /** The effective hook limits: the defaults above, or a valid lower environment override. */
30
+ export declare function managedHookContextLimits(): {
31
+ maxChars: number;
32
+ maxSkills: number;
33
+ bodyChars: number;
34
+ };
35
+ /** The effective phrase length: the default above, or a valid higher environment override. */
36
+ export declare function managedHookPromptMinPhraseWords(): number;
37
+ /**
38
+ * The selection flags one agent's managed hook passes to its context child.
39
+ * Sumi's plugin and Cursor's prompt hook both discard the output of a prompt
40
+ * call and only deliver what a later call restores, so a pointer could never
41
+ * reach their models: it would turn a delivered body into nothing. They keep the
42
+ * plain selection until they can carry pointers.
43
+ */
44
+ export declare function managedHookSelectionArgs(agent: IntegrationAgent): string[];
45
+ /** Clamp assembled hook context to the cap at a line boundary, with a fixed note. */
46
+ export declare function capManagedHookContext(context: string, maxChars?: number): string;
47
+ /**
48
+ * Prepend a pending session pin migration notice to context the agent will
49
+ * read, then mark it delivered. Cursor shows hook context only at session
50
+ * start, and Sumi discards its prompt-admission output (its context call sends
51
+ * an empty prompt), so those calls leave the notice pending. OpenCode uses
52
+ * an explicit delivery phase, including for empty attachment-only admissions.
53
+ */
54
+ export declare function withSessionPinMigrationNotice(agent: IntegrationAgent, event: string, input: unknown, result: {
55
+ context: string;
56
+ }): void;
2
57
  export declare function registerAgentIntegration(parent: Command): void;
@@ -5,8 +5,12 @@ export declare function selectedProfileId(explicit?: string): string;
5
5
  export interface ContextCommandOptions {
6
6
  selectionProfile?: string;
7
7
  cached?: boolean;
8
+ cacheFirst?: boolean;
9
+ pointerCacheFirst?: boolean;
8
10
  autoReconcileSafe?: boolean;
9
11
  autoMigrateSessionPin?: boolean;
12
+ backgroundRenewal?: boolean;
13
+ renewalBudgetMs?: string;
10
14
  json?: boolean;
11
15
  stdin?: boolean;
12
16
  session?: string;
@@ -14,8 +18,12 @@ export interface ContextCommandOptions {
14
18
  maxChars?: string;
15
19
  maxSkills?: string;
16
20
  file?: string;
21
+ minPromptPhraseWords?: string;
22
+ inheritedBodies?: string;
17
23
  }
18
24
  export declare function contextResolverOptions(options: ContextCommandOptions): SelectionResolverOptions;
19
25
  export declare function registerContextCommands(parent: Command): void;
26
+ /** One fixed line naming only the code of a failed renewal ahead of expiry. */
27
+ export declare function renewAheadFailedNotice(code: string): string;
20
28
  export declare function reportContextError(error: unknown, json?: boolean): void;
21
29
  export declare function parseSkillContextInput(raw: string): SkillContextInput;
@@ -1,21 +1,16 @@
1
- export declare const PINNED_LAUNCHER_SCHEMA = "hasna-skills-pinned-launcher-v2";
1
+ export declare const PINNED_LAUNCHER_SCHEMA = "hasna-skills-pinned-launcher-v3";
2
2
  /** The variable the launcher uses to hand the caller's directory to the CLI. */
3
3
  export declare const LAUNCH_CWD_VARIABLE = "HASNA_SKILLS_LAUNCH_CWD";
4
4
  /** Bun runtime flags that remove every working-directory configuration source. */
5
5
  export declare const PINNED_LAUNCHER_BUN_FLAGS: readonly ["--config=/dev/null", "--no-env-file", "--no-macros", "--no-install"];
6
- /**
7
- * Environment names passed through `env -i`, by exact name. Everything else,
8
- * including `BUN_*`, `NODE_OPTIONS`, `DYLD_*`, `LD_*` and proxy settings, is
9
- * dropped. The handling is total on purpose: a name is either listed here,
10
- * matches a prefix below, and passes the server-owned profile policy.
11
- */
12
- export declare const PINNED_LAUNCHER_ENV_NAMES: readonly ["HOME", "PATH", "TMPDIR", "TERM", "TERM_PROGRAM", "TERM_PROGRAM_VERSION", "COLORTERM", "LANG", "USER", "LOGNAME", "SHELL", "TZ", "NO_COLOR", "FORCE_COLOR", "CI", "COLUMNS", "LINES", "EDITOR", "VISUAL", "PAGER", "SSH_AUTH_SOCK", "TERMINAL_CWD", "CODEX_HOME", "HERMES_HOME", "HERMES_ENABLE_PROJECT_PLUGINS", "HOST", "PORT", "NODE_ENV", "AGENT_ID", "ECS_CONTAINER_METADATA_URI_V4"];
6
+ /** V3 also preserves Claude's explicit native configuration root. */
7
+ export declare const PINNED_LAUNCHER_ENV_NAMES: readonly ["HOME", "PATH", "TMPDIR", "TERM", "TERM_PROGRAM", "TERM_PROGRAM_VERSION", "COLORTERM", "LANG", "USER", "LOGNAME", "SHELL", "TZ", "NO_COLOR", "FORCE_COLOR", "CI", "COLUMNS", "LINES", "EDITOR", "VISUAL", "PAGER", "SSH_AUTH_SOCK", "TERMINAL_CWD", "CODEX_HOME", "HERMES_HOME", "HERMES_ENABLE_PROJECT_PLUGINS", "HOST", "PORT", "NODE_ENV", "AGENT_ID", "ECS_CONTAINER_METADATA_URI_V4", "CLAUDE_CONFIG_DIR"];
13
8
  /** Environment name prefixes passed through, for the app's own documented overrides. */
14
9
  export declare const PINNED_LAUNCHER_ENV_PREFIXES: readonly ["HASNA", "SKILLS", "SKILL", "MCP", "XDG", "LC", "AWS"];
15
10
  /** The allowlisted subset of an environment, by the same rule the launcher applies. */
16
11
  export declare function pinnedLauncherEnvironment(env: Record<string, string | undefined>, profile?: LauncherProfile): Record<string, string>;
17
12
  export type LauncherShape = "symlink" | "pinned";
18
- export type LauncherFormat = "v1" | "v2";
13
+ export type LauncherFormat = "v1" | "v2" | "v3";
19
14
  export type LauncherProfile = "client" | "server";
20
15
  export interface LauncherMetadata {
21
16
  format?: LauncherFormat;