qlogicagent 2.11.4 → 2.11.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.
- package/dist/agent.js +6 -6
- package/dist/cli.js +391 -363
- package/dist/index.js +390 -362
- package/dist/types/cli/handlers/agents-handler.d.ts +18 -1
- package/dist/types/cli/tool-bootstrap.d.ts +2 -0
- package/dist/types/protocol/wire/acp-agent-management.d.ts +27 -0
- package/dist/types/protocol/wire/notification-payloads.d.ts +98 -0
- package/dist/types/runtime/infra/acp-detector.d.ts +29 -1
- package/dist/types/runtime/infra/acp-host-handler.d.ts +9 -1
- package/dist/types/runtime/infra/acp-protocol-adapter.d.ts +68 -49
- package/dist/types/runtime/infra/agent-install-runner.d.ts +57 -0
- package/dist/types/runtime/infra/agent-process.d.ts +10 -0
- package/dist/types/runtime/infra/external-agent-approvals.d.ts +41 -0
- package/dist/types/runtime/infra/external-agent-pool.d.ts +54 -0
- package/dist/types/runtime/infra/model-registry.d.ts +9 -0
- package/dist/types/runtime/infra/provider-catalog-adapter.d.ts +21 -0
- package/dist/types/runtime/infra/trae-adapter.d.ts +31 -0
- package/dist/types/runtime/ports/permission-contracts.d.ts +6 -0
- package/dist/types/skills/permissions/community-sandbox-policy.d.ts +1 -1
- package/dist/types/skills/permissions/hook-runner.d.ts +13 -2
- package/dist/types/skills/permissions/operation-classifier.d.ts +7 -0
- package/dist/types/skills/permissions/rule-engine.d.ts +10 -1
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReasoningMode } from "./provider-catalog-adapter.js";
|
|
1
2
|
import { type KeyConfig, type KeyHandle, type LoadBalanceStrategy, type PoolStatus, type ProviderPoolConfig } from "./key-pool.js";
|
|
2
3
|
export type RegistryChangeCallback = () => void;
|
|
3
4
|
export type ModelPurpose = "textGeneration" | "smallModel" | "stt" | "tts" | "imageGeneration" | "imageUnderstanding" | "videoGeneration" | "videoUnderstanding" | "threeDGeneration" | "embedding" | "voiceClone" | "musicGeneration" | "realtimeAudio" | "realtimeVideo";
|
|
@@ -34,6 +35,8 @@ export interface ModelEntry {
|
|
|
34
35
|
streamRequired?: boolean;
|
|
35
36
|
capabilities?: string[];
|
|
36
37
|
pricing?: Record<string, unknown>;
|
|
38
|
+
/** Thinking-strength control class for the UI (see ReasoningMode). */
|
|
39
|
+
reasoningMode?: ReasoningMode;
|
|
37
40
|
}
|
|
38
41
|
export type PurposeBindings = Partial<Record<ModelPurpose, string>>;
|
|
39
42
|
export interface ModelRegistryConfig {
|
|
@@ -87,6 +90,12 @@ export declare class ModelRegistry {
|
|
|
87
90
|
addModel(entry: Omit<ModelEntry, "id"> & {
|
|
88
91
|
id?: string;
|
|
89
92
|
}): string;
|
|
93
|
+
/**
|
|
94
|
+
* Backfill the reasoning control class for entries that arrived without it
|
|
95
|
+
* (e.g. from the llmrouter cloud catalog), using provider-core as the single
|
|
96
|
+
* source of truth. Entries that already carry reasoningMode are left as-is.
|
|
97
|
+
*/
|
|
98
|
+
private withReasoningMode;
|
|
90
99
|
replaceCatalogModels(entries: ModelEntry[]): void;
|
|
91
100
|
replaceProviderModels(providerId: string, entries: ModelEntry[]): void;
|
|
92
101
|
migrateModelIds(aliasToNative: Map<string, string>): void;
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { type ProviderVariantCapability } from "@xiaozhiclaw/provider-core";
|
|
2
2
|
export type RuntimeProviderVariantCapability = ProviderVariantCapability;
|
|
3
|
+
/**
|
|
4
|
+
* How a model's thinking depth can be controlled, derived from provider-core
|
|
5
|
+
* capabilities + quirks. The UI maps each mode to a different effort option set:
|
|
6
|
+
* - none : model has no reasoning/thinking → hide the strength control
|
|
7
|
+
* - adaptive : model self-regulates depth natively (Anthropic Opus/Sonnet
|
|
8
|
+
* type:"adaptive") → only "智能"
|
|
9
|
+
* - collapsed : provider collapses effort levels (DeepSeek: low/medium→high,
|
|
10
|
+
* high/xhigh→max) → "标准 / 最大" only
|
|
11
|
+
* - effort : full granular control honored (o-series/Kimi reasoning_effort,
|
|
12
|
+
* Anthropic budget thinking) → full 5 options
|
|
13
|
+
*/
|
|
14
|
+
export type ReasoningMode = "none" | "adaptive" | "collapsed" | "effort";
|
|
3
15
|
export interface RuntimeProviderCatalogProvider {
|
|
4
16
|
id: string;
|
|
5
17
|
name: string;
|
|
@@ -24,6 +36,8 @@ export interface RuntimeProviderCatalogModel {
|
|
|
24
36
|
costCacheRead?: number;
|
|
25
37
|
costCacheWrite?: number;
|
|
26
38
|
pricing?: Record<string, unknown>;
|
|
39
|
+
/** Derived control class for thinking strength (see ReasoningMode). */
|
|
40
|
+
reasoningMode?: ReasoningMode;
|
|
27
41
|
}
|
|
28
42
|
export interface RuntimeProviderVariantResolutionInput {
|
|
29
43
|
publicModel: string;
|
|
@@ -44,5 +58,12 @@ export declare class ProviderCatalogAdapter {
|
|
|
44
58
|
getProvider(providerId: string): RuntimeProviderCatalogProvider | undefined;
|
|
45
59
|
listProviders(): RuntimeProviderCatalogProvider[];
|
|
46
60
|
listModels(providerId: string): RuntimeProviderCatalogModel[];
|
|
61
|
+
/**
|
|
62
|
+
* Classify a model's reasoning control from provider-core (the single source of
|
|
63
|
+
* truth), for entries sourced outside the builtin catalog (e.g. the llmrouter
|
|
64
|
+
* cloud catalog). Returns undefined when the model isn't a known provider-core
|
|
65
|
+
* model — callers should fall back to the granular default.
|
|
66
|
+
*/
|
|
67
|
+
classifyReasoningMode(providerId: string, modelId: string): ReasoningMode | undefined;
|
|
47
68
|
resolveBest(input: RuntimeProviderVariantResolutionInput): RuntimeProviderVariantResolution | undefined;
|
|
48
69
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface TraeProc {
|
|
2
|
+
stdout?: {
|
|
3
|
+
on(ev: "data", cb: (c: Buffer | string) => void): void;
|
|
4
|
+
} | null;
|
|
5
|
+
stderr?: {
|
|
6
|
+
on(ev: "data", cb: (c: Buffer | string) => void): void;
|
|
7
|
+
} | null;
|
|
8
|
+
on(ev: "close", cb: (code: number | null) => void): void;
|
|
9
|
+
on(ev: "error", cb: (e: Error) => void): void;
|
|
10
|
+
kill(signal?: string): void;
|
|
11
|
+
}
|
|
12
|
+
export type TraeSpawn = (command: string, args: string[], opts: {
|
|
13
|
+
cwd?: string;
|
|
14
|
+
env?: Record<string, string>;
|
|
15
|
+
}) => TraeProc;
|
|
16
|
+
export interface TraeTurnOptions {
|
|
17
|
+
cliCommand?: string;
|
|
18
|
+
cwd?: string;
|
|
19
|
+
env?: Record<string, string>;
|
|
20
|
+
provider?: string;
|
|
21
|
+
model?: string;
|
|
22
|
+
timeoutMs?: number;
|
|
23
|
+
spawnImpl?: TraeSpawn;
|
|
24
|
+
}
|
|
25
|
+
export interface TraeTurnResult {
|
|
26
|
+
ok: boolean;
|
|
27
|
+
content: string;
|
|
28
|
+
error?: string;
|
|
29
|
+
}
|
|
30
|
+
/** Run one Trae turn (`trae-cli run "<prompt>"`) and return its captured output. */
|
|
31
|
+
export declare function runTraeTurn(prompt: string, opts?: TraeTurnOptions): Promise<TraeTurnResult>;
|
|
@@ -9,6 +9,12 @@ export interface PermissionRuleEntry {
|
|
|
9
9
|
behavior: PermissionBehavior;
|
|
10
10
|
reason?: string;
|
|
11
11
|
source?: string;
|
|
12
|
+
/**
|
|
13
|
+
* When set, the rule only matches if this operation-classification flag is true
|
|
14
|
+
* (in addition to pattern/pathPrefix). Lets a rule target an operation property
|
|
15
|
+
* (e.g. a shell command that performs network egress) rather than just a tool name.
|
|
16
|
+
*/
|
|
17
|
+
requireOp?: "commandNetworkEgress";
|
|
12
18
|
}
|
|
13
19
|
export type PermissionDecisionReason = {
|
|
14
20
|
type: "rule";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { PermissionRuleEntry } from "./types.js";
|
|
2
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
|
|
3
|
+
export declare function createCommunitySandboxScopedRules(): PermissionRuleEntry[];
|
|
@@ -66,7 +66,13 @@ export declare class PermissionChecker {
|
|
|
66
66
|
private readonly getTurnId;
|
|
67
67
|
private readonly communityTelemetryRecorder;
|
|
68
68
|
private readonly communitySandboxTurnIds;
|
|
69
|
-
|
|
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;
|
|
70
76
|
private unregisterHook;
|
|
71
77
|
/** Tool meta cache — populated from ToolDefinition[] at agent creation */
|
|
72
78
|
private toolMetaCache;
|
|
@@ -89,7 +95,12 @@ export declare class PermissionChecker {
|
|
|
89
95
|
*/
|
|
90
96
|
setToolMeta(tools: ToolDefinition[]): void;
|
|
91
97
|
get ruleEngineRef(): PermissionRuleEngine;
|
|
92
|
-
|
|
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;
|
|
93
104
|
/** Fire permission.denied hook + onDenied callback + audit log */
|
|
94
105
|
private fireDenied;
|
|
95
106
|
private handleResult;
|
|
@@ -14,6 +14,13 @@ export interface OperationClassification {
|
|
|
14
14
|
isEgress: boolean;
|
|
15
15
|
egressCarriesData: boolean;
|
|
16
16
|
isDestructive: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Shell command performs network egress (curl/wget/nc/scp/...). Used to gate
|
|
19
|
+
* untrusted community-skill shell commands (which would otherwise bypass the
|
|
20
|
+
* web_fetch/web_search deny via raw shell). Best-effort detection; the OS sandbox
|
|
21
|
+
* (netPolicy=deny on community turns) is the robust second layer on POSIX.
|
|
22
|
+
*/
|
|
23
|
+
commandNetworkEgress: boolean;
|
|
17
24
|
}
|
|
18
25
|
export interface ClassifyContext {
|
|
19
26
|
workspaceRoot: string;
|
|
@@ -26,9 +26,18 @@ export declare class PermissionRuleEngine {
|
|
|
26
26
|
* `op` is optional and defaults to an all-false classification so callers
|
|
27
27
|
* that have not yet been wired to the classifier keep compiling.
|
|
28
28
|
*/
|
|
29
|
-
check(input: ToolPermissionCheckInput, op?: OperationClassification
|
|
29
|
+
check(input: ToolPermissionCheckInput, op?: OperationClassification, ctx?: {
|
|
30
|
+
extraRules?: readonly PermissionRuleEntry[];
|
|
31
|
+
}): PermissionResult;
|
|
30
32
|
/** Rebuild compiledPatterns: [persistent-deny] → [session] → [persistent non-deny]. */
|
|
31
33
|
private recompile;
|
|
34
|
+
/**
|
|
35
|
+
* Match a caller-supplied rule set (deny-first) against this call, using the SAME
|
|
36
|
+
* matching semantics as the base rules (pathPrefix prefix-match, else toolName glob).
|
|
37
|
+
* Returns the first hit's result, or null if none match. Used for per-call scoped
|
|
38
|
+
* rules (community-skill turns) so trust-level restrictions stay in the one engine.
|
|
39
|
+
*/
|
|
40
|
+
private matchRuleSet;
|
|
32
41
|
}
|
|
33
42
|
/**
|
|
34
43
|
* Parse permission config from Gateway-injected or local settings.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qlogicagent",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.6",
|
|
4
4
|
"description": "XiaozhiClaw Agent CLI — subprocess architecture (JSON-RPC over stdio)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
"node": ">=22.0.0"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
+
"@agentclientprotocol/sdk": "^0.25.0",
|
|
89
90
|
"@napi-rs/canvas": "0.1.100",
|
|
90
91
|
"@xiaozhiclaw/pet-core": "0.1.0",
|
|
91
92
|
"@xiaozhiclaw/provider-core": "0.1.4",
|
|
@@ -98,7 +99,6 @@
|
|
|
98
99
|
"devDependencies": {
|
|
99
100
|
"@types/better-sqlite3": "^7.6.13",
|
|
100
101
|
"@types/node": "^22.15.0",
|
|
101
|
-
"@zed-industries/agent-client-protocol": "0.4.5",
|
|
102
102
|
"esbuild": "^0.28.0",
|
|
103
103
|
"oxlint": "1.67.0",
|
|
104
104
|
"tsx": "^4.19.0",
|