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
@@ -5,27 +5,16 @@
5
5
  * New runtime code should depend on a ToolCatalog/ToolRegistry instance; the
6
6
  * module-level functions below remain as a compatibility facade for older
7
7
  * bootstrap paths while those call sites are migrated.
8
+ *
9
+ * All registered tools are resident: every enabled tool is offered to the model
10
+ * each turn (hermes-aligned). There is no deferral / on-demand discovery.
8
11
  */
9
12
  import type { PortableTool } from "./portable-tool.js";
10
13
  import type { ToolDefinition } from "../protocol/wire/index.js";
11
14
  import { AGENT_DISALLOWED_TOOLS, CUSTOM_AGENT_DISALLOWED_TOOLS, filterToolsForAgent } from "./tool-access.js";
12
15
  export { AGENT_DISALLOWED_TOOLS, CUSTOM_AGENT_DISALLOWED_TOOLS, filterToolsForAgent };
13
- /**
14
- * Deferral policy (CC-aligned): a few HIGH-FREQUENCY capabilities stay LOADED even if their
15
- * factory marks them deferrable, so the model never has to voluntarily tool_search for the
16
- * things users ask for most. Only the long tail (rare media variants, niche tools) and MCP
17
- * stay deferred. Trades a small always-on token cost on common paths for discovery
18
- * reliability — mirrors Claude Code (keeps common tools loaded; defers only the long
19
- * tail / large MCP sets) rather than relying on the model to decide to search.
20
- */
21
- export declare const COMMON_LOADED_CAPABILITIES: Set<string>;
22
16
  export declare class ToolRegistry {
23
17
  private readonly toolPool;
24
- private readonly activatedTools;
25
- private readonly maxActivatedDeferred;
26
- constructor(options?: {
27
- maxActivatedDeferred?: number;
28
- });
29
18
  setTools(tools: PortableTool[]): void;
30
19
  addTool(tool: PortableTool<any>): void;
31
20
  addTools(tools: PortableTool<any>[]): void;
@@ -36,22 +25,7 @@ export declare class ToolRegistry {
36
25
  getToolCount(): number;
37
26
  executeTool(name: string, toolCallId: string, args: Record<string, unknown>, signal?: AbortSignal): Promise<import("./portable-tool.js").PortableToolResult>;
38
27
  getTools(): PortableTool[];
39
- activateTool(name: string): boolean;
40
- isToolActivated(name: string): boolean;
41
- clearActivatedTools(): void;
42
- /**
43
- * SSOT for "which tools are deferred". Both the deferred-tool index (system
44
- * prompt) and the tool_search corpus consume this — never re-derive the
45
- * deferred set inline. Lists every deferred+enabled tool regardless of
46
- * activation, so the model can always see/search a capability that exists.
47
- * searchHint is carried for the search corpus; the prompt index ignores it.
48
- */
49
- listDeferredTools(): Array<{
50
- name: string;
51
- description: string;
52
- searchHint?: string;
53
- }>;
54
- getToolManifest(includeDeferred?: boolean): ToolDefinition[];
28
+ getToolManifest(): ToolDefinition[];
55
29
  }
56
30
  export declare function getDefaultToolRegistry(): ToolRegistry;
57
31
  export declare function setToolPool(tools: PortableTool[]): void;
@@ -64,12 +38,4 @@ export declare function getToolNames(): string[];
64
38
  export declare function getToolCount(): number;
65
39
  export declare function executeTool(name: string, toolCallId: string, args: Record<string, unknown>, signal?: AbortSignal): Promise<import("./portable-tool.js").PortableToolResult>;
66
40
  export declare function getTools(): PortableTool[];
67
- export declare function activateTool(name: string): boolean;
68
- export declare function isToolActivated(name: string): boolean;
69
- export declare function clearActivatedTools(): void;
70
- export declare function listDeferredTools(): Array<{
71
- name: string;
72
- description: string;
73
- searchHint?: string;
74
- }>;
75
- export declare function getToolManifest(includeDeferred?: boolean): ToolDefinition[];
41
+ export declare function getToolManifest(): ToolDefinition[];
@@ -2,7 +2,7 @@
2
2
  * ACP ServerAgent-Client Protocol server layer for qlogicagent.
3
3
  *
4
4
  * This module implements qlogicagent as an ACP Server, allowing any ACP-compliant
5
- * host (AionUI, Cursor, openclaw, etc.) to connect and interact with the agent.
5
+ * host (AionUI, Cursor, xiaozhiclaw, etc.) to connect and interact with the agent.
6
6
  *
7
7
  * Protocol: ACP v1 over JSON-RPC 2.0 / stdio (line-delimited JSON).
8
8
  *
@@ -94,6 +94,18 @@ export interface AcpRequestHandler {
94
94
  handleAcpProductReplay(params: Record<string, unknown>): Promise<unknown>;
95
95
  handleAcpProductStatus(params: Record<string, unknown>): Promise<unknown>;
96
96
  handleAcpProductSubscribe(params: Record<string, unknown>): Promise<unknown>;
97
+ handleAcpGoalStart(params: Record<string, unknown>): Promise<unknown>;
98
+ handleAcpGoalStatus(params: Record<string, unknown>): Promise<unknown>;
99
+ handleAcpGoalPause(params: Record<string, unknown>): Promise<unknown>;
100
+ handleAcpGoalResume(params: Record<string, unknown>): Promise<unknown>;
101
+ handleAcpGoalUpdateGoal(params: Record<string, unknown>): Promise<unknown>;
102
+ handleAcpGoalStop(params: Record<string, unknown>): Promise<unknown>;
103
+ handleAcpGoalMessage(params: Record<string, unknown>): Promise<unknown>;
104
+ handleAcpGoalSubscribe(params: Record<string, unknown>): Promise<unknown>;
105
+ handleAcpGoalEvents(params: Record<string, unknown>): Promise<unknown>;
106
+ handleAcpMentionDelegate(params: Record<string, unknown>): Promise<unknown>;
107
+ handleAcpMentionCancel(params: Record<string, unknown>): Promise<unknown>;
108
+ handleAcpMentionList(params: Record<string, unknown>): Promise<unknown>;
97
109
  }
98
110
  export interface AcpServerConfig {
99
111
  verbose?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qlogicagent",
3
- "version": "2.16.4",
3
+ "version": "2.16.6",
4
4
  "description": "XiaozhiClaw Agent CLI — subprocess architecture (JSON-RPC over stdio)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -71,6 +71,7 @@
71
71
  "test": "vitest run",
72
72
  "check": "tsc --noEmit && pnpm test && pnpm run check:architecture-boundaries && pnpm run check:provider-core-boundary && pnpm run check:provider-core-release-sync && pnpm run check:pet-core-boundary && pnpm run check:workspace-hygiene && pnpm run check:package-artifact",
73
73
  "test:watch": "vitest",
74
+ "benchmark:hermes-superiority": "tsx benchmarks/hermes-superiority/runner.ts",
74
75
  "lint": "oxlint .",
75
76
  "check:architecture-boundaries": "node scripts/check-architecture-boundaries.mjs",
76
77
  "check:provider-core-boundary": "node scripts/check-provider-core-boundary.mjs",
@@ -80,7 +81,6 @@
80
81
  "check:workspace-hygiene:strict": "node scripts/check-workspace-hygiene.mjs --strict",
81
82
  "check:package-artifact": "npm run build && node scripts/check-package-artifact.mjs",
82
83
  "redteam:community-desensitization": "tsx src/runtime/community/community-desensitization-red-team-cli.ts",
83
- "redteam:community-sandbox": "tsx src/skills/permissions/community-sandbox-red-team-cli.ts",
84
84
  "clean:workspace-hygiene": "node scripts/clean-workspace-hygiene.mjs",
85
85
  "release": "node scripts/release.mjs"
86
86
  },
@@ -90,7 +90,7 @@
90
90
  "dependencies": {
91
91
  "@agentclientprotocol/sdk": "^0.25.0",
92
92
  "@napi-rs/canvas": "0.1.100",
93
- "@xiaozhiclaw/pet-core": "0.1.2",
93
+ "@xiaozhiclaw/pet-core": "0.1.3",
94
94
  "@xiaozhiclaw/provider-core": "^0.1.20",
95
95
  "better-sqlite3": "^12.10.0",
96
96
  "dotenv": "^17.3.1",
@@ -1,62 +0,0 @@
1
- /**
2
- * TeamRegistry — session-scoped roster for the team tool: create registers
3
- * members (producer), the send action routes messages to them (consumer).
4
- *
5
- * The team tool spawns each member as a real subprocess agent
6
- * (AgentProcessManager) and registers a delivery closure here. The send
7
- * action looks the target up by name or full member id and routes the message
8
- * into the member's process via that closure, returning the member's reply.
9
- *
10
- * This registry is the ONLY routing path to team members, so an
11
- * unregistered/dead target fails loud.
12
- */
13
- export interface TeamRegistryMember {
14
- /** Full member id, e.g. "team-research-coder". */
15
- memberId: string;
16
- /** Display name within the team, e.g. "coder". */
17
- name: string;
18
- /** Team this member belongs to. */
19
- teamName: string;
20
- /** Role description. */
21
- role: string;
22
- /** Deliver a message into the member's process and return its reply text. */
23
- deliver: (message: string, fromId: string) => Promise<string>;
24
- /** Whether the member's process is still alive. */
25
- isAlive: () => boolean;
26
- }
27
- export interface TeamRegistryListEntry {
28
- memberId: string;
29
- name: string;
30
- teamName: string;
31
- role: string;
32
- alive: boolean;
33
- }
34
- export interface DeliveryOutcome {
35
- ok: boolean;
36
- /** Per-recipient replies (broadcast may have several). */
37
- replies?: Array<{
38
- memberId: string;
39
- name: string;
40
- reply: string;
41
- }>;
42
- error?: string;
43
- }
44
- export declare class TeamRegistry {
45
- private readonly members;
46
- register(member: TeamRegistryMember): void;
47
- unregister(memberId: string): void;
48
- /** Live roster (alive flag reflects the underlying process). */
49
- list(): TeamRegistryListEntry[];
50
- /**
51
- * Resolve a send `to` token to concrete members.
52
- * Accepts a member name ("coder"), a full member id ("team-x-coder"),
53
- * or "*" for broadcast to all alive members.
54
- * Returns [] when nothing matches (caller fails loud).
55
- */
56
- private resolveTargets;
57
- /**
58
- * Deliver a message to the resolved target(s) and collect replies.
59
- * Fail-loud: no target → ok:false; any delivery error → surfaced.
60
- */
61
- deliver(to: string, message: string, fromId: string): Promise<DeliveryOutcome>;
62
- }
@@ -1,11 +0,0 @@
1
- import type { ToolCatalog } from "../../runtime/ports/index.js";
2
- import type { AgentLogger } from "../../agent/types.js";
3
- import { type TeamToolServiceHost } from "./team-tool-service.js";
4
- import type { TeamRegistry } from "./team-registry.js";
5
- export interface TeamToolRegistrationDeps {
6
- host: TeamToolServiceHost;
7
- log: AgentLogger;
8
- toolCatalog: ToolCatalog;
9
- teamRegistry: TeamRegistry;
10
- }
11
- export declare function registerTeamTool({ host, log, toolCatalog, teamRegistry }: TeamToolRegistrationDeps): void;
@@ -1,43 +0,0 @@
1
- import type { AgentLogger } from "../../agent/types.js";
2
- import type { BackgroundTaskManager } from "../../runtime/infra/background-tasks.js";
3
- import type { TeamToolDeps } from "../../skills/tools/team-tool.js";
4
- import type { TeamRegistry } from "./team-registry.js";
5
- export interface TeamToolService extends TeamToolDeps {
6
- dispose(): void;
7
- }
8
- export interface TeamToolServiceHost {
9
- readonly currentSessionId: string;
10
- readonly verbose: boolean;
11
- /**
12
- * The leader's resolved LLM config, pushed to each spawned member as standing
13
- * session config (session/set_config_option). Without it a standalone member
14
- * (no llmrouter directory to hydrate a catalog from) cannot provision a
15
- * provider, and its first reply turn fails with NO_PROVIDER. Returns null
16
- * when the leader has no resolved provider yet.
17
- */
18
- getLlmConfig(): {
19
- provider: string;
20
- model: string;
21
- apiKey: string;
22
- baseUrl?: string;
23
- } | null;
24
- /** Lightweight memory INDEX injected into each member's system prompt (parent context). */
25
- getMemoryIndex(): string | null;
26
- /**
27
- * Unified background-task registry. Team members register here as `team_member`
28
- * tasks so the `task` tool's list/output/cancel reach them. Null when unbound.
29
- */
30
- getBackgroundTasks(): BackgroundTaskManager | null;
31
- sendNotification(method: string, params: Record<string, unknown>): void;
32
- emitAgentStatus(agentId: string, state: string, extra?: {
33
- missedBeats?: number;
34
- lastActivityAt?: number;
35
- usage?: {
36
- inputTokens: number;
37
- outputTokens: number;
38
- totalTokens: number;
39
- };
40
- }): void;
41
- handleMcpToolCall(memberId: string, toolName: string, args: Record<string, unknown>): Promise<unknown>;
42
- }
43
- export declare function createTeamToolService(host: TeamToolServiceHost, log: AgentLogger, registry: TeamRegistry): TeamToolService;
@@ -1,26 +0,0 @@
1
- import type { TurnEvent, TurnRequest } from "../agent/types.js";
2
- import type { HookRegistry } from "../contracts/hooks.js";
3
- import type { ToolCatalog } from "../runtime/ports/index.js";
4
- import { type CommunitySignalReporter } from "../runtime/community/community-signal-reporter.js";
5
- import { type SkillSandbox } from "../runtime/sandbox/skill-sandbox.js";
6
- import { type SkillLifecycleRecord } from "../skills/skill-system/skill-lifecycle.js";
7
- export interface SkillSubturnAgent {
8
- run(request: TurnRequest, signal?: AbortSignal): AsyncGenerator<TurnEvent>;
9
- }
10
- export interface SkillSubturnHost {
11
- getAgent(): SkillSubturnAgent | null;
12
- getCurrentSessionId(): string;
13
- getCurrentHooks(): HookRegistry | null;
14
- }
15
- export interface ExecuteSkillSubturnParams {
16
- host: SkillSubturnHost;
17
- toolCatalog: ToolCatalog;
18
- skillName: string;
19
- skillContent: string;
20
- userArgs?: string;
21
- signal?: AbortSignal;
22
- communitySignalReporter?: CommunitySignalReporter | null;
23
- skillSandbox?: SkillSandbox | null;
24
- }
25
- export declare function executeSkillSubturn(params: ExecuteSkillSubturnParams): Promise<string>;
26
- export declare function resolveSkillSubagentTypeForLifecycle(skillName: string, record: SkillLifecycleRecord | undefined): string;
@@ -1,37 +0,0 @@
1
- import type { HookRegistry } from "../../contracts/hooks.js";
2
- import type { CommunityDiscoveryCoordinator } from "../community/community-discovery-coordinator.js";
3
- export declare const SKILL_RECALL_CONFIG: {
4
- readonly MAX_RECALLED_SKILLS: 3;
5
- readonly MAX_SKILL_CONTENT_CHARS: 800;
6
- readonly CACHE_TTL_MS: number;
7
- };
8
- /**
9
- * Detect whether user message contains retrospective/cross-reference semantics
10
- * OR similar-task patterns that could benefit from existing skills.
11
- * Returns extracted keywords for skill matching if triggered, or null.
12
- */
13
- export declare function detectRetrospectiveTrigger(message: string): string[] | null;
14
- export interface SkillRecallHooksDeps {
15
- /** Current project cwd (to exclude from cross-project search). */
16
- currentCwd?: string;
17
- /** Optional online community discovery coordinator. */
18
- communityDiscovery?: CommunityDiscoveryCoordinator | null;
19
- /** Logger. */
20
- log: {
21
- debug(msg: string): void;
22
- warn(msg: string): void;
23
- };
24
- }
25
- /**
26
- * Register the cross-project skill recall hook on `memory.before_recall`.
27
- * Runs at lower priority (60) than QMemory prefetch (50) so it supplements,
28
- * not replaces, the standard memory recall.
29
- *
30
- * When triggered, injects cross-project skill metadata into recalledMemories.
31
- */
32
- export declare function registerSkillRecallHooks(hooks: HookRegistry, deps: SkillRecallHooksDeps): () => void;
33
- /**
34
- * Invalidate the cross-project skill index cache.
35
- * Call when skills are created/deleted/promoted to refresh.
36
- */
37
- export declare function invalidateSkillRecallCache(): void;
@@ -1,53 +0,0 @@
1
- import { buildWindowsProcessTreeLauncherAuditEnvelope, type WindowsSkillSandboxAvailability } from "./windows-skill-sandbox.js";
2
- export type SkillSandboxOrigin = "community" | "first-party" | "official";
3
- export type SkillSandboxRiskTier = "R0" | "R1" | "R2" | "R3" | "unknown";
4
- export type SkillSandboxDecisionReason = "first-party-action" | "community-low-risk" | "manual-run" | "l0-available" | "l0-unavailable" | "launcher-required" | "launcher-unavailable";
5
- export interface SkillSandboxAvailability extends WindowsSkillSandboxAvailability {
6
- }
7
- export interface SkillSandboxRunRequest {
8
- origin: SkillSandboxOrigin;
9
- official?: boolean;
10
- riskTier?: SkillSandboxRiskTier;
11
- autoRun?: boolean;
12
- executable?: boolean;
13
- }
14
- export interface SkillSandboxLauncherDecisionMetadata {
15
- level: "L0";
16
- mode: "os-native-launcher";
17
- defaultHostAccess: true;
18
- noFsNetworkRestriction: true;
19
- audit: {
20
- envelope: "l0-launcher-audit-v1";
21
- subject: {
22
- origin: SkillSandboxOrigin;
23
- official: boolean;
24
- executable: boolean;
25
- autoRun: boolean;
26
- };
27
- decision: "allowed" | "blocked";
28
- reason: "launcher-required" | "launcher-unavailable";
29
- };
30
- windows?: ReturnType<typeof buildWindowsProcessTreeLauncherAuditEnvelope>;
31
- }
32
- export interface SkillSandboxDecision {
33
- allowed: boolean;
34
- spawnAllowed: boolean;
35
- launcherRequired: boolean;
36
- reason: SkillSandboxDecisionReason;
37
- backend: "first-party" | "community-l1-l2" | "community-l0" | "community-l0-launcher";
38
- l0: SkillSandboxAvailability;
39
- launcher?: SkillSandboxLauncherDecisionMetadata;
40
- }
41
- export interface SkillSandbox {
42
- getAvailability(): SkillSandboxAvailability;
43
- decide(request: SkillSandboxRunRequest): SkillSandboxDecision;
44
- }
45
- export interface SkillSandboxOptions {
46
- availability?: SkillSandboxAvailability;
47
- platform?: string;
48
- appContainerAvailable?: boolean;
49
- jobObjectAvailable?: boolean;
50
- processTreeLauncherAvailable?: boolean;
51
- }
52
- export declare function createSkillSandbox(options?: SkillSandboxOptions): SkillSandbox;
53
- export declare function createDefaultSkillSandbox(): SkillSandbox;
@@ -1,78 +0,0 @@
1
- export type WindowsSkillSandboxBackend = "windows-process-tree-launcher";
2
- export type WindowsProcessTreeLauncherAuditEvent = "launch-requested" | "process-started" | "process-exited" | "tree-kill-requested" | "launch-failed";
3
- export interface WindowsSkillSandboxAvailabilityOptions {
4
- platform?: string;
5
- appContainerAvailable?: boolean;
6
- jobObjectAvailable?: boolean;
7
- processTreeLauncherAvailable?: boolean;
8
- }
9
- export interface WindowsSkillSandboxAvailability {
10
- level: "L0";
11
- available: boolean;
12
- backend: WindowsSkillSandboxBackend | "unsupported-platform" | "unavailable";
13
- platform: string;
14
- reason?: "unsupported-platform" | "windows-l0-not-provisioned";
15
- }
16
- export interface WindowsSandboxLaunchMetadata {
17
- backend: WindowsSkillSandboxBackend;
18
- command: string;
19
- args: string[];
20
- elevated: false;
21
- defaultHostAccess: true;
22
- noFsNetworkRestriction: true;
23
- jobObject: {
24
- implemented: false;
25
- ready: true;
26
- };
27
- processTree: {
28
- killOnClose: true;
29
- trackChildren: true;
30
- terminateOnLauncherClose: true;
31
- };
32
- audit: {
33
- envelope: "l0-launcher-audit-v1";
34
- lifecycle: WindowsProcessTreeLauncherAuditEvent[];
35
- };
36
- }
37
- export interface WindowsProcessTreeLauncherAuditEnvelope {
38
- envelope: "l0-launcher-audit-v1";
39
- backend: WindowsSkillSandboxBackend;
40
- defaultHostAccess: true;
41
- noFsNetworkRestriction: true;
42
- processTree: {
43
- killOnClose: true;
44
- trackChildren: true;
45
- };
46
- jobObject: {
47
- implemented: false;
48
- ready: true;
49
- };
50
- }
51
- export interface WindowsProcessTreeChild {
52
- pid?: number;
53
- }
54
- export interface WindowsProcessTreeLauncherDependencies {
55
- spawn?: (command: string, args: string[]) => WindowsProcessTreeChild;
56
- killProcessTree?: (pid: number) => Promise<void> | void;
57
- }
58
- export interface WindowsProcessTreeLaunchRequest {
59
- command: string;
60
- args?: string[];
61
- }
62
- export interface WindowsProcessTreeLaunchHandle {
63
- pid: number;
64
- metadata: WindowsSandboxLaunchMetadata;
65
- auditEvents: WindowsProcessTreeLauncherAuditEvent[];
66
- close(): Promise<void>;
67
- }
68
- export interface WindowsProcessTreeLauncher {
69
- auditEvents: WindowsProcessTreeLauncherAuditEvent[];
70
- launch(request: WindowsProcessTreeLaunchRequest): WindowsProcessTreeLaunchHandle;
71
- }
72
- export declare function getWindowsSkillSandboxAvailability(options?: WindowsSkillSandboxAvailabilityOptions): WindowsSkillSandboxAvailability;
73
- export declare function buildWindowsSandboxLaunchMetadata(input: {
74
- command: string;
75
- args?: string[];
76
- }): WindowsSandboxLaunchMetadata;
77
- export declare function buildWindowsProcessTreeLauncherAuditEnvelope(): WindowsProcessTreeLauncherAuditEnvelope;
78
- export declare function createWindowsProcessTreeLauncher(dependencies?: WindowsProcessTreeLauncherDependencies): WindowsProcessTreeLauncher;
@@ -1,3 +0,0 @@
1
- import type { PermissionRuleEntry } from "./types.js";
2
- export type CommunitySandboxRuleId = "community-l1-shell" | "community-l1-file-read" | "community-l1-file-write" | "community-l1-network" | "community-l1-mcp" | "community-l1-host-control" | "community-l2-host-side-effect" | "community-l2-data-egress" | "community-l2-provider-prompt-egress" | "community-l2-provider-media-egress";
3
- export declare function createCommunitySandboxScopedRules(): PermissionRuleEntry[];
@@ -1,7 +0,0 @@
1
- export interface CommunitySandboxRedTeamCliDeps {
2
- log?: {
3
- info(message: string): void;
4
- error(message: string): void;
5
- };
6
- }
7
- export declare function runCommunitySandboxRedTeamCli(argv?: string[], deps?: CommunitySandboxRedTeamCliDeps): Promise<number>;
@@ -1,32 +0,0 @@
1
- import { type SkillSandboxAvailability } from "../../runtime/sandbox/skill-sandbox.js";
2
- export type CommunitySandboxRedTeamFinding = "community-sandbox:shell-exec" | "community-sandbox:file-read" | "community-sandbox:file-write" | "community-sandbox:network-egress" | "community-sandbox:mcp-call" | "community-sandbox:host-side-effect" | "community-sandbox:data-egress" | "community-sandbox:provider-prompt-egress" | "community-sandbox:provider-media-egress";
3
- export interface CommunitySandboxRedTeamCase {
4
- id: string;
5
- expectedFinding: CommunitySandboxRedTeamFinding;
6
- toolName: string;
7
- arguments?: Record<string, unknown>;
8
- }
9
- export interface CommunitySandboxRedTeamReport {
10
- suite: "sandbox";
11
- generatedAt: string;
12
- cases: number;
13
- passed: boolean;
14
- failures: number;
15
- telemetryEvents: number;
16
- approvalRequests: number;
17
- l0: SkillSandboxAvailability;
18
- breakdown: Record<CommunitySandboxRedTeamFinding, {
19
- cases: number;
20
- failures: number;
21
- }>;
22
- failureDetails: Array<{
23
- id: string;
24
- expectedFinding: CommunitySandboxRedTeamFinding;
25
- action: "continue" | "abort" | "skip" | "prevent";
26
- reason?: string;
27
- telemetryRecorded: boolean;
28
- approvalRecorded: boolean;
29
- }>;
30
- }
31
- export declare function buildCommunitySandboxRedTeamCases(): CommunitySandboxRedTeamCase[];
32
- export declare function runCommunitySandboxRedTeam(cases?: CommunitySandboxRedTeamCase[]): Promise<CommunitySandboxRedTeamReport>;
@@ -1,38 +0,0 @@
1
- /**
2
- * Lightweight per-skill stats stored in `~/.qlogicagent/skill-stats.json`.
3
- * Covers learned, promoted, and registry-installed skills.
4
- */
5
- export interface SkillUsageStats {
6
- /** Total number of times this skill has been invoked/applied. */
7
- invokeCount: number;
8
- /** Number of turns where the skill was active and contributed. */
9
- activeCount: number;
10
- /** Number of times the skill received positive feedback. */
11
- positiveCount: number;
12
- /** Number of times the skill received negative feedback. */
13
- negativeCount: number;
14
- /** ISO 8601 timestamp of last use. */
15
- lastUsedAt?: string;
16
- /** Derived success rate = (invokeCount - negativeCount) / invokeCount */
17
- successRate?: number;
18
- }
19
- export interface SkillStatsFile {
20
- [skillName: string]: SkillUsageStats;
21
- }
22
- /**
23
- * Record a skill invocation. Fire-and-forget — never throws.
24
- * @param agentHome - path to `~/.qlogicagent/`
25
- * @param skillName - the skill that was invoked
26
- * @param success - whether the invocation completed without error
27
- */
28
- export declare function trackSkillInvocation(agentHome: string, skillName: string, success: boolean): void;
29
- /**
30
- * Read stats for a skill. Returns undefined if no stats recorded.
31
- */
32
- export declare function getSkillStats(agentHome: string, skillName: string): SkillUsageStats | undefined;
33
- /**
34
- * Get all skill stats. Useful for UI display.
35
- */
36
- export declare function getAllSkillStats(agentHome: string): SkillStatsFile;
37
- /** Reset cache (for testing). */
38
- export declare function resetStatsCache(): void;