@caplets/core 0.21.0 → 0.21.1

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.
@@ -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>;
@@ -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-Bs7l5haO.js";
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-lkrQheFA.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/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-Bs7l5haO.js";
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-lkrQheFA.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-GTIuH0CW.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-Cb-pshjL.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.21.0";
1556
+ var version = "0.21.1";
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
- ...resolveServeOptions(attachLocalServeOptions(raw), env),
7188
- projectRoot: raw.projectRoot ?? process.cwd(),
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
  }
@@ -11720,6 +11724,8 @@ async function attachResolvedCaplets(options, io = {}) {
11720
11724
  function createAttachNativeService(options, io) {
11721
11725
  return createNativeCapletsService({
11722
11726
  mode: options.selection.kind === "hosted_cloud" ? "cloud" : "remote",
11727
+ configPath: options.configPath,
11728
+ projectConfigPath: options.projectConfigPath,
11723
11729
  server: {
11724
11730
  url: options.selection.remote.baseUrl.toString(),
11725
11731
  ...options.selection.remote.fetch ? { fetch: options.selection.remote.fetch } : {}
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-Bs7l5haO.js";
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-lkrQheFA.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 = {}) {
@@ -61896,7 +61896,7 @@ var CapletsEngine = class {
61896
61896
  }
61897
61897
  }
61898
61898
  async completeCliWords(words) {
61899
- const { completeCliWords } = await import("./completion-GTIuH0CW.js").then((n) => n.r);
61899
+ const { completeCliWords } = await import("./completion-Cb-pshjL.js").then((n) => n.r);
61900
61900
  return await completeCliWords(words, {
61901
61901
  config: this.registry.config,
61902
61902
  managers: {
@@ -78275,7 +78275,7 @@ var CompositeNativeCapletsService = class {
78275
78275
  }
78276
78276
  async execute(capletId, request) {
78277
78277
  if (capletId === "code_mode") return await executeCodeModeRunNative(this, request);
78278
- const localHasCaplet = this.local.listTools().some((tool) => tool.caplet === capletId);
78278
+ const localHasCaplet = serviceHasCaplet(this.local, capletId);
78279
78279
  const remoteHasCaplet = serviceHasCaplet(this.remote, capletId);
78280
78280
  if (localHasCaplet && !remoteHasCaplet) return await this.local.execute(capletId, request);
78281
78281
  return await this.remote.execute(capletId, request);
@@ -78350,7 +78350,7 @@ var CompositeNativeCapletsService = class {
78350
78350
  function serviceHasCaplet(service, capletId) {
78351
78351
  return service.listTools().some((tool) => {
78352
78352
  if (tool.codeModeRun) return tool.codeModeCaplets?.some((caplet) => caplet.id === capletId) ?? false;
78353
- return tool.caplet === capletId;
78353
+ return tool.caplet === capletId || tool.sourceCaplet === capletId;
78354
78354
  });
78355
78355
  }
78356
78356
  function createProjectBindingSessionManager(cloud, local, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caplets/core",
3
- "version": "0.21.0",
3
+ "version": "0.21.1",
4
4
  "description": "Core runtime library for Caplets Code Mode and progressive disclosure gateways.",
5
5
  "keywords": [
6
6
  "caplets",