@caplets/core 0.21.0 → 0.22.0
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/attach/options.d.ts +2 -0
- package/dist/caplet-files-bundle.d.ts +4 -0
- package/dist/caplet-source.js +5 -0
- package/dist/cli/auth.d.ts +2 -0
- package/dist/code-mode/types.d.ts +1 -0
- package/dist/{completion-GTIuH0CW.js → completion-DnQujlrc.js} +1 -1
- package/dist/config-runtime.d.ts +2 -0
- package/dist/config-runtime.js +2 -0
- package/dist/config.d.ts +7 -0
- package/dist/index.js +22 -13
- package/dist/native/remote.d.ts +1 -0
- package/dist/native/service.d.ts +1 -0
- package/dist/native.js +1 -1
- package/dist/{service-Bs7l5haO.js → service-4_chB2wu.js} +66 -29
- package/package.json +1 -1
package/dist/attach/options.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ export type RawAttachServeOptions = RemoteSelectionInput & RawServeOptions & {
|
|
|
4
4
|
projectRoot?: string;
|
|
5
5
|
};
|
|
6
6
|
export type AttachServeOptions = ServeOptions & {
|
|
7
|
+
configPath: string;
|
|
7
8
|
projectRoot: string;
|
|
9
|
+
projectConfigPath: string;
|
|
8
10
|
selection: ResolvedRemoteSelection;
|
|
9
11
|
};
|
|
10
12
|
export declare function resolveAttachServeOptions(raw?: RawAttachServeOptions, env?: Record<string, string | undefined>): Promise<AttachServeOptions>;
|
|
@@ -390,6 +390,10 @@ export declare const capletFileSchema: z.ZodObject<{
|
|
|
390
390
|
direct_and_code_mode: "direct_and_code_mode";
|
|
391
391
|
progressive_and_code_mode: "progressive_and_code_mode";
|
|
392
392
|
}>>;
|
|
393
|
+
shadowing: z.ZodOptional<z.ZodEnum<{
|
|
394
|
+
forbid: "forbid";
|
|
395
|
+
allow: "allow";
|
|
396
|
+
}>>;
|
|
393
397
|
}, z.core.$strict>;
|
|
394
398
|
export declare function capletJsonSchema(): unknown;
|
|
395
399
|
export type CapletFileConfig = {
|
package/dist/caplet-source.js
CHANGED
|
@@ -10166,6 +10166,7 @@ const capletExposureSchema = _enum([
|
|
|
10166
10166
|
"direct_and_code_mode",
|
|
10167
10167
|
"progressive_and_code_mode"
|
|
10168
10168
|
]).describe("How this Caplet is exposed to agents.");
|
|
10169
|
+
const capletShadowingSchema = _enum(["forbid", "allow"]).describe("Whether attached local Caplets may shadow this remote Caplet ID.");
|
|
10169
10170
|
const capletEndpointAuthSchema = discriminatedUnion("type", [
|
|
10170
10171
|
object({ type: literal("none") }).strict(),
|
|
10171
10172
|
object({
|
|
@@ -10446,6 +10447,7 @@ const capletFileSchema = object({
|
|
|
10446
10447
|
description: string().describe("Compact capability description shown before the full Caplet card is disclosed.").refine((value) => value.trim().length >= 10, "description must contain at least 10 non-whitespace characters").refine((value) => value.length <= 1500, "description must be at most 1500 characters"),
|
|
10447
10448
|
tags: array(string().trim().min(1).max(80)).optional().describe("Optional tags for grouping or searching Caplets."),
|
|
10448
10449
|
exposure: capletExposureSchema.optional(),
|
|
10450
|
+
shadowing: capletShadowingSchema.optional(),
|
|
10449
10451
|
...capletAgentSelectionHintsSchema,
|
|
10450
10452
|
setup: capletSetupSchema.optional(),
|
|
10451
10453
|
projectBinding: capletProjectBindingSchema.optional(),
|
|
@@ -10643,6 +10645,7 @@ function sharedCapletFields(frontmatter) {
|
|
|
10643
10645
|
return {
|
|
10644
10646
|
...frontmatter.tags ? { tags: frontmatter.tags } : {},
|
|
10645
10647
|
...frontmatter.exposure ? { exposure: frontmatter.exposure } : {},
|
|
10648
|
+
...frontmatter.shadowing ? { shadowing: frontmatter.shadowing } : {},
|
|
10646
10649
|
...frontmatter.useWhen ? { useWhen: frontmatter.useWhen } : {},
|
|
10647
10650
|
...frontmatter.avoidWhen ? { avoidWhen: frontmatter.avoidWhen } : {},
|
|
10648
10651
|
...frontmatter.setup ? { setup: frontmatter.setup } : {},
|
|
@@ -10797,11 +10800,13 @@ const exposureSchema = _enum([
|
|
|
10797
10800
|
"direct_and_code_mode",
|
|
10798
10801
|
"progressive_and_code_mode"
|
|
10799
10802
|
]);
|
|
10803
|
+
const shadowingSchema = _enum(["forbid", "allow"]).default("forbid");
|
|
10800
10804
|
const commonSchema = {
|
|
10801
10805
|
name: string().trim().min(1).max(80),
|
|
10802
10806
|
description: string().refine((value) => value.trim().length >= 10, "description must contain at least 10 non-whitespace characters").refine((value) => value.length <= 1500, "description must be at most 1500 characters"),
|
|
10803
10807
|
tags: array(string().trim().min(1).max(80)).optional(),
|
|
10804
10808
|
exposure: exposureSchema.optional(),
|
|
10809
|
+
shadowing: shadowingSchema,
|
|
10805
10810
|
...agentSelectionHintsSchema,
|
|
10806
10811
|
body: string().optional(),
|
|
10807
10812
|
setup: setupSchema.optional(),
|
package/dist/cli/auth.d.ts
CHANGED
|
@@ -82,6 +82,7 @@ declare function authTargets(config: ReturnType<typeof loadConfig>): (import("..
|
|
|
82
82
|
name: string;
|
|
83
83
|
description: string;
|
|
84
84
|
exposure?: import("../config").CapletExposure | undefined;
|
|
85
|
+
shadowing?: import("../config").CapletShadowingPolicy | undefined;
|
|
85
86
|
tags?: string[] | undefined;
|
|
86
87
|
body?: string | undefined;
|
|
87
88
|
endpointUrl: string;
|
|
@@ -103,6 +104,7 @@ declare function authTargets(config: ReturnType<typeof loadConfig>): (import("..
|
|
|
103
104
|
name: string;
|
|
104
105
|
description: string;
|
|
105
106
|
exposure?: import("../config").CapletExposure | undefined;
|
|
107
|
+
shadowing?: import("../config").CapletShadowingPolicy | undefined;
|
|
106
108
|
tags?: string[] | undefined;
|
|
107
109
|
body?: string | undefined;
|
|
108
110
|
baseUrl: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ct as resolveCapletsRoot, Et as resolveProjectConfigPath, Q as loadConfigWithSources, Sn as __exportAll, _t as DEFAULT_AUTH_DIR, vt as DEFAULT_COMPLETION_CACHE_DIR, wt as resolveConfigPath } from "./service-
|
|
1
|
+
import { Ct as resolveCapletsRoot, Et as resolveProjectConfigPath, Q as loadConfigWithSources, Sn as __exportAll, _t as DEFAULT_AUTH_DIR, vt as DEFAULT_COMPLETION_CACHE_DIR, wt as resolveConfigPath } from "./service-4_chB2wu.js";
|
|
2
2
|
import { u as CapletsError } from "./validation-DgxCzt-A.js";
|
|
3
3
|
import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { dirname, join } from "node:path";
|
package/dist/config-runtime.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export type AgentSelectionHintsConfig = {
|
|
|
49
49
|
avoidWhen?: string | undefined;
|
|
50
50
|
};
|
|
51
51
|
export type CapletExposure = "direct" | "progressive" | "code_mode" | "direct_and_code_mode" | "progressive_and_code_mode";
|
|
52
|
+
export type CapletShadowingPolicy = "forbid" | "allow";
|
|
52
53
|
export type CapletServerConfig = CommonCapletConfig & {
|
|
53
54
|
backend: "mcp";
|
|
54
55
|
transport: "stdio" | "http" | "sse";
|
|
@@ -172,6 +173,7 @@ type CommonCapletConfig = AgentSelectionHintsConfig & {
|
|
|
172
173
|
name: string;
|
|
173
174
|
description: string;
|
|
174
175
|
exposure?: CapletExposure | undefined;
|
|
176
|
+
shadowing?: CapletShadowingPolicy | undefined;
|
|
175
177
|
tags?: string[] | undefined;
|
|
176
178
|
body?: string | undefined;
|
|
177
179
|
setup?: CapletSetupConfig | undefined;
|
package/dist/config-runtime.js
CHANGED
|
@@ -49,11 +49,13 @@ const exposureSchema = _enum([
|
|
|
49
49
|
"direct_and_code_mode",
|
|
50
50
|
"progressive_and_code_mode"
|
|
51
51
|
]);
|
|
52
|
+
const shadowingSchema = _enum(["forbid", "allow"]).default("forbid");
|
|
52
53
|
const commonSchema = {
|
|
53
54
|
name: string().trim().min(1).max(80),
|
|
54
55
|
description: string().refine((value) => value.trim().length >= 10, "description must contain at least 10 non-whitespace characters").refine((value) => value.length <= 1500, "description must be at most 1500 characters"),
|
|
55
56
|
tags: array(string().trim().min(1).max(80)).optional(),
|
|
56
57
|
exposure: exposureSchema.optional(),
|
|
58
|
+
shadowing: shadowingSchema,
|
|
57
59
|
...agentSelectionHintsSchema,
|
|
58
60
|
body: string().optional(),
|
|
59
61
|
setup: setupSchema.optional(),
|
package/dist/config.d.ts
CHANGED
|
@@ -63,6 +63,7 @@ export type AgentSelectionHintsConfig = {
|
|
|
63
63
|
useWhen?: string | undefined;
|
|
64
64
|
avoidWhen?: string | undefined;
|
|
65
65
|
};
|
|
66
|
+
export type CapletShadowingPolicy = "forbid" | "allow";
|
|
66
67
|
export type CapletExposure = "direct" | "progressive" | "code_mode" | "direct_and_code_mode" | "progressive_and_code_mode";
|
|
67
68
|
export type CapletServerConfig = AgentSelectionHintsConfig & {
|
|
68
69
|
server: string;
|
|
@@ -70,6 +71,7 @@ export type CapletServerConfig = AgentSelectionHintsConfig & {
|
|
|
70
71
|
name: string;
|
|
71
72
|
description: string;
|
|
72
73
|
exposure?: CapletExposure | undefined;
|
|
74
|
+
shadowing?: CapletShadowingPolicy | undefined;
|
|
73
75
|
tags?: string[] | undefined;
|
|
74
76
|
body?: string | undefined;
|
|
75
77
|
transport: "stdio" | "http" | "sse";
|
|
@@ -104,6 +106,7 @@ export type OpenApiEndpointConfig = AgentSelectionHintsConfig & {
|
|
|
104
106
|
name: string;
|
|
105
107
|
description: string;
|
|
106
108
|
exposure?: CapletExposure | undefined;
|
|
109
|
+
shadowing?: CapletShadowingPolicy | undefined;
|
|
107
110
|
tags?: string[] | undefined;
|
|
108
111
|
body?: string | undefined;
|
|
109
112
|
specPath?: string | undefined;
|
|
@@ -129,6 +132,7 @@ export type GraphQlEndpointConfig = AgentSelectionHintsConfig & {
|
|
|
129
132
|
name: string;
|
|
130
133
|
description: string;
|
|
131
134
|
exposure?: CapletExposure | undefined;
|
|
135
|
+
shadowing?: CapletShadowingPolicy | undefined;
|
|
132
136
|
tags?: string[] | undefined;
|
|
133
137
|
body?: string | undefined;
|
|
134
138
|
endpointUrl: string;
|
|
@@ -161,6 +165,7 @@ export type HttpApiConfig = AgentSelectionHintsConfig & {
|
|
|
161
165
|
name: string;
|
|
162
166
|
description: string;
|
|
163
167
|
exposure?: CapletExposure | undefined;
|
|
168
|
+
shadowing?: CapletShadowingPolicy | undefined;
|
|
164
169
|
tags?: string[] | undefined;
|
|
165
170
|
body?: string | undefined;
|
|
166
171
|
baseUrl: string;
|
|
@@ -200,6 +205,7 @@ export type CliToolsConfig = AgentSelectionHintsConfig & {
|
|
|
200
205
|
name: string;
|
|
201
206
|
description: string;
|
|
202
207
|
exposure?: CapletExposure | undefined;
|
|
208
|
+
shadowing?: CapletShadowingPolicy | undefined;
|
|
203
209
|
tags?: string[] | undefined;
|
|
204
210
|
body?: string | undefined;
|
|
205
211
|
actions: Record<string, CliToolActionConfig>;
|
|
@@ -218,6 +224,7 @@ export type CapletSetConfig = AgentSelectionHintsConfig & {
|
|
|
218
224
|
name: string;
|
|
219
225
|
description: string;
|
|
220
226
|
exposure?: CapletExposure | undefined;
|
|
227
|
+
shadowing?: CapletShadowingPolicy | undefined;
|
|
221
228
|
tags?: string[] | undefined;
|
|
222
229
|
body?: string | undefined;
|
|
223
230
|
configPath?: string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { $ as loadGlobalConfig, $t as ListRootsResultSchema, A as codeModeRunParamsSchema, At as assertToolsCallTaskCapability, B as generateCodeModeRunToolDescription, Bt as CreateTaskResultSchema, C as nativeCapletPromptGuidance, Ct as resolveCapletsRoot, D as nativeCodeModeToolId, Dt as ReadBuffer, Et as resolveProjectConfigPath, F as listCodeModeCallableCaplets, Ft as CallToolRequestSchema, G as directResourceUriMatchesTemplate, Gt as GetPromptRequestSchema, H as CapletsEngine, Ht as ElicitResultSchema, I as CodeModeLogStore, It as CallToolResultSchema, J as handleServerTool, Jt as JSONRPCMessageSchema, K as findProjectRoot, Kt as InitializeRequestSchema, L as redactCodeModeLogText, Lt as CompleteRequestSchema, M as QuickJsCodeModeSandbox, Mt as Protocol, N as diagnoseCodeModeTypeScript, Nt as mergeCapabilities, Ot as serializeMessage, P as createCodeModeCapletsApi, Pt as toJsonSchemaCompat, Q as loadConfigWithSources, Qt as ListResourcesRequestSchema, R as codeModeDeclarationHash, Rt as CreateMessageResultSchema, S as resolveCapletsServer, St as defaultStateBaseDir, T as nativeCapletToolName, Tt as resolveProjectCapletsRoot, U as resolveExposure, Ut as EmptyResultSchema, V as minifyCodeModeDeclarationText, W as decodeDirectResourceUri, Wt as ErrorCode, X as capabilityDescription, Xt as ListPromptsRequestSchema, Y as ServerRegistry, Yt as LATEST_PROTOCOL_VERSION, Z as loadConfig, Zt as ListResourceTemplatesRequestSchema, _ as resolveHostedCloudRemote, _n as isZ4Schema, a as projectBindingError, an as SetLevelRequestSchema, at as loadCapletFilesFromMap, b as parseServerBaseUrl, bn as safeParse, bt as defaultCacheBaseDir, c as cloudAuthPath, cn as isInitializeRequest, ct as markdownStructuredContent, d as CloudAuthClient, dn as isJSONRPCResultResponse, dt as runOAuthFlow, en as ListToolsRequestSchema, et as loadLocalOverlayConfigWithSources, fn as getLiteralValue, ft as startGenericOAuthFlow, g as resolveCapletsRemote, gn as isSchemaOptional, gt as readTokenBundle, hn as getSchemaDescription, ht as isTokenBundleExpired, i as ProjectBindingError, in as SUPPORTED_PROTOCOL_VERSIONS, it as validateCapletFile, j as runCodeMode, jt as AjvJsonSchemaValidator, k as codeModeRunInputSchema, kt as assertClientRequestTaskCapability, l as migrateCredentials, ln as isJSONRPCErrorResponse, lt as refreshOAuthTokenBundle, m as buildProjectSyncManifest, mn as getParseErrorMessage, mt as deleteTokenBundle, n as resolveRemoteSelection, nn as McpError, nt as parseConfig, o as projectBindingRecovery, on as assertCompleteRequestPrompt, ot as hasRenderableStructuredContent, p as createSdkRemoteCapletsClient, pn as getObjectShape, pt as startOAuthFlow, q as fingerprintProjectRoot, qt as InitializedNotificationSchema, r as PROJECT_BINDING_ERROR_CODES, rn as ReadResourceRequestSchema, rt as discoverCapletFiles, s as CloudAuthStore, sn as assertCompleteRequestResourceTemplate, st as markdownCallToolResultContent, t as createNativeCapletsService, tn as LoggingLevelSchema, tt as loadProjectConfig, u as redactedCloudAuthStatus, un as isJSONRPCRequest, ut as runGenericOAuthFlow, v as resolveRemoteMode, vn as normalizeObjectSchema, w as nativeCapletToolDescription, wt as resolveConfigPath, x as resolveCapletsMode, xn as safeParseAsync, xt as defaultConfigBaseDir, y as controlUrlForBase, yn as objectFromShape, yt as DEFAULT_OBSERVED_OUTPUT_SHAPE_CACHE_DIR, z as generateCodeModeDeclarations, zt as CreateMessageResultWithToolsSchema } from "./service-
|
|
1
|
+
import { $ as loadGlobalConfig, $t as ListRootsResultSchema, A as codeModeRunParamsSchema, At as assertToolsCallTaskCapability, B as generateCodeModeRunToolDescription, Bt as CreateTaskResultSchema, C as nativeCapletPromptGuidance, Ct as resolveCapletsRoot, D as nativeCodeModeToolId, Dt as ReadBuffer, Et as resolveProjectConfigPath, F as listCodeModeCallableCaplets, Ft as CallToolRequestSchema, G as directResourceUriMatchesTemplate, Gt as GetPromptRequestSchema, H as CapletsEngine, Ht as ElicitResultSchema, I as CodeModeLogStore, It as CallToolResultSchema, J as handleServerTool, Jt as JSONRPCMessageSchema, K as findProjectRoot, Kt as InitializeRequestSchema, L as redactCodeModeLogText, Lt as CompleteRequestSchema, M as QuickJsCodeModeSandbox, Mt as Protocol, N as diagnoseCodeModeTypeScript, Nt as mergeCapabilities, Ot as serializeMessage, P as createCodeModeCapletsApi, Pt as toJsonSchemaCompat, Q as loadConfigWithSources, Qt as ListResourcesRequestSchema, R as codeModeDeclarationHash, Rt as CreateMessageResultSchema, S as resolveCapletsServer, St as defaultStateBaseDir, T as nativeCapletToolName, Tt as resolveProjectCapletsRoot, U as resolveExposure, Ut as EmptyResultSchema, V as minifyCodeModeDeclarationText, W as decodeDirectResourceUri, Wt as ErrorCode, X as capabilityDescription, Xt as ListPromptsRequestSchema, Y as ServerRegistry, Yt as LATEST_PROTOCOL_VERSION, Z as loadConfig, Zt as ListResourceTemplatesRequestSchema, _ as resolveHostedCloudRemote, _n as isZ4Schema, a as projectBindingError, an as SetLevelRequestSchema, at as loadCapletFilesFromMap, b as parseServerBaseUrl, bn as safeParse, bt as defaultCacheBaseDir, c as cloudAuthPath, cn as isInitializeRequest, ct as markdownStructuredContent, d as CloudAuthClient, dn as isJSONRPCResultResponse, dt as runOAuthFlow, en as ListToolsRequestSchema, et as loadLocalOverlayConfigWithSources, fn as getLiteralValue, ft as startGenericOAuthFlow, g as resolveCapletsRemote, gn as isSchemaOptional, gt as readTokenBundle, hn as getSchemaDescription, ht as isTokenBundleExpired, i as ProjectBindingError, in as SUPPORTED_PROTOCOL_VERSIONS, it as validateCapletFile, j as runCodeMode, jt as AjvJsonSchemaValidator, k as codeModeRunInputSchema, kt as assertClientRequestTaskCapability, l as migrateCredentials, ln as isJSONRPCErrorResponse, lt as refreshOAuthTokenBundle, m as buildProjectSyncManifest, mn as getParseErrorMessage, mt as deleteTokenBundle, n as resolveRemoteSelection, nn as McpError, nt as parseConfig, o as projectBindingRecovery, on as assertCompleteRequestPrompt, ot as hasRenderableStructuredContent, p as createSdkRemoteCapletsClient, pn as getObjectShape, pt as startOAuthFlow, q as fingerprintProjectRoot, qt as InitializedNotificationSchema, r as PROJECT_BINDING_ERROR_CODES, rn as ReadResourceRequestSchema, rt as discoverCapletFiles, s as CloudAuthStore, sn as assertCompleteRequestResourceTemplate, st as markdownCallToolResultContent, t as createNativeCapletsService, tn as LoggingLevelSchema, tt as loadProjectConfig, u as redactedCloudAuthStatus, un as isJSONRPCRequest, ut as runGenericOAuthFlow, v as resolveRemoteMode, vn as normalizeObjectSchema, w as nativeCapletToolDescription, wt as resolveConfigPath, x as resolveCapletsMode, xn as safeParseAsync, xt as defaultConfigBaseDir, y as controlUrlForBase, yn as objectFromShape, yt as DEFAULT_OBSERVED_OUTPUT_SHAPE_CACHE_DIR, z as generateCodeModeDeclarations, zt as CreateMessageResultWithToolsSchema } from "./service-4_chB2wu.js";
|
|
2
2
|
import { _ as record, b as unknown, d as literal, m as object, n as ZodOptional, o as array, p as number, r as _enum, s as boolean, v as string, x as url } from "./schemas-C0PNPwjS.js";
|
|
3
3
|
import { f as redactSecrets, i as SERVER_ID_PATTERN, l as CAPLETS_ERROR_CODES, p as toSafeError, u as CapletsError } from "./validation-DgxCzt-A.js";
|
|
4
4
|
import { generatedToolInputJsonSchemaForCaplet, generatedToolInputSchema, generatedToolInputSchemaForCaplet } from "./generated-tool-input-schema.js";
|
|
5
5
|
import { f as observedOutputShapeKey, g as stableJsonStringify, h as schemaHash, i as observeOutputShape, u as FileObservedOutputShapeStore } from "./observed-output-shapes-CL5MFXwM.js";
|
|
6
|
-
import { a as formatCapletList, c as resolveCliConfigPaths, l as cliCommands$1, n as completionScript, o as formatConfigPaths, s as listCaplets, t as completeCliWords, u as completionShells } from "./completion-
|
|
6
|
+
import { a as formatCapletList, c as resolveCliConfigPaths, l as cliCommands$1, n as completionScript, o as formatConfigPaths, s as listCaplets, t as completeCliWords, u as completionShells } from "./completion-DnQujlrc.js";
|
|
7
7
|
import { n as normalizeCapletSourcePath, t as FilesystemCapletSource } from "./filesystem-Kkg32TOJ.js";
|
|
8
8
|
import { parseConfig as parseConfig$1 } from "./config-runtime.js";
|
|
9
9
|
import fs, { accessSync, chmodSync, closeSync, constants, copyFileSync, cpSync, existsSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, rmSync, statSync, writeFileSync, writeSync } from "node:fs";
|
|
@@ -1553,7 +1553,7 @@ const EMPTY_COMPLETION_RESULT = { completion: {
|
|
|
1553
1553
|
} };
|
|
1554
1554
|
//#endregion
|
|
1555
1555
|
//#region package.json
|
|
1556
|
-
var version = "0.
|
|
1556
|
+
var version = "0.22.0";
|
|
1557
1557
|
//#endregion
|
|
1558
1558
|
//#region src/serve/session.ts
|
|
1559
1559
|
var CapletsMcpSession = class {
|
|
@@ -7183,9 +7183,13 @@ function hasEnv(value) {
|
|
|
7183
7183
|
//#region src/attach/options.ts
|
|
7184
7184
|
async function resolveAttachServeOptions(raw = {}, env = process.env) {
|
|
7185
7185
|
const selection = await resolveRemoteSelection(raw, env);
|
|
7186
|
+
const serve = resolveServeOptions(attachLocalServeOptions(raw), env);
|
|
7187
|
+
const projectRoot = raw.projectRoot ?? process.cwd();
|
|
7186
7188
|
return {
|
|
7187
|
-
...
|
|
7188
|
-
|
|
7189
|
+
...serve,
|
|
7190
|
+
configPath: resolveConfigPath(env.CAPLETS_CONFIG?.trim() || void 0),
|
|
7191
|
+
projectRoot,
|
|
7192
|
+
projectConfigPath: env.CAPLETS_PROJECT_CONFIG?.trim() || resolveProjectConfigPath(projectRoot),
|
|
7189
7193
|
selection
|
|
7190
7194
|
};
|
|
7191
7195
|
}
|
|
@@ -10662,7 +10666,7 @@ function progressiveCapletExport(entry) {
|
|
|
10662
10666
|
inputSchema,
|
|
10663
10667
|
schemaHash: schemaHash(inputSchema),
|
|
10664
10668
|
capletId: entry.caplet.server,
|
|
10665
|
-
shadowing:
|
|
10669
|
+
shadowing: shadowingPolicy(entry.caplet)
|
|
10666
10670
|
};
|
|
10667
10671
|
}
|
|
10668
10672
|
function codeModeCapletExport(entry) {
|
|
@@ -10674,7 +10678,7 @@ function codeModeCapletExport(entry) {
|
|
|
10674
10678
|
description: entry.caplet.description,
|
|
10675
10679
|
schemaHash: null,
|
|
10676
10680
|
capletId: entry.caplet.server,
|
|
10677
|
-
shadowing:
|
|
10681
|
+
shadowing: shadowingPolicy(entry.caplet)
|
|
10678
10682
|
};
|
|
10679
10683
|
}
|
|
10680
10684
|
function toolExport(entry) {
|
|
@@ -10693,7 +10697,7 @@ function toolExport(entry) {
|
|
|
10693
10697
|
output: entry.tool.outputSchema
|
|
10694
10698
|
}),
|
|
10695
10699
|
capletId: entry.caplet.server,
|
|
10696
|
-
shadowing:
|
|
10700
|
+
shadowing: shadowingPolicy(entry.caplet)
|
|
10697
10701
|
};
|
|
10698
10702
|
}
|
|
10699
10703
|
function resourceExport(entry) {
|
|
@@ -10708,7 +10712,7 @@ function resourceExport(entry) {
|
|
|
10708
10712
|
...typeof entry.resource.size === "number" ? { size: entry.resource.size } : {},
|
|
10709
10713
|
schemaHash: null,
|
|
10710
10714
|
capletId: entry.caplet.server,
|
|
10711
|
-
shadowing:
|
|
10715
|
+
shadowing: shadowingPolicy(entry.caplet)
|
|
10712
10716
|
};
|
|
10713
10717
|
}
|
|
10714
10718
|
function resourceTemplateExport(entry) {
|
|
@@ -10722,7 +10726,7 @@ function resourceTemplateExport(entry) {
|
|
|
10722
10726
|
...entry.resourceTemplate.mimeType ? { mimeType: entry.resourceTemplate.mimeType } : {},
|
|
10723
10727
|
schemaHash: null,
|
|
10724
10728
|
capletId: entry.caplet.server,
|
|
10725
|
-
shadowing:
|
|
10729
|
+
shadowing: shadowingPolicy(entry.caplet)
|
|
10726
10730
|
};
|
|
10727
10731
|
}
|
|
10728
10732
|
function promptExport(entry) {
|
|
@@ -10737,11 +10741,11 @@ function promptExport(entry) {
|
|
|
10737
10741
|
inputSchema,
|
|
10738
10742
|
schemaHash: schemaHash(inputSchema),
|
|
10739
10743
|
capletId: entry.caplet.server,
|
|
10740
|
-
shadowing:
|
|
10744
|
+
shadowing: shadowingPolicy(entry.caplet)
|
|
10741
10745
|
};
|
|
10742
10746
|
}
|
|
10743
10747
|
function completionExports(snapshot) {
|
|
10744
|
-
return [...new
|
|
10748
|
+
return [...new Map([...snapshot.directPrompts, ...snapshot.directResourceTemplates].map((entry) => [entry.caplet.server, entry.caplet])).entries()].sort(([left], [right]) => left.localeCompare(right)).map(([capletId, caplet]) => ({
|
|
10745
10749
|
stableId: `completion:${capletId}`,
|
|
10746
10750
|
kind: "completion",
|
|
10747
10751
|
name: `${capletId}:complete`,
|
|
@@ -10749,9 +10753,12 @@ function completionExports(snapshot) {
|
|
|
10749
10753
|
description: `MCP completion for ${capletId}.`,
|
|
10750
10754
|
schemaHash: null,
|
|
10751
10755
|
capletId,
|
|
10752
|
-
shadowing:
|
|
10756
|
+
shadowing: shadowingPolicy(caplet)
|
|
10753
10757
|
}));
|
|
10754
10758
|
}
|
|
10759
|
+
function shadowingPolicy(caplet) {
|
|
10760
|
+
return caplet.shadowing ?? "forbid";
|
|
10761
|
+
}
|
|
10755
10762
|
function sortAttachProjectionInput(partial) {
|
|
10756
10763
|
return {
|
|
10757
10764
|
caplets: sortByStableId(partial.caplets),
|
|
@@ -11720,6 +11727,8 @@ async function attachResolvedCaplets(options, io = {}) {
|
|
|
11720
11727
|
function createAttachNativeService(options, io) {
|
|
11721
11728
|
return createNativeCapletsService({
|
|
11722
11729
|
mode: options.selection.kind === "hosted_cloud" ? "cloud" : "remote",
|
|
11730
|
+
configPath: options.configPath,
|
|
11731
|
+
projectConfigPath: options.projectConfigPath,
|
|
11723
11732
|
server: {
|
|
11724
11733
|
url: options.selection.remote.baseUrl.toString(),
|
|
11725
11734
|
...options.selection.remote.fetch ? { fetch: options.selection.remote.fetch } : {}
|
package/dist/native/remote.d.ts
CHANGED
package/dist/native/service.d.ts
CHANGED
package/dist/native.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as nativeCapletPromptGuidance, D as nativeCodeModeToolId, E as nativeCapletsSystemGuidance, O as nativeCodeModeToolName, T as nativeCapletToolName, f as RemoteNativeCapletsService, h as resolveNativeCapletsServiceOptions, p as createSdkRemoteCapletsClient, t as createNativeCapletsService, w as nativeCapletToolDescription } from "./service-
|
|
1
|
+
import { C as nativeCapletPromptGuidance, D as nativeCodeModeToolId, E as nativeCapletsSystemGuidance, O as nativeCodeModeToolName, T as nativeCapletToolName, f as RemoteNativeCapletsService, h as resolveNativeCapletsServiceOptions, p as createSdkRemoteCapletsClient, t as createNativeCapletsService, w as nativeCapletToolDescription } from "./service-4_chB2wu.js";
|
|
2
2
|
import { generatedToolInputJsonSchema, generatedToolInputSchema } from "./generated-tool-input-schema.js";
|
|
3
3
|
//#region src/native/process-cleanup.ts
|
|
4
4
|
function registerNativeCapletsProcessCleanup(service, options = {}) {
|
|
@@ -25967,6 +25967,7 @@ const capletExposureSchema = _enum([
|
|
|
25967
25967
|
"direct_and_code_mode",
|
|
25968
25968
|
"progressive_and_code_mode"
|
|
25969
25969
|
]).describe("How this Caplet is exposed to agents.");
|
|
25970
|
+
const capletShadowingSchema = _enum(["forbid", "allow"]).describe("Whether attached local Caplets may shadow this remote Caplet ID.");
|
|
25970
25971
|
const capletEndpointAuthSchema = discriminatedUnion("type", [
|
|
25971
25972
|
object$1({ type: literal("none") }).strict(),
|
|
25972
25973
|
object$1({
|
|
@@ -26247,6 +26248,7 @@ const capletFileSchema = object$1({
|
|
|
26247
26248
|
description: string().describe("Compact capability description shown before the full Caplet card is disclosed.").refine((value) => value.trim().length >= 10, "description must contain at least 10 non-whitespace characters").refine((value) => value.length <= 1500, "description must be at most 1500 characters"),
|
|
26248
26249
|
tags: array(string().trim().min(1).max(80)).optional().describe("Optional tags for grouping or searching Caplets."),
|
|
26249
26250
|
exposure: capletExposureSchema.optional(),
|
|
26251
|
+
shadowing: capletShadowingSchema.optional(),
|
|
26250
26252
|
...capletAgentSelectionHintsSchema,
|
|
26251
26253
|
setup: capletSetupSchema.optional(),
|
|
26252
26254
|
projectBinding: capletProjectBindingSchema.optional(),
|
|
@@ -26444,6 +26446,7 @@ function sharedCapletFields(frontmatter) {
|
|
|
26444
26446
|
return {
|
|
26445
26447
|
...frontmatter.tags ? { tags: frontmatter.tags } : {},
|
|
26446
26448
|
...frontmatter.exposure ? { exposure: frontmatter.exposure } : {},
|
|
26449
|
+
...frontmatter.shadowing ? { shadowing: frontmatter.shadowing } : {},
|
|
26447
26450
|
...frontmatter.useWhen ? { useWhen: frontmatter.useWhen } : {},
|
|
26448
26451
|
...frontmatter.avoidWhen ? { avoidWhen: frontmatter.avoidWhen } : {},
|
|
26449
26452
|
...frontmatter.setup ? { setup: frontmatter.setup } : {},
|
|
@@ -26794,6 +26797,7 @@ const exposureSchema = _enum([
|
|
|
26794
26797
|
"direct_and_code_mode",
|
|
26795
26798
|
"progressive_and_code_mode"
|
|
26796
26799
|
]).describe("How this Caplet is exposed to agents.");
|
|
26800
|
+
const shadowingSchema = _enum(["forbid", "allow"]).default("forbid").describe("Whether attached local Caplets may shadow this remote Caplet ID.");
|
|
26797
26801
|
const publicServerSchema = object$1({
|
|
26798
26802
|
name: string().trim().min(1).max(80).describe("Human-readable server display name."),
|
|
26799
26803
|
description: string().describe("Capability description shown to agents before downstream tools are disclosed.").refine((value) => value.trim().length >= 10, "description must contain at least 10 non-whitespace characters").refine((value) => value.length <= 1500, "description must be at most 1500 characters"),
|
|
@@ -26810,6 +26814,7 @@ const publicServerSchema = object$1({
|
|
|
26810
26814
|
auth: remoteAuthSchema.optional(),
|
|
26811
26815
|
tags: array(string().trim().min(1).max(80)).optional(),
|
|
26812
26816
|
exposure: exposureSchema.optional(),
|
|
26817
|
+
shadowing: shadowingSchema,
|
|
26813
26818
|
...agentSelectionHintsSchema,
|
|
26814
26819
|
setup: setupSchema.optional(),
|
|
26815
26820
|
projectBinding: projectBindingSchema.optional(),
|
|
@@ -26829,6 +26834,7 @@ const publicOpenApiEndpointSchema = object$1({
|
|
|
26829
26834
|
auth: openApiAuthSchema.describe("Explicit OpenAPI request auth config. Use {\"type\":\"none\"} for public APIs."),
|
|
26830
26835
|
tags: array(string().trim().min(1).max(80)).optional(),
|
|
26831
26836
|
exposure: exposureSchema.optional(),
|
|
26837
|
+
shadowing: shadowingSchema,
|
|
26832
26838
|
...agentSelectionHintsSchema,
|
|
26833
26839
|
setup: setupSchema.optional(),
|
|
26834
26840
|
projectBinding: projectBindingSchema.optional(),
|
|
@@ -26861,6 +26867,7 @@ const publicGraphQlEndpointSchema = object$1({
|
|
|
26861
26867
|
auth: openApiAuthSchema.describe("Explicit GraphQL request auth config. Use {\"type\":\"none\"} for public APIs."),
|
|
26862
26868
|
tags: array(string().trim().min(1).max(80)).optional(),
|
|
26863
26869
|
exposure: exposureSchema.optional(),
|
|
26870
|
+
shadowing: shadowingSchema,
|
|
26864
26871
|
...agentSelectionHintsSchema,
|
|
26865
26872
|
setup: setupSchema.optional(),
|
|
26866
26873
|
projectBinding: projectBindingSchema.optional(),
|
|
@@ -26912,6 +26919,7 @@ const publicHttpApiSchema = object$1({
|
|
|
26912
26919
|
actions: record(string().regex(SERVER_ID_PATTERN), httpActionSchema).refine((actions) => Object.keys(actions).length > 0, "HTTP API must define at least one action").describe("Configured HTTP actions keyed by stable tool name."),
|
|
26913
26920
|
tags: array(string().trim().min(1).max(80)).optional(),
|
|
26914
26921
|
exposure: exposureSchema.optional(),
|
|
26922
|
+
shadowing: shadowingSchema,
|
|
26915
26923
|
...agentSelectionHintsSchema,
|
|
26916
26924
|
setup: setupSchema.optional(),
|
|
26917
26925
|
projectBinding: projectBindingSchema.optional(),
|
|
@@ -26950,6 +26958,7 @@ const publicCliToolsSchema = object$1({
|
|
|
26950
26958
|
env: record(string(), string()).optional().describe("Default environment variables for CLI actions."),
|
|
26951
26959
|
tags: array(string().trim().min(1).max(80)).optional(),
|
|
26952
26960
|
exposure: exposureSchema.optional(),
|
|
26961
|
+
shadowing: shadowingSchema,
|
|
26953
26962
|
...agentSelectionHintsSchema,
|
|
26954
26963
|
setup: setupSchema.optional(),
|
|
26955
26964
|
projectBinding: projectBindingSchema.optional(),
|
|
@@ -26969,6 +26978,7 @@ const publicCapletSetSchema = object$1({
|
|
|
26969
26978
|
toolCacheTtlMs: number$1().int().nonnegative().default(3e4).describe("Milliseconds child Caplet metadata stays fresh. Set 0 to refresh every time."),
|
|
26970
26979
|
tags: array(string().trim().min(1).max(80)).optional(),
|
|
26971
26980
|
exposure: exposureSchema.optional(),
|
|
26981
|
+
shadowing: shadowingSchema,
|
|
26972
26982
|
...agentSelectionHintsSchema,
|
|
26973
26983
|
setup: setupSchema.optional(),
|
|
26974
26984
|
projectBinding: projectBindingSchema.optional(),
|
|
@@ -61896,7 +61906,7 @@ var CapletsEngine = class {
|
|
|
61896
61906
|
}
|
|
61897
61907
|
}
|
|
61898
61908
|
async completeCliWords(words) {
|
|
61899
|
-
const { completeCliWords } = await import("./completion-
|
|
61909
|
+
const { completeCliWords } = await import("./completion-DnQujlrc.js").then((n) => n.r);
|
|
61900
61910
|
return await completeCliWords(words, {
|
|
61901
61911
|
config: this.registry.config,
|
|
61902
61912
|
managers: {
|
|
@@ -76978,6 +76988,7 @@ function remoteToolToNativeTool(tool) {
|
|
|
76978
76988
|
return {
|
|
76979
76989
|
caplet: capletId,
|
|
76980
76990
|
...sourceCaplet && sourceCaplet !== capletId ? { sourceCaplet } : {},
|
|
76991
|
+
...tool.shadowing ? { shadowing: tool.shadowing } : {},
|
|
76981
76992
|
toolName,
|
|
76982
76993
|
title: tool.title ?? capletId,
|
|
76983
76994
|
description: [
|
|
@@ -76991,7 +77002,8 @@ function remoteToolToNativeTool(tool) {
|
|
|
76991
77002
|
...tool.codeModeCaplets ? { codeModeCaplets: tool.codeModeCaplets.map((caplet) => ({
|
|
76992
77003
|
id: caplet.capletId,
|
|
76993
77004
|
name: caplet.name,
|
|
76994
|
-
description: caplet.description ?? ""
|
|
77005
|
+
description: caplet.description ?? "",
|
|
77006
|
+
shadowing: caplet.shadowing
|
|
76995
77007
|
})) } : {},
|
|
76996
77008
|
inputSchema,
|
|
76997
77009
|
...isPlainObject(tool.outputSchema) ? { outputSchema: tool.outputSchema } : {},
|
|
@@ -77125,6 +77137,7 @@ function primitiveInvokeInput(capletId, operation, input) {
|
|
|
77125
77137
|
}
|
|
77126
77138
|
function toolsFromManifest(manifest) {
|
|
77127
77139
|
const codeModeMarker = attachCodeModeMarker(manifest);
|
|
77140
|
+
const codeModeShadowing = manifest.codeModeCaplets.some((entry) => entry.shadowing === "forbid") ? "forbid" : "allow";
|
|
77128
77141
|
return [
|
|
77129
77142
|
...manifest.caplets.map((entry) => ({
|
|
77130
77143
|
name: entry.capletId,
|
|
@@ -77132,6 +77145,7 @@ function toolsFromManifest(manifest) {
|
|
|
77132
77145
|
title: entry.title ?? entry.name,
|
|
77133
77146
|
description: entry.description,
|
|
77134
77147
|
inputSchema: entry.inputSchema,
|
|
77148
|
+
shadowing: entry.shadowing,
|
|
77135
77149
|
...codeModeMarker
|
|
77136
77150
|
})),
|
|
77137
77151
|
...manifest.tools.map((entry) => ({
|
|
@@ -77143,6 +77157,7 @@ function toolsFromManifest(manifest) {
|
|
|
77143
77157
|
inputSchema: entry.inputSchema,
|
|
77144
77158
|
outputSchema: entry.outputSchema,
|
|
77145
77159
|
annotations: entry.annotations,
|
|
77160
|
+
shadowing: entry.shadowing,
|
|
77146
77161
|
...codeModeMarker
|
|
77147
77162
|
})),
|
|
77148
77163
|
...primitiveToolsFromManifest(manifest, codeModeMarker),
|
|
@@ -77153,6 +77168,7 @@ function toolsFromManifest(manifest) {
|
|
|
77153
77168
|
description: "Remote Caplets available to locally-run attached Code Mode.",
|
|
77154
77169
|
codeModeRun: true,
|
|
77155
77170
|
codeModeCaplets: manifest.codeModeCaplets,
|
|
77171
|
+
shadowing: codeModeShadowing,
|
|
77156
77172
|
inputSchema: codeModeRunInputJsonSchema()
|
|
77157
77173
|
}] : []
|
|
77158
77174
|
];
|
|
@@ -77163,46 +77179,50 @@ function attachCodeModeMarker(manifest) {
|
|
|
77163
77179
|
function primitiveToolsFromManifest(manifest, codeModeMarker) {
|
|
77164
77180
|
const directToolNames = new Set(manifest.tools.map((entry) => entry.name));
|
|
77165
77181
|
const byCaplet = /* @__PURE__ */ new Map();
|
|
77166
|
-
const entryFor = (capletId) => {
|
|
77182
|
+
const entryFor = (capletId, shadowing) => {
|
|
77167
77183
|
const existing = byCaplet.get(capletId);
|
|
77168
|
-
if (existing)
|
|
77184
|
+
if (existing) {
|
|
77185
|
+
if (shadowing === "forbid") existing.shadowing = "forbid";
|
|
77186
|
+
return existing;
|
|
77187
|
+
}
|
|
77169
77188
|
const next = {
|
|
77170
77189
|
resources: false,
|
|
77171
77190
|
resourceTemplates: false,
|
|
77172
77191
|
prompts: false,
|
|
77173
|
-
completions: false
|
|
77192
|
+
completions: false,
|
|
77193
|
+
shadowing
|
|
77174
77194
|
};
|
|
77175
77195
|
byCaplet.set(capletId, next);
|
|
77176
77196
|
return next;
|
|
77177
77197
|
};
|
|
77178
|
-
for (const entry of manifest.resources) entryFor(entry.capletId).resources = true;
|
|
77179
|
-
for (const entry of manifest.resourceTemplates) entryFor(entry.capletId).resourceTemplates = true;
|
|
77180
|
-
for (const entry of manifest.prompts) entryFor(entry.capletId).prompts = true;
|
|
77181
|
-
for (const entry of manifest.completions) entryFor(entry.capletId).completions = true;
|
|
77198
|
+
for (const entry of manifest.resources) entryFor(entry.capletId, entry.shadowing).resources = true;
|
|
77199
|
+
for (const entry of manifest.resourceTemplates) entryFor(entry.capletId, entry.shadowing).resourceTemplates = true;
|
|
77200
|
+
for (const entry of manifest.prompts) entryFor(entry.capletId, entry.shadowing).prompts = true;
|
|
77201
|
+
for (const entry of manifest.completions) entryFor(entry.capletId, entry.shadowing).completions = true;
|
|
77182
77202
|
const tools = [];
|
|
77183
|
-
const addPrimitiveTool = (capletId, operation) => {
|
|
77203
|
+
const addPrimitiveTool = (capletId, operation, shadowing) => {
|
|
77184
77204
|
const name = `${capletId}__${operation}`;
|
|
77185
77205
|
if (directToolNames.has(name)) return;
|
|
77186
|
-
tools.push(primitiveTool(capletId, operation, codeModeMarker));
|
|
77206
|
+
tools.push(primitiveTool(capletId, operation, shadowing, codeModeMarker));
|
|
77187
77207
|
};
|
|
77188
77208
|
for (const [capletId, flags] of byCaplet) {
|
|
77189
77209
|
if (flags.resources) {
|
|
77190
|
-
addPrimitiveTool(capletId, "list_resources");
|
|
77191
|
-
addPrimitiveTool(capletId, "read_resource");
|
|
77210
|
+
addPrimitiveTool(capletId, "list_resources", flags.shadowing);
|
|
77211
|
+
addPrimitiveTool(capletId, "read_resource", flags.shadowing);
|
|
77192
77212
|
}
|
|
77193
77213
|
if (flags.resourceTemplates) {
|
|
77194
|
-
addPrimitiveTool(capletId, "list_resource_templates");
|
|
77195
|
-
addPrimitiveTool(capletId, "read_resource");
|
|
77214
|
+
addPrimitiveTool(capletId, "list_resource_templates", flags.shadowing);
|
|
77215
|
+
addPrimitiveTool(capletId, "read_resource", flags.shadowing);
|
|
77196
77216
|
}
|
|
77197
77217
|
if (flags.prompts) {
|
|
77198
|
-
addPrimitiveTool(capletId, "list_prompts");
|
|
77199
|
-
addPrimitiveTool(capletId, "get_prompt");
|
|
77218
|
+
addPrimitiveTool(capletId, "list_prompts", flags.shadowing);
|
|
77219
|
+
addPrimitiveTool(capletId, "get_prompt", flags.shadowing);
|
|
77200
77220
|
}
|
|
77201
|
-
if (flags.completions) addPrimitiveTool(capletId, "complete");
|
|
77221
|
+
if (flags.completions) addPrimitiveTool(capletId, "complete", flags.shadowing);
|
|
77202
77222
|
}
|
|
77203
77223
|
return [...new Map(tools.map((tool) => [tool.name, tool])).values()];
|
|
77204
77224
|
}
|
|
77205
|
-
function primitiveTool(capletId, operation, codeModeMarker) {
|
|
77225
|
+
function primitiveTool(capletId, operation, shadowing, codeModeMarker) {
|
|
77206
77226
|
return {
|
|
77207
77227
|
name: `${capletId}__${operation}`,
|
|
77208
77228
|
capletId,
|
|
@@ -77210,6 +77230,7 @@ function primitiveTool(capletId, operation, codeModeMarker) {
|
|
|
77210
77230
|
title: operation,
|
|
77211
77231
|
description: `MCP ${operation.replace(/_/g, " ")}.`,
|
|
77212
77232
|
inputSchema: primitiveInputSchema(operation),
|
|
77233
|
+
shadowing,
|
|
77213
77234
|
...codeModeMarker
|
|
77214
77235
|
};
|
|
77215
77236
|
}
|
|
@@ -77902,6 +77923,7 @@ var DefaultNativeCapletsService = class {
|
|
|
77902
77923
|
});
|
|
77903
77924
|
return {
|
|
77904
77925
|
caplet: routeId,
|
|
77926
|
+
sourceCaplet: caplet.server,
|
|
77905
77927
|
toolName,
|
|
77906
77928
|
title: operationName,
|
|
77907
77929
|
description: options.description ?? "",
|
|
@@ -78069,6 +78091,7 @@ function codeModeRunNativeTool(capletTools) {
|
|
|
78069
78091
|
id: tool.caplet,
|
|
78070
78092
|
name: tool.title,
|
|
78071
78093
|
description: tool.description,
|
|
78094
|
+
...tool.shadowing ? { shadowing: tool.shadowing } : {},
|
|
78072
78095
|
...tool.useWhen ? { useWhen: tool.useWhen } : {},
|
|
78073
78096
|
...tool.avoidWhen ? { avoidWhen: tool.avoidWhen } : {}
|
|
78074
78097
|
}));
|
|
@@ -78103,6 +78126,7 @@ function codeModeCallableNativeTools(tools, options) {
|
|
|
78103
78126
|
toolName: tool?.toolName ?? nativeCapletToolName(caplet.id),
|
|
78104
78127
|
title: caplet.name,
|
|
78105
78128
|
description: caplet.description,
|
|
78129
|
+
...caplet.shadowing ? { shadowing: caplet.shadowing } : {},
|
|
78106
78130
|
...caplet.useWhen ? { useWhen: caplet.useWhen } : {},
|
|
78107
78131
|
...caplet.avoidWhen ? { avoidWhen: caplet.avoidWhen } : {},
|
|
78108
78132
|
promptGuidance: tool?.promptGuidance ?? []
|
|
@@ -78275,9 +78299,7 @@ var CompositeNativeCapletsService = class {
|
|
|
78275
78299
|
}
|
|
78276
78300
|
async execute(capletId, request) {
|
|
78277
78301
|
if (capletId === "code_mode") return await executeCodeModeRunNative(this, request);
|
|
78278
|
-
|
|
78279
|
-
const remoteHasCaplet = serviceHasCaplet(this.remote, capletId);
|
|
78280
|
-
if (localHasCaplet && !remoteHasCaplet) return await this.local.execute(capletId, request);
|
|
78302
|
+
if (this.localCanExecute(capletId)) return await this.local.execute(capletId, request);
|
|
78281
78303
|
return await this.remote.execute(capletId, request);
|
|
78282
78304
|
}
|
|
78283
78305
|
async reload() {
|
|
@@ -78320,8 +78342,8 @@ var CompositeNativeCapletsService = class {
|
|
|
78320
78342
|
mergeTools() {
|
|
78321
78343
|
const allLocalTools = this.local.listTools();
|
|
78322
78344
|
const allRemoteTools = this.remote.listTools();
|
|
78323
|
-
const remoteCodeModeTools =
|
|
78324
|
-
const remoteIds =
|
|
78345
|
+
const remoteCodeModeTools = remoteCodeModeCallableNativeTools(allRemoteTools);
|
|
78346
|
+
const remoteIds = remoteSuppressedCapletIds(allRemoteTools, remoteCodeModeTools);
|
|
78325
78347
|
const localTools = allLocalTools.filter((tool) => tool.codeModeRun !== true && !remoteIds.has(tool.sourceCaplet ?? tool.caplet));
|
|
78326
78348
|
this.warnShadowedLocalCaplets(allLocalTools, remoteIds);
|
|
78327
78349
|
const localCodeModeTools = codeModeCallableNativeTools(allLocalTools, { fallbackToVisible: false }).filter((tool) => !remoteIds.has(tool.caplet));
|
|
@@ -78329,6 +78351,10 @@ var CompositeNativeCapletsService = class {
|
|
|
78329
78351
|
const codeModeTools = [...remoteCodeModeTools, ...localCodeModeTools];
|
|
78330
78352
|
return [...mergedTools, ...codeModeTools.length > 0 ? [codeModeRunNativeTool(codeModeTools)] : []];
|
|
78331
78353
|
}
|
|
78354
|
+
localCanExecute(capletId) {
|
|
78355
|
+
const remoteIds = remoteSuppressedCapletIds(this.remote.listTools());
|
|
78356
|
+
return localExecutionKeys(this.local.listTools(), capletId).some((key) => !remoteIds.has(key));
|
|
78357
|
+
}
|
|
78332
78358
|
warnShadowedLocalCaplets(localTools, remoteIds) {
|
|
78333
78359
|
const localIds = new Set([...localTools.filter((tool) => tool.codeModeRun !== true).map((tool) => tool.sourceCaplet ?? tool.caplet), ...codeModeCallableNativeTools(localTools, { fallbackToVisible: false }).map((tool) => tool.caplet)]);
|
|
78334
78360
|
for (const capletId of localIds) {
|
|
@@ -78347,11 +78373,22 @@ var CompositeNativeCapletsService = class {
|
|
|
78347
78373
|
}
|
|
78348
78374
|
}
|
|
78349
78375
|
};
|
|
78350
|
-
function
|
|
78351
|
-
return
|
|
78352
|
-
|
|
78353
|
-
|
|
78354
|
-
|
|
78376
|
+
function remoteCodeModeCallableNativeTools(tools) {
|
|
78377
|
+
return codeModeCallableNativeTools(tools, { fallbackToVisible: true });
|
|
78378
|
+
}
|
|
78379
|
+
function remoteSuppressedCapletIds(allRemoteTools, remoteCodeModeTools = remoteCodeModeCallableNativeTools(allRemoteTools)) {
|
|
78380
|
+
return new Set([...allRemoteTools.filter((tool) => tool.codeModeRun !== true && tool.shadowing !== "allow").map((tool) => tool.sourceCaplet ?? tool.caplet), ...remoteCodeModeTools.filter((tool) => tool.shadowing !== "allow").map((tool) => tool.caplet)].filter((caplet) => caplet !== nativeCodeModeToolId));
|
|
78381
|
+
}
|
|
78382
|
+
function localExecutionKeys(tools, capletId) {
|
|
78383
|
+
const keys = [];
|
|
78384
|
+
for (const tool of tools) {
|
|
78385
|
+
if (tool.codeModeRun) {
|
|
78386
|
+
for (const caplet of tool.codeModeCaplets ?? []) if (caplet.id === capletId) keys.push(caplet.id);
|
|
78387
|
+
continue;
|
|
78388
|
+
}
|
|
78389
|
+
if (tool.caplet === capletId || tool.sourceCaplet === capletId) keys.push(tool.sourceCaplet ?? tool.caplet);
|
|
78390
|
+
}
|
|
78391
|
+
return keys;
|
|
78355
78392
|
}
|
|
78356
78393
|
function createProjectBindingSessionManager(cloud, local, options) {
|
|
78357
78394
|
if (!cloud) return;
|