@tencent-ai/agent-sdk 0.3.252 → 0.3.253
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/cli/CHANGELOG.md +22 -0
- package/cli/dist/codebuddy-headless.js +73 -58
- package/cli/dist/codebuddy-lite-wb.mjs +96 -81
- package/cli/dist/lazy/{427.68132a34.js → 427.74b982af.js} +4 -4
- package/cli/dist/lazy-headless/{834.391fb41e.js → 834.3b674e07.js} +9 -9
- package/cli/dist-server/3556.codebuddy.js +1 -1
- package/cli/dist-server/6037.codebuddy.js +1 -1
- package/cli/dist-server/6784.codebuddy.js +1 -1
- package/cli/dist-server/codebuddy.js +45 -30
- package/cli/dist-server/types/node/agent/openai-agents-types.d.ts +5 -5
- package/cli/dist-server/types/node/mcp/mcp-sdk-values.d.ts +1 -1
- package/cli/dist-server/types/node/model/model-provider.d.ts +3 -1
- package/cli/dist-server/types/node/tools/a2a-get-task-tool.d.ts +139 -34
- package/cli/dist-server/types/node/tools/a2a-poll-retry.d.ts +46 -0
- package/cli/package.json +1 -1
- package/cli/product.cloudhosted.json +2 -2
- package/cli/product.internal.json +2 -2
- package/cli/product.ioa.json +2 -2
- package/cli/product.json +4 -4
- package/cli/product.selfhosted.json +2 -2
- package/package.json +1 -1
- package/cli/dist-server/types/node/acp/acp-view-rewind-to.d.ts +0 -34
- package/cli/dist-server/types/node/acp/acp-web-ui-client.d.ts +0 -22
- package/cli/dist-server/types/node/acp/usage-by-category-calculator.d.ts +0 -45
- package/cli/dist-server/types/node/acp/usage-by-category-char-weight.d.ts +0 -9
- package/cli/dist-server/types/node/acp/usage-by-category-distribute.d.ts +0 -6
- package/cli/dist-server/types/node/acp/usage-by-category-tools-split.d.ts +0 -11
- package/cli/dist-server/types/node/agent-home/agent-home-envelope-body.d.ts +0 -54
- package/cli/dist-server/types/node/agent-home/agent-home-inbox-events.d.ts +0 -14
- package/cli/dist-server/types/node/agent-home/agent-home-room-contacts.d.ts +0 -30
- package/cli/dist-server/types/node/agent-team/permission-bridge-client.d.ts +0 -32
- package/cli/dist-server/types/node/agent-team/permission-bridge-protocol.d.ts +0 -47
- package/cli/dist-server/types/node/agent-view/handoff-policy.d.ts +0 -80
- package/cli/dist-server/types/node/agent-view/job-respawn-prefs.d.ts +0 -12
- package/cli/dist-server/types/node/agent-view/session-handoff.d.ts +0 -161
- package/cli/dist-server/types/node/ask/index.d.ts +0 -3
- package/cli/dist-server/types/node/bash-sandbox/bash-sandbox-manager.d.ts +0 -125
- package/cli/dist-server/types/node/bash-sandbox/legacy-sandbox-shell-service.d.ts +0 -33
- package/cli/dist-server/types/node/bash-sandbox/managed-security-policy.d.ts +0 -6
- package/cli/dist-server/types/node/bash-sandbox/workbuddy-directory-protection.d.ts +0 -12
- package/cli/dist-server/types/node/checkpoint/checkpoint-service.d.ts +0 -70
- package/cli/dist-server/types/node/checkpoint/file-changes-controller.d.ts +0 -29
- package/cli/dist-server/types/node/checkpoint/file-track-service.d.ts +0 -11
- package/cli/dist-server/types/node/checkpoint/file-version-manager.d.ts +0 -10
- package/cli/dist-server/types/node/checkpoint/file-version-store.d.ts +0 -9
- package/cli/dist-server/types/node/checkpoint/file-version-update-strategies.d.ts +0 -62
- package/cli/dist-server/types/node/command/add-dir-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/agents-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/auto-compact-command-executor.d.ts +0 -20
- package/cli/dist-server/types/node/command/background-command-executor.d.ts +0 -29
- package/cli/dist-server/types/node/command/btw-command-executor.d.ts +0 -19
- package/cli/dist-server/types/node/command/clear-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/config-command-executor.d.ts +0 -15
- package/cli/dist-server/types/node/command/context-command-executor.d.ts +0 -42
- package/cli/dist-server/types/node/command/copy-command-executor.d.ts +0 -10
- package/cli/dist-server/types/node/command/cost-command-executor.d.ts +0 -13
- package/cli/dist-server/types/node/command/debug-command-executor.d.ts +0 -15
- package/cli/dist-server/types/node/command/deep-research-command-executor.d.ts +0 -25
- package/cli/dist-server/types/node/command/doctor-command-executor.d.ts +0 -7
- package/cli/dist-server/types/node/command/effort-command-executor.d.ts +0 -46
- package/cli/dist-server/types/node/command/exit-command-executor.d.ts +0 -14
- package/cli/dist-server/types/node/command/export-command-executor.d.ts +0 -7
- package/cli/dist-server/types/node/command/feedback-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/fork-bg-command-executor.d.ts +0 -30
- package/cli/dist-server/types/node/command/fork-command-executor.d.ts +0 -28
- package/cli/dist-server/types/node/command/goal-command-executor.d.ts +0 -50
- package/cli/dist-server/types/node/command/handoff-message-adapter.d.ts +0 -9
- package/cli/dist-server/types/node/command/help-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/hooks-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/ide-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/mcp-command-executor.d.ts +0 -15
- package/cli/dist-server/types/node/command/memory-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/mode-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/model-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/model-image-to-image-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/model-image-to-video-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/model-lite-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/model-reasoning-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/model-text-to-image-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/model-text-to-video-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/multitask-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/permissions-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/plan-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/plugin-command-executor.d.ts +0 -25
- package/cli/dist-server/types/node/command/plugin-validate-command-executor.d.ts +0 -21
- package/cli/dist-server/types/node/command/release-notes-command-executor.d.ts +0 -18
- package/cli/dist-server/types/node/command/reload-plugins-command-executor.d.ts +0 -24
- package/cli/dist-server/types/node/command/remote-control-command-executor.d.ts +0 -44
- package/cli/dist-server/types/node/command/rename-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/reset-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/resume-command-executor.d.ts +0 -21
- package/cli/dist-server/types/node/command/rewind-command-executor.d.ts +0 -10
- package/cli/dist-server/types/node/command/sandbox-command-executor.d.ts +0 -20
- package/cli/dist-server/types/node/command/save-workflow-command-executor.d.ts +0 -43
- package/cli/dist-server/types/node/command/session-reset-notifier.d.ts +0 -23
- package/cli/dist-server/types/node/command/skills-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/stats-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/status-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/tasks-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/terminal-setup-command-executor.d.ts +0 -7
- package/cli/dist-server/types/node/command/theme-command-executor.d.ts +0 -7
- package/cli/dist-server/types/node/command/todos-command-executor.d.ts +0 -16
- package/cli/dist-server/types/node/command/upgrade-command-executor.d.ts +0 -13
- package/cli/dist-server/types/node/command/vim-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/workflows-command-executor.d.ts +0 -26
- package/cli/dist-server/types/node/feedback/feedback-protocol.d.ts +0 -32
- package/cli/dist-server/types/node/feedback/feedback-service.d.ts +0 -19
- package/cli/dist-server/types/node/feedback/index.d.ts +0 -2
- package/cli/dist-server/types/node/goal/goal-policy.d.ts +0 -55
- package/cli/dist-server/types/node/goal/goal-protocol.d.ts +0 -178
- package/cli/dist-server/types/node/goal/goal-service.d.ts +0 -201
- package/cli/dist-server/types/node/goal/goal-session-start-hook.d.ts +0 -24
- package/cli/dist-server/types/node/hooks/parse-frontmatter-hooks.d.ts +0 -42
- package/cli/dist-server/types/node/install/index.d.ts +0 -6
- package/cli/dist-server/types/node/install/install-controller.d.ts +0 -15
- package/cli/dist-server/types/node/install/install-env.d.ts +0 -12
- package/cli/dist-server/types/node/install/install-errors.d.ts +0 -46
- package/cli/dist-server/types/node/install/install-protocol.d.ts +0 -83
- package/cli/dist-server/types/node/install/install-service.d.ts +0 -36
- package/cli/dist-server/types/node/install/install-utils.d.ts +0 -7
- package/cli/dist-server/types/node/install/releases-service.d.ts +0 -18
- package/cli/dist-server/types/node/install/shell-setup.d.ts +0 -36
- package/cli/dist-server/types/node/mcp/mcp-cancellation.d.ts +0 -65
- package/cli/dist-server/types/node/mcp/mcp-controller.d.ts +0 -56
- package/cli/dist-server/types/node/mcp/mcp-model-id-header-helper.d.ts +0 -12
- package/cli/dist-server/types/node/mcp/mcp-oauth-callback-html.d.ts +0 -6
- package/cli/dist-server/types/node/mcp/mcp-oauth-controller.d.ts +0 -26
- package/cli/dist-server/types/node/mcp/mcp-output-storage.d.ts +0 -57
- package/cli/dist-server/types/node/mcp/mcp-server-override-impl.d.ts +0 -136
- package/cli/dist-server/types/node/mcp/mcp-server-override.d.ts +0 -29
- package/cli/dist-server/types/node/mcp/mcp-tool-result-sideband.d.ts +0 -26
- package/cli/dist-server/types/node/mcp/mcp-validate-middleware.d.ts +0 -25
- package/cli/dist-server/types/node/mcp/models/mcp-server.d.ts +0 -18
- package/cli/dist-server/types/node/mcp/node-websocket-transport.d.ts +0 -38
- package/cli/dist-server/types/node/mcp/official-mcp-egress-policy.d.ts +0 -17
- package/cli/dist-server/types/node/mcp/sdk-mcp-server.d.ts +0 -143
- package/cli/dist-server/types/node/mcp/sdk-mcp-transport.d.ts +0 -97
- package/cli/dist-server/types/node/message-queue/followup-queue.d.ts +0 -35
- package/cli/dist-server/types/node/message-queue/index.d.ts +0 -11
- package/cli/dist-server/types/node/plugins/concurrency.d.ts +0 -1
- package/cli/dist-server/types/node/plugins/dependency-resolver.d.ts +0 -43
- package/cli/dist-server/types/node/plugins/directory-plugin-cache-projection.d.ts +0 -2
- package/cli/dist-server/types/node/plugins/guards/index.d.ts +0 -2
- package/cli/dist-server/types/node/plugins/guards/weixinpay-integrity-guard.d.ts +0 -15
- package/cli/dist-server/types/node/plugins/installers/git-plugin-installer.d.ts +0 -42
- package/cli/dist-server/types/node/plugins/installers/git-subdir-plugin-installer.d.ts +0 -19
- package/cli/dist-server/types/node/plugins/installers/index.d.ts +0 -4
- package/cli/dist-server/types/node/plugins/installers/local-plugin-installer.d.ts +0 -40
- package/cli/dist-server/types/node/plugins/installers/npm-plugin-installer.d.ts +0 -23
- package/cli/dist-server/types/node/plugins/loaders/agent-loader.d.ts +0 -43
- package/cli/dist-server/types/node/plugins/loaders/command-loader.d.ts +0 -37
- package/cli/dist-server/types/node/plugins/loaders/hook-loader.d.ts +0 -55
- package/cli/dist-server/types/node/plugins/loaders/index.d.ts +0 -8
- package/cli/dist-server/types/node/plugins/loaders/lsp-loader.d.ts +0 -47
- package/cli/dist-server/types/node/plugins/loaders/mcp-loader.d.ts +0 -75
- package/cli/dist-server/types/node/plugins/loaders/output-style-loader.d.ts +0 -49
- package/cli/dist-server/types/node/plugins/loaders/plugin-loader-manager.d.ts +0 -49
- package/cli/dist-server/types/node/plugins/loaders/skill-loader.d.ts +0 -45
- package/cli/dist-server/types/node/plugins/marketplace-name-validator.d.ts +0 -50
- package/cli/dist-server/types/node/plugins/marketplace-path-safety.d.ts +0 -86
- package/cli/dist-server/types/node/plugins/marketplaces/base-marketplace.d.ts +0 -43
- package/cli/dist-server/types/node/plugins/marketplaces/builtin-marketplace-provider.d.ts +0 -22
- package/cli/dist-server/types/node/plugins/marketplaces/directory-marketplace.d.ts +0 -19
- package/cli/dist-server/types/node/plugins/marketplaces/git-availability-detector.d.ts +0 -62
- package/cli/dist-server/types/node/plugins/marketplaces/git-fallback-coordinator.d.ts +0 -42
- package/cli/dist-server/types/node/plugins/marketplaces/git-to-zip-url-converter.d.ts +0 -50
- package/cli/dist-server/types/node/plugins/marketplaces/github-marketplace.d.ts +0 -41
- package/cli/dist-server/types/node/plugins/marketplaces/http-marketplace.d.ts +0 -47
- package/cli/dist-server/types/node/plugins/marketplaces/index.d.ts +0 -13
- package/cli/dist-server/types/node/plugins/marketplaces/marketplace-config-manager.d.ts +0 -39
- package/cli/dist-server/types/node/plugins/marketplaces/marketplace-factory.d.ts +0 -11
- package/cli/dist-server/types/node/plugins/marketplaces/marketplace-storage.d.ts +0 -141
- package/cli/dist-server/types/node/plugins/marketplaces/marketplace-update-checker.d.ts +0 -38
- package/cli/dist-server/types/node/plugins/marketplaces/workspace-project-root.d.ts +0 -14
- package/cli/dist-server/types/node/plugins/marketplaces/zip-marketplace.d.ts +0 -134
- package/cli/dist-server/types/node/plugins/mcpb-handler.d.ts +0 -29
- package/cli/dist-server/types/node/plugins/plugin-controller.d.ts +0 -75
- package/cli/dist-server/types/node/plugins/plugin-error-collector.d.ts +0 -17
- package/cli/dist-server/types/node/plugins/plugin-install-stats-service.d.ts +0 -20
- package/cli/dist-server/types/node/plugins/plugin-manager.d.ts +0 -692
- package/cli/dist-server/types/node/plugins/plugin-policy-service.d.ts +0 -53
- package/cli/dist-server/types/node/plugins/plugin-validator.d.ts +0 -48
- package/cli/dist-server/types/node/plugins/zip-utils.d.ts +0 -93
- package/cli/dist-server/types/node/remote-control/clients/liveness-watchdog.d.ts +0 -56
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-activity.d.ts +0 -23
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-auth.d.ts +0 -64
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-client-factory.d.ts +0 -47
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-client.d.ts +0 -191
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-inbound.d.ts +0 -7
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-interaction.d.ts +0 -142
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-live.d.ts +0 -78
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-media.d.ts +0 -35
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-qr-bind.d.ts +0 -49
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-respond-queue.d.ts +0 -33
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-types.d.ts +0 -207
- package/cli/dist-server/types/node/remote-control/remote-control-protocol.d.ts +0 -288
- package/cli/dist-server/types/node/remote-gateway/gateway-protocol.d.ts +0 -502
- package/cli/dist-server/types/node/remote-gateway/utils/qrcode-utils.d.ts +0 -16
- package/cli/dist-server/types/node/session/session-preview-utils.d.ts +0 -30
- package/cli/dist-server/types/node/settings/model-setting-utils.d.ts +0 -2
- package/cli/dist-server/types/node/tool-control/tool-control-policy.d.ts +0 -35
- package/cli/dist-server/types/node/tools/auto-mode/auto-mode-critique-client.d.ts +0 -51
- package/cli/dist-server/types/node/tools/auto-mode/auto-mode-strategy.d.ts +0 -19
- package/cli/dist-server/types/node/utils/add-dir-utils.d.ts +0 -20
- package/cli/dist-server/types/node/utils/compress-path.source.d.ts +0 -59
- package/cli/dist-server/types/node/vim/index.d.ts +0 -2
- package/cli/dist-server/types/node/vim/vim-manager.d.ts +0 -12
- package/cli/dist-server/types/node/vim/vim-protocol.d.ts +0 -24
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { CustomError } from '@celljs/core';
|
|
2
|
-
/**
|
|
3
|
-
* Custom error types for installation process
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Base class for all installation errors
|
|
7
|
-
*/
|
|
8
|
-
export declare class InstallError extends CustomError {
|
|
9
|
-
constructor(message: string);
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Network-related errors (download failures, timeouts, DNS errors)
|
|
13
|
-
*/
|
|
14
|
-
export declare class NetworkError extends InstallError {
|
|
15
|
-
constructor(message?: string);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Permission errors (EACCES, insufficient privileges)
|
|
19
|
-
*/
|
|
20
|
-
export declare class PermissionError extends InstallError {
|
|
21
|
-
constructor(message?: string);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Disk space errors (ENOSPC)
|
|
25
|
-
*/
|
|
26
|
-
export declare class DiskSpaceError extends InstallError {
|
|
27
|
-
constructor(message?: string);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* File system errors (file not found, directory not found)
|
|
31
|
-
*/
|
|
32
|
-
export declare class FileSystemError extends InstallError {
|
|
33
|
-
constructor(message?: string);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Version-related errors (version fetch, invalid version)
|
|
37
|
-
*/
|
|
38
|
-
export declare class VersionError extends InstallError {
|
|
39
|
-
constructor(message: string);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Archive extraction errors (corrupted archives, extraction failures)
|
|
43
|
-
*/
|
|
44
|
-
export declare class ExtractionError extends InstallError {
|
|
45
|
-
constructor(message?: string);
|
|
46
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import type { Event } from '@celljs/core';
|
|
2
|
-
import type { FileSystem } from '@genie/runtime';
|
|
3
|
-
import type { Installation, PackageManager } from '../utils/installation-utils';
|
|
4
|
-
export type { Installation, PackageManager };
|
|
5
|
-
export declare const ReleasesService: unique symbol;
|
|
6
|
-
export interface ReleasesService {
|
|
7
|
-
getLatestVersion(): Promise<string>;
|
|
8
|
-
getDownloadUrl(version: string, os: {
|
|
9
|
-
platform: () => NodeJS.Platform;
|
|
10
|
-
arch: () => NodeJS.Architecture;
|
|
11
|
-
}): string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Progress events emitted during installation
|
|
15
|
-
*/
|
|
16
|
-
export type InstallProgressEvent = {
|
|
17
|
-
type: 'start';
|
|
18
|
-
version: string;
|
|
19
|
-
} | {
|
|
20
|
-
type: 'downloading';
|
|
21
|
-
url: string;
|
|
22
|
-
} | {
|
|
23
|
-
type: 'extracting';
|
|
24
|
-
destination: string;
|
|
25
|
-
skipped?: boolean;
|
|
26
|
-
} | {
|
|
27
|
-
type: 'installing';
|
|
28
|
-
location: string;
|
|
29
|
-
displayLocation: string;
|
|
30
|
-
};
|
|
31
|
-
export declare const InstallEnvironment: unique symbol;
|
|
32
|
-
export interface InstallEnvironment {
|
|
33
|
-
fs: FileSystem;
|
|
34
|
-
platform(): NodeJS.Platform;
|
|
35
|
-
arch(): NodeJS.Architecture;
|
|
36
|
-
homedir(): string;
|
|
37
|
-
versiondir(app: string): string;
|
|
38
|
-
bindir(app: string): string;
|
|
39
|
-
findCmd(cmd: string): Promise<string | undefined>;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* PATH status after installation
|
|
43
|
-
*/
|
|
44
|
-
export type PathStatus = {
|
|
45
|
-
type: 'in-path';
|
|
46
|
-
} | {
|
|
47
|
-
type: 'needs-refresh';
|
|
48
|
-
commands: string[];
|
|
49
|
-
} | {
|
|
50
|
-
type: 'needs-setup';
|
|
51
|
-
commands: string[];
|
|
52
|
-
};
|
|
53
|
-
export interface InstallOptions {
|
|
54
|
-
target?: string;
|
|
55
|
-
force?: boolean;
|
|
56
|
-
silent?: boolean;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Result of installation operation
|
|
60
|
-
*/
|
|
61
|
-
export interface InstallResult {
|
|
62
|
-
success: boolean;
|
|
63
|
-
version?: string;
|
|
64
|
-
location?: string;
|
|
65
|
-
displayLocation?: string;
|
|
66
|
-
pathStatus?: PathStatus;
|
|
67
|
-
error?: string;
|
|
68
|
-
}
|
|
69
|
-
export declare const InstallService: unique symbol;
|
|
70
|
-
export interface InstallService {
|
|
71
|
-
readonly binary: string;
|
|
72
|
-
readonly onProgress: Event<InstallProgressEvent>;
|
|
73
|
-
install(options?: InstallOptions): Promise<InstallResult>;
|
|
74
|
-
currentInstallation(): Promise<Installation>;
|
|
75
|
-
}
|
|
76
|
-
export type MaybePromise<T> = Promise<T> | T;
|
|
77
|
-
export declare const ShellSetup: unique symbol;
|
|
78
|
-
export interface ShellSetup {
|
|
79
|
-
readonly name: string;
|
|
80
|
-
exists(env: InstallEnvironment): MaybePromise<boolean>;
|
|
81
|
-
envScript(env: InstallEnvironment, bindir: string): string;
|
|
82
|
-
setup(env: InstallEnvironment, bindir: string): MaybePromise<void>;
|
|
83
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ConsoleManager } from '../console';
|
|
2
|
-
import { type Installation } from '../utils/installation-utils';
|
|
3
|
-
import type { InstallOptions, InstallProgressEvent, InstallResult } from './install-protocol';
|
|
4
|
-
import { InstallEnvironment, InstallService, ReleasesService, ShellSetup } from './install-protocol';
|
|
5
|
-
export declare class InstallServiceImpl implements InstallService {
|
|
6
|
-
protected readonly env: InstallEnvironment;
|
|
7
|
-
protected readonly releases: ReleasesService;
|
|
8
|
-
protected readonly shellSetups: ShellSetup[];
|
|
9
|
-
protected readonly consoleManager: ConsoleManager;
|
|
10
|
-
private readonly onProgressEmitter;
|
|
11
|
-
readonly onProgress: import("@celljs/core").Event<InstallProgressEvent>;
|
|
12
|
-
private pathWasAutoSetup;
|
|
13
|
-
get binary(): string;
|
|
14
|
-
get binaryExe(): string;
|
|
15
|
-
get productName(): string;
|
|
16
|
-
get packageName(): string;
|
|
17
|
-
install(options?: InstallOptions): Promise<InstallResult>;
|
|
18
|
-
currentInstallation(): Promise<Installation>;
|
|
19
|
-
private fetchVersion;
|
|
20
|
-
private downloadAndExtract;
|
|
21
|
-
private installBins;
|
|
22
|
-
private handleInstallError;
|
|
23
|
-
private getErrorMessage;
|
|
24
|
-
private getDisplayLocation;
|
|
25
|
-
private trySetupPath;
|
|
26
|
-
private setupPathUnix;
|
|
27
|
-
private setupPathWindows;
|
|
28
|
-
private getPathStatus;
|
|
29
|
-
private isBinaryInPath;
|
|
30
|
-
private getRefreshCommands;
|
|
31
|
-
private getSetupCommands;
|
|
32
|
-
/**
|
|
33
|
-
* Remove old versions to save disk space, keeping the most recent ones
|
|
34
|
-
*/
|
|
35
|
-
private pruneOldVersions;
|
|
36
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Writable } from 'node:stream';
|
|
2
|
-
import { FileSystem } from '@genie/runtime';
|
|
3
|
-
export declare function extractTo(fs: FileSystem, path: string): Writable;
|
|
4
|
-
export declare function unzipTo(fs: FileSystem, path: string): Writable;
|
|
5
|
-
export declare function ensure(fs: FileSystem, ...paths: string[]): Promise<string>;
|
|
6
|
-
export declare function linkOrCopyFile(fs: FileSystem, src: string, dest: string): Promise<void>;
|
|
7
|
-
export declare function makeExecutable(fs: FileSystem, path: string): Promise<void>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ReleasesService } from './install-protocol';
|
|
2
|
-
interface ReleasesConfig {
|
|
3
|
-
packageName: string;
|
|
4
|
-
baseUrl: string;
|
|
5
|
-
filenamePattern?: (platform: string, arch: string) => string;
|
|
6
|
-
}
|
|
7
|
-
export declare class ReleasesServiceImpl implements ReleasesService {
|
|
8
|
-
config: ReleasesConfig;
|
|
9
|
-
/** Fetches latest version from {baseUrl}/latest */
|
|
10
|
-
getLatestVersion(): Promise<string>;
|
|
11
|
-
/** Returns download URL for the release artifact */
|
|
12
|
-
getDownloadUrl(version: string, os: {
|
|
13
|
-
platform: () => NodeJS.Platform;
|
|
14
|
-
arch: () => NodeJS.Architecture;
|
|
15
|
-
}): string;
|
|
16
|
-
static defaultFilenamePattern(packageName: string, platform: string, arch: string): string;
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type InstallEnvironment, ShellSetup } from './install-protocol';
|
|
2
|
-
export declare class PosixSetup implements ShellSetup {
|
|
3
|
-
get name(): string;
|
|
4
|
-
exists(): boolean;
|
|
5
|
-
rcfiles(env: InstallEnvironment): string[];
|
|
6
|
-
rcsToUpdate(env: InstallEnvironment): string[];
|
|
7
|
-
envScript(env: InstallEnvironment, bindir: string): string;
|
|
8
|
-
setup(env: InstallEnvironment, bindir: string): Promise<void>;
|
|
9
|
-
}
|
|
10
|
-
export declare class BashSetup implements ShellSetup {
|
|
11
|
-
get name(): string;
|
|
12
|
-
exists(env: InstallEnvironment): Promise<boolean>;
|
|
13
|
-
rcfiles(env: InstallEnvironment): string[];
|
|
14
|
-
rcsToUpdate(env: InstallEnvironment): Promise<string[]>;
|
|
15
|
-
envScript(env: InstallEnvironment, bindir: string): string;
|
|
16
|
-
setup(env: InstallEnvironment, bindir: string): Promise<void>;
|
|
17
|
-
}
|
|
18
|
-
export declare class ZshSetup implements ShellSetup {
|
|
19
|
-
get name(): string;
|
|
20
|
-
exists(env: InstallEnvironment): Promise<boolean>;
|
|
21
|
-
private getZshDotDir;
|
|
22
|
-
rcfiles(env: InstallEnvironment): Promise<string[]>;
|
|
23
|
-
rcsToUpdate(env: InstallEnvironment): Promise<string[]>;
|
|
24
|
-
envScript(env: InstallEnvironment, bindir: string): string;
|
|
25
|
-
setup(env: InstallEnvironment, bindir: string): Promise<void>;
|
|
26
|
-
}
|
|
27
|
-
export declare class FishSetup implements ShellSetup {
|
|
28
|
-
get name(): string;
|
|
29
|
-
exists(env: InstallEnvironment): Promise<boolean>;
|
|
30
|
-
envScript(env: InstallEnvironment, bindir: string): string;
|
|
31
|
-
setup(env: InstallEnvironment, bindir: string): Promise<void>;
|
|
32
|
-
}
|
|
33
|
-
export declare function filterAsync<T>(arr: T[], pred: (v: T) => Promise<boolean>): Promise<T[]>;
|
|
34
|
-
export declare function shellEnvContains(shellName: string): boolean;
|
|
35
|
-
export declare function portablePath(env: InstallEnvironment, path: string): string;
|
|
36
|
-
export declare function getCurrentShellRcFiles(env: InstallEnvironment): Promise<string[]>;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 客户端侧的 MCP 请求取消(`notifications/cancelled`)。
|
|
3
|
-
*
|
|
4
|
-
* MCP 规范:客户端放弃一个已发出的请求时 SHOULD 向 server 发
|
|
5
|
-
* `notifications/cancelled { requestId, reason }`,让 server 有机会终止底层工作
|
|
6
|
-
* (杀子进程、断上游 HTTP、停轮询),而不是把结果算完再交给一个没人接的连接。
|
|
7
|
-
*
|
|
8
|
-
* 发送侧在 `@modelcontextprotocol/sdk` 里已经实现好了:`Protocol.request` 只要
|
|
9
|
-
* 拿到 `RequestOptions.signal`,signal abort 时就会自动发出该通知并 reject 本地
|
|
10
|
-
* Promise(见 SDK `shared/protocol.ts` 的 `cancel()`)。`mcp-server-override` 的
|
|
11
|
-
* `__signal` sideband 也早就把 meta 接到了 `RequestOptions.signal` 上。
|
|
12
|
-
*
|
|
13
|
-
* 缺的只是「谁来喂这个 signal」:此前只有微信支付长轮询显式传 `__signal`,
|
|
14
|
-
* 普通 MCP 工具调用一律不传 —— 用户按停止 / 新一轮取代旧一轮时,在途的
|
|
15
|
-
* `tools/call` 只是被本地静默丢弃,server 侧仍然跑到底。本模块把
|
|
16
|
-
* 「本轮 run 的中断」桥成一个可以安全交给 SDK 的 signal,补上这一环。
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* `notifications/cancelled.params.reason` 的取值。
|
|
20
|
-
*
|
|
21
|
-
* SDK 用 `String(signal.reason)` 填这个字段,所以这里必须 abort 一个字符串
|
|
22
|
-
* (abort 一个 Error 会得到 `"Error: ..."` 这种带前缀的噪音文案)。
|
|
23
|
-
*/
|
|
24
|
-
export declare const MCP_CANCEL_REASON_CLIENT_STOPPED = "Client cancelled the in-flight tool call";
|
|
25
|
-
/** 本模块只需要 Session 的这两个字段,收窄依赖便于单测构造。 */
|
|
26
|
-
export interface McpCancellableSession {
|
|
27
|
-
abortSignal?: AbortSignal;
|
|
28
|
-
lastAbortReason?: 'user' | 'internal';
|
|
29
|
-
}
|
|
30
|
-
export interface McpCallCancellation {
|
|
31
|
-
/**
|
|
32
|
-
* 交给 `RequestOptions.signal` 的 signal;`undefined` 表示本次调用不接取消线。
|
|
33
|
-
*/
|
|
34
|
-
readonly signal: AbortSignal | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* 摘除挂在 `session.abortSignal` 上的监听器。幂等,**必须**在调用 settle 后执行。
|
|
37
|
-
*
|
|
38
|
-
* 一轮 run 里可能发生几十次 MCP 调用,而它们共享同一个 `session.abortSignal`;
|
|
39
|
-
* 不摘监听器会累积到 Node 的 `MaxListenersExceededWarning`(EventTarget 阈值 10)。
|
|
40
|
-
*/
|
|
41
|
-
dispose(): void;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* 为一次 MCP `tools/call` 派生取消 signal。
|
|
45
|
-
*
|
|
46
|
-
* @param explicitSignal 调用方经 `meta.__signal` 显式传入的 signal(微信支付长轮询)。
|
|
47
|
-
* 显式传入优先,原样透传,不做任何包装。
|
|
48
|
-
* @param session 当前会话;取 `abortSignal` 作为取消源。
|
|
49
|
-
*
|
|
50
|
-
* 两条刻意的保守规则:
|
|
51
|
-
*
|
|
52
|
-
* 1. **调用开始时 signal 已经 aborted → 不接线**。此时 run 早已结束,拿到的是
|
|
53
|
-
* 上一轮遗留的 controller(`createRunStartupController` 只在下一轮启动时才换新的)。
|
|
54
|
-
* 非 run 路径的调用方(`/mcp` 手动调用、mcp-ui 反向调用)会因此被误判成"已取消",
|
|
55
|
-
* 把本来能成功的调用打挂。只有「开始时 run 还活着」的在途调用才需要取消语义。
|
|
56
|
-
* 2. **`lastAbortReason === 'internal'` 时不取消**。与 BashTool 同一把尺子
|
|
57
|
-
* (见 `bash-tool.ts` 的 `onAbort`):turn 切换 / compact 这类内部流程也会 abort
|
|
58
|
-
* `session.abortSignal`,但那不代表用户要停掉这个工具。未显式标记时按 `'user'`
|
|
59
|
-
* 处理,保持既有语义。
|
|
60
|
-
*/
|
|
61
|
-
export declare function createMcpCallCancellation(explicitSignal: AbortSignal | undefined, session: McpCancellableSession | undefined): McpCallCancellation;
|
|
62
|
-
/**
|
|
63
|
-
* 该次调用是否由我们主动取消(用于把"用户取消"与"server 真失败"在埋点/日志上分开)。
|
|
64
|
-
*/
|
|
65
|
-
export declare function isMcpCallCancelled(cancellation: McpCallCancellation): boolean;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { ConsoleManager } from '../console';
|
|
2
|
-
import { McpConfig, McpConfigManager, McpConnectionManager, McpManager, McpScope, McpServerManager, McpTool, McpTransportType } from './mcp-protocol';
|
|
3
|
-
export interface McpScopeOptions {
|
|
4
|
-
scope?: McpScope;
|
|
5
|
-
}
|
|
6
|
-
export interface McpNameRequest extends McpScopeOptions {
|
|
7
|
-
name: string;
|
|
8
|
-
}
|
|
9
|
-
export interface McpServerRequestBase extends McpNameRequest {
|
|
10
|
-
args?: string[];
|
|
11
|
-
env?: string[];
|
|
12
|
-
header?: string[];
|
|
13
|
-
description?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface McpAddRequest extends McpServerRequestBase {
|
|
16
|
-
commandOrUrl: string;
|
|
17
|
-
transport: McpTransportType;
|
|
18
|
-
}
|
|
19
|
-
export interface McpUpdateRequest extends McpServerRequestBase {
|
|
20
|
-
commandOrUrl?: string;
|
|
21
|
-
transport?: McpTransportType;
|
|
22
|
-
}
|
|
23
|
-
export interface McpAddJsonRequest extends McpNameRequest {
|
|
24
|
-
json: McpConfig;
|
|
25
|
-
}
|
|
26
|
-
export declare class McpController {
|
|
27
|
-
protected readonly mcpManager: McpManager;
|
|
28
|
-
protected readonly mcpConfigManager: McpConfigManager;
|
|
29
|
-
protected readonly mcpConnectionManager: McpConnectionManager;
|
|
30
|
-
protected readonly mcpServerManager: McpServerManager;
|
|
31
|
-
protected readonly consoleManager: ConsoleManager;
|
|
32
|
-
add(request: McpAddRequest): Promise<void>;
|
|
33
|
-
remove(request: McpNameRequest): Promise<void>;
|
|
34
|
-
get(request: McpNameRequest): Promise<void>;
|
|
35
|
-
list(request: McpScopeOptions): Promise<void>;
|
|
36
|
-
addJson(request: McpAddJsonRequest): Promise<void>;
|
|
37
|
-
listTools(request: McpNameRequest): Promise<McpTool[]>;
|
|
38
|
-
/**
|
|
39
|
-
* Get MCP server connection status
|
|
40
|
-
* Used by workbuddy-desktop to poll connection state after /add
|
|
41
|
-
*/
|
|
42
|
-
status(request: McpNameRequest): Promise<{
|
|
43
|
-
name: string;
|
|
44
|
-
status: string;
|
|
45
|
-
needsAuth: boolean;
|
|
46
|
-
error?: string;
|
|
47
|
-
}>;
|
|
48
|
-
/**
|
|
49
|
-
* Get OAuth authorization URL for a server that needs authentication
|
|
50
|
-
* Used by workbuddy-desktop to open browser for OAuth
|
|
51
|
-
*/
|
|
52
|
-
oauthAuthorize(request: McpNameRequest): Promise<{
|
|
53
|
-
authorizationUrl?: string;
|
|
54
|
-
error?: string;
|
|
55
|
-
}>;
|
|
56
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 在 operation 执行期间,把 `modelId` 绑定到当前 async 作用域;
|
|
3
|
-
* 期间由该作用域内发出的任何 MCP HTTP 请求都会被自动注入 `X-Model-ID`。
|
|
4
|
-
*
|
|
5
|
-
* 当 `modelId` 缺失、或 transport 不带 HTTP fetch 钩子(如 stdio)时,
|
|
6
|
-
* 直接执行 operation 不做注入。
|
|
7
|
-
*/
|
|
8
|
-
export declare function withMcpModelIdHeader<T>(params: {
|
|
9
|
-
serverName: string;
|
|
10
|
-
transport: unknown;
|
|
11
|
-
modelId?: string;
|
|
12
|
-
}, operation: () => Promise<T>): Promise<T>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/** HTML entity escape for OAuth callback pages (text-node / quoted-attr context). */
|
|
2
|
-
export declare function escapeHtml(s: string): string;
|
|
3
|
-
/** CSP for static OAuth callback HTML (inline CSS only, no scripts). */
|
|
4
|
-
export declare const OAUTH_CALLBACK_CSP = "default-src 'none'; style-src 'unsafe-inline'; img-src 'none'; script-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'";
|
|
5
|
-
export declare function generateOAuthSuccessHtml(serverName: string, operation: 'connect' | 'authenticate'): string;
|
|
6
|
-
export declare function generateOAuthErrorHtml(errorMessage: string): string;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ConsoleManager } from '../console';
|
|
2
|
-
import { McpManager, McpOAuthManager } from './mcp-protocol';
|
|
3
|
-
export interface OAuthCallbackQuery {
|
|
4
|
-
code?: string;
|
|
5
|
-
state?: string;
|
|
6
|
-
error?: string;
|
|
7
|
-
error_description?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare class McpOAuthController {
|
|
10
|
-
protected readonly oauthManager: McpOAuthManager;
|
|
11
|
-
protected readonly mcpManager: McpManager;
|
|
12
|
-
protected readonly consoleManager: ConsoleManager;
|
|
13
|
-
/**
|
|
14
|
-
* Handle OAuth callback from authorization server
|
|
15
|
-
* It will attempt to find the server by matching the OAuth state parameter
|
|
16
|
-
*/
|
|
17
|
-
handleCallback(query: OAuthCallbackQuery): Promise<string>;
|
|
18
|
-
protected applyOAuthCallbackSecurityHeaders(): void;
|
|
19
|
-
protected processOAuthCallback(query: OAuthCallbackQuery): Promise<string>;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Legacy controller for backward compatibility with /internal/mcp/oauth/callback path
|
|
23
|
-
*/
|
|
24
|
-
export declare class McpOAuthInternalController extends McpOAuthController {
|
|
25
|
-
handleCallback(query: OAuthCallbackQuery): Promise<string>;
|
|
26
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { CallToolResultContent } from './mcp-protocol';
|
|
2
|
-
/**
|
|
3
|
-
* 计算内容的字符数(与原 checkTokenUsage 同 metric,image 块跳过)。
|
|
4
|
-
*
|
|
5
|
-
* 对非法块(字段缺失 / 类型错误)容错:按 0 处理而不是抛错,保证
|
|
6
|
-
* processMcpResult 的"永不 throw"契约不会被上游返回的异常结构打破。
|
|
7
|
-
*/
|
|
8
|
-
export declare function computeCharCount(content: CallToolResultContent): number;
|
|
9
|
-
/**
|
|
10
|
-
* 检测内容是否含 image 块。含 image 时走截断而非落盘:base64 图片 payload
|
|
11
|
-
* 写入 `.txt` 文件会丢失 UI 层的图片查看/渲染集成。cbc 不像 CC 那样会
|
|
12
|
-
* `compressImageBlock` 压缩图片塞进剩余预算——预算够则原样保留,不够则丢。
|
|
13
|
-
*/
|
|
14
|
-
export declare function contentContainsImages(content: CallToolResultContent): boolean;
|
|
15
|
-
/**
|
|
16
|
-
* 生成模型指引文本(逐字对齐 CC `getLargeOutputInstructions`)。
|
|
17
|
-
*/
|
|
18
|
-
export declare function getLargeOutputInstructions(rawOutputPath: string, contentLength: number, formatDescription: string): string;
|
|
19
|
-
/** 截断降级文案(对齐 CC `getTruncationMessage` + `truncateMcpContent`)。 */
|
|
20
|
-
export declare function getTruncationMessage(maxTokens: number): string;
|
|
21
|
-
/**
|
|
22
|
-
* 截断内容到 maxTokens*4 字符上限。
|
|
23
|
-
* - text: 切片到剩余预算
|
|
24
|
-
* - image: 整块保留(不计入预算;cbc 无压缩)
|
|
25
|
-
* - resource / resource_link / audio: 预算有剩整块保留,否则丢弃但
|
|
26
|
-
* **插入占位文本**告知模型"N 个 X 类型块因超限被丢弃"——不让降级悄无声息地丢数据
|
|
27
|
-
*/
|
|
28
|
-
export declare function truncateMcpContent(content: CallToolResultContent, maxTokens: number): CallToolResultContent;
|
|
29
|
-
/** 落盘结果 union。 */
|
|
30
|
-
export type PersistResult = {
|
|
31
|
-
filepath: string;
|
|
32
|
-
originalSize: number;
|
|
33
|
-
} | {
|
|
34
|
-
error: string;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* 把内容写入会话的 tool-results 目录。
|
|
38
|
-
* 路径规则与 `ToolResultBlobService` 一致:
|
|
39
|
-
* - 主 session: `~/.codebuddy/projects/<hash>/<sessionStoreId>/tool-results/mcp-<server>-<tool>-<ts>-<rand>.txt`
|
|
40
|
-
* - 子 agent: `~/.codebuddy/projects/<hash>/<parentSessionId>/subagents/<storeId>/tool-results/...`
|
|
41
|
-
*
|
|
42
|
-
* 文件名含 6 位随机后缀,避免同毫秒并发 call 互相覆盖。
|
|
43
|
-
*/
|
|
44
|
-
export declare function persistMcpOutput(content: CallToolResultContent, sessionStoreId: string, parentSessionId: string | undefined, serverName: string, toolName: string): Promise<PersistResult>;
|
|
45
|
-
/**
|
|
46
|
-
* 统一入口:返回替换后的 content,**永不 throw**。
|
|
47
|
-
*
|
|
48
|
-
* 决策逻辑:
|
|
49
|
-
* 1. 未超限 → 原样返回
|
|
50
|
-
* 2. env 禁用 / 含 image / 无 sessionStoreId / 落盘失败 → 截断降级
|
|
51
|
-
* 3. 否则 → 落盘,返回单条 text 指引
|
|
52
|
-
*
|
|
53
|
-
* 最外层 try/catch 兜底任何意外 throw(如 DI container 未就绪时
|
|
54
|
-
* `PathUtils.getHomeProjectDir` 抛、content 结构异常让 helper 抛等),
|
|
55
|
-
* 失败时用同步的最小截断确保模型拿到可读内容。
|
|
56
|
-
*/
|
|
57
|
-
export declare function processMcpResult(content: CallToolResultContent, maxTokens: number, serverName: string, toolName: string, sessionStoreId: string | undefined, parentSessionId: string | undefined): Promise<CallToolResultContent>;
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { MCPServerSSE, MCPServerStdio, MCPServerStreamableHttp } from '@openai/agents';
|
|
2
|
-
import { MCPServerSSE as UnderlyingMCPServerSSE, MCPServerStdio as UnderlyingMCPServerStdio, MCPServerStreamableHttp as UnderlyingMCPServerStreamableHttp } from '@openai/agents-core/_shims';
|
|
3
|
-
import { CallToolResultContent, GetPromptResult, McpPrompt, McpResource, McpResourceTemplate, MCPServer, ReadResourceResult } from './mcp-protocol';
|
|
4
|
-
import { extractMcpCallSideband } from './mcp-tool-result-sideband';
|
|
5
|
-
/**
|
|
6
|
-
* MCP progress callback and result-sideband contracts. The shared extractor is
|
|
7
|
-
* used by every transport so wire metadata stays open while all local `__*`
|
|
8
|
-
* fields are removed before serialization.
|
|
9
|
-
*/
|
|
10
|
-
export type { McpResultMetaSink, McpToolProgressCallback } from './mcp-tool-result-sideband';
|
|
11
|
-
/**
|
|
12
|
-
* The MCP SDK's Client.callTool, when handed `RequestOptions.onprogress`, automatically:
|
|
13
|
-
* 1. assigns a JSON-RPC messageId as `progressToken` in `_meta`
|
|
14
|
-
* 2. registers the callback in its `_progressHandlers` map
|
|
15
|
-
* 3. routes incoming `notifications/progress` by `progressToken` to the callback
|
|
16
|
-
* 4. cleans up after the request settles
|
|
17
|
-
*/
|
|
18
|
-
declare const extractProgressCallback: typeof extractMcpCallSideband;
|
|
19
|
-
export { extractProgressCallback };
|
|
20
|
-
/**
|
|
21
|
-
* Override MCPServerStdio to set stderr: 'ignore' when creating StdioClientTransport
|
|
22
|
-
*/
|
|
23
|
-
export declare class OverriddenUnderlyingMCPServerStdio extends UnderlyingMCPServerStdio implements MCPServer {
|
|
24
|
-
private _name;
|
|
25
|
-
private transport;
|
|
26
|
-
onToolsListChanged?: () => void;
|
|
27
|
-
connect(): Promise<void>;
|
|
28
|
-
/** Timestamp of the last listTools failure. Used to skip retries for a cooldown period. */
|
|
29
|
-
private _lastListToolsFailure;
|
|
30
|
-
listTools(): ReturnType<MCPServer['listTools']>;
|
|
31
|
-
callTool(toolName: string, args: Record<string, unknown> | null, meta?: Record<string, unknown> | null): Promise<CallToolResultContent>;
|
|
32
|
-
listPrompts(): Promise<McpPrompt[]>;
|
|
33
|
-
/**
|
|
34
|
-
* Capability declared at `initialize` and cached by the MCP client, so this
|
|
35
|
-
* is a memory read that cannot time out — see MCPServer.supportsResources.
|
|
36
|
-
*/
|
|
37
|
-
supportsResources(): boolean;
|
|
38
|
-
listResources(): Promise<McpResource[]>;
|
|
39
|
-
listResourceTemplates(): Promise<McpResourceTemplate[]>;
|
|
40
|
-
getPrompt(promptName: string, args?: Record<string, string>): Promise<GetPromptResult['messages']>;
|
|
41
|
-
readResource(request: {
|
|
42
|
-
uri: string;
|
|
43
|
-
}): Promise<ReadResourceResult['contents']>;
|
|
44
|
-
}
|
|
45
|
-
export declare class OverriddenMCPServerStdio extends MCPServerStdio implements MCPServer {
|
|
46
|
-
protected underlying: OverriddenUnderlyingMCPServerStdio;
|
|
47
|
-
constructor(params: ConstructorParameters<typeof MCPServerStdio>[0]);
|
|
48
|
-
get onToolsListChanged(): (() => void) | undefined;
|
|
49
|
-
set onToolsListChanged(callback: (() => void) | undefined);
|
|
50
|
-
connect(): Promise<void>;
|
|
51
|
-
listTools(): ReturnType<MCPServer['listTools']>;
|
|
52
|
-
listPrompts(): Promise<McpPrompt[]>;
|
|
53
|
-
supportsResources(): boolean;
|
|
54
|
-
listResources(): Promise<McpResource[]>;
|
|
55
|
-
listResourceTemplates(): Promise<McpResourceTemplate[]>;
|
|
56
|
-
getPrompt(promptName: string, args?: Record<string, string>): Promise<GetPromptResult['messages']>;
|
|
57
|
-
readResource(request: {
|
|
58
|
-
uri: string;
|
|
59
|
-
}): Promise<ReadResourceResult['contents']>;
|
|
60
|
-
}
|
|
61
|
-
export declare class OverriddenUnderlyingMCPServerSSE extends UnderlyingMCPServerSSE implements MCPServer {
|
|
62
|
-
private _name;
|
|
63
|
-
private transport;
|
|
64
|
-
onToolsListChanged?: () => void;
|
|
65
|
-
connect(): Promise<void>;
|
|
66
|
-
/** Timestamp of the last listTools failure. Used to skip retries for a cooldown period. */
|
|
67
|
-
private _lastListToolsFailure;
|
|
68
|
-
listTools(): ReturnType<MCPServer['listTools']>;
|
|
69
|
-
callTool(toolName: string, args: Record<string, unknown> | null, meta?: Record<string, unknown> | null): Promise<CallToolResultContent>;
|
|
70
|
-
listPrompts(): Promise<McpPrompt[]>;
|
|
71
|
-
/**
|
|
72
|
-
* Capability declared at `initialize` and cached by the MCP client, so this
|
|
73
|
-
* is a memory read that cannot time out — see MCPServer.supportsResources.
|
|
74
|
-
*/
|
|
75
|
-
supportsResources(): boolean;
|
|
76
|
-
listResources(): Promise<McpResource[]>;
|
|
77
|
-
listResourceTemplates(): Promise<McpResourceTemplate[]>;
|
|
78
|
-
getPrompt(promptName: string, args?: Record<string, string>): Promise<GetPromptResult['messages']>;
|
|
79
|
-
readResource(request: {
|
|
80
|
-
uri: string;
|
|
81
|
-
}): Promise<ReadResourceResult['contents']>;
|
|
82
|
-
}
|
|
83
|
-
export declare class OverriddenMCPServerSSE extends MCPServerSSE implements MCPServer {
|
|
84
|
-
protected underlying: OverriddenUnderlyingMCPServerSSE;
|
|
85
|
-
constructor(params: ConstructorParameters<typeof MCPServerSSE>[0]);
|
|
86
|
-
get onToolsListChanged(): (() => void) | undefined;
|
|
87
|
-
set onToolsListChanged(callback: (() => void) | undefined);
|
|
88
|
-
connect(): Promise<void>;
|
|
89
|
-
listTools(): ReturnType<MCPServer['listTools']>;
|
|
90
|
-
listPrompts(): Promise<McpPrompt[]>;
|
|
91
|
-
supportsResources(): boolean;
|
|
92
|
-
listResources(): Promise<McpResource[]>;
|
|
93
|
-
listResourceTemplates(): Promise<McpResourceTemplate[]>;
|
|
94
|
-
getPrompt(promptName: string, args?: Record<string, string>): Promise<GetPromptResult['messages']>;
|
|
95
|
-
readResource(request: {
|
|
96
|
-
uri: string;
|
|
97
|
-
}): Promise<ReadResourceResult['contents']>;
|
|
98
|
-
}
|
|
99
|
-
export declare class OverriddenUnderlyingMCPServerStreamableHttp extends UnderlyingMCPServerStreamableHttp implements MCPServer {
|
|
100
|
-
private _name;
|
|
101
|
-
private transport;
|
|
102
|
-
onToolsListChanged?: () => void;
|
|
103
|
-
connect(): Promise<void>;
|
|
104
|
-
/** Timestamp of the last listTools failure. Used to skip retries for a cooldown period. */
|
|
105
|
-
private _lastListToolsFailure;
|
|
106
|
-
listTools(): ReturnType<MCPServer['listTools']>;
|
|
107
|
-
callTool(toolName: string, args: Record<string, unknown> | null, meta?: Record<string, unknown> | null): Promise<CallToolResultContent>;
|
|
108
|
-
listPrompts(): Promise<McpPrompt[]>;
|
|
109
|
-
/**
|
|
110
|
-
* Capability declared at `initialize` and cached by the MCP client, so this
|
|
111
|
-
* is a memory read that cannot time out — see MCPServer.supportsResources.
|
|
112
|
-
*/
|
|
113
|
-
supportsResources(): boolean;
|
|
114
|
-
listResources(): Promise<McpResource[]>;
|
|
115
|
-
listResourceTemplates(): Promise<McpResourceTemplate[]>;
|
|
116
|
-
getPrompt(promptName: string, args?: Record<string, string>): Promise<GetPromptResult['messages']>;
|
|
117
|
-
readResource(request: {
|
|
118
|
-
uri: string;
|
|
119
|
-
}): Promise<ReadResourceResult['contents']>;
|
|
120
|
-
}
|
|
121
|
-
export declare class OverriddenMCPServerStreamableHttp extends MCPServerStreamableHttp implements MCPServer {
|
|
122
|
-
protected underlying: OverriddenUnderlyingMCPServerStreamableHttp;
|
|
123
|
-
constructor(params: ConstructorParameters<typeof MCPServerStreamableHttp>[0]);
|
|
124
|
-
get onToolsListChanged(): (() => void) | undefined;
|
|
125
|
-
set onToolsListChanged(callback: (() => void) | undefined);
|
|
126
|
-
connect(): Promise<void>;
|
|
127
|
-
listTools(): ReturnType<MCPServer['listTools']>;
|
|
128
|
-
listPrompts(): Promise<McpPrompt[]>;
|
|
129
|
-
supportsResources(): boolean;
|
|
130
|
-
listResources(): Promise<McpResource[]>;
|
|
131
|
-
listResourceTemplates(): Promise<McpResourceTemplate[]>;
|
|
132
|
-
getPrompt(promptName: string, args?: Record<string, string>): Promise<GetPromptResult['messages']>;
|
|
133
|
-
readResource(request: {
|
|
134
|
-
uri: string;
|
|
135
|
-
}): Promise<ReadResourceResult['contents']>;
|
|
136
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP server override 的 async factory shim(standby lazy 化 #107267)。
|
|
3
|
-
*
|
|
4
|
-
* ## 背景
|
|
5
|
-
*
|
|
6
|
-
* 6 个 `Overridden*` 类都 `extends` `@openai/agents` / `@openai/agents-core/_shims`
|
|
7
|
-
* 里的基类。`class X extends Y {}` 是 module-load 时求值——若 Y 走 lazy binding
|
|
8
|
-
* 会崩 `Class extends value undefined is not a constructor`。
|
|
9
|
-
*
|
|
10
|
-
* 解法:**把 subclass 定义整体挪到 `./mcp-server-override-impl.ts`**(保留原 static
|
|
11
|
-
* imports),主入口只做 async factory + `await import()`。rspack 看到 dynamic
|
|
12
|
-
* `import()` 就会把 impl 文件连同它顶层 static import 的 `@openai/agents(-core)`
|
|
13
|
-
* 一起拆到 lazy chunk。standby 期不加载 —— agent-loop / MCP connect 都在 activate
|
|
14
|
-
* 后才走到这里。
|
|
15
|
-
*
|
|
16
|
-
* ## 使用契约
|
|
17
|
-
*
|
|
18
|
-
* caller: `mcp-server-manager.ts` 3 处从 `new OverriddenMCPServer*(...)` 改为
|
|
19
|
-
* `await createOverriddenMCPServerXxx(...)`(都在 async 上下文,改动最小)。
|
|
20
|
-
* 首次调用时 impl chunk 加载并缓存;之后 O(1) 拿 factory。
|
|
21
|
-
*
|
|
22
|
-
* 类型层(`OverriddenMCPServerStdio` 等)通过 `import type` re-export,
|
|
23
|
-
* 依然可以在 caller 里作类型注解,不 pull SDK 到主 chunk。
|
|
24
|
-
*/
|
|
25
|
-
import type { OverriddenMCPServerSSE, OverriddenMCPServerStdio, OverriddenMCPServerStreamableHttp, OverriddenUnderlyingMCPServerSSE, OverriddenUnderlyingMCPServerStdio, OverriddenUnderlyingMCPServerStreamableHttp } from './mcp-server-override-impl';
|
|
26
|
-
export type { OverriddenMCPServerSSE, OverriddenMCPServerStdio, OverriddenMCPServerStreamableHttp, OverriddenUnderlyingMCPServerSSE, OverriddenUnderlyingMCPServerStdio, OverriddenUnderlyingMCPServerStreamableHttp, };
|
|
27
|
-
export declare function createOverriddenMCPServerStdio(params: ConstructorParameters<typeof import('./mcp-server-override-impl').OverriddenMCPServerStdio>[0]): Promise<OverriddenMCPServerStdio>;
|
|
28
|
-
export declare function createOverriddenMCPServerSSE(params: ConstructorParameters<typeof import('./mcp-server-override-impl').OverriddenMCPServerSSE>[0]): Promise<OverriddenMCPServerSSE>;
|
|
29
|
-
export declare function createOverriddenMCPServerStreamableHttp(params: ConstructorParameters<typeof import('./mcp-server-override-impl').OverriddenMCPServerStreamableHttp>[0]): Promise<OverriddenMCPServerStreamableHttp>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export type McpToolProgressCallback = (progress: number, total?: number, message?: string) => void;
|
|
2
|
-
export type McpResultMetaSink = (result: Record<string, unknown> & {
|
|
3
|
-
content?: unknown[];
|
|
4
|
-
structuredContent?: Record<string, unknown>;
|
|
5
|
-
_meta?: Record<string, unknown>;
|
|
6
|
-
isError?: boolean;
|
|
7
|
-
}) => void;
|
|
8
|
-
export interface McpCallSideband {
|
|
9
|
-
onProgress?: McpToolProgressCallback;
|
|
10
|
-
resultMetaSink?: McpResultMetaSink;
|
|
11
|
-
abortSignal?: AbortSignal;
|
|
12
|
-
timeoutMs?: number;
|
|
13
|
-
realMeta?: Record<string, unknown>;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Split local `__*` sideband fields from the open MCP wire metadata. Known
|
|
17
|
-
* sidebands are returned to the caller; every `__*` key is kept off the wire.
|
|
18
|
-
*/
|
|
19
|
-
export declare function extractMcpCallSideband(meta: Record<string, unknown> | null | undefined): McpCallSideband;
|
|
20
|
-
/** 保留原始未知字段,并用 schema 解析值覆盖标准字段。 */
|
|
21
|
-
export declare function emitMcpToolResultSideband(rawResponse: unknown, parsed: Record<string, unknown> & {
|
|
22
|
-
content?: unknown[];
|
|
23
|
-
structuredContent?: Record<string, unknown>;
|
|
24
|
-
_meta?: Record<string, unknown>;
|
|
25
|
-
isError?: boolean;
|
|
26
|
-
}, sink?: McpResultMetaSink): void;
|