@agentclientprotocol/claude-agent-acp 0.102.1-preview.1 → 0.102.1-preview.3
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/README.md +5 -1
- package/dist/acp-agent.d.ts +93 -622
- package/dist/acp-agent.d.ts.map +1 -1
- package/dist/acp-agent.js +369 -3474
- package/dist/acp-client.d.ts +28 -0
- package/dist/acp-client.d.ts.map +1 -0
- package/dist/acp-client.js +1 -0
- package/dist/acp-subagents.d.ts +1 -2
- package/dist/acp-subagents.d.ts.map +1 -1
- package/dist/auth-methods.d.ts +21 -0
- package/dist/auth-methods.d.ts.map +1 -0
- package/dist/auth-methods.js +68 -0
- package/dist/auth-status-reporter.d.ts +112 -0
- package/dist/auth-status-reporter.d.ts.map +1 -0
- package/dist/auth-status-reporter.js +253 -0
- package/dist/background-work.d.ts +12 -265
- package/dist/background-work.d.ts.map +1 -1
- package/dist/background-work.js +8 -558
- package/dist/client-system-prompt.d.ts +7 -0
- package/dist/client-system-prompt.d.ts.map +1 -1
- package/dist/client-system-prompt.js +24 -0
- package/dist/context-compaction.d.ts +20 -0
- package/dist/context-compaction.d.ts.map +1 -1
- package/dist/context-compaction.js +26 -0
- package/dist/context-window.d.ts +70 -0
- package/dist/context-window.d.ts.map +1 -0
- package/dist/context-window.js +132 -0
- package/dist/diff.d.ts +1 -1
- package/dist/diff.js +1 -1
- package/dist/elicitation.d.ts +66 -1
- package/dist/elicitation.d.ts.map +1 -1
- package/dist/elicitation.js +109 -0
- package/dist/file-change-audit.d.ts +4 -3
- package/dist/file-change-audit.d.ts.map +1 -1
- package/dist/file-change-audit.js +3 -2
- package/dist/lib.d.ts +5 -1
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +3 -1
- package/dist/logger.d.ts +10 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +1 -0
- package/dist/mcp-oauth.d.ts +44 -0
- package/dist/mcp-oauth.d.ts.map +1 -0
- package/dist/mcp-oauth.js +142 -0
- package/dist/mcp-servers.d.ts +10 -0
- package/dist/mcp-servers.d.ts.map +1 -0
- package/dist/mcp-servers.js +29 -0
- package/dist/message-filters.d.ts +43 -0
- package/dist/message-filters.d.ts.map +1 -0
- package/dist/message-filters.js +197 -0
- package/dist/native-subagents.d.ts +18 -8
- package/dist/native-subagents.d.ts.map +1 -1
- package/dist/native-subagents.js +7 -35
- package/dist/new-session-meta.d.ts +40 -0
- package/dist/new-session-meta.d.ts.map +1 -0
- package/dist/new-session-meta.js +1 -0
- package/dist/permissions/presentation.d.ts +29 -0
- package/dist/permissions/presentation.d.ts.map +1 -1
- package/dist/permissions/presentation.js +38 -11
- package/dist/prompt-suggestions.d.ts +29 -0
- package/dist/prompt-suggestions.d.ts.map +1 -1
- package/dist/prompt-suggestions.js +45 -0
- package/dist/prompt-to-claude.d.ts +10 -0
- package/dist/prompt-to-claude.d.ts.map +1 -0
- package/dist/prompt-to-claude.js +120 -0
- package/dist/providers.d.ts +139 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +286 -0
- package/dist/remote-control.d.ts +62 -0
- package/dist/remote-control.d.ts.map +1 -0
- package/dist/remote-control.js +78 -0
- package/dist/result-end.d.ts +68 -0
- package/dist/result-end.d.ts.map +1 -0
- package/dist/result-end.js +84 -0
- package/dist/sdk-to-acp.d.ts +93 -0
- package/dist/sdk-to-acp.d.ts.map +1 -0
- package/dist/sdk-to-acp.js +635 -0
- package/dist/serve.d.ts +9 -3
- package/dist/serve.d.ts.map +1 -1
- package/dist/serve.js +10 -5
- package/dist/session-config-ids.d.ts +1 -0
- package/dist/session-config-ids.d.ts.map +1 -1
- package/dist/session-config-ids.js +1 -0
- package/dist/session-config-options.d.ts +64 -0
- package/dist/session-config-options.d.ts.map +1 -0
- package/dist/session-config-options.js +162 -0
- package/dist/session-effort.d.ts +67 -0
- package/dist/session-effort.d.ts.map +1 -1
- package/dist/session-effort.js +98 -0
- package/dist/session-env.d.ts +22 -0
- package/dist/session-env.d.ts.map +1 -0
- package/dist/session-env.js +66 -0
- package/dist/session-fast-mode.d.ts +83 -0
- package/dist/session-fast-mode.d.ts.map +1 -0
- package/dist/session-fast-mode.js +142 -0
- package/dist/session-index/connection.d.ts +5 -6
- package/dist/session-index/connection.d.ts.map +1 -1
- package/dist/session-index/connection.js +3 -5
- package/dist/session-mode.d.ts +1 -0
- package/dist/session-mode.d.ts.map +1 -1
- package/dist/session-mode.js +1 -1
- package/dist/session-model.d.ts +41 -0
- package/dist/session-model.d.ts.map +1 -1
- package/dist/session-model.js +110 -45
- package/dist/session-notices.d.ts +44 -0
- package/dist/session-notices.d.ts.map +1 -1
- package/dist/session-notices.js +68 -0
- package/dist/session-titles.d.ts +34 -12
- package/dist/session-titles.d.ts.map +1 -1
- package/dist/session-titles.js +7 -6
- package/dist/session-usage.d.ts +125 -0
- package/dist/session-usage.d.ts.map +1 -0
- package/dist/session-usage.js +196 -0
- package/dist/slash-commands.d.ts +10 -0
- package/dist/slash-commands.d.ts.map +1 -0
- package/dist/slash-commands.js +99 -0
- package/dist/streamed-text.d.ts +33 -0
- package/dist/streamed-text.d.ts.map +1 -0
- package/dist/streamed-text.js +71 -0
- package/dist/subagent-configuration.d.ts +32 -0
- package/dist/subagent-configuration.d.ts.map +1 -0
- package/dist/subagent-configuration.js +70 -0
- package/dist/subagent-replay.d.ts +18 -0
- package/dist/subagent-replay.d.ts.map +1 -1
- package/dist/subagent-replay.js +25 -15
- package/dist/tool-calls/client-capabilities.d.ts +8 -8
- package/dist/tool-calls/client-capabilities.js +4 -4
- package/dist/tool-calls/renderer.d.ts +4 -5
- package/dist/tool-calls/renderer.d.ts.map +1 -1
- package/dist/tool-calls/renderer.js +4 -5
- package/dist/turn-events.d.ts +6 -46
- package/dist/turn-events.d.ts.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/v2/agent.d.ts +7 -11
- package/dist/v2/agent.d.ts.map +1 -1
- package/dist/v2/agent.js +751 -331
- package/dist/v2/air.d.ts +33 -0
- package/dist/v2/air.d.ts.map +1 -0
- package/dist/v2/air.js +29 -0
- package/dist/v2/auth.d.ts +97 -0
- package/dist/v2/auth.d.ts.map +1 -0
- package/dist/v2/auth.js +216 -0
- package/dist/v2/background.d.ts +27 -16
- package/dist/v2/background.d.ts.map +1 -1
- package/dist/v2/background.js +4 -32
- package/dist/v2/child-config.d.ts +55 -0
- package/dist/v2/child-config.d.ts.map +1 -0
- package/dist/v2/child-config.js +92 -0
- package/dist/v2/clear-context.d.ts +94 -0
- package/dist/v2/clear-context.d.ts.map +1 -0
- package/dist/v2/clear-context.js +176 -0
- package/dist/v2/commands.d.ts +46 -0
- package/dist/v2/commands.d.ts.map +1 -0
- package/dist/v2/commands.js +54 -0
- package/dist/v2/config.d.ts +187 -0
- package/dist/v2/config.d.ts.map +1 -0
- package/dist/v2/config.js +494 -0
- package/dist/v2/elicitation.d.ts +93 -0
- package/dist/v2/elicitation.d.ts.map +1 -0
- package/dist/v2/elicitation.js +160 -0
- package/dist/v2/file-changes.d.ts +61 -0
- package/dist/v2/file-changes.d.ts.map +1 -0
- package/dist/v2/file-changes.js +108 -0
- package/dist/v2/file-preview.d.ts +18 -0
- package/dist/v2/file-preview.d.ts.map +1 -0
- package/dist/v2/file-preview.js +29 -0
- package/dist/v2/initialize.d.ts +10 -24
- package/dist/v2/initialize.d.ts.map +1 -1
- package/dist/v2/initialize.js +4 -111
- package/dist/v2/outcome.d.ts +81 -0
- package/dist/v2/outcome.d.ts.map +1 -0
- package/dist/v2/outcome.js +166 -0
- package/dist/v2/permissions.d.ts +92 -0
- package/dist/v2/permissions.d.ts.map +1 -0
- package/dist/v2/permissions.js +162 -0
- package/dist/v2/prompt.d.ts +2 -42
- package/dist/v2/prompt.d.ts.map +1 -1
- package/dist/v2/prompt.js +2 -119
- package/dist/v2/remote-control.d.ts +41 -0
- package/dist/v2/remote-control.d.ts.map +1 -0
- package/dist/v2/remote-control.js +63 -0
- package/dist/v2/reports.d.ts +198 -0
- package/dist/v2/reports.d.ts.map +1 -0
- package/dist/v2/reports.js +487 -0
- package/dist/v2/restarts.d.ts +128 -0
- package/dist/v2/restarts.d.ts.map +1 -0
- package/dist/v2/restarts.js +348 -0
- package/dist/v2/session-requests.d.ts +20 -0
- package/dist/v2/session-requests.d.ts.map +1 -0
- package/dist/v2/session-requests.js +108 -0
- package/dist/v2/session-update.d.ts +2 -13
- package/dist/v2/session-update.d.ts.map +1 -1
- package/dist/v2/session-update.js +2 -22
- package/dist/v2/session.d.ts +340 -41
- package/dist/v2/session.d.ts.map +1 -1
- package/dist/v2/session.js +1224 -141
- package/dist/v2/setup.d.ts +49 -0
- package/dist/v2/setup.d.ts.map +1 -0
- package/dist/v2/setup.js +62 -0
- package/dist/v2/stopped-work.d.ts +123 -0
- package/dist/v2/stopped-work.d.ts.map +1 -0
- package/dist/v2/stopped-work.js +210 -0
- package/dist/v2/stream.d.ts +229 -0
- package/dist/v2/stream.d.ts.map +1 -0
- package/dist/v2/stream.js +507 -0
- package/dist/v2/subagent-replay.d.ts +115 -0
- package/dist/v2/subagent-replay.d.ts.map +1 -0
- package/dist/v2/subagent-replay.js +479 -0
- package/dist/v2/subscription-guard.d.ts +60 -0
- package/dist/v2/subscription-guard.d.ts.map +1 -0
- package/dist/v2/subscription-guard.js +84 -0
- package/dist/v2/tasks.d.ts +492 -0
- package/dist/v2/tasks.d.ts.map +1 -0
- package/dist/v2/tasks.js +1728 -0
- package/dist/v2/terminal.d.ts.map +1 -1
- package/dist/v2/terminal.js +6 -1
- package/dist/v2/tool-call.d.ts +3 -2
- package/dist/v2/tool-call.d.ts.map +1 -1
- package/dist/v2/update-translator.d.ts +36 -0
- package/dist/v2/update-translator.d.ts.map +1 -0
- package/dist/v2/update-translator.js +80 -0
- package/dist/workflow-progress.d.ts +23 -0
- package/dist/workflow-progress.d.ts.map +1 -1
- package/dist/workflow-progress.js +31 -8
- package/package.json +1 -1
- package/dist/v2/permission.d.ts +0 -28
- package/dist/v2/permission.d.ts.map +0 -1
- package/dist/v2/permission.js +0 -41
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Options, SDKMessageOrigin } from "@anthropic-ai/claude-agent-sdk";
|
|
2
|
+
export type SDKMessageFilter = {
|
|
3
|
+
type: string;
|
|
4
|
+
subtype?: string;
|
|
5
|
+
origin?: SDKMessageOrigin["kind"];
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Extra metadata that can be given when creating a new session.
|
|
9
|
+
*/
|
|
10
|
+
export type NewSessionMeta = {
|
|
11
|
+
claudeCode?: {
|
|
12
|
+
/**
|
|
13
|
+
* Options forwarded to Claude Code when starting a new session.
|
|
14
|
+
* Those parameters will be ignored and managed by ACP:
|
|
15
|
+
* - cwd
|
|
16
|
+
* - includePartialMessages
|
|
17
|
+
* - permissionMode
|
|
18
|
+
* - canUseTool
|
|
19
|
+
* - executable
|
|
20
|
+
* Those parameters will be used and updated to work with ACP:
|
|
21
|
+
* - hooks (merged with ACP's hooks)
|
|
22
|
+
* - mcpServers (merged with ACP's mcpServers)
|
|
23
|
+
* - disallowedTools (merged with ACP's disallowedTools)
|
|
24
|
+
* - tools (passed through; defaults to claude_code preset if not provided)
|
|
25
|
+
* - allowDangerouslySkipPermissions (set to `false` to remove bypassPermissions
|
|
26
|
+
* from this session; repeat it on session/load. `true` cannot override root)
|
|
27
|
+
*/
|
|
28
|
+
options?: Options;
|
|
29
|
+
/**
|
|
30
|
+
* When set, raw SDK messages are emitted as extNotification("_claude/sdkMessage", message)
|
|
31
|
+
* in addition to normal processing.
|
|
32
|
+
* - true: emit all messages
|
|
33
|
+
* - false/undefined: emit nothing (default)
|
|
34
|
+
* - SDKMessageFilter[]: emit only messages matching at least one filter
|
|
35
|
+
*/
|
|
36
|
+
emitRawSDKMessages?: boolean | SDKMessageFilter[];
|
|
37
|
+
};
|
|
38
|
+
additionalRoots?: string[];
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=new-session-meta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-session-meta.d.ts","sourceRoot":"","sources":["../src/new-session-meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAEhF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;CACnC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,CAAC,EAAE;QACX;;;;;;;;;;;;;;;WAeG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB;;;;;;WAMG;QACH,kBAAkB,CAAC,EAAE,OAAO,GAAG,gBAAgB,EAAE,CAAC;KACnD,CAAC;IACF,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -39,4 +39,33 @@ export interface ClaudePermissionPresentationInput {
|
|
|
39
39
|
* v2 client as `title` and `description`.
|
|
40
40
|
*/
|
|
41
41
|
export declare function buildClaudePermissionPresentation(value: ClaudePermissionPresentationInput): Pick<AcpPermissionRequest, "toolCall" | "_meta" | "title" | "description">;
|
|
42
|
+
/**
|
|
43
|
+
* The `_meta.jetbrains.air.permission` of a permission request, from the
|
|
44
|
+
* heading and explanation that {@link buildClaudePermissionPresentation}
|
|
45
|
+
* built. The v2 core adds it for an AIR client, whose tool calls it
|
|
46
|
+
* renders without the AIR tool call contract.
|
|
47
|
+
*/
|
|
48
|
+
export declare function airPermissionMeta({ title, description, defaultToNo, }: {
|
|
49
|
+
title: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
defaultToNo?: boolean;
|
|
52
|
+
}): Record<string, unknown>;
|
|
53
|
+
/**
|
|
54
|
+
* The `_meta.claudeCode` of a permission request's tool call: which MCP
|
|
55
|
+
* server serves an `mcp__*` tool and where its definition came from
|
|
56
|
+
* (`mcpServer`, SDK 0.3.274+), so a client can key trust on `source`, and,
|
|
57
|
+
* for clients other than AIR, the tool name and the Agent or Task call of a
|
|
58
|
+
* subagent's request. Undefined when there is nothing to add.
|
|
59
|
+
*/
|
|
60
|
+
export declare function permissionToolCallMeta({ toolName, parentToolUseId, mcpServer, airClient, }: {
|
|
61
|
+
toolName: string;
|
|
62
|
+
parentToolUseId: string | undefined;
|
|
63
|
+
mcpServer: {
|
|
64
|
+
name: string;
|
|
65
|
+
source: string;
|
|
66
|
+
} | undefined;
|
|
67
|
+
airClient: boolean;
|
|
68
|
+
}): {
|
|
69
|
+
claudeCode: Record<string, unknown>;
|
|
70
|
+
} | undefined;
|
|
42
71
|
//# sourceMappingURL=presentation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation.d.ts","sourceRoot":"","sources":["../../src/permissions/presentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEnG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GAAG;IAC5D,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,iCAAiC;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,oGAAoG;IACpG,cAAc,CAAC,EAAE,eAAe,EAAE,CAAC;IACnC,W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AAE,OAAO,CAAC;CACvB;AA0BD;;;;;;;;;;GAUG;AACH,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,iCAAiC,GACvC,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,aAAa,CAAC,CAuD5E;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,WAAW,EACX,WAAW,GACZ,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAU1B;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,eAAe,EACf,SAAS,EACT,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,SAAS,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IACxD,SAAS,EAAE,OAAO,CAAC;CACpB,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAAG,SAAS,CAWtD"}
|
|
@@ -80,18 +80,45 @@ export function buildClaudePermissionPresentation(value) {
|
|
|
80
80
|
}),
|
|
81
81
|
// Only AIR gets the permission presentation.
|
|
82
82
|
...(title && capabilities.air.client
|
|
83
|
-
? {
|
|
84
|
-
_meta: withAirMeta(undefined, AIR_PERMISSION_KEY, {
|
|
85
|
-
version: 1,
|
|
86
|
-
title,
|
|
87
|
-
...(description ? { description } : {}),
|
|
88
|
-
// The CLI's own hint, forwarded so a client that can pre-select
|
|
89
|
-
// an option keeps the decline focused; the option order already
|
|
90
|
-
// leads with the reject options when this is set.
|
|
91
|
-
...(value.defaultToNo === true ? { defaultToNo: true } : {}),
|
|
92
|
-
}),
|
|
93
|
-
}
|
|
83
|
+
? { _meta: airPermissionMeta({ title, description, defaultToNo: value.defaultToNo }) }
|
|
94
84
|
: {}),
|
|
95
85
|
...(capabilities.v2 ? { title, ...(description ? { description } : {}) } : {}),
|
|
96
86
|
};
|
|
97
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* The `_meta.jetbrains.air.permission` of a permission request, from the
|
|
90
|
+
* heading and explanation that {@link buildClaudePermissionPresentation}
|
|
91
|
+
* built. The v2 core adds it for an AIR client, whose tool calls it
|
|
92
|
+
* renders without the AIR tool call contract.
|
|
93
|
+
*/
|
|
94
|
+
export function airPermissionMeta({ title, description, defaultToNo, }) {
|
|
95
|
+
return withAirMeta(undefined, AIR_PERMISSION_KEY, {
|
|
96
|
+
version: 1,
|
|
97
|
+
title,
|
|
98
|
+
...(description ? { description } : {}),
|
|
99
|
+
// The CLI's own hint, forwarded so a client that can pre-select an
|
|
100
|
+
// option keeps the decline focused; the option order already leads with
|
|
101
|
+
// the reject options when this is set.
|
|
102
|
+
...(defaultToNo === true ? { defaultToNo: true } : {}),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The `_meta.claudeCode` of a permission request's tool call: which MCP
|
|
107
|
+
* server serves an `mcp__*` tool and where its definition came from
|
|
108
|
+
* (`mcpServer`, SDK 0.3.274+), so a client can key trust on `source`, and,
|
|
109
|
+
* for clients other than AIR, the tool name and the Agent or Task call of a
|
|
110
|
+
* subagent's request. Undefined when there is nothing to add.
|
|
111
|
+
*/
|
|
112
|
+
export function permissionToolCallMeta({ toolName, parentToolUseId, mcpServer, airClient, }) {
|
|
113
|
+
if (!mcpServer && !(parentToolUseId && !airClient))
|
|
114
|
+
return undefined;
|
|
115
|
+
// The name is the config key as authored: untrusted text, so it rides
|
|
116
|
+
// `_meta` rather than the title.
|
|
117
|
+
return {
|
|
118
|
+
claudeCode: {
|
|
119
|
+
...(airClient ? {} : { toolName }),
|
|
120
|
+
...(parentToolUseId && !airClient ? { parentToolUseId } : {}),
|
|
121
|
+
...(mcpServer ? { mcpServer: { name: mcpServer.name, source: mcpServer.source } } : {}),
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
}
|
|
@@ -34,4 +34,33 @@ export declare function promptSuggestionText(raw: string | null | undefined): st
|
|
|
34
34
|
* predicted nothing, so the composer must not keep the previous prediction.
|
|
35
35
|
*/
|
|
36
36
|
export declare function promptSuggestionsMeta(text: string | null): Record<string, unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* The prediction a session holds on the client, and whether an arriving
|
|
39
|
+
* `prompt_suggestion` still answers the turn the user waits on. Both cores
|
|
40
|
+
* keep one per session and send the `_meta` that its methods return as a
|
|
41
|
+
* `session_info_update`, to an AIR client only. Undefined: nothing to send.
|
|
42
|
+
*/
|
|
43
|
+
export declare class PromptSuggestions {
|
|
44
|
+
/** The last text sent (`null` after a clear). Undefined until the first send. */
|
|
45
|
+
private published;
|
|
46
|
+
/**
|
|
47
|
+
* Set at a turn's result, cleared when the next prompt arrives. A
|
|
48
|
+
* prediction that the next prompt outran (sent before the prediction was
|
|
49
|
+
* read off the stream) follows a turn that is answered already, so it is
|
|
50
|
+
* dropped instead of published mid-turn.
|
|
51
|
+
*/
|
|
52
|
+
private expected;
|
|
53
|
+
/** A result came: the CLI predicts the next prompt right after it. */
|
|
54
|
+
resultArrived(): void;
|
|
55
|
+
/** The `_meta` of the CLI's `prompt_suggestion`, if it answers the last result and changes what the client holds. */
|
|
56
|
+
suggested(raw: string | null | undefined): Record<string, unknown> | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* The `_meta` that clears the prediction: a client prompt spent it, or a
|
|
59
|
+
* `conversation_reset` dropped the transcript it came from. It also drops
|
|
60
|
+
* a prediction still in flight for the last result. Undefined when the
|
|
61
|
+
* client holds none.
|
|
62
|
+
*/
|
|
63
|
+
clear(): Record<string, unknown> | undefined;
|
|
64
|
+
private publish;
|
|
65
|
+
}
|
|
37
66
|
//# sourceMappingURL=prompt-suggestions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-suggestions.d.ts","sourceRoot":"","sources":["../src/prompt-suggestions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,wEAAwE;AACxE,eAAO,MAAM,2BAA2B,sBAAsB,CAAC;AAE/D,6DAA6D;AAC7D,MAAM,MAAM,0BAA0B,GAAG;IACvC,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACjC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAGlF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAGlF"}
|
|
1
|
+
{"version":3,"file":"prompt-suggestions.d.ts","sourceRoot":"","sources":["../src/prompt-suggestions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,wEAAwE;AACxE,eAAO,MAAM,2BAA2B,sBAAsB,CAAC;AAE/D,6DAA6D;AAC7D,MAAM,MAAM,0BAA0B,GAAG;IACvC,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACjC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAGlF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAGlF;AAED;;;;;GAKG;AACH,qBAAa,iBAAiB;IAC5B,iFAAiF;IACjF,OAAO,CAAC,SAAS,CAA4B;IAC7C;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAS;IAEzB,sEAAsE;IACtE,aAAa,IAAI,IAAI;IAIrB,qHAAqH;IACrH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;IAM9E;;;;;OAKG;IACH,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;IAK5C,OAAO,CAAC,OAAO;CAMhB"}
|
|
@@ -34,3 +34,48 @@ export function promptSuggestionsMeta(text) {
|
|
|
34
34
|
const value = { suggestions: text === null ? [] : [{ text }] };
|
|
35
35
|
return { [PROMPT_SUGGESTIONS_META_KEY]: value };
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* The prediction a session holds on the client, and whether an arriving
|
|
39
|
+
* `prompt_suggestion` still answers the turn the user waits on. Both cores
|
|
40
|
+
* keep one per session and send the `_meta` that its methods return as a
|
|
41
|
+
* `session_info_update`, to an AIR client only. Undefined: nothing to send.
|
|
42
|
+
*/
|
|
43
|
+
export class PromptSuggestions {
|
|
44
|
+
/** The last text sent (`null` after a clear). Undefined until the first send. */
|
|
45
|
+
published;
|
|
46
|
+
/**
|
|
47
|
+
* Set at a turn's result, cleared when the next prompt arrives. A
|
|
48
|
+
* prediction that the next prompt outran (sent before the prediction was
|
|
49
|
+
* read off the stream) follows a turn that is answered already, so it is
|
|
50
|
+
* dropped instead of published mid-turn.
|
|
51
|
+
*/
|
|
52
|
+
expected = false;
|
|
53
|
+
/** A result came: the CLI predicts the next prompt right after it. */
|
|
54
|
+
resultArrived() {
|
|
55
|
+
this.expected = true;
|
|
56
|
+
}
|
|
57
|
+
/** The `_meta` of the CLI's `prompt_suggestion`, if it answers the last result and changes what the client holds. */
|
|
58
|
+
suggested(raw) {
|
|
59
|
+
if (!this.expected)
|
|
60
|
+
return undefined;
|
|
61
|
+
this.expected = false;
|
|
62
|
+
return this.publish(promptSuggestionText(raw));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The `_meta` that clears the prediction: a client prompt spent it, or a
|
|
66
|
+
* `conversation_reset` dropped the transcript it came from. It also drops
|
|
67
|
+
* a prediction still in flight for the last result. Undefined when the
|
|
68
|
+
* client holds none.
|
|
69
|
+
*/
|
|
70
|
+
clear() {
|
|
71
|
+
this.expected = false;
|
|
72
|
+
return this.publish(null);
|
|
73
|
+
}
|
|
74
|
+
publish(text) {
|
|
75
|
+
// An unchanged prediction is not sent again.
|
|
76
|
+
if ((this.published ?? null) === text)
|
|
77
|
+
return undefined;
|
|
78
|
+
this.published = text;
|
|
79
|
+
return promptSuggestionsMeta(text);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The conversion of an ACP prompt into the Claude Code user message.
|
|
3
|
+
*/
|
|
4
|
+
import type { PromptRequest } from "@agentclientprotocol/sdk/unstable";
|
|
5
|
+
import type { SDKUserMessage } from "@anthropic-ai/claude-agent-sdk";
|
|
6
|
+
/** The prompt content block types that `promptToClaude` converts. The agent
|
|
7
|
+
* advertises no `audio` prompt capability. */
|
|
8
|
+
export declare const SUPPORTED_PROMPT_CONTENT_TYPES: readonly string[];
|
|
9
|
+
export declare function promptToClaude(prompt: PromptRequest): SDKUserMessage;
|
|
10
|
+
//# sourceMappingURL=prompt-to-claude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-to-claude.d.ts","sourceRoot":"","sources":["../src/prompt-to-claude.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAoBrE;+CAC+C;AAC/C,eAAO,MAAM,8BAA8B,EAAE,SAAS,MAAM,EAK3D,CAAC;AAEF,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,cAAc,CA+FpE"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { blobResourceToClaude } from "./blob-resources.js";
|
|
2
|
+
function formatUriAsLink(uri) {
|
|
3
|
+
try {
|
|
4
|
+
if (uri.startsWith("file://")) {
|
|
5
|
+
const path = uri.slice(7); // Remove "file://"
|
|
6
|
+
const name = path.split("/").pop() || path;
|
|
7
|
+
return `[@${name}](${uri})`;
|
|
8
|
+
}
|
|
9
|
+
else if (uri.startsWith("zed://")) {
|
|
10
|
+
const parts = uri.split("/");
|
|
11
|
+
const name = parts[parts.length - 1] || uri;
|
|
12
|
+
return `[@${name}](${uri})`;
|
|
13
|
+
}
|
|
14
|
+
return uri;
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return uri;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** The prompt content block types that `promptToClaude` converts. The agent
|
|
21
|
+
* advertises no `audio` prompt capability. */
|
|
22
|
+
export const SUPPORTED_PROMPT_CONTENT_TYPES = [
|
|
23
|
+
"text",
|
|
24
|
+
"image",
|
|
25
|
+
"resource_link",
|
|
26
|
+
"resource",
|
|
27
|
+
];
|
|
28
|
+
export function promptToClaude(prompt) {
|
|
29
|
+
const content = [];
|
|
30
|
+
const context = [];
|
|
31
|
+
const firstText = prompt.prompt.find((chunk) => chunk.type === "text");
|
|
32
|
+
for (const chunk of prompt.prompt) {
|
|
33
|
+
switch (chunk.type) {
|
|
34
|
+
case "text": {
|
|
35
|
+
let text = chunk.text;
|
|
36
|
+
// A slash command is the first text block. Change
|
|
37
|
+
// `/mcp:server:command args` to `/server:command (MCP) args`; the
|
|
38
|
+
// arguments can span lines.
|
|
39
|
+
const mcpMatch = chunk === firstText ? text.match(/^\/mcp:([^:\s]+):(\S+)(?:\s+([\s\S]*))?$/) : null;
|
|
40
|
+
if (mcpMatch) {
|
|
41
|
+
const [, server, command, args] = mcpMatch;
|
|
42
|
+
text = `/${server}:${command} (MCP)${args ? ` ${args}` : ""}`;
|
|
43
|
+
}
|
|
44
|
+
content.push({ type: "text", text });
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
case "resource_link": {
|
|
48
|
+
const formattedUri = formatUriAsLink(chunk.uri);
|
|
49
|
+
content.push({
|
|
50
|
+
type: "text",
|
|
51
|
+
text: formattedUri,
|
|
52
|
+
});
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
case "resource": {
|
|
56
|
+
const { uri } = chunk.resource;
|
|
57
|
+
// A blob resource becomes an image or document block, or its decoded
|
|
58
|
+
// text. A v1 prompt skips a blob of any other type, e.g.
|
|
59
|
+
// `application/zip`; a v2 prompt rejects it (see `v1PromptRequest`).
|
|
60
|
+
const blob = "blob" in chunk.resource ? blobResourceToClaude(chunk.resource) : undefined;
|
|
61
|
+
const text = "text" in chunk.resource
|
|
62
|
+
? chunk.resource.text
|
|
63
|
+
: blob?.kind === "text"
|
|
64
|
+
? blob.text
|
|
65
|
+
: undefined;
|
|
66
|
+
if (blob?.kind === "image" || blob?.kind === "document") {
|
|
67
|
+
content.push({ type: "text", text: formatUriAsLink(uri) }, blob.block);
|
|
68
|
+
}
|
|
69
|
+
else if (text !== undefined) {
|
|
70
|
+
content.push({ type: "text", text: formatUriAsLink(uri) });
|
|
71
|
+
context.push({
|
|
72
|
+
type: "text",
|
|
73
|
+
text: `\n<context ref="${uri}">\n${text}\n</context>`,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
case "image":
|
|
79
|
+
if (chunk.data) {
|
|
80
|
+
content.push({
|
|
81
|
+
type: "image",
|
|
82
|
+
source: {
|
|
83
|
+
type: "base64",
|
|
84
|
+
data: chunk.data,
|
|
85
|
+
media_type: chunk.mimeType,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
else if (chunk.uri && chunk.uri.startsWith("http")) {
|
|
90
|
+
content.push({
|
|
91
|
+
type: "image",
|
|
92
|
+
source: {
|
|
93
|
+
type: "url",
|
|
94
|
+
url: chunk.uri,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
break;
|
|
99
|
+
// Ignore audio and other unsupported types
|
|
100
|
+
default:
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
content.push(...context);
|
|
105
|
+
return {
|
|
106
|
+
type: "user",
|
|
107
|
+
message: {
|
|
108
|
+
role: "user",
|
|
109
|
+
content: content,
|
|
110
|
+
},
|
|
111
|
+
session_id: prompt.sessionId,
|
|
112
|
+
parent_tool_use_id: null,
|
|
113
|
+
// ACP prompts are the user's own input relayed by the client. Stamp the
|
|
114
|
+
// provenance explicitly: per the SDK, a host wrapping keyboard input must
|
|
115
|
+
// send `{kind: "human"}` — an absent `origin` is treated as unattributed
|
|
116
|
+
// and fails closed at the CLI's strict isHuman() trust gates (e.g. the
|
|
117
|
+
// ultracode keyword opt-in honors only human-originated turns).
|
|
118
|
+
origin: { kind: "human" },
|
|
119
|
+
};
|
|
120
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-managed LLM routing, shared by the v1 core and the v2 core:
|
|
3
|
+
* the `main` provider of `providers/list`, `providers/set` and
|
|
4
|
+
* `providers/disable`, and the legacy gateway logins (`authenticate` or
|
|
5
|
+
* `auth/login` with `gateway` or `gateway-bedrock`). Each core holds its own
|
|
6
|
+
* {@link ProviderConfig} and gateway login, and builds the query env of its
|
|
7
|
+
* sessions with {@link createEnvForProvider}.
|
|
8
|
+
*/
|
|
9
|
+
import { type AuthenticateRequest, type AuthMethod, type ListProvidersResponse, type LlmProtocol, type SetProviderRequest } from "@agentclientprotocol/sdk/unstable";
|
|
10
|
+
type ProviderLogger = {
|
|
11
|
+
log: (...args: any[]) => void;
|
|
12
|
+
error: (...args: any[]) => void;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Extra metadata for 'gateway' authentication requests.
|
|
16
|
+
*/
|
|
17
|
+
export type GatewayAuthMeta = {
|
|
18
|
+
/**
|
|
19
|
+
* These parameters are mapped to environment variables to:
|
|
20
|
+
* - Redirect API calls via baseUrl
|
|
21
|
+
* - Inject custom headers
|
|
22
|
+
* - Bypass the default Claude login requirement
|
|
23
|
+
*
|
|
24
|
+
* Both members are optional in the type because the payload arrives
|
|
25
|
+
* unvalidated from the client. `authenticate` rejects a request that lacks a
|
|
26
|
+
* usable `baseUrl`.
|
|
27
|
+
*/
|
|
28
|
+
gateway?: {
|
|
29
|
+
baseUrl?: string;
|
|
30
|
+
headers?: Record<string, string>;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type GatewayAuthRequest = AuthenticateRequest & {
|
|
34
|
+
_meta?: GatewayAuthMeta;
|
|
35
|
+
};
|
|
36
|
+
export declare const SUPPORTED_PROTOCOLS: LlmProtocol[];
|
|
37
|
+
export declare const PROVIDER_ID = "main";
|
|
38
|
+
export declare const DEFAULT_ANTHROPIC_BASE_URL = "https://api.anthropic.com";
|
|
39
|
+
export declare const DEFAULT_VERTEX_BASE_URL = "https://aiplatform.googleapis.com";
|
|
40
|
+
/**
|
|
41
|
+
* Vertex needs project + region that the standard `providers/set` payload
|
|
42
|
+
* (`apiType`/`baseUrl`/`headers`) does not model, so clients pass them through
|
|
43
|
+
* `_meta.claudeCode.vertex`. Required only when `apiType === "vertex"`.
|
|
44
|
+
*/
|
|
45
|
+
export type SetProviderMeta = {
|
|
46
|
+
claudeCode?: {
|
|
47
|
+
vertex?: {
|
|
48
|
+
projectId: string;
|
|
49
|
+
region: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Resolved, non-secret + secret routing config for the `main` provider. This is
|
|
55
|
+
* the shared shape produced by both `providers/set` and the legacy gateway auth
|
|
56
|
+
* path, and consumed by {@link createEnvForProvider}. `null` means the provider
|
|
57
|
+
* is unconfigured (no client-managed routing in effect).
|
|
58
|
+
*/
|
|
59
|
+
export type ProviderConfig = {
|
|
60
|
+
apiType: LlmProtocol;
|
|
61
|
+
baseUrl: string;
|
|
62
|
+
headers: Record<string, string>;
|
|
63
|
+
/** Present only for `apiType === "vertex"`. */
|
|
64
|
+
vertex?: {
|
|
65
|
+
projectId: string;
|
|
66
|
+
region: string;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Model ids an `anthropic` or `bedrock` gateway listed when it was set via
|
|
70
|
+
* `providers/set`; the model picker offers only these. Absent when the
|
|
71
|
+
* listing failed or the config came from elsewhere (gateway `authenticate`),
|
|
72
|
+
* so nothing is narrowed.
|
|
73
|
+
*/
|
|
74
|
+
listedModels?: string[];
|
|
75
|
+
/**
|
|
76
|
+
* The cross-region prefix of the model ids a `bedrock` gateway
|
|
77
|
+
* listed (`eu` for `eu.anthropic.claude-sonnet-5`), passed to the CLI as
|
|
78
|
+
* `ANTHROPIC_BEDROCK_REGION_PREFIX` so it calls the models under that prefix.
|
|
79
|
+
*/
|
|
80
|
+
bedrockRegionPrefix?: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Adapt a legacy gateway `authenticate` request into the shared
|
|
84
|
+
* {@link ProviderConfig} shape. Returns `null` when no gateway request is
|
|
85
|
+
* present. `methodId` selects the protocol: `gateway-bedrock` → bedrock,
|
|
86
|
+
* otherwise anthropic.
|
|
87
|
+
*/
|
|
88
|
+
export declare function gatewayRequestToProviderConfig(request?: GatewayAuthRequest): ProviderConfig | null;
|
|
89
|
+
/**
|
|
90
|
+
* Map a resolved provider config into the Claude Code env vars that redirect API
|
|
91
|
+
* traffic and inject headers. Returns an empty object when routing is
|
|
92
|
+
* unconfigured. The token/bypass placeholders (`" "`) are required so the CLI
|
|
93
|
+
* skips its normal login/credential checks when a gateway is in use.
|
|
94
|
+
*/
|
|
95
|
+
export declare function createEnvForProvider(config: ProviderConfig | null): Record<string, string>;
|
|
96
|
+
/**
|
|
97
|
+
* A provider base URL as logs may show it: its origin only. The URL can come
|
|
98
|
+
* from the env or the client and can carry credentials (`https://user:key@host`)
|
|
99
|
+
* or a key in its path or query, so a log line must not print it whole.
|
|
100
|
+
*/
|
|
101
|
+
export declare function loggableBaseUrl(baseUrl: string | undefined): string;
|
|
102
|
+
/**
|
|
103
|
+
* Validate a provider base URL: must be a non-empty absolute http(s) URL.
|
|
104
|
+
*/
|
|
105
|
+
export declare function isValidBaseUrl(baseUrl: string | undefined): baseUrl is string;
|
|
106
|
+
/** The gateway login methods, advertised to a client with `auth._meta.gateway`. */
|
|
107
|
+
export declare function gatewayAuthMethods(): AuthMethod[];
|
|
108
|
+
export declare function isGatewayAuthMethod(methodId: string): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* The gateway login `params` asks for, once its payload is usable: the same
|
|
111
|
+
* base URL rule as `providers/set`. An unchecked payload either throws a
|
|
112
|
+
* `TypeError` deep in session creation, or installs an empty base URL that
|
|
113
|
+
* silently turns the `--hide-claude-auth` subscription guard off.
|
|
114
|
+
*
|
|
115
|
+
* A request that carries no gateway payload at all keeps its historical
|
|
116
|
+
* meaning: it installs no override and succeeds. A client that probes the
|
|
117
|
+
* method this way must keep working. Only a payload that IS present has to be
|
|
118
|
+
* usable.
|
|
119
|
+
*/
|
|
120
|
+
export declare function validatedGatewayAuthRequest(params: AuthenticateRequest): GatewayAuthRequest;
|
|
121
|
+
/** The native routing of the agent: a gateway login, else the process env. */
|
|
122
|
+
export declare function defaultProviderConfig(gatewayAuthRequest?: GatewayAuthRequest): ProviderConfig;
|
|
123
|
+
/** The `providers/list` response for the `main` provider routed by `config`. */
|
|
124
|
+
export declare function listProvidersResponse(config: ProviderConfig): ListProvidersResponse;
|
|
125
|
+
/**
|
|
126
|
+
* The configuration a `providers/set` request asks for. Rejects unknown IDs,
|
|
127
|
+
* unsupported protocols, empty or invalid base URLs, and a `vertex` request
|
|
128
|
+
* without its project and region, with `invalid_params`.
|
|
129
|
+
*/
|
|
130
|
+
export declare function providerConfigFromSetRequest(params: SetProviderRequest): ProviderConfig;
|
|
131
|
+
/**
|
|
132
|
+
* Adds to `config` the model ids its gateway lists, and for `bedrock` the
|
|
133
|
+
* region prefix picked from them, so the sessions it routes offer only those.
|
|
134
|
+
* Setting the same gateway as `current` again reuses its listing. `vertex`
|
|
135
|
+
* gateways are not listed. A failed listing throws an `internal_error`.
|
|
136
|
+
*/
|
|
137
|
+
export declare function withListedModels(config: ProviderConfig, current: ProviderConfig | undefined, logger: ProviderLogger): Promise<ProviderConfig>;
|
|
138
|
+
export {};
|
|
139
|
+
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAEhB,KAAK,kBAAkB,EACxB,MAAM,mCAAmC,CAAC;AAS3C,KAAK,cAAc,GAAG;IAAE,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;CAAE,CAAC;AAEzF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAClC,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,GAAG;IAAE,KAAK,CAAC,EAAE,eAAe,CAAA;CAAE,CAAC;AAEnF,eAAO,MAAM,mBAAmB,EAAE,WAAW,EAAuC,CAAC;AACrF,eAAO,MAAM,WAAW,SAAS,CAAC;AAClC,eAAO,MAAM,0BAA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