qlogicagent 2.16.4 → 2.16.6

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 (95) hide show
  1. package/README.md +2 -11
  2. package/dist/agent.js +20 -21
  3. package/dist/cli.js +516 -375
  4. package/dist/index.js +515 -374
  5. package/dist/orchestration.js +11 -12
  6. package/dist/protocol.js +1 -1
  7. package/dist/types/agent/tool-loop/completion-action-policy.d.ts +2 -1
  8. package/dist/types/agent/tool-loop/loop-helpers.d.ts +1 -4
  9. package/dist/types/agent/tool-loop/pseudo-tool-output.d.ts +8 -0
  10. package/dist/types/agent/tool-loop/tool-failure-policy.d.ts +0 -1
  11. package/dist/types/agent/tool-loop/tool-guardrails.d.ts +24 -0
  12. package/dist/types/agent/tool-loop/tool-result-classification.d.ts +10 -0
  13. package/dist/types/agent/tool-loop.d.ts +4 -0
  14. package/dist/types/agent/types.d.ts +2 -2
  15. package/dist/types/cli/acp-commands.d.ts +1 -2
  16. package/dist/types/cli/acp-extended-handlers.d.ts +25 -0
  17. package/dist/types/cli/agent-runtime-bootstrap.d.ts +0 -2
  18. package/dist/types/cli/community-resource-installer.d.ts +5 -3
  19. package/dist/types/cli/core-tools/fork-system-prompt.d.ts +0 -2
  20. package/dist/types/cli/core-tools/registry.d.ts +1 -2
  21. package/dist/types/cli/core-tools/session-tool-manifest.d.ts +0 -2
  22. package/dist/types/cli/handlers/community-handler.d.ts +4 -0
  23. package/dist/types/cli/handlers/goal-handler.d.ts +54 -0
  24. package/dist/types/cli/handlers/pinned-skill-context.d.ts +2 -0
  25. package/dist/types/cli/handlers/turn-handler.d.ts +0 -1
  26. package/dist/types/cli/skill-invocation-service.d.ts +8 -0
  27. package/dist/types/cli/{skill-meta-tool-bootstrap.d.ts → skill-tools-bootstrap.d.ts} +6 -12
  28. package/dist/types/cli/stdio-agent-session-bootstrap.d.ts +0 -1
  29. package/dist/types/cli/tool-bootstrap-core-registration.d.ts +1 -9
  30. package/dist/types/cli/tool-bootstrap.d.ts +0 -2
  31. package/dist/types/contracts/turn-event.d.ts +1 -1
  32. package/dist/types/orchestration/agent-instance.d.ts +19 -2
  33. package/dist/types/orchestration/delegation-coordinator.d.ts +43 -0
  34. package/dist/types/orchestration/goal-acceptance.d.ts +20 -0
  35. package/dist/types/orchestration/goal-loop-coordinator.d.ts +87 -0
  36. package/dist/types/orchestration/goal-mode-adapters.d.ts +94 -0
  37. package/dist/types/orchestration/goal-run-persistence.d.ts +15 -0
  38. package/dist/types/orchestration/goal-run-types.d.ts +112 -0
  39. package/dist/types/orchestration/index.d.ts +1 -1
  40. package/dist/types/orchestration/skill-improvement.d.ts +1 -21
  41. package/dist/types/orchestration/subagent/agent-registry.d.ts +1 -1
  42. package/dist/types/orchestration/workflow/host-executors.d.ts +1 -1
  43. package/dist/types/orchestration/workflow/node-schema.d.ts +3 -3
  44. package/dist/types/orchestration/workflow/qla-executor-host.d.ts +2 -2
  45. package/dist/types/orchestration/workflow/workflow-scheduler.d.ts +1 -1
  46. package/dist/types/protocol/methods.d.ts +0 -3
  47. package/dist/types/protocol/wire/acp-agent-management.d.ts +33 -1
  48. package/dist/types/protocol/wire/acp-protocol.d.ts +14 -2
  49. package/dist/types/protocol/wire/agent-events.d.ts +2 -2
  50. package/dist/types/protocol/wire/agent-methods.d.ts +0 -2
  51. package/dist/types/protocol/wire/notification-payloads.d.ts +36 -20
  52. package/dist/types/runtime/community/community-pet-publisher.d.ts +21 -24
  53. package/dist/types/runtime/community/community-signal-reporter.d.ts +0 -14
  54. package/dist/types/runtime/config/tunable-defaults.d.ts +0 -21
  55. package/dist/types/runtime/execution/untrusted-tool-result.d.ts +2 -0
  56. package/dist/types/runtime/hooks/community-discovery-hook.d.ts +18 -0
  57. package/dist/types/runtime/infra/acp-protocol-adapter.d.ts +2 -2
  58. package/dist/types/runtime/infra/agent-install-runner.d.ts +1 -1
  59. package/dist/types/runtime/infra/skill-resolver.d.ts +9 -3
  60. package/dist/types/runtime/pet/pet-community-assets.d.ts +16 -11
  61. package/dist/types/runtime/pet/pet-profile-service.d.ts +2 -2
  62. package/dist/types/runtime/pet/petdex-asset.d.ts +28 -0
  63. package/dist/types/runtime/ports/tool-contracts.d.ts +1 -10
  64. package/dist/types/runtime/prompt/environment-context.d.ts +8 -32
  65. package/dist/types/runtime/tasks/task-types.d.ts +2 -32
  66. package/dist/types/skills/mcp/mcp-manager.d.ts +20 -2
  67. package/dist/types/skills/permissions/hook-runner.d.ts +0 -22
  68. package/dist/types/skills/plugins/plugin-api.d.ts +1 -1
  69. package/dist/types/skills/portable-tool.d.ts +2 -8
  70. package/dist/types/skills/skill-system/skill-bundles.d.ts +8 -0
  71. package/dist/types/skills/skill-system/skill-frontmatter.d.ts +1 -5
  72. package/dist/types/skills/skill-system/skill-lifecycle.d.ts +13 -1
  73. package/dist/types/skills/skill-system/skill-preprocessing.d.ts +11 -0
  74. package/dist/types/skills/skill-system/skill-types.d.ts +0 -75
  75. package/dist/types/skills/skill-system/skill-validation.d.ts +1 -0
  76. package/dist/types/skills/tools/skill-tool.d.ts +58 -22
  77. package/dist/types/skills/tools.d.ts +5 -39
  78. package/dist/types/transport/acp-server.d.ts +13 -1
  79. package/package.json +3 -3
  80. package/dist/types/cli/core-tools/team-registry.d.ts +0 -62
  81. package/dist/types/cli/core-tools/team-tool-bootstrap.d.ts +0 -11
  82. package/dist/types/cli/core-tools/team-tool-service.d.ts +0 -43
  83. package/dist/types/cli/skill-meta-subturn-service.d.ts +0 -26
  84. package/dist/types/runtime/hooks/skill-recall-hooks.d.ts +0 -37
  85. package/dist/types/runtime/sandbox/skill-sandbox.d.ts +0 -53
  86. package/dist/types/runtime/sandbox/windows-skill-sandbox.d.ts +0 -78
  87. package/dist/types/skills/permissions/community-sandbox-policy.d.ts +0 -3
  88. package/dist/types/skills/permissions/community-sandbox-red-team-cli.d.ts +0 -7
  89. package/dist/types/skills/permissions/community-sandbox-red-team.d.ts +0 -32
  90. package/dist/types/skills/skill-system/skill-source.d.ts +0 -38
  91. package/dist/types/skills/tools/team-tool.d.ts +0 -152
  92. package/dist/types/skills/tools/tool-search-tool.d.ts +0 -75
  93. package/dist/types/skills/tools/tool-selection-eval.d.ts +0 -49
  94. package/dist/types/skills/tools/tool-selection-eval.dataset.d.ts +0 -5
  95. package/dist/types/skills/tools/tool-selection-eval.tasks.d.ts +0 -9
@@ -7,7 +7,7 @@ export interface PetPreferences {
7
7
  export interface PetdexPetAssetSummary {
8
8
  id: string;
9
9
  assetKind: "petdex";
10
- sourceKind?: "builtin" | "upload" | "forge";
10
+ sourceKind?: "builtin" | "upload" | "forge" | "community";
11
11
  name: string;
12
12
  description: string;
13
13
  createdAt: string;
@@ -38,7 +38,7 @@ export interface PetdexPetAsset extends Omit<PetdexPetAssetSummary, "atlas"> {
38
38
  schema: "qlogic.petdex.asset.v1";
39
39
  atlas: PetdexPetAssetAtlas;
40
40
  source: {
41
- kind: "builtin" | "upload" | "forge";
41
+ kind: "builtin" | "upload" | "forge" | "community";
42
42
  prompt: string | null;
43
43
  };
44
44
  animations: Record<PetdexAnimationId, PetdexPetAnimation>;
@@ -2,6 +2,8 @@ import { type PetdexAssetSource, type PetdexPetAsset, type PetdexValidationRepor
2
2
  export { PETDEX_SCHEMA, PETDEX_VALIDATION_SCHEMA, PETDEX_ATLAS_CONTRACT, PETDEX_ANIMATION_IDS, createDefaultPetdexAnimations, toPetdexAssetSummary, validatePetdexAssetManifest, petdexImageDataUrl, } from "@xiaozhiclaw/pet-core";
3
3
  export type { PetdexAnimationId, PetdexAnimation, PetdexAtlas, PetdexAssetSource, PetdexPetAsset, PetdexAssetManifest, PetdexPetAssetSummary, PetdexValidationReport, LoadedPetdexPackage, PetdexAssetPackage, PetdexAssetValidation, PetdexImportResult, } from "@xiaozhiclaw/pet-core";
4
4
  export declare function loadPetdexAssetPackage(filePath: string): Promise<LoadedPetdexPackage>;
5
+ /** Load a `.petdex` package directly from its zip bytes (community install downloads it). */
6
+ export declare function loadPetdexAssetPackageBytes(zip: Buffer): Promise<LoadedPetdexPackage>;
5
7
  export declare function buildPetdexAssetImport(filePath: string, targetDir: string): Promise<PetdexImportResult>;
6
8
  export declare function writePetdexAssetPackage(params: {
7
9
  asset: PetdexPetAsset;
@@ -11,6 +13,32 @@ export declare function writePetdexAssetPackage(params: {
11
13
  outputDir: string;
12
14
  fileName?: string;
13
15
  }): Promise<string>;
16
+ /**
17
+ * Build a `.petdex` zip in memory (single source of truth for the package layout).
18
+ * Community publish gzips these bytes for Hub OSS; writePetdexAssetPackage lands them on disk.
19
+ * Validation is recomputed from asset+spritesheet so the embedded validation.json always matches.
20
+ */
21
+ export declare function buildPetdexAssetPackageBytes(params: {
22
+ asset: PetdexPetAsset;
23
+ spritesheet: Buffer;
24
+ productionRun?: unknown;
25
+ }): Buffer;
26
+ /**
27
+ * Package a petdex asset for community publish: the gzipped `.petdex` blob (the exact wire
28
+ * format Hub OSS serves at downloadUrl, which the installer gunzips) plus a v15 asset manifest
29
+ * carrying the petdex asset descriptor. The hub derives checksum + sizeBytes from the decoded
30
+ * blob server-side, so neither is sent here.
31
+ */
32
+ export declare function buildPetdexPublishPayload(params: {
33
+ asset: PetdexPetAsset;
34
+ spritesheet: Buffer;
35
+ version?: string;
36
+ tags?: string[];
37
+ }): {
38
+ manifest: Record<string, unknown>;
39
+ version: string;
40
+ packageGzipBase64: string;
41
+ };
14
42
  export declare function createPetdexAssetFromSpritesheet(params: {
15
43
  id?: string;
16
44
  name: string;
@@ -26,7 +26,6 @@ export interface RuntimeToolContract {
26
26
  isEgress?: boolean;
27
27
  egressCarriesData?: boolean;
28
28
  isEnabled?: () => boolean;
29
- shouldDefer?: boolean;
30
29
  execute?(toolCallId: string, params: any, signal?: AbortSignal): Promise<{
31
30
  content: Array<{
32
31
  type: "text" | "image";
@@ -40,20 +39,12 @@ export interface RuntimeToolContract {
40
39
  }
41
40
  export interface ToolCatalog {
42
41
  findTool(name: string): RuntimeToolContract | undefined;
43
- getToolManifest(includeDeferred?: boolean): ToolDefinition[];
42
+ getToolManifest(): ToolDefinition[];
44
43
  getToolNames(): string[];
45
44
  setTools(tools: RuntimeToolContract[]): void;
46
45
  addTool(tool: RuntimeToolContract): void;
47
46
  addTools(tools: RuntimeToolContract[]): void;
48
47
  removeTool(name: string): boolean;
49
- activateTool(name: string): boolean;
50
- clearActivatedTools(): void;
51
- /** SSOT for the deferred-tool set consumed by the prompt index and the tool_search corpus. */
52
- listDeferredTools(): Array<{
53
- name: string;
54
- description: string;
55
- searchHint?: string;
56
- }>;
57
48
  }
58
49
  export interface ToolBootstrapProgress {
59
50
  output: string;
@@ -35,37 +35,6 @@ export declare function createTaskGuidanceSection(domain?: TaskDomain): SystemPr
35
35
  * Tells the LLM when to use specialized tools vs. primitives.
36
36
  */
37
37
  export declare function createToolGuidanceSection(): SystemPromptSection;
38
- type DeferredIndexEntry = {
39
- name: string;
40
- description: string;
41
- searchHint?: string;
42
- };
43
- /**
44
- * Render the deferred-tool listing with accuracy-aware token discipline.
45
- *
46
- * Dropping ALL descriptions to save tokens trades away tool-SELECTION accuracy:
47
- * the model cannot tell `mcp__exa__search` from `mcp__github__search` by name.
48
- * So spend the description budget exactly where confusion lives:
49
- * - small set (<= richHintLimit): every tool rich.
50
- * - built-in deferred tools (no server): always rich — small, bounded set.
51
- * - MCP tools whose leaf name collides with another tool: keep the hint.
52
- * - MCP tools with a unique leaf: name only (unambiguous; tool_search recovers
53
- * details on demand).
54
- * Names are ALWAYS listed so any capability can be `select:`ed directly.
55
- */
56
- export declare function buildDeferredToolIndexBody(deferred: DeferredIndexEntry[], richHintLimit: number): string[];
57
- /**
58
- * Index of deferred tools so the model KNOWS these capabilities exist even
59
- * though their schemas are not loaded. Without this the model sees only the
60
- * non-deferred tool list and will wrongly claim it lacks e.g. video generation.
61
- *
62
- * Volatile (recomputed each turn) because the deferred set can change when
63
- * dynamic registrations (MCP, session bootstrap) land; the rendered text is
64
- * stable across turns otherwise, so prompt cache is preserved in practice.
65
- */
66
- export declare function createDeferredToolIndexSection(listDeferredTools: () => DeferredIndexEntry[], options?: {
67
- richHintLimit?: number;
68
- }): SystemPromptSection;
69
38
  /**
70
39
  * Create a system prompt section that instructs the model on response language.
71
40
  * CC parity: only injected when language is explicitly set; when absent,
@@ -76,6 +45,14 @@ export declare function createDeferredToolIndexSection(listDeferredTools: () =>
76
45
  * (e.g., Chinese INDEX.md + English tool guidance).
77
46
  */
78
47
  export declare function createLanguageSection(language?: string): SystemPromptSection;
48
+ /**
49
+ * Available Skills — CC skill-discovery parity. Lists every active (installed, not muted) skill
50
+ * with its description (hermes-style, description-only), and tells the model to load a matching
51
+ * skill via skill_view BEFORE acting — even when the user did not name it. This is the link that
52
+ * makes installed skills actually auto-activate; without it active skills only sit behind the
53
+ * skill_view tool as a passive catalog and never fire on their own.
54
+ */
55
+ export declare function createAvailableSkillsSection(cwdOverride?: string): SystemPromptSection;
79
56
  /**
80
57
  * Detect the response language from the user's current-turn text so the strong
81
58
  * explicit-language branch of createLanguageSection actually fires.
@@ -87,4 +64,3 @@ export declare function createLanguageSection(language?: string): SystemPromptSe
87
64
  * fallback handle English/other, which weak models already mirror fine).
88
65
  */
89
66
  export declare function detectResponseLanguage(userText: string): string | undefined;
90
- export {};
@@ -15,7 +15,6 @@
15
15
  * PRODUCED today (have a real registration site):
16
16
  * - local_bash: backgrounded shell command (BackgroundTaskManager.registerBashTask)
17
17
  * - local_agent: backgrounded forked agent (BackgroundTaskManager.startAgentTask)
18
- * - team_member: long-lived team subprocess (team-tool-service → registerExternalTask)
19
18
  * - dream: memory consolidation (runDream → taskStore.registerTask)
20
19
  *
21
20
  * PLANNED — declared for the TASK_PREFIX taxonomy + UI/protocol contract, but NO
@@ -24,13 +23,8 @@
24
23
  * - remote_agent: cloud sandbox (polling-based)
25
24
  * - local_workflow: DAG/pipeline execution
26
25
  * - monitor_mcp: MCP server monitoring agent
27
- *
28
- * Naming note: we deliberately diverge from upstream CC's `in_process_teammate`.
29
- * Our team members run as isolated SUBPROCESSES (AgentProcessManager) in their own
30
- * git worktrees, not AsyncLocalStorage in-process agents — so the honest name is
31
- * `team_member`. Keeps the `t` task-id prefix.
32
26
  */
33
- export type TaskType = "local_bash" | "local_agent" | "remote_agent" | "team_member" | "local_workflow" | "monitor_mcp" | "dream";
27
+ export type TaskType = "local_bash" | "local_agent" | "remote_agent" | "local_workflow" | "monitor_mcp" | "dream";
34
28
  /**
35
29
  * How a sub-agent is isolated from the parent execution.
36
30
  *
@@ -115,22 +109,6 @@ export interface RemoteAgentTaskState extends TaskStateBase {
115
109
  /** Polling endpoint for status checks. */
116
110
  pollEndpoint?: string;
117
111
  }
118
- /** Team member — long-lived collaborator subprocess in its own git worktree. */
119
- export interface TeamMemberTaskState extends TaskStateBase {
120
- type: "team_member";
121
- /** Team this member belongs to. */
122
- teamName: string;
123
- /** Member's display name. */
124
- agentName: string;
125
- /** Stable member id (`team-<team>-<name>`) — routes team send / cancel. */
126
- memberId: string;
127
- /** Subprocess PID, once spawned. */
128
- pid?: number;
129
- /** Isolated git worktree path (when provisioned). */
130
- worktreePath?: string;
131
- /** Worktree branch name (for cleanup). */
132
- worktreeBranch?: string;
133
- }
134
112
  /** A single dream agent turn — text output + tool use count. */
135
113
  export interface DreamTurn {
136
114
  text: string;
@@ -158,14 +136,6 @@ export interface PlannedTaskState extends TaskStateBase {
158
136
  type: "local_workflow" | "monitor_mcp";
159
137
  }
160
138
  /** Union of all concrete task states. */
161
- export type TaskState = LocalBashTaskState | LocalAgentTaskState | RemoteAgentTaskState | TeamMemberTaskState | DreamTaskState | PlannedTaskState;
162
- /**
163
- * Filter available tools by permission role.
164
- *
165
- * @param role - The agent's permission role
166
- * @param availableTools - Full set of tool names
167
- * @returns Filtered tool names appropriate for the role
168
- */
169
- export declare function filterToolsByRole(role: PermissionRole, availableTools: string[]): string[];
139
+ export type TaskState = LocalBashTaskState | LocalAgentTaskState | RemoteAgentTaskState | DreamTaskState | PlannedTaskState;
170
140
  /** Create a new task state with defaults populated. */
171
141
  export declare function createTaskState(overrides: Pick<TaskStateBase, "taskId" | "type" | "label"> & Partial<TaskStateBase>): TaskStateBase;
@@ -21,10 +21,19 @@ export interface McpServerEntry {
21
21
  url?: string;
22
22
  /** Extra HTTP headers (http only) */
23
23
  headers?: Record<string, string>;
24
- /** Init timeout (ms) — accepted for config compatibility; mcporter owns connect timeouts. */
25
- initTimeoutMs?: number;
26
24
  /** Whether this server is disabled (skip connection) */
27
25
  disabled?: boolean;
26
+ /** Allow the MCP runtime to start an OAuth flow for this server; default is cached-token/headless only. */
27
+ oauth?: boolean;
28
+ /** Optional tool-name allow/deny filters applied after connect-time discovery. */
29
+ tools?: {
30
+ include?: string[];
31
+ exclude?: string[];
32
+ };
33
+ }
34
+ export interface McpSecurityIssue {
35
+ code: "dangerous_egress" | "persistence" | "ioc_public_key";
36
+ message: string;
28
37
  }
29
38
  export interface McpManagerConfig {
30
39
  servers: McpServerEntry[];
@@ -45,6 +54,8 @@ export declare class McpManager {
45
54
  private log;
46
55
  private workspaceRoot?;
47
56
  private toolCatalog?;
57
+ private serverToolFilters;
58
+ private serverOAuth;
48
59
  constructor(config: McpManagerConfig);
49
60
  private toServerDefinition;
50
61
  /**
@@ -56,6 +67,7 @@ export declare class McpManager {
56
67
  * Register all snapshotted MCP tools into the tool pool.
57
68
  */
58
69
  injectTools(): void;
70
+ refreshServerTools(serverName: string): Promise<number>;
59
71
  /** Get names of all connected servers. */
60
72
  getConnectedServers(): string[];
61
73
  /** Get total number of MCP tools across all servers. */
@@ -67,9 +79,15 @@ export declare class McpManager {
67
79
  disconnectAll(): Promise<void>;
68
80
  private toPortableTool;
69
81
  private wrapToolsForWorkspaceBoundary;
82
+ private injectPortableTools;
83
+ private retractServerTools;
70
84
  private registerTools;
71
85
  private removeRegisteredTool;
72
86
  }
73
87
  export declare function validateMcpToolWorkspaceBoundary(toolName: string, args: unknown, workspaceRoot: string | undefined): string | null;
74
88
  export declare function parseMcpConfig(json: unknown): McpServerEntry[];
89
+ export declare function filterMcpTools<T extends {
90
+ name: string;
91
+ }>(tools: readonly T[], filter?: McpServerEntry["tools"]): T[];
92
+ export declare function validateMcpServerSecurity(entry: McpServerEntry): McpSecurityIssue[];
75
93
  export {};
@@ -43,13 +43,6 @@ export interface PermissionCheckerDeps {
43
43
  sessionId?: string;
44
44
  /** Getter for current turn ID (changes per turn). */
45
45
  getTurnId?: () => string;
46
- /** Best-effort community telemetry sink for consent-gated sandbox metrics. */
47
- communityTelemetryRecorder?: {
48
- recordTelemetry(input: {
49
- event: "community.sandbox.violation";
50
- metadata?: Record<string, unknown>;
51
- }): Promise<unknown>;
52
- };
53
46
  }
54
47
  export declare class PermissionChecker {
55
48
  private readonly ruleEngine;
@@ -64,15 +57,6 @@ export declare class PermissionChecker {
64
57
  private readonly auditLogger;
65
58
  private readonly sessionId;
66
59
  private readonly getTurnId;
67
- private readonly communityTelemetryRecorder;
68
- private readonly communitySandboxTurnIds;
69
- /**
70
- * cut7c — community-skill (untrusted) scoped deny/ask rules, passed per-call as
71
- * `ruleEngine.check(..., { extraRules })` for community turns. NOT a second engine:
72
- * the single rule engine evaluates these alongside the base rules. FS/exec tools are
73
- * absent here → they flow through the unified pipeline (workspace + prompt + OS sandbox).
74
- */
75
- private readonly communityScopedRules;
76
60
  private unregisterHook;
77
61
  /** Tool meta cache — populated from ToolDefinition[] at agent creation */
78
62
  private toolMetaCache;
@@ -95,12 +79,6 @@ export declare class PermissionChecker {
95
79
  */
96
80
  setToolMeta(tools: ToolDefinition[]): void;
97
81
  get ruleEngineRef(): PermissionRuleEngine;
98
- /**
99
- * cut7c — whether the CURRENT turn is a community-skill (untrusted) turn. Consumed by
100
- * the OS-sandbox builder to tighten community execs (netPolicy=deny: no outbound network
101
- * from the sandboxed child) as defense-in-depth on POSIX.
102
- */
103
- isCommunitySandboxTurn(): boolean;
104
82
  /** Fire permission.denied hook + onDenied callback + audit log */
105
83
  private fireDenied;
106
84
  private handleResult;
@@ -11,7 +11,7 @@ export interface PluginApi {
11
11
  registerHook(phase: PluginHookPhase, handler: HookHandler<any>): void;
12
12
  /** Register a skill (Markdown instructions + metadata). */
13
13
  registerSkill(skill: WorkspaceSkill): void;
14
- /** Get plugin-scoped configuration (from openclaw/plugins/name/config.json). */
14
+ /** Get plugin-scoped configuration (from xiaozhiclaw/plugins/name/config.json). */
15
15
  getConfig(): Record<string, unknown>;
16
16
  /**
17
17
  * Set an activation check function. When it returns false, the plugin's
@@ -66,13 +66,6 @@ export interface PortableTool<TParams = Record<string, unknown>> {
66
66
  description: string;
67
67
  /** JSON Schema object describing the tool's parameters. */
68
68
  parameters: Record<string, unknown>;
69
- /**
70
- * When true, the tool should NOT appear in the default tool list.
71
- * The host injects it only for complex tasks (e.g. multi-step reasoning)
72
- * or when explicitly activated via tool_search.
73
- * This saves context tokens in simple conversations.
74
- */
75
- shouldDefer?: boolean;
76
69
  /**
77
70
  * Whether the tool can safely run concurrently with other tools.
78
71
  * When true, the runtime may execute this tool in parallel with others.
@@ -132,8 +125,9 @@ export interface PortableTool<TParams = Record<string, unknown>> {
132
125
  reason?: string;
133
126
  };
134
127
  /**
135
- * Brief keyword hint for tool_search to match against
128
+ * Brief keyword hint describing the tool's intent
136
129
  * (e.g. "return the final response as structured JSON").
130
+ * Carried as capability metadata for UI/search surfaces.
137
131
  */
138
132
  searchHint?: string;
139
133
  /**
@@ -0,0 +1,8 @@
1
+ export interface SkillBundle {
2
+ name: string;
3
+ skills: string[];
4
+ filePath: string;
5
+ }
6
+ export declare function getSkillBundlesDir(): string;
7
+ export declare function listSkillBundles(bundleDir?: string): SkillBundle[];
8
+ export declare function resolveSkillBundle(name: string, bundleDir?: string): SkillBundle | undefined;
@@ -1,4 +1,4 @@
1
- import type { ParsedSkillFrontmatter, SkillInvocationPolicy, SkillMetadata } from "./skill-types.js";
1
+ import type { ParsedSkillFrontmatter, SkillMetadata } from "./skill-types.js";
2
2
  /**
3
3
  * Parse a YAML-like frontmatter block into a flat key→value record.
4
4
  * Uses a lightweight line parser to avoid a YAML library dependency.
@@ -9,10 +9,6 @@ export declare function parseFrontmatter(content: string): ParsedSkillFrontmatte
9
9
  * Expects `metadata: {"openclaw": {...}}` (JSON format).
10
10
  */
11
11
  export declare function resolveSkillMetadata(frontmatter: ParsedSkillFrontmatter): SkillMetadata | undefined;
12
- /**
13
- * Resolve invocation policy from frontmatter fields.
14
- */
15
- export declare function resolveSkillInvocationPolicy(frontmatter: ParsedSkillFrontmatter): SkillInvocationPolicy;
16
12
  /**
17
13
  * Get the canonical key for a skill (metadata.skillKey or skill.name).
18
14
  */
@@ -10,6 +10,8 @@ export interface SkillLifecycleRecord {
10
10
  archivedAt?: string;
11
11
  pinned: boolean;
12
12
  useCount: number;
13
+ positiveCount?: number;
14
+ negativeCount?: number;
13
15
  source: "learned" | "created" | "installed" | "promoted";
14
16
  resourceType?: string;
15
17
  launcherRequired?: boolean;
@@ -28,6 +30,14 @@ export interface SkillLifecycleStore {
28
30
  version: 1;
29
31
  records: Record<string, SkillLifecycleRecord>;
30
32
  }
33
+ export interface SkillUsageStats {
34
+ invokeCount: number;
35
+ activeCount: number;
36
+ positiveCount: number;
37
+ negativeCount: number;
38
+ lastUsedAt?: string;
39
+ successRate?: number;
40
+ }
31
41
  export interface CuratorResult {
32
42
  transitioned: Array<{
33
43
  name: string;
@@ -45,7 +55,7 @@ export declare function ensureRecord(store: SkillLifecycleStore, name: string, s
45
55
  /**
46
56
  * Record a skill invocation — resets to active if stale.
47
57
  */
48
- export declare function recordInvocation(store: SkillLifecycleStore, name: string): void;
58
+ export declare function recordInvocation(store: SkillLifecycleStore, name: string, success?: boolean): void;
49
59
  /**
50
60
  * Record that a skill was viewed/listed.
51
61
  */
@@ -87,6 +97,8 @@ export declare function getSkillsByState(store: SkillLifecycleStore, state: Skil
87
97
  * Get lifecycle record for a skill. Returns undefined if not tracked.
88
98
  */
89
99
  export declare function getLifecycleRecord(store: SkillLifecycleStore, name: string): SkillLifecycleRecord | undefined;
100
+ export declare function getLifecycleSkillStats(store: SkillLifecycleStore, name: string): SkillUsageStats | undefined;
101
+ export declare function getAllLifecycleSkillStats(store: SkillLifecycleStore): Record<string, SkillUsageStats>;
90
102
  /**
91
103
  * Remove a lifecycle record (e.g., when skill is deleted).
92
104
  */
@@ -0,0 +1,11 @@
1
+ export interface SkillTemplateVars {
2
+ skillDir?: string;
3
+ sessionId?: string;
4
+ }
5
+ export interface SkillPreprocessOptions extends SkillTemplateVars {
6
+ inlineShell?: boolean;
7
+ runInlineShellCommand?: (command: string) => Promise<string>;
8
+ maxInlineShellOutput?: number;
9
+ }
10
+ export declare function preprocessSkillContent(content: string, options?: SkillPreprocessOptions): Promise<string>;
11
+ export declare function substituteSkillTemplateVars(content: string, vars?: SkillTemplateVars): string;
@@ -63,78 +63,3 @@ export interface SkillMetadata {
63
63
  };
64
64
  install?: SkillInstallSpec[];
65
65
  }
66
- /**
67
- * Controls how a skill may be activated by user commands or model tool calls.
68
- */
69
- export interface SkillInvocationPolicy {
70
- /** Whether users can directly invoke this skill via slash-command. */
71
- userInvocable: boolean;
72
- /** If true, the model cannot trigger this skill autonomously. */
73
- disableModelInvocation: boolean;
74
- }
75
- /**
76
- * Slash-command dispatch specification for a skill.
77
- */
78
- export interface SkillCommandDispatchSpec {
79
- kind: "tool";
80
- toolName: string;
81
- argMode?: "raw";
82
- }
83
- /**
84
- * A skill-derived slash-command for IM platforms.
85
- */
86
- export interface SkillCommandSpec {
87
- name: string;
88
- skillName: string;
89
- description: string;
90
- dispatch?: SkillCommandDispatchSpec;
91
- }
92
- export type SkillScanSeverity = "info" | "warn" | "critical";
93
- export interface SkillScanFinding {
94
- ruleId: string;
95
- severity: SkillScanSeverity;
96
- file: string;
97
- line: number;
98
- message: string;
99
- evidence: string;
100
- }
101
- export interface SkillScanSummary {
102
- scannedFiles: number;
103
- critical: number;
104
- warn: number;
105
- info: number;
106
- findings: SkillScanFinding[];
107
- }
108
- export interface SkillScanOptions {
109
- includeFiles?: string[];
110
- maxFiles?: number;
111
- maxFileBytes?: number;
112
- }
113
- /**
114
- * Filesystem dependencies injected by the host runtime.
115
- * Keeps the skill system decoupled from Node.js `fs` / `path`.
116
- */
117
- export interface SkillFsDeps {
118
- readFileSync(path: string, encoding: "utf-8"): string;
119
- readFile(path: string, encoding: "utf-8"): Promise<string>;
120
- existsSync(path: string): boolean;
121
- statSync(path: string): {
122
- size: number;
123
- mtimeMs: number;
124
- isDirectory(): boolean;
125
- };
126
- readdirSync(path: string, opts: {
127
- withFileTypes: true;
128
- }): Array<{
129
- name: string;
130
- isDirectory(): boolean;
131
- isSymbolicLink(): boolean;
132
- }>;
133
- realpathSync(path: string): string;
134
- }
135
- export interface SkillPathDeps {
136
- join(...segments: string[]): string;
137
- resolve(...segments: string[]): string;
138
- extname(p: string): string;
139
- sep: string;
140
- }
@@ -5,6 +5,7 @@ export interface FrontmatterValidationResult {
5
5
  /** Parsed frontmatter if valid. */
6
6
  parsed?: Record<string, string>;
7
7
  }
8
+ export declare const MAX_DESCRIPTION_LENGTH = 60;
8
9
  /**
9
10
  * Validate SKILL.md content for required frontmatter structure.
10
11
  * Used before persisting agent-created skills.
@@ -1,11 +1,20 @@
1
1
  import type { PortableTool } from "../portable-tool.js";
2
2
  import type { WorkspaceSkill } from "../skill-system/skill-types.js";
3
- export declare const SKILL_TOOL_NAME: "skill";
4
- export type SkillAction = "invoke" | "list" | "view" | "create" | "edit" | "patch" | "delete" | "promote";
5
- export interface SkillToolParams {
6
- action: SkillAction;
7
- name?: string;
3
+ export declare const SKILL_VIEW_TOOL_NAME: "skill_view";
4
+ export declare const SKILLS_LIST_TOOL_NAME: "skills_list";
5
+ export declare const SKILL_MANAGE_TOOL_NAME: "skill_manage";
6
+ export type SkillManageAction = "create" | "edit" | "patch" | "delete" | "promote";
7
+ export interface SkillViewParams {
8
+ name: string;
8
9
  args?: string;
10
+ filePath?: string;
11
+ }
12
+ export interface SkillsListParams {
13
+ category?: string;
14
+ }
15
+ export interface SkillManageParams {
16
+ action: SkillManageAction;
17
+ name: string;
9
18
  category?: string;
10
19
  content?: string;
11
20
  filePath?: string;
@@ -13,25 +22,49 @@ export interface SkillToolParams {
13
22
  oldString?: string;
14
23
  newString?: string;
15
24
  }
16
- export declare const SKILL_TOOL_SCHEMA: {
25
+ export declare const SKILL_VIEW_TOOL_SCHEMA: {
26
+ readonly type: "object";
27
+ readonly properties: {
28
+ readonly name: {
29
+ readonly type: "string";
30
+ readonly description: "The skill to use. Calling skill_view(name='X') loads that skill and you follow its instructions in THIS turn — that single call is all you need to USE a skill.";
31
+ };
32
+ readonly args: {
33
+ readonly type: "string";
34
+ readonly description: "Optional context/arguments to pass to the skill.";
35
+ };
36
+ readonly filePath: {
37
+ readonly type: "string";
38
+ readonly description: "Optional path of a supporting file inside the skill folder to read instead of running the skill (e.g. a reference doc or script). When omitted, the skill is loaded and run.";
39
+ };
40
+ };
41
+ readonly required: readonly ["name"];
42
+ };
43
+ export declare const SKILLS_LIST_TOOL_SCHEMA: {
44
+ readonly type: "object";
45
+ readonly properties: {
46
+ readonly category: {
47
+ readonly type: "string";
48
+ readonly description: "Optional category filter.";
49
+ };
50
+ };
51
+ readonly required: readonly [];
52
+ };
53
+ export declare const SKILL_MANAGE_TOOL_SCHEMA: {
17
54
  readonly type: "object";
18
55
  readonly properties: {
19
56
  readonly action: {
20
57
  readonly type: "string";
21
- readonly enum: readonly ["invoke", "list", "view", "create", "edit", "patch", "delete", "promote"];
58
+ readonly enum: readonly ["create", "edit", "patch", "delete", "promote"];
22
59
  readonly description: string;
23
60
  };
24
61
  readonly name: {
25
62
  readonly type: "string";
26
- readonly description: "Skill name (required for invoke/view/create/edit/patch/delete/promote).";
27
- };
28
- readonly args: {
29
- readonly type: "string";
30
- readonly description: "Arguments or context to pass when invoking a skill.";
63
+ readonly description: "The skill name to author or manage.";
31
64
  };
32
65
  readonly category: {
33
66
  readonly type: "string";
34
- readonly description: "Filter skills by category (for 'list' action).";
67
+ readonly description: "Optional category label for create/edit.";
35
68
  };
36
69
  readonly content: {
37
70
  readonly type: "string";
@@ -39,22 +72,22 @@ export declare const SKILL_TOOL_SCHEMA: {
39
72
  };
40
73
  readonly filePath: {
41
74
  readonly type: "string";
42
- readonly description: "Path of a file inside the skill folder: read it (view) or write it with fileContent (create/edit). SKILL.md itself always goes through 'content'.";
75
+ readonly description: "Path of a file inside the skill folder to write with fileContent (create/edit). SKILL.md itself always goes through 'content'.";
43
76
  };
44
77
  readonly fileContent: {
45
78
  readonly type: "string";
46
- readonly description: "Supporting file content. With filePath, writes that file inside the skill folder (create: alongside SKILL.md; edit: file-only update).";
79
+ readonly description: "Supporting file content. With filePath, writes that file inside the skill folder.";
47
80
  };
48
81
  readonly oldString: {
49
82
  readonly type: "string";
50
- readonly description: "Text to find for patch action.";
83
+ readonly description: "Text to find for the patch action.";
51
84
  };
52
85
  readonly newString: {
53
86
  readonly type: "string";
54
- readonly description: "Replacement text for patch action.";
87
+ readonly description: "Replacement text for the patch action.";
55
88
  };
56
89
  };
57
- readonly required: readonly ["action"];
90
+ readonly required: readonly ["action", "name"];
58
91
  };
59
92
  export interface SkillListItem {
60
93
  name: string;
@@ -71,6 +104,7 @@ export interface SkillListOutput {
71
104
  export interface SkillViewOutput {
72
105
  name: string;
73
106
  content: string;
107
+ skillDir?: string;
74
108
  referenceFiles?: string[];
75
109
  }
76
110
  export interface SkillManageResult {
@@ -81,14 +115,14 @@ export interface SkillManageResult {
81
115
  export interface SkillToolDeps {
82
116
  /** List all available skills (Layer 0 metadata). */
83
117
  listSkills(): WorkspaceSkill[];
84
- /** List skills with full detail (for list action). */
118
+ /** List skills with full detail (for skills_list). */
85
119
  listSkillsFull(category?: string): Promise<SkillListOutput>;
86
120
  /** Read skill content (Layer 1 instructions). */
87
121
  readSkillContent(name: string): Promise<string | null>;
88
122
  /** View skill with optional file path. */
89
123
  viewSkill(name: string, filePath?: string): Promise<SkillViewOutput | null>;
90
- /** Execute skill as sub-turn. */
91
- executeSkillSubturn?(skillName: string, skillContent: string, userArgs: string | undefined, signal?: AbortSignal): Promise<string>;
124
+ /** Run a skill returns its instructions for the main model to follow inline (mainstream, no sub-turn). */
125
+ runSkillInvocation(skillName: string, skillContent: string, userArgs: string | undefined, skillDir: string | undefined, signal?: AbortSignal): Promise<string>;
92
126
  /** Manage skill (create/edit/patch/delete). */
93
127
  manageSkill(params: {
94
128
  action: string;
@@ -103,4 +137,6 @@ export interface SkillToolDeps {
103
137
  /** Promote a project-level skill to user/global level. Returns success message. */
104
138
  promoteSkill?(name: string): Promise<SkillManageResult>;
105
139
  }
106
- export declare function createSkillMetaTool(deps: SkillToolDeps): PortableTool<SkillToolParams>;
140
+ export declare function createSkillViewTool(deps: SkillToolDeps): PortableTool<SkillViewParams>;
141
+ export declare function createSkillsListTool(deps: SkillToolDeps): PortableTool<SkillsListParams>;
142
+ export declare function createSkillManageTool(deps: SkillToolDeps): PortableTool<SkillManageParams>;