qlogicagent 2.10.33 → 2.10.35
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 -21
- package/dist/cli.js +386 -387
- package/dist/index.js +388 -389
- package/dist/orchestration.js +8 -8
- package/dist/permissions.js +1 -1
- package/dist/protocol.js +1 -1
- package/dist/types/agent/agent.d.ts +4 -2
- package/dist/types/agent/tool-loop/artifact-events.d.ts +17 -0
- package/dist/types/agent/tool-loop/loop-helpers.d.ts +15 -0
- package/dist/types/agent/tool-loop/recovery-helpers.d.ts +18 -0
- package/dist/types/agent/tool-loop/single-round.d.ts +2 -0
- package/dist/types/agent/tool-loop/tool-result-events.d.ts +7 -0
- package/dist/types/agent/tool-loop.d.ts +12 -11
- package/dist/types/agent/types.d.ts +3 -1
- package/dist/types/cli/acp-session-handlers.d.ts +2 -0
- package/dist/types/cli/agent-runtime-bootstrap.d.ts +2 -1
- package/dist/types/cli/agent-runtime-ports-adapter.d.ts +2 -0
- package/dist/types/cli/agent-runtime-session-state.d.ts +24 -0
- package/dist/types/cli/base-tool-bootstrap.d.ts +2 -0
- package/dist/types/cli/core-tool-coordinator.d.ts +3 -0
- package/dist/types/cli/core-tools/agent-tool-bootstrap.d.ts +3 -1
- package/dist/types/cli/core-tools/agent-tool-service.d.ts +3 -1
- package/dist/types/cli/core-tools/checkpoint-tool-bootstrap.d.ts +3 -1
- package/dist/types/cli/core-tools/config-tool-bootstrap.d.ts +3 -1
- package/dist/types/cli/core-tools/cron-tool-bootstrap.d.ts +3 -1
- package/dist/types/cli/core-tools/monitor-tool-bootstrap.d.ts +3 -1
- package/dist/types/cli/core-tools/team-tool-bootstrap.d.ts +3 -1
- package/dist/types/cli/core-tools/utility-tool-bootstrap.d.ts +3 -1
- package/dist/types/cli/dev-tool-bootstrap.d.ts +4 -0
- package/dist/types/cli/dev-tools/dev-tool-bootstrap-service.d.ts +6 -0
- package/dist/types/cli/dev-tools/dev-tool-registry.d.ts +7 -0
- package/dist/types/cli/dream-host-adapter.d.ts +1 -0
- package/dist/types/cli/handlers/community-handler.d.ts +2 -1
- package/dist/types/cli/handlers/config-handler.d.ts +2 -0
- package/dist/types/cli/handlers/dream-handler.d.ts +2 -0
- package/dist/types/cli/handlers/pet-handler.d.ts +1 -0
- package/dist/types/cli/handlers/product-handler.d.ts +18 -40
- package/dist/types/cli/handlers/project-handler.d.ts +1 -1
- package/dist/types/cli/handlers/turn-handler.d.ts +3 -1
- package/dist/types/cli/handlers/workflow-handler.d.ts +2 -0
- package/dist/types/cli/mcp-bootstrap.d.ts +20 -0
- package/dist/types/cli/mcp-plugin-bootstrap.d.ts +2 -27
- package/dist/types/cli/media-runtime-facade.d.ts +20 -0
- package/dist/types/cli/memory-candidate-service.d.ts +74 -0
- package/dist/types/cli/memory-coordinator.d.ts +3 -3
- package/dist/types/cli/permission-approval-bridge.d.ts +15 -0
- package/dist/types/cli/permission-bootstrap.d.ts +6 -6
- package/dist/types/cli/permission-runtime-service.d.ts +9 -0
- package/dist/types/cli/pet-confirm-coordinator.d.ts +2 -2
- package/dist/types/cli/plugin-bootstrap.d.ts +14 -0
- package/dist/types/cli/product-coordinator.d.ts +25 -0
- package/dist/types/cli/project-command-service.d.ts +26 -0
- package/dist/types/cli/provider-core-facade.d.ts +1 -0
- package/dist/types/cli/runtime-hook-bootstrap.d.ts +2 -1
- package/dist/types/cli/runtime-watcher-bootstrap.d.ts +2 -2
- package/dist/types/cli/session-coordinator.d.ts +5 -3
- package/dist/types/cli/session-query-service.d.ts +23 -0
- package/dist/types/cli/skill-meta-subturn-service.d.ts +22 -0
- package/dist/types/cli/skill-meta-tool-bootstrap.d.ts +9 -7
- package/dist/types/cli/skills-query-service.d.ts +26 -0
- package/dist/types/cli/stdio-agent-session-bootstrap.d.ts +78 -0
- package/dist/types/cli/stdio-runtime-bootstrap.d.ts +16 -0
- package/dist/types/cli/stdio-runtime-services.d.ts +36 -0
- package/dist/types/cli/stdio-server.d.ts +19 -18
- package/dist/types/cli/test-support/tool-catalog-fixture.d.ts +3 -0
- package/dist/types/cli/tool-bootstrap-providers.d.ts +3 -0
- package/dist/types/cli/tool-bootstrap.d.ts +7 -20
- package/dist/types/cli/tool-catalog.d.ts +4 -2
- package/dist/types/cli/tool-invoker-factory.d.ts +2 -0
- package/dist/types/cli/tool-registry-adapter.d.ts +5 -0
- package/dist/types/contracts/hooks.d.ts +1 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/types/orchestration/product-persistence.d.ts +7 -3
- package/dist/types/orchestration/solo-persistence.d.ts +8 -4
- package/dist/types/orchestration/subagent/agent-registry.d.ts +3 -3
- package/dist/types/orchestration/tool-cascade.d.ts +12 -3
- package/dist/types/orchestration/tool-loop/tool-schema.d.ts +4 -1
- package/dist/types/orchestration/workflow/qla-executor-host.d.ts +3 -3
- package/dist/types/protocol/methods.d.ts +27 -1
- package/dist/types/protocol/wire/acp-protocol.d.ts +0 -2
- package/dist/types/protocol/wire/agent-rpc.d.ts +4 -4
- package/dist/types/protocol/wire/capability-manifest.d.ts +2 -1
- package/dist/types/protocol/wire/capability-transport.d.ts +2 -2
- package/dist/types/protocol/wire/chat-types.d.ts +4 -0
- package/dist/types/protocol/wire/index.d.ts +1 -1
- package/dist/types/protocol/wire/notification-payloads.d.ts +2 -1
- package/dist/types/protocol/wire/web-capability.d.ts +3 -0
- package/dist/types/runtime/community/community-consent-client.d.ts +21 -1
- package/dist/types/runtime/execution/dream-agent.d.ts +1 -1
- package/dist/types/runtime/execution/forked-agent.d.ts +1 -1
- package/dist/types/runtime/execution/tool-eligibility.d.ts +14 -37
- package/dist/types/runtime/hooks/context-compression.d.ts +1 -1
- package/dist/types/runtime/infra/agent-paths.d.ts +0 -4
- package/dist/types/runtime/infra/default-path-service.d.ts +32 -0
- package/dist/types/runtime/infra/llmrouter-catalog.d.ts +6 -5
- package/dist/types/runtime/infra/model-registry.d.ts +1 -2
- package/dist/types/runtime/infra/process-config-port.d.ts +2 -0
- package/dist/types/runtime/infra/provider-catalog-adapter.d.ts +48 -0
- package/dist/types/runtime/infra/token-budget.d.ts +1 -1
- package/dist/types/runtime/ports/agent-runtime-ports.d.ts +76 -0
- package/dist/types/runtime/ports/config-port.d.ts +4 -0
- package/dist/types/runtime/ports/index.d.ts +8 -2
- package/dist/types/runtime/ports/model-transport-contracts.d.ts +125 -0
- package/dist/types/runtime/ports/path-service.d.ts +18 -0
- package/dist/types/runtime/ports/permission-contracts.d.ts +8 -3
- package/dist/types/runtime/ports/tool-contracts.d.ts +63 -2
- package/dist/types/runtime/session/session-persistence.d.ts +1 -1
- package/dist/types/runtime/tasks/task-types.d.ts +2 -1
- package/dist/types/skills/index.d.ts +1 -109
- package/dist/types/skills/mcp/mcp-manager.d.ts +13 -0
- package/dist/types/skills/memory/local-memory-provider.d.ts +0 -4
- package/dist/types/skills/memory/local-store-records.d.ts +184 -0
- package/dist/types/skills/memory/local-store.d.ts +9 -14
- package/dist/types/skills/memory/memory-db-path.d.ts +7 -0
- package/dist/types/skills/memory/memory-embedding-config.d.ts +31 -0
- package/dist/types/skills/memory/memory-provider-factory.d.ts +3 -14
- package/dist/types/skills/memory/memory-vector-utils.d.ts +2 -0
- package/dist/types/skills/memory/sqlite-memory-mappers.d.ts +6 -0
- package/dist/types/skills/memory/sqlite-memory-schema.d.ts +3 -0
- package/dist/types/skills/permissions/hook-runner.d.ts +1 -1
- package/dist/types/skills/permissions/rule-engine.d.ts +2 -5
- package/dist/types/skills/permissions/settings-watcher.d.ts +6 -35
- package/dist/types/skills/permissions/types.d.ts +1 -1
- package/dist/types/skills/plugins/plugin-loader.d.ts +10 -0
- package/dist/types/skills/portable-tool.d.ts +10 -0
- package/dist/types/skills/tools/cron-tool.d.ts +0 -20
- package/dist/types/skills/tools.d.ts +24 -59
- package/dist/types/transport/acp-server.d.ts +7 -7
- package/package.json +3 -1
- package/dist/types/agent/memory-recall-context.test.d.ts +0 -1
- package/dist/types/cli/acp-extended-host-adapter.test.d.ts +0 -1
- package/dist/types/cli/acp-session-handlers.test.d.ts +0 -1
- package/dist/types/cli/agent-status-notifier.test.d.ts +0 -1
- package/dist/types/cli/cli-acp-request-handler.test.d.ts +0 -1
- package/dist/types/cli/community-skill-installer.test.d.ts +0 -1
- package/dist/types/cli/core-tools/cron-workflow-service.test.d.ts +0 -1
- package/dist/types/cli/dev-tools/repl-lsp-tool-services.test.d.ts +0 -1
- package/dist/types/cli/handlers/community-handler.test.d.ts +0 -1
- package/dist/types/cli/handlers/config-handler.test.d.ts +0 -1
- package/dist/types/cli/handlers/config-handler.tools-list.test.d.ts +0 -1
- package/dist/types/cli/handlers/files-handler.instructions.test.d.ts +0 -1
- package/dist/types/cli/handlers/media-handler.test.d.ts +0 -1
- package/dist/types/cli/handlers/pet-handler.test.d.ts +0 -1
- package/dist/types/cli/handlers/session-handler.resume.test.d.ts +0 -1
- package/dist/types/cli/handlers/settings-handler.remote-catalog.test.d.ts +0 -1
- package/dist/types/cli/handlers/skills-handler.profile.test.d.ts +0 -1
- package/dist/types/cli/handlers/turn-handler.approval.test.d.ts +0 -1
- package/dist/types/cli/handlers/workflow-handler.events.test.d.ts +0 -1
- package/dist/types/cli/idle-dream-coordinator.test.d.ts +0 -1
- package/dist/types/cli/mcp-plugin-bootstrap.test.d.ts +0 -1
- package/dist/types/cli/media-file-api-service.test.d.ts +0 -1
- package/dist/types/cli/multi-agent-handler-host.test.d.ts +0 -1
- package/dist/types/cli/permission-bootstrap.test.d.ts +0 -1
- package/dist/types/cli/permission-settings-store.test.d.ts +0 -1
- package/dist/types/cli/pet-confirm-coordinator.test.d.ts +0 -1
- package/dist/types/cli/pet-runtime.test.d.ts +0 -1
- package/dist/types/cli/rpc-registry.community.test.d.ts +0 -1
- package/dist/types/cli/session-coordinator.test.d.ts +0 -1
- package/dist/types/cli/session-history-coordinator.test.d.ts +0 -1
- package/dist/types/cli/skill-meta-tool-bootstrap.test.d.ts +0 -1
- package/dist/types/cli/stdio-server.contract.test.d.ts +0 -1
- package/dist/types/cli/tool-bootstrap.instructions.test.d.ts +0 -1
- package/dist/types/cli/tool-bootstrap.media-provider-alias.test.d.ts +0 -1
- package/dist/types/cli/turn-lifecycle.test.d.ts +0 -1
- package/dist/types/cli/turn-media-setup.test.d.ts +0 -1
- package/dist/types/cli/turn-permission-sync.test.d.ts +0 -1
- package/dist/types/cli/turn-project-router.test.d.ts +0 -1
- package/dist/types/cli/turn-skill-autopersist.test.d.ts +0 -1
- package/dist/types/permissions.public-api.test.d.ts +0 -1
- package/dist/types/protocol/wire/gateway-contract.test.d.ts +0 -1
- package/dist/types/runtime/community/community-consent-client.test.d.ts +0 -1
- package/dist/types/runtime/community/community-desensitization-red-team-cli.test.d.ts +0 -1
- package/dist/types/runtime/community/community-desensitization.test.d.ts +0 -1
- package/dist/types/runtime/infra/agent-paths.test.d.ts +0 -1
- package/dist/types/runtime/infra/model-registry.test.d.ts +0 -1
- package/dist/types/runtime/infra/profile-storage.test.d.ts +0 -1
- package/dist/types/runtime/infra/skill-injector.test.d.ts +0 -1
- package/dist/types/runtime/pet/pet-growth-engine.test.d.ts +0 -1
- package/dist/types/runtime/pet/pet-reaction-service.test.d.ts +0 -1
- package/dist/types/runtime/pet/pet-soul-service.test.d.ts +0 -1
- package/dist/types/runtime/prompt/environment-context.test.d.ts +0 -1
- package/dist/types/runtime/prompt/fresh-workspace-evidence.test.d.ts +0 -1
- package/dist/types/runtime/prompt/instruction-loader.test.d.ts +0 -1
- package/dist/types/runtime/session/session-persistence.test.d.ts +0 -1
|
@@ -23,18 +23,27 @@
|
|
|
23
23
|
*
|
|
24
24
|
* ```ts
|
|
25
25
|
* import { cascadeWebSearch } from "./tool-cascade.js";
|
|
26
|
-
*
|
|
26
|
+
* const providerApi = host.resolveProviderToolApi();
|
|
27
27
|
*
|
|
28
28
|
* const providerApi = new ZhipuToolAPI({ baseUrl, apiKey });
|
|
29
29
|
* const cascadedSearch = cascadeWebSearch(providerApi, fallbackSearchFn);
|
|
30
30
|
* const tool = createWebSearchTool({ search: cascadedSearch });
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
import type { ProviderToolAPI } from "@xiaozhiclaw/provider-core";
|
|
34
33
|
import type { WebSearchBackend } from "../runtime/ports/web-search-contracts.js";
|
|
34
|
+
export interface ProviderToolApiPort {
|
|
35
|
+
capabilities: readonly string[];
|
|
36
|
+
webSearch?(query: string, options?: {
|
|
37
|
+
maxResults?: number;
|
|
38
|
+
}): Promise<Array<{
|
|
39
|
+
title: string;
|
|
40
|
+
url: string;
|
|
41
|
+
snippet: string;
|
|
42
|
+
}>>;
|
|
43
|
+
}
|
|
35
44
|
/**
|
|
36
45
|
* Cascade web search: provider-native search → host fallback.
|
|
37
46
|
* Returns a WebSearchToolDeps.search function that tries the provider's
|
|
38
47
|
* webSearch API first, falling back to the host's search on error.
|
|
39
48
|
*/
|
|
40
|
-
export declare function cascadeWebSearch(providerApi:
|
|
49
|
+
export declare function cascadeWebSearch(providerApi: ProviderToolApiPort | undefined, fallbackSearch: WebSearchBackend["search"]): WebSearchBackend["search"];
|
|
@@ -2,6 +2,10 @@ import type { OpenAiToolCall } from "./conversation-repair.js";
|
|
|
2
2
|
export type ToolSchemaProvider = {
|
|
3
3
|
modelProvider?: string;
|
|
4
4
|
modelId?: string;
|
|
5
|
+
cleanSchema?: (schema: Record<string, unknown>, context: {
|
|
6
|
+
modelProvider?: string;
|
|
7
|
+
modelId?: string;
|
|
8
|
+
}) => Record<string, unknown>;
|
|
5
9
|
};
|
|
6
10
|
export interface FunctionToolSource {
|
|
7
11
|
name: string;
|
|
@@ -40,4 +44,3 @@ export declare function buildToolResultMessage(callId: string, result: {
|
|
|
40
44
|
toolReferences?: string[];
|
|
41
45
|
imageUrls?: string[];
|
|
42
46
|
}): Record<string, unknown>;
|
|
43
|
-
export declare function cleanToolSchemaForGemini(schema: Record<string, unknown>): unknown;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* callback. Tool invocation goes straight through the single-source-of-truth tool registry
|
|
8
8
|
* (`findTool`). fail-loud everywhere: unknown tool, missing channel host, or any rejection throws.
|
|
9
9
|
*/
|
|
10
|
-
import type {
|
|
10
|
+
import type { RuntimeToolContract } from "../../runtime/ports/index.js";
|
|
11
11
|
import type { ExecutorHost } from "./node-schema.js";
|
|
12
12
|
/** Injected boundary capabilities — supplied by the handler host that owns the real runners. */
|
|
13
13
|
export interface QlaExecutorHostDeps {
|
|
@@ -34,8 +34,8 @@ export interface QlaExecutorHostDeps {
|
|
|
34
34
|
payload: unknown;
|
|
35
35
|
signal?: AbortSignal;
|
|
36
36
|
}) => Promise<unknown>;
|
|
37
|
-
/** Tool lookup
|
|
38
|
-
findTool
|
|
37
|
+
/** Tool lookup supplied by the runtime host. */
|
|
38
|
+
findTool: (name: string) => RuntimeToolContract | undefined;
|
|
39
39
|
/** fetch impl; defaults to global fetch. Injectable for tests. */
|
|
40
40
|
fetchImpl?: typeof fetch;
|
|
41
41
|
}
|
|
@@ -348,6 +348,28 @@ export interface CommunitySetConsentResult {
|
|
|
348
348
|
consent: CommunityConsentView;
|
|
349
349
|
warning?: string;
|
|
350
350
|
}
|
|
351
|
+
export interface CommunityMatchRegistryParams {
|
|
352
|
+
intent: string;
|
|
353
|
+
topK?: 1 | 2 | 3;
|
|
354
|
+
preferOfficial?: boolean;
|
|
355
|
+
}
|
|
356
|
+
export interface CommunityRegistryMatchResult {
|
|
357
|
+
id: string;
|
|
358
|
+
type: string;
|
|
359
|
+
title: string;
|
|
360
|
+
summary: string;
|
|
361
|
+
capabilityTags: string[];
|
|
362
|
+
sourceTier: CommunityInstallSourceTier;
|
|
363
|
+
trustStage: CommunityInstallTrustStage;
|
|
364
|
+
resourceRiskTier: CommunityInstallRiskTier;
|
|
365
|
+
effectiveRiskTier: CommunityInstallRiskTier;
|
|
366
|
+
latestVersion: string | null;
|
|
367
|
+
canonical: true;
|
|
368
|
+
}
|
|
369
|
+
export interface CommunityMatchRegistryResult {
|
|
370
|
+
ok: boolean;
|
|
371
|
+
matches: CommunityRegistryMatchResult[];
|
|
372
|
+
}
|
|
351
373
|
export interface CommunitySharedResource {
|
|
352
374
|
id: string;
|
|
353
375
|
type: string;
|
|
@@ -539,7 +561,7 @@ export interface AgentAbortResult {
|
|
|
539
561
|
}
|
|
540
562
|
export interface ToolApprovalResponseParams {
|
|
541
563
|
approvalId: string;
|
|
542
|
-
decision: "allow
|
|
564
|
+
decision: "allow" | "deny";
|
|
543
565
|
toolName?: string;
|
|
544
566
|
updatedInput?: Record<string, unknown>;
|
|
545
567
|
permissionUpdate?: {
|
|
@@ -729,6 +751,10 @@ export interface RpcMethodMap {
|
|
|
729
751
|
params: CommunitySetConsentParams;
|
|
730
752
|
result: CommunitySetConsentResult;
|
|
731
753
|
};
|
|
754
|
+
"community.matchRegistry": {
|
|
755
|
+
params: CommunityMatchRegistryParams;
|
|
756
|
+
result: CommunityMatchRegistryResult;
|
|
757
|
+
};
|
|
732
758
|
"community.listShared": {
|
|
733
759
|
params: undefined;
|
|
734
760
|
result: CommunityListSharedResult;
|
|
@@ -354,8 +354,6 @@ export interface AcpPermissionRequestParams {
|
|
|
354
354
|
export interface AcpPermissionOption {
|
|
355
355
|
id: string;
|
|
356
356
|
label: string;
|
|
357
|
-
/** Whether this option grants persistent permission */
|
|
358
|
-
persistent?: boolean;
|
|
359
357
|
}
|
|
360
358
|
export interface AcpPermissionRequestResult {
|
|
361
359
|
optionId: string;
|
|
@@ -87,7 +87,7 @@ export interface ToolApprovalRequestParams {
|
|
|
87
87
|
arguments: string;
|
|
88
88
|
/** Human-readable reason for requiring approval. */
|
|
89
89
|
message?: string;
|
|
90
|
-
/** Suggested
|
|
90
|
+
/** Suggested allow/ask/deny policy updates the user can apply with the decision. */
|
|
91
91
|
suggestions?: string[];
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
@@ -98,12 +98,12 @@ export interface ToolApprovalResponseParams {
|
|
|
98
98
|
/** Must match the `approvalId` from the request. */
|
|
99
99
|
approvalId: string;
|
|
100
100
|
/** User's decision. */
|
|
101
|
-
decision: "allow
|
|
102
|
-
/** Optional tool name
|
|
101
|
+
decision: "allow" | "deny";
|
|
102
|
+
/** Optional tool name for host display or audit context. */
|
|
103
103
|
toolName?: string;
|
|
104
104
|
/** Optional corrected tool input after user review. */
|
|
105
105
|
updatedInput?: Record<string, unknown>;
|
|
106
|
-
/** Optional
|
|
106
|
+
/** Optional rule update to save after an allow decision. Scope is metadata, not a decision value. */
|
|
107
107
|
permissionUpdate?: {
|
|
108
108
|
pattern: string;
|
|
109
109
|
behavior: "allow" | "ask" | "deny";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WebActionScope, WebApprovalDefault, WebCapabilityDescriptorContract, WebCapabilityFamily, WebCapabilityId, WebDegradationTarget, WebEscalationReason, WebExecutionMode, WebPolicyRiskClass, WebRetryPolicy, WebStatefulness, WebTaskMode } from "./web-capability.js";
|
|
1
|
+
import type { WebActionScope, WebApprovalDefault, WebCapabilityDescriptorContract, WebCapabilityFamily, WebCapabilityId, WebDegradationTarget, WebEscalationReason, WebExecutionMode, WebPolicyRiskClass, WebRetryPolicy, WebStatefulness, WebTaskMode, ToolRiskLevel } from "./web-capability.js";
|
|
2
2
|
import type { ApprovalRequiredToolContract } from "./session.js";
|
|
3
3
|
export declare const CAPABILITY_MANIFEST_DIFF_SECTIONS: readonly ["gatewayVersion", "toolNamespaces", "workspaceIds", "installedCapabilities", "enabledCapabilities", "features", "approvalMode", "toolManifests", "skillManifests", "pluginManifests", "mcpManifests", "approvalPolicy", "workspaceSummaries"];
|
|
4
4
|
export type CapabilityManifestDiffSection = (typeof CAPABILITY_MANIFEST_DIFF_SECTIONS)[number];
|
|
@@ -15,6 +15,7 @@ export type CapabilityToolManifestContract = WebCapabilityDescriptorContract & {
|
|
|
15
15
|
statefulness?: WebStatefulness;
|
|
16
16
|
approvalDefault?: WebApprovalDefault;
|
|
17
17
|
policyRiskClass?: WebPolicyRiskClass;
|
|
18
|
+
riskLevel?: ToolRiskLevel;
|
|
18
19
|
allowedActionScopes?: WebActionScope[];
|
|
19
20
|
degradationTarget?: WebDegradationTarget;
|
|
20
21
|
upgradeTargets?: WebCapabilityId[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ProxyKeySource } from "./transport.js";
|
|
2
2
|
import type { MemoryContextBlock } from "./memory-provider-lifecycle.js";
|
|
3
|
-
import type { WebCapabilityFamily, WebTaskMode, WebExecutionMode, WebStatefulness, WebPolicyRiskClass } from "./web-capability.js";
|
|
3
|
+
import type { WebCapabilityFamily, WebTaskMode, WebExecutionMode, WebStatefulness, WebPolicyRiskClass, ToolRiskLevel } from "./web-capability.js";
|
|
4
4
|
export interface TransportCapabilitySummaryContract {
|
|
5
5
|
snapshotVersion: string;
|
|
6
6
|
installedCapabilities: string[];
|
|
@@ -97,7 +97,7 @@ export interface CapabilityToolManifestEntry {
|
|
|
97
97
|
defaultProfiles?: string[];
|
|
98
98
|
requiredParameters?: string[];
|
|
99
99
|
parametersSummary?: string;
|
|
100
|
-
riskLevel?:
|
|
100
|
+
riskLevel?: ToolRiskLevel;
|
|
101
101
|
approvalMode?: "user-confirm" | "pre-authorized";
|
|
102
102
|
requiresApproval?: boolean;
|
|
103
103
|
parallelSafe?: boolean;
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* These types appear in RPC method params/results (thread.turn, session.resume, etc.)
|
|
5
5
|
* and are needed by every consumer that interacts with the agent.
|
|
6
6
|
*/
|
|
7
|
+
import type { ToolRiskLevel } from "./web-capability.js";
|
|
8
|
+
export type { ToolRiskLevel } from "./web-capability.js";
|
|
7
9
|
export type ChatMessageRole = "system" | "user" | "assistant" | "tool";
|
|
8
10
|
/** Thinking block from Anthropic Messages API (DeepSeek, Claude, etc.) */
|
|
9
11
|
export interface ThinkingBlock {
|
|
@@ -86,6 +88,8 @@ export interface ToolDefinition {
|
|
|
86
88
|
displayDescription?: LocalizedToolText;
|
|
87
89
|
serialOnly?: boolean;
|
|
88
90
|
parallelSafe?: boolean;
|
|
91
|
+
/** Unified permission risk class. */
|
|
92
|
+
riskLevel?: ToolRiskLevel;
|
|
89
93
|
/** If true, host should request user approval before execution. */
|
|
90
94
|
requiresApproval?: boolean;
|
|
91
95
|
/** Tool is read-only / safe — skip approval even in strict mode. */
|
|
@@ -10,7 +10,7 @@ export { ACP_EXTENDED_METHODS, ACP_EXTENDED_SESSION_UPDATE_TYPES, ACP_METHODS, A
|
|
|
10
10
|
export { type ApprovalRequiredToolContract, type ModelSelectionReason, type PendingPromptContract, type RuntimeCapabilitySummaryContract, type RuntimeSessionContract, type SessionIdentityContract, } from "./session.js";
|
|
11
11
|
export { type GatewayChannelExecutionEgressContract, type GatewayChannelExecutionEgressKind, type GatewayChannelExecutionIngressBindingContract, type GatewayChannelExecutionIngressSource, } from "./channel-ingress.js";
|
|
12
12
|
export { CAPABILITY_MANIFEST_DIFF_SECTIONS, cloneCapabilityManifestSnapshot, createCapabilityManifestDiffPayload, deriveCapabilityToolNamespaces, deriveCapabilityWorkspaceIds, mergeCapabilityManifestSnapshot, type CapabilityManifestApprovalMode, type CapabilityManifestApprovalPolicyContract, type CapabilityManifestDiffSection, type CapabilityMcpManifestContract, type CapabilityManifestSnapshotContract, type HostCapabilitySnapshotContract, type CapabilityPluginManifestContract, type RuntimeCapabilityViewContract, type RuntimeToolEligibilityContract, type CapabilitySkillManifestContract, type CapabilityToolManifestContract, type CapabilityWorkspaceSummaryContract, type ToolEligibilityResolvedSource, type ToolEligibilityReasonCode, type ToolEligibilityStatus, } from "./capability-manifest.js";
|
|
13
|
-
export { WEB_ACTION_SCOPE_VALUES, WEB_APPROVAL_DEFAULT_VALUES, WEB_CAPABILITY_FAMILY_VALUES, WEB_CAPABILITY_ID_VALUES, WEB_DEGRADATION_TARGET_VALUES, WEB_ESCALATION_REASON_VALUES, WEB_EXECUTION_MODE_VALUES, WEB_POLICY_RISK_CLASS_VALUES, WEB_RETRY_POLICY_VALUES, WEB_STATEFULNESS_VALUES, WEB_TASK_MODE_VALUES, type WebActionScope, type WebApprovalDefault, type WebCapabilityDescriptorContract, type WebCapabilityFamily, type WebCapabilityId, type WebDegradationTarget, type WebEscalationReason, type WebExecutionMode, type WebPolicyRiskClass, type WebRetryPolicy, type WebStatefulness, type WebTaskMode, } from "./web-capability.js";
|
|
13
|
+
export { WEB_ACTION_SCOPE_VALUES, WEB_APPROVAL_DEFAULT_VALUES, WEB_CAPABILITY_FAMILY_VALUES, WEB_CAPABILITY_ID_VALUES, WEB_DEGRADATION_TARGET_VALUES, WEB_ESCALATION_REASON_VALUES, WEB_EXECUTION_MODE_VALUES, WEB_POLICY_RISK_CLASS_VALUES, WEB_RETRY_POLICY_VALUES, WEB_STATEFULNESS_VALUES, WEB_TASK_MODE_VALUES, type WebActionScope, type WebApprovalDefault, type WebCapabilityDescriptorContract, type WebCapabilityFamily, type WebCapabilityId, type WebDegradationTarget, type WebEscalationReason, type WebExecutionMode, type WebPolicyRiskClass, type WebRetryPolicy, type WebStatefulness, type WebTaskMode, type ToolRiskLevel, } from "./web-capability.js";
|
|
14
14
|
export { MEMORY_OBSERVATION_HOOK_VALUES, MEMORY_OBSERVATION_SOURCE_VALUES, MEMORY_WRITE_ACCESS_VALUES, type MemoryContextBlock, type MemoryIngestMessage, type MemoryIngestOptions, type MemoryLlmConfig, type MemoryObservedMsg, type MemoryObservedPayload, type MemoryObservationEnvelope, type MemoryObservationHook, type MemoryObservationSource, type MemoryObserveRequestMsg, type MemoryProvider, type MemorySearchOptions, type MemorySearchResult, type MemoryWriteAccess, } from "./memory-provider-lifecycle.js";
|
|
15
15
|
export { RESOURCE_MANIFEST_SCHEMA_VERSION, RUNTIME_ASSET_IDS, RUNTIME_PROFILE_IDS, createDefaultRuntimeResourceProfiles, getManifestShortcutEntry, getRuntimeResourceAsset, getRuntimeResourceProfile, getRuntimeResourceProfileAssets, normalizeRuntimeResourceManifest, upsertRuntimeResourceAsset, type RuntimeManifestShortcutEntry, type RuntimeResourceArtifact, type RuntimeResourceAsset, type RuntimeResourceAssetDelivery, type RuntimeResourceAssetKind, type RuntimeResourceAssetMap, type RuntimeResourceManifest, type RuntimeResourcePlatform, type RuntimeResourceProfile, type RuntimeResourceProfileMap, } from "./resource-manifest.js";
|
|
16
16
|
export { MUTATION_CHECKPOINT_ENTRY_KIND_VALUES, MUTATION_CHECKPOINT_BACKEND_VALUES, MUTATION_CHECKPOINT_PHASE_VALUES, type MutationCheckpointBackend, type MutationCheckpointContract, type MutationCheckpointEntryKind, type MutationCheckpointPhase, type MutationCheckpointRestoreAckContract, type MutationCheckpointRollbackResultContract, type MutationCheckpointRestoreContract, type MutationCheckpointSnapshotEntryContract, } from "./checkpoint.js";
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* 2. Add entry in NotificationMethodMap here
|
|
11
11
|
* 3. Add event name string in agent-events.ts (if WS-relayed)
|
|
12
12
|
*/
|
|
13
|
+
import type { ToolRiskLevel } from "./web-capability.js";
|
|
13
14
|
/** Identifies which agent produced this notification (main or teammate). */
|
|
14
15
|
export interface AgentSource {
|
|
15
16
|
id: string;
|
|
@@ -630,7 +631,7 @@ export interface PetConfirmNotification {
|
|
|
630
631
|
confirmId: string;
|
|
631
632
|
toolName: string;
|
|
632
633
|
description: string;
|
|
633
|
-
risk:
|
|
634
|
+
risk: ToolRiskLevel;
|
|
634
635
|
timeoutMs?: number;
|
|
635
636
|
}
|
|
636
637
|
export interface PetForgedNotification {
|
|
@@ -12,6 +12,8 @@ export declare const WEB_APPROVAL_DEFAULT_VALUES: readonly ["required", "conditi
|
|
|
12
12
|
export type WebApprovalDefault = (typeof WEB_APPROVAL_DEFAULT_VALUES)[number];
|
|
13
13
|
export declare const WEB_POLICY_RISK_CLASS_VALUES: readonly ["browser-read", "browser-authenticated-read", "browser-state-changing"];
|
|
14
14
|
export type WebPolicyRiskClass = (typeof WEB_POLICY_RISK_CLASS_VALUES)[number];
|
|
15
|
+
export declare const TOOL_RISK_LEVEL_VALUES: readonly ["read", "write", "system", "external_egress"];
|
|
16
|
+
export type ToolRiskLevel = (typeof TOOL_RISK_LEVEL_VALUES)[number];
|
|
15
17
|
export declare const WEB_ACTION_SCOPE_VALUES: readonly ["read-page", "read-authenticated-page", "fill-form", "submit-form", "download-file", "reuse-session"];
|
|
16
18
|
export type WebActionScope = (typeof WEB_ACTION_SCOPE_VALUES)[number];
|
|
17
19
|
export declare const WEB_DEGRADATION_TARGET_VALUES: readonly ["web_search", "web_fetch", "deep_research", "blocked"];
|
|
@@ -28,6 +30,7 @@ export interface WebCapabilityDescriptorContract {
|
|
|
28
30
|
statefulness?: WebStatefulness;
|
|
29
31
|
approvalDefault?: WebApprovalDefault;
|
|
30
32
|
policyRiskClass?: WebPolicyRiskClass;
|
|
33
|
+
riskLevel?: ToolRiskLevel;
|
|
31
34
|
requiresRuntimeBackend?: boolean;
|
|
32
35
|
requiresHostBridge?: boolean;
|
|
33
36
|
supportsRenderBackend?: boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ConfigPort } from "../ports/index.js";
|
|
1
2
|
import type { CommunityTelemetryEvent } from "./community-telemetry-types.js";
|
|
2
3
|
export interface CommunityConsentView {
|
|
3
4
|
enabled: boolean;
|
|
@@ -15,6 +16,7 @@ export interface SetCommunityConsentInput {
|
|
|
15
16
|
export interface CommunityConsentClient {
|
|
16
17
|
getConsent(): Promise<CommunityConsentView>;
|
|
17
18
|
setConsent(input: SetCommunityConsentInput): Promise<CommunityConsentView>;
|
|
19
|
+
matchRegistry(input: CommunityRegistryMatchInput): Promise<CommunityRegistryMatchResult[]>;
|
|
18
20
|
publishSkill(input: CommunityPublishSkillInput): Promise<CommunityPublishSkillResult>;
|
|
19
21
|
recordSignal(input: CommunityRecordSignalInput): Promise<CommunityRecordSignalResult>;
|
|
20
22
|
recordTelemetry(input: CommunityRecordTelemetryInput): Promise<CommunityRecordTelemetryResult>;
|
|
@@ -40,6 +42,24 @@ export interface CommunityPublishedVersion {
|
|
|
40
42
|
checksum: string;
|
|
41
43
|
sizeBytes: number;
|
|
42
44
|
}
|
|
45
|
+
export interface CommunityRegistryMatchInput {
|
|
46
|
+
intent: string;
|
|
47
|
+
topK?: number;
|
|
48
|
+
preferOfficial?: boolean;
|
|
49
|
+
}
|
|
50
|
+
export interface CommunityRegistryMatchResult {
|
|
51
|
+
id: string;
|
|
52
|
+
type: string;
|
|
53
|
+
title: string;
|
|
54
|
+
summary: string;
|
|
55
|
+
capabilityTags: string[];
|
|
56
|
+
sourceTier: CommunityInstallSourceTier;
|
|
57
|
+
trustStage: CommunityInstallTrustStage;
|
|
58
|
+
resourceRiskTier: CommunityInstallRiskTier;
|
|
59
|
+
effectiveRiskTier: CommunityInstallRiskTier;
|
|
60
|
+
latestVersion: string | null;
|
|
61
|
+
canonical: true;
|
|
62
|
+
}
|
|
43
63
|
export interface CommunityPublishSkillInput {
|
|
44
64
|
id: string;
|
|
45
65
|
title: string;
|
|
@@ -113,5 +133,5 @@ export interface CommunityConsentClientOptions {
|
|
|
113
133
|
fetchFn?: typeof fetch;
|
|
114
134
|
}
|
|
115
135
|
export declare function createCommunityConsentClient(options: CommunityConsentClientOptions): CommunityConsentClient;
|
|
116
|
-
export declare function createDefaultCommunityConsentClient(): CommunityConsentClient | null;
|
|
136
|
+
export declare function createDefaultCommunityConsentClient(configPort?: ConfigPort): CommunityConsentClient | null;
|
|
117
137
|
export declare function normalizeCommunityConsent(value: unknown, remoteSynced: boolean): CommunityConsentView;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import type { DreamTaskState, DreamTurn } from "../tasks/task-types.js";
|
|
14
14
|
import type { ToolDefinition, ToolInvoker, AgentLogger, HookRegistry, ForkedAgentRunnerFactory } from "../ports/agent-execution-contracts.js";
|
|
15
|
-
import type { LLMTransport } from "
|
|
15
|
+
import type { LLMTransport } from "../ports/index.js";
|
|
16
16
|
export interface DreamTriggerConfig {
|
|
17
17
|
/** Minimum hours since last consolidation. Default: 24. */
|
|
18
18
|
minHours: number;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* Reference: claude-code src/utils/forkedAgent.ts
|
|
19
19
|
*/
|
|
20
20
|
import type { AgentLogger, ChatMessage, ToolDefinition, ToolInvoker, TokenUsage, TurnEvent, HookRegistry, ForkedAgentRunnerFactory } from "../ports/agent-execution-contracts.js";
|
|
21
|
-
import type { LLMTransport } from "
|
|
21
|
+
import type { LLMTransport } from "../ports/index.js";
|
|
22
22
|
import type { AgentProgress } from "./progress-tracker.js";
|
|
23
23
|
/**
|
|
24
24
|
* Tool permission check function — CC canUseTool parity.
|
|
@@ -1,59 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool eligibility resolver for CLI subprocess mode.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Core decision logic preserved:
|
|
8
|
-
* - Policy blocked (explicit block list)
|
|
9
|
-
* - Approval required (meta.requiresApproval / meta.isDangerous)
|
|
10
|
-
* - Read-only / safe tools (meta.isReadOnly → skip approval even in strict)
|
|
11
|
-
* - All tools from Gateway manifest are considered enabled & reachable
|
|
12
|
-
* (Gateway only sends available tools)
|
|
13
|
-
*
|
|
14
|
-
* Zero imports from express/pg/ioredis/ws.
|
|
4
|
+
* This layer only gates whether a tool may be offered to the model at all.
|
|
5
|
+
* Permission prompts are handled by the permission rule engine.
|
|
15
6
|
*/
|
|
16
7
|
import type { ToolDefinition } from "../ports/agent-execution-contracts.js";
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* Level 2 — default-allow: normal tools with no risk markers
|
|
22
|
-
* Level 3 — notify: isDangerous tools → emit tool_blocked warning but allow
|
|
23
|
-
* Level 4 — ask: requiresApproval tools → hook can block, emit approval.requested
|
|
24
|
-
* Level 5 — never-allow: explicitly blocked by policy
|
|
25
|
-
*/
|
|
26
|
-
export type PermissionLevel = 1 | 2 | 3 | 4 | 5;
|
|
27
|
-
export type ToolEligibilityStatus = "eligible" | "approval-required" | "blocked-by-policy" | "dangerous-notify";
|
|
28
|
-
export type ToolEligibilityReasonCode = "policy_blocked" | "approval_required" | "dangerous_tool" | "always_allowed";
|
|
8
|
+
import type { PermissionRiskLevel } from "../ports/permission-contracts.js";
|
|
9
|
+
export type ToolEligibilityDecision = "allow" | "ask" | "deny";
|
|
10
|
+
export type ToolEligibilityStatus = "eligible" | "approval-required" | "blocked-by-policy";
|
|
11
|
+
export type ToolEligibilityReasonCode = "policy_blocked" | "requires_approval" | "risk_read" | "risk_write" | "risk_system" | "risk_external_egress";
|
|
29
12
|
export interface ToolEligibilityEntry {
|
|
30
13
|
toolName: string;
|
|
31
14
|
status: ToolEligibilityStatus;
|
|
32
|
-
|
|
15
|
+
decision: ToolEligibilityDecision;
|
|
16
|
+
riskLevel: PermissionRiskLevel;
|
|
33
17
|
approvalRequired: boolean;
|
|
34
18
|
reasonCodes: ToolEligibilityReasonCode[];
|
|
35
19
|
}
|
|
36
20
|
export interface ToolEligibilityContext {
|
|
37
|
-
/** Explicitly blocked tool names
|
|
21
|
+
/** Explicitly blocked tool names from config or policy. */
|
|
38
22
|
blockedToolNames?: string[];
|
|
39
|
-
/**
|
|
23
|
+
/** Tool name regexes treated as system risk when no manifest risk is present. */
|
|
40
24
|
dangerousPatterns?: string[];
|
|
41
25
|
}
|
|
42
26
|
export interface ToolEligibilityResult {
|
|
43
|
-
/** Tools eligible for execution
|
|
27
|
+
/** Tools eligible for execution, including ask-before-run tools. */
|
|
44
28
|
eligibleTools: ToolDefinition[];
|
|
45
|
-
/** Tools blocked by policy
|
|
29
|
+
/** Tools blocked by policy and removed from the LLM tool list. */
|
|
46
30
|
blockedTools: ToolEligibilityEntry[];
|
|
47
|
-
/** Tools needing approval before execution */
|
|
31
|
+
/** Tools needing approval before execution. */
|
|
48
32
|
approvalRequiredTools: ToolEligibilityEntry[];
|
|
49
|
-
/** Full eligibility map by tool name */
|
|
33
|
+
/** Full eligibility map by tool name. */
|
|
50
34
|
eligibilityByName: Map<string, ToolEligibilityEntry>;
|
|
51
35
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Resolve tool eligibility for a set of tools from agent.turn.
|
|
54
|
-
*
|
|
55
|
-
* Returns filtered tool lists and eligibility metadata.
|
|
56
|
-
* Blocked tools are removed from the eligible list (not sent to LLM).
|
|
57
|
-
* Approval-required tools remain in the list but flagged for hook interception.
|
|
58
|
-
*/
|
|
59
36
|
export declare function resolveToolEligibility(tools: ToolDefinition[], context?: ToolEligibilityContext): ToolEligibilityResult;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ContextEngineRegistry, type CompressibleMessage, type CompressionResult, type CompressionStrategy, type AsyncCompressionStrategy, type SummarizeFn } from "../context/context-compression-strategies.js";
|
|
2
2
|
import type { HookRegistry } from "./hook-registry.js";
|
|
3
3
|
import type { RuntimeLogger } from "./hook-registry.js";
|
|
4
|
-
import type { LLMTransport } from "
|
|
4
|
+
import type { LLMTransport } from "../ports/index.js";
|
|
5
5
|
/** Rough token estimate: ~4 chars per token for mixed CJK/English. */
|
|
6
6
|
export declare function estimateTokens(msg: CompressibleMessage): number;
|
|
7
7
|
/** Estimate total tokens for a message array. */
|
|
@@ -9,10 +9,6 @@
|
|
|
9
9
|
export declare const AGENT_DOT_DIR = ".qlogicagent";
|
|
10
10
|
/** `~/.qlogicagent/` (or QLOGICAGENT_HOME override) */
|
|
11
11
|
export declare function getUserAgentHome(): string;
|
|
12
|
-
/** Legacy pre-profile user settings path: `~/.qlogicagent/settings.json`. */
|
|
13
|
-
export declare function getLegacyUserSettingsPath(): string;
|
|
14
|
-
/** Legacy pre-profile local memory database path: `~/.qlogicagent/memory/memories.db`. */
|
|
15
|
-
export declare function getLegacyMemoryDbPath(): string;
|
|
16
12
|
export declare function resolveActiveOwnerUserId(): string;
|
|
17
13
|
export declare function encodeOwnerProfileSegment(ownerUserId: string): string;
|
|
18
14
|
export declare function getOwnerProfileDir(ownerUserId?: string): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { PathService } from "../ports/index.js";
|
|
2
|
+
export interface DefaultPathServiceOptions {
|
|
3
|
+
getActiveProjectRoot?: () => string;
|
|
4
|
+
setActiveWorkdir?: (dir: string) => void;
|
|
5
|
+
resolveProjectDir?: (projectId?: string) => string | undefined;
|
|
6
|
+
}
|
|
7
|
+
export declare class DefaultPathService implements PathService {
|
|
8
|
+
private readonly options;
|
|
9
|
+
constructor(options?: DefaultPathServiceOptions);
|
|
10
|
+
getActiveProjectRoot(): string;
|
|
11
|
+
setActiveWorkdir(dir: string): void;
|
|
12
|
+
resolveProjectDir(projectId?: string): string | undefined;
|
|
13
|
+
resolveActiveOwnerUserId(): string;
|
|
14
|
+
getUserAgentHome(): string;
|
|
15
|
+
getOwnerProfileDir(ownerUserId?: string): string;
|
|
16
|
+
getProfileMemoryDir(ownerUserId?: string): string;
|
|
17
|
+
getUserSettingsPath(): string;
|
|
18
|
+
getUserSkillsDir(): string;
|
|
19
|
+
getUserPluginsDir(): string;
|
|
20
|
+
getUserMcpConfigPath(): string;
|
|
21
|
+
getUserPluginCacheDir(): string;
|
|
22
|
+
getUserMarketplaceConfigPath(): string;
|
|
23
|
+
getProjectAgentDir(projectRoot?: string): string;
|
|
24
|
+
getProjectSettingsPath(projectRoot?: string): string;
|
|
25
|
+
getProjectInstructionsPath(projectRoot?: string): string;
|
|
26
|
+
getProjectSkillsDir(projectRoot?: string): string;
|
|
27
|
+
getProjectRulesDir(projectRoot?: string): string;
|
|
28
|
+
getProjectSessionsRoot(projectRoot?: string): string;
|
|
29
|
+
getKnownProjectDirs(projectDirs: string[], excludeCwd?: string): string[];
|
|
30
|
+
getAllProjectSkillDirs(projectDirs: string[], excludeCwd?: string): string[];
|
|
31
|
+
}
|
|
32
|
+
export declare function getDefaultPathService(): PathService;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ModelEntry, ModelRegistry } from "./model-registry.js";
|
|
2
|
+
import type { ConfigPort } from "../ports/index.js";
|
|
2
3
|
export declare const LLMROUTER_CATALOG_UNAVAILABLE_MESSAGE = "\u65E0\u6CD5\u8FDE\u63A5 llmrouter \u6A21\u578B\u76EE\u5F55";
|
|
3
4
|
export declare const LLMROUTER_PROVIDER_ID = "llmrouter";
|
|
4
5
|
export declare const LLMROUTER_PROVIDER_NAME = "LLMRouter";
|
|
@@ -42,15 +43,15 @@ export interface LlmrouterCatalogModel {
|
|
|
42
43
|
capabilities?: string[];
|
|
43
44
|
pricing?: Record<string, unknown>;
|
|
44
45
|
}
|
|
45
|
-
export declare function getLlmrouterBaseUrl(): string;
|
|
46
|
+
export declare function getLlmrouterBaseUrl(configPort?: ConfigPort): string;
|
|
46
47
|
export declare function getLlmrouterModelsUrl(baseUrl: string): string;
|
|
47
|
-
export declare function listLlmrouterCatalogProviders(): Promise<LlmrouterCatalogProvider[]>;
|
|
48
|
-
export declare function listLlmrouterCatalogModels(): Promise<LlmrouterCatalogModel[]>;
|
|
48
|
+
export declare function listLlmrouterCatalogProviders(configPort?: ConfigPort): Promise<LlmrouterCatalogProvider[]>;
|
|
49
|
+
export declare function listLlmrouterCatalogModels(configPort?: ConfigPort): Promise<LlmrouterCatalogModel[]>;
|
|
49
50
|
export declare function listLlmrouterModelsByApiKey(baseUrl: string, apiKey: string): Promise<LlmrouterCatalogModel[]>;
|
|
50
51
|
export declare function providerDisplayName(provider: LlmrouterCatalogProvider): string;
|
|
51
52
|
export declare function providerBaseUrl(provider: LlmrouterCatalogProvider): string | undefined;
|
|
52
|
-
export declare function getLlmrouterCatalogProvider(providerId: string): Promise<LlmrouterCatalogProvider | null>;
|
|
53
|
-
export declare function refreshRegistryFromLlmrouterCatalog(registry: ModelRegistry): Promise<ModelEntry[]>;
|
|
53
|
+
export declare function getLlmrouterCatalogProvider(providerId: string, configPort?: ConfigPort): Promise<LlmrouterCatalogProvider | null>;
|
|
54
|
+
export declare function refreshRegistryFromLlmrouterCatalog(registry: ModelRegistry, configPort?: ConfigPort): Promise<ModelEntry[]>;
|
|
54
55
|
export declare function refreshRegistryFromLlmrouterApiKey(registry: ModelRegistry, options: {
|
|
55
56
|
baseUrl: string;
|
|
56
57
|
apiKey: string;
|
|
@@ -55,8 +55,7 @@ export interface ResolvedModel {
|
|
|
55
55
|
export declare const ALL_PURPOSES: ModelPurpose[];
|
|
56
56
|
export declare class ModelRegistry {
|
|
57
57
|
private keyPool;
|
|
58
|
-
private
|
|
59
|
-
private providerVariantResolver;
|
|
58
|
+
private providerCatalog;
|
|
60
59
|
private models;
|
|
61
60
|
private modelEnabledOverrides;
|
|
62
61
|
private bindings;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type ProviderVariantCapability } from "@xiaozhiclaw/provider-core";
|
|
2
|
+
export type RuntimeProviderVariantCapability = ProviderVariantCapability;
|
|
3
|
+
export interface RuntimeProviderCatalogProvider {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
transport: string;
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
defaultModel?: string;
|
|
9
|
+
group?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface RuntimeProviderCatalogModel {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
aliases?: string[];
|
|
15
|
+
contextWindow?: number;
|
|
16
|
+
maxOutput?: number;
|
|
17
|
+
streamRequired?: boolean;
|
|
18
|
+
toolCall?: boolean;
|
|
19
|
+
reasoning?: boolean;
|
|
20
|
+
vision?: boolean;
|
|
21
|
+
mediaType?: string;
|
|
22
|
+
costInput?: number;
|
|
23
|
+
costOutput?: number;
|
|
24
|
+
costCacheRead?: number;
|
|
25
|
+
costCacheWrite?: number;
|
|
26
|
+
pricing?: Record<string, unknown>;
|
|
27
|
+
}
|
|
28
|
+
export interface RuntimeProviderVariantResolutionInput {
|
|
29
|
+
publicModel: string;
|
|
30
|
+
requestedProtocol?: "openai-chat" | "openai-responses" | "anthropic-messages" | "volcengine-responses";
|
|
31
|
+
capabilities: RuntimeProviderVariantCapability[];
|
|
32
|
+
purpose: string;
|
|
33
|
+
userPreference?: {
|
|
34
|
+
providerIds?: string[];
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export interface RuntimeProviderVariantResolution {
|
|
38
|
+
provider: string;
|
|
39
|
+
nativeModelId: string;
|
|
40
|
+
}
|
|
41
|
+
export declare class ProviderCatalogAdapter {
|
|
42
|
+
private readonly registry;
|
|
43
|
+
private readonly resolver;
|
|
44
|
+
getProvider(providerId: string): RuntimeProviderCatalogProvider | undefined;
|
|
45
|
+
listProviders(): RuntimeProviderCatalogProvider[];
|
|
46
|
+
listModels(providerId: string): RuntimeProviderCatalogModel[];
|
|
47
|
+
resolveBest(input: RuntimeProviderVariantResolutionInput): RuntimeProviderVariantResolution | undefined;
|
|
48
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* 1. Per-task token budget (from TaskStateBase.tokenBudget)
|
|
6
6
|
* 2. Session-level aggregate budget (all tasks combined)
|
|
7
7
|
* 3. Budget continuation messages (CC tokenBudget.ts pattern)
|
|
8
|
-
* 4. Graceful degradation (warn
|
|
8
|
+
* 4. Graceful degradation (warn -> force-stop, never hard-crash)
|
|
9
9
|
*
|
|
10
10
|
* CC reference: utils/tokenBudget.ts, main.tsxmax-budget-usd /task-budget
|
|
11
11
|
*
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { HookRegistry } from "../../contracts/hooks.js";
|
|
2
|
+
import type { OpenAiToolCall } from "./tool-call-contracts.js";
|
|
3
|
+
import type { AgentLogger, ToolDefinition, ToolInvoker } from "./agent-execution-contracts.js";
|
|
4
|
+
export interface RecallCategoryHint {
|
|
5
|
+
preferred: string[];
|
|
6
|
+
deprioritized: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface RuntimeCompressibleMessage {
|
|
9
|
+
role: string;
|
|
10
|
+
content?: string | unknown;
|
|
11
|
+
}
|
|
12
|
+
export interface RuntimeCompressionResult {
|
|
13
|
+
messages: RuntimeCompressibleMessage[];
|
|
14
|
+
droppedCount: number;
|
|
15
|
+
tokensFreed?: number;
|
|
16
|
+
strategy: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ToolExecutionResultPort {
|
|
19
|
+
callId: string;
|
|
20
|
+
toolName: string;
|
|
21
|
+
ok: boolean;
|
|
22
|
+
error?: string;
|
|
23
|
+
blocked?: boolean;
|
|
24
|
+
blockReason?: string;
|
|
25
|
+
durationMs?: number;
|
|
26
|
+
details?: Record<string, unknown>;
|
|
27
|
+
message: unknown;
|
|
28
|
+
}
|
|
29
|
+
export interface StreamingToolExecutorPort {
|
|
30
|
+
addTool(toolCall: OpenAiToolCall): void;
|
|
31
|
+
getRemainingResults(): AsyncIterable<ToolExecutionResultPort>;
|
|
32
|
+
}
|
|
33
|
+
export interface StreamingToolExecutorPortConfig {
|
|
34
|
+
toolInvoker: ToolInvoker;
|
|
35
|
+
hooks?: HookRegistry;
|
|
36
|
+
sessionId: string;
|
|
37
|
+
turnId: string;
|
|
38
|
+
log: AgentLogger;
|
|
39
|
+
signal?: AbortSignal;
|
|
40
|
+
maxConcurrentTools?: number;
|
|
41
|
+
}
|
|
42
|
+
export interface ContextCompressionEnginePort {
|
|
43
|
+
compressAsync(messages: RuntimeCompressibleMessage[], budget: number, context: {
|
|
44
|
+
model: string;
|
|
45
|
+
sessionId: string;
|
|
46
|
+
}): Promise<RuntimeCompressionResult>;
|
|
47
|
+
}
|
|
48
|
+
export interface ToolLoopRuntimePorts {
|
|
49
|
+
createContentReplacementState(): unknown;
|
|
50
|
+
enforceToolResultBudget(messages: Array<{
|
|
51
|
+
role: string;
|
|
52
|
+
content?: string | unknown;
|
|
53
|
+
tool_call_id?: string;
|
|
54
|
+
}>, state: unknown, sessionId: string): Promise<{
|
|
55
|
+
messages: unknown[];
|
|
56
|
+
newlyReplacedCount: number;
|
|
57
|
+
}>;
|
|
58
|
+
getActiveContextCompressionEngine(): ContextCompressionEnginePort | null;
|
|
59
|
+
compressMessages(messages: RuntimeCompressibleMessage[], options: {
|
|
60
|
+
budget: number;
|
|
61
|
+
model: string;
|
|
62
|
+
}): RuntimeCompressionResult;
|
|
63
|
+
getBudgetContinuationMessage(usagePct: number, totalUsed: number, tokenBudget: number): string;
|
|
64
|
+
createStreamingToolExecutor(config: StreamingToolExecutorPortConfig): StreamingToolExecutorPort;
|
|
65
|
+
resolveToolEligibility(tools: ToolDefinition[], context: unknown): {
|
|
66
|
+
eligibleTools: ToolDefinition[];
|
|
67
|
+
blockedTools: Array<{
|
|
68
|
+
toolName: string;
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export interface AgentRuntimePorts {
|
|
73
|
+
toolLoop: ToolLoopRuntimePorts;
|
|
74
|
+
detectRecallCategories(query: string): RecallCategoryHint;
|
|
75
|
+
resolveModelForPurpose(purpose: "smallModel" | string): string | null;
|
|
76
|
+
}
|