@caplets/core 0.18.9 → 0.20.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.
Files changed (132) hide show
  1. package/dist/attach/options.d.ts +10 -0
  2. package/dist/attach/server.d.ts +5 -0
  3. package/dist/caplet-files-bundle.d.ts +430 -0
  4. package/dist/caplet-files.d.ts +3 -266
  5. package/dist/caplet-source/bundle.d.ts +7 -0
  6. package/dist/caplet-source/filesystem.d.ts +7 -0
  7. package/dist/caplet-source/filesystem.js +2 -0
  8. package/dist/caplet-source/index.d.ts +4 -0
  9. package/dist/caplet-source/parse.d.ts +35 -0
  10. package/dist/caplet-source/types.d.ts +9 -0
  11. package/dist/caplet-source.js +7011 -0
  12. package/dist/cli/auth.d.ts +40 -2
  13. package/dist/cli/cloud-add.d.ts +8 -0
  14. package/dist/cli/code-mode.d.ts +16 -0
  15. package/dist/cli/commands.d.ts +8 -1
  16. package/dist/cli/doctor.d.ts +21 -0
  17. package/dist/cli/setup-caplet.d.ts +12 -0
  18. package/dist/cli/setup.d.ts +11 -0
  19. package/dist/cli-tools.d.ts +1 -1
  20. package/dist/cli.d.ts +8 -1
  21. package/dist/cloud/apply.d.ts +36 -0
  22. package/dist/cloud/client.d.ts +30 -0
  23. package/dist/cloud/presence.d.ts +29 -0
  24. package/dist/cloud/project-root.d.ts +2 -0
  25. package/dist/cloud/runtime-adapter.d.ts +23 -0
  26. package/dist/cloud/runtime-http.d.ts +6 -0
  27. package/dist/cloud/sync.d.ts +10 -0
  28. package/dist/cloud-auth/client.d.ts +57 -0
  29. package/dist/cloud-auth/errors.d.ts +11 -0
  30. package/dist/cloud-auth/open-url.d.ts +7 -0
  31. package/dist/cloud-auth/store.d.ts +35 -0
  32. package/dist/cloud-auth/types.d.ts +67 -0
  33. package/dist/code-mode/api.d.ts +32 -0
  34. package/dist/code-mode/declarations.d.ts +5 -0
  35. package/dist/code-mode/diagnostics.d.ts +8 -0
  36. package/dist/code-mode/index.d.ts +4 -0
  37. package/dist/code-mode/logs.d.ts +21 -0
  38. package/dist/code-mode/runner.d.ts +15 -0
  39. package/dist/code-mode/runtime-api.generated.d.ts +1 -0
  40. package/dist/code-mode/sandbox.d.ts +28 -0
  41. package/dist/code-mode/static-analysis.d.ts +2 -0
  42. package/dist/code-mode/tool.d.ts +11 -0
  43. package/dist/code-mode/types.d.ts +120 -0
  44. package/dist/code-mode.js +147855 -0
  45. package/dist/{completion-RqzHpHRY.js → completion-CbazRAiL.js} +20 -1
  46. package/dist/config/paths.d.ts +2 -0
  47. package/dist/config-runtime.d.ts +183 -0
  48. package/dist/config-runtime.js +421 -0
  49. package/dist/config.d.ts +76 -9
  50. package/dist/downstream.d.ts +20 -2
  51. package/dist/engine.d.ts +20 -0
  52. package/dist/exposure/direct-names.d.ts +9 -0
  53. package/dist/exposure/discovery.d.ts +75 -0
  54. package/dist/exposure/policy.d.ts +8 -0
  55. package/dist/filesystem-Kkg32TOJ.js +66 -0
  56. package/dist/generated-tool-input-schema.d.ts +89 -59
  57. package/dist/generated-tool-input-schema.js +172 -1
  58. package/dist/graphql.d.ts +1 -1
  59. package/dist/http-actions.d.ts +1 -1
  60. package/dist/index.d.ts +48 -0
  61. package/dist/index.js +4176 -501
  62. package/dist/native/options.d.ts +22 -3
  63. package/dist/native/remote.d.ts +2 -1
  64. package/dist/native/service.d.ts +13 -3
  65. package/dist/native/tools.d.ts +2 -0
  66. package/dist/native.d.ts +1 -1
  67. package/dist/native.js +3 -431
  68. package/dist/observed-output-shapes/extract.d.ts +5 -0
  69. package/dist/observed-output-shapes/file-store.d.ts +17 -0
  70. package/dist/observed-output-shapes/index.d.ts +7 -0
  71. package/dist/observed-output-shapes/key.d.ts +14 -0
  72. package/dist/observed-output-shapes/merge.d.ts +2 -0
  73. package/dist/observed-output-shapes/pure.d.ts +5 -0
  74. package/dist/observed-output-shapes/pure.js +241 -0
  75. package/dist/observed-output-shapes/schema.d.ts +1 -0
  76. package/dist/observed-output-shapes/types.d.ts +84 -0
  77. package/dist/observed-output-shapes/typescript.d.ts +7 -0
  78. package/dist/observed-output-shapes-uzAMQPhg.js +485 -0
  79. package/dist/observed-output-shapes.js +2 -0
  80. package/dist/openapi.d.ts +1 -1
  81. package/dist/project-binding/attach.d.ts +46 -0
  82. package/dist/project-binding/errors.d.ts +17 -0
  83. package/dist/project-binding/gitignore.d.ts +5 -0
  84. package/dist/project-binding/index.d.ts +2 -0
  85. package/dist/project-binding/mutagen.d.ts +65 -0
  86. package/dist/project-binding/routes.d.ts +9 -0
  87. package/dist/project-binding/session.d.ts +82 -0
  88. package/dist/project-binding/sync-filter.d.ts +19 -0
  89. package/dist/project-binding/sync-size.d.ts +27 -0
  90. package/dist/project-binding/transport.d.ts +21 -0
  91. package/dist/project-binding/types.d.ts +31 -0
  92. package/dist/project-binding/workspaces.d.ts +60 -0
  93. package/dist/project-binding.js +22 -0
  94. package/dist/redaction.d.ts +14 -0
  95. package/dist/redaction.js +30 -0
  96. package/dist/registry.d.ts +4 -0
  97. package/dist/remote/options.d.ts +44 -0
  98. package/dist/remote/selection.d.ts +26 -0
  99. package/dist/remote-control/types.d.ts +1 -1
  100. package/dist/runtime-plan/features.d.ts +7 -0
  101. package/dist/runtime-plan/index.d.ts +4 -0
  102. package/dist/runtime-plan/planner.d.ts +5 -0
  103. package/dist/runtime-plan/resources.d.ts +13 -0
  104. package/dist/runtime-plan/types.d.ts +82 -0
  105. package/dist/runtime-plan.js +281 -0
  106. package/dist/schemas-1HZ0kFpx.js +4270 -0
  107. package/dist/{generated-tool-input-schema--kVuUNc5.js → schemas-BZ6BBrh7.js} +1 -161
  108. package/dist/serve/daemon/config.d.ts +8 -0
  109. package/dist/serve/daemon/index.d.ts +16 -0
  110. package/dist/serve/daemon/paths.d.ts +3 -0
  111. package/dist/serve/daemon/platform-darwin.d.ts +2 -0
  112. package/dist/serve/daemon/platform-linux.d.ts +2 -0
  113. package/dist/serve/daemon/platform-windows.d.ts +2 -0
  114. package/dist/serve/daemon/platform.d.ts +9 -0
  115. package/dist/serve/daemon/process.d.ts +5 -0
  116. package/dist/serve/daemon/types.d.ts +86 -0
  117. package/dist/serve/http.d.ts +8 -0
  118. package/dist/serve/index.d.ts +5 -1
  119. package/dist/serve/native-session.d.ts +19 -0
  120. package/dist/serve/options.d.ts +1 -0
  121. package/dist/serve/session.d.ts +15 -3
  122. package/dist/server/options.d.ts +1 -1
  123. package/dist/{options-DnOUjft1.js → service-D0MwLNyb.js} +38003 -27618
  124. package/dist/setup/hash.d.ts +3 -0
  125. package/dist/setup/local-store.d.ts +34 -0
  126. package/dist/setup/runner.d.ts +40 -0
  127. package/dist/setup/types.d.ts +52 -0
  128. package/dist/stable-json.d.ts +3 -0
  129. package/dist/stable-json.js +26 -0
  130. package/dist/tools.d.ts +38 -12
  131. package/dist/validation-CdqbI2zN.js +174 -0
  132. package/package.json +48 -6
@@ -4557,164 +4557,4 @@ function preprocess(fn, schema) {
4557
4557
  });
4558
4558
  }
4559
4559
  //#endregion
4560
- //#region src/generated-tool-input-schema.ts
4561
- const operations = [
4562
- "inspect",
4563
- "check_backend",
4564
- "list_tools",
4565
- "search_tools",
4566
- "get_tool",
4567
- "call_tool"
4568
- ];
4569
- const mcpOperations = [
4570
- ...operations,
4571
- "list_resources",
4572
- "search_resources",
4573
- "list_resource_templates",
4574
- "read_resource",
4575
- "list_prompts",
4576
- "search_prompts",
4577
- "get_prompt",
4578
- "complete"
4579
- ];
4580
- const generatedToolInputDescriptions = {
4581
- operation: "Wrapper operation: inspect, check_backend, list_tools, search_tools, get_tool, call_tool. MCP Caplets also expose resources, prompts, and completions.",
4582
- query: "Required for search operations only.",
4583
- limit: "Optional list/search result limit.",
4584
- tool: "Exact downstream tool name for get_tool or call_tool.",
4585
- arguments: "JSON object for call_tool arguments/downstream inputs or get_prompt arguments.",
4586
- fields: "Optional call_tool structured output paths when outputSchema allows it.",
4587
- uri: "Exact downstream resource URI for read_resource.",
4588
- prompt: "Exact downstream prompt name for get_prompt.",
4589
- ref: "Completion target reference for complete.",
4590
- argument: "Completion argument object for complete."
4591
- };
4592
- const completionRefSchema = union([object({
4593
- type: literal("prompt"),
4594
- name: string().min(1)
4595
- }).strict(), object({
4596
- type: literal("resourceTemplate"),
4597
- uri: string().min(1)
4598
- }).strict()]);
4599
- const completionArgumentSchema = object({
4600
- name: string().min(1),
4601
- value: string()
4602
- }).strict();
4603
- const baseShape = {
4604
- query: string().optional().describe(generatedToolInputDescriptions.query),
4605
- limit: number().int().positive().optional().describe(generatedToolInputDescriptions.limit),
4606
- tool: string().optional().describe(generatedToolInputDescriptions.tool),
4607
- arguments: object({}).catchall(any()).optional().describe(generatedToolInputDescriptions.arguments),
4608
- fields: array(string().min(1)).min(1).optional().describe(generatedToolInputDescriptions.fields)
4609
- };
4610
- function generatedToolInputSchemaForCaplet(caplet) {
4611
- return object({
4612
- operation: (caplet.backend === "mcp" ? _enum(mcpOperations) : _enum(operations)).describe(generatedToolInputDescriptions.operation),
4613
- ...baseShape,
4614
- ...caplet.backend === "mcp" ? {
4615
- uri: string().optional().describe(generatedToolInputDescriptions.uri),
4616
- prompt: string().optional().describe(generatedToolInputDescriptions.prompt),
4617
- ref: completionRefSchema.optional().describe(generatedToolInputDescriptions.ref),
4618
- argument: completionArgumentSchema.optional().describe(generatedToolInputDescriptions.argument)
4619
- } : {}
4620
- }).strict();
4621
- }
4622
- const generatedToolInputSchema = object({
4623
- operation: _enum(operations).describe(generatedToolInputDescriptions.operation),
4624
- ...baseShape
4625
- }).strict();
4626
- function generatedToolInputJsonSchemaForCaplet(caplet) {
4627
- const mcp = caplet.backend === "mcp";
4628
- return {
4629
- type: "object",
4630
- properties: {
4631
- operation: {
4632
- type: "string",
4633
- enum: mcp ? mcpOperations : operations,
4634
- description: generatedToolInputDescriptions.operation
4635
- },
4636
- query: {
4637
- type: "string",
4638
- description: generatedToolInputDescriptions.query
4639
- },
4640
- limit: {
4641
- type: "integer",
4642
- minimum: 1,
4643
- description: generatedToolInputDescriptions.limit
4644
- },
4645
- tool: {
4646
- type: "string",
4647
- description: generatedToolInputDescriptions.tool
4648
- },
4649
- arguments: {
4650
- type: "object",
4651
- description: generatedToolInputDescriptions.arguments
4652
- },
4653
- fields: {
4654
- type: "array",
4655
- items: {
4656
- type: "string",
4657
- minLength: 1
4658
- },
4659
- minItems: 1,
4660
- description: generatedToolInputDescriptions.fields
4661
- },
4662
- ...mcp ? {
4663
- uri: {
4664
- type: "string",
4665
- description: generatedToolInputDescriptions.uri
4666
- },
4667
- prompt: {
4668
- type: "string",
4669
- description: generatedToolInputDescriptions.prompt
4670
- },
4671
- ref: {
4672
- oneOf: [{
4673
- type: "object",
4674
- properties: {
4675
- type: { const: "prompt" },
4676
- name: {
4677
- type: "string",
4678
- minLength: 1
4679
- }
4680
- },
4681
- required: ["type", "name"],
4682
- additionalProperties: false
4683
- }, {
4684
- type: "object",
4685
- properties: {
4686
- type: { const: "resourceTemplate" },
4687
- uri: {
4688
- type: "string",
4689
- minLength: 1
4690
- }
4691
- },
4692
- required: ["type", "uri"],
4693
- additionalProperties: false
4694
- }],
4695
- description: generatedToolInputDescriptions.ref
4696
- },
4697
- argument: {
4698
- type: "object",
4699
- properties: {
4700
- name: {
4701
- type: "string",
4702
- minLength: 1
4703
- },
4704
- value: { type: "string" }
4705
- },
4706
- required: ["name", "value"],
4707
- additionalProperties: false,
4708
- description: generatedToolInputDescriptions.argument
4709
- }
4710
- } : {}
4711
- },
4712
- required: ["operation"],
4713
- additionalProperties: false
4714
- };
4715
- }
4716
- function generatedToolInputJsonSchema() {
4717
- return generatedToolInputJsonSchemaForCaplet({ backend: "tool" });
4718
- }
4719
- //#endregion
4720
- export { url as A, clone as B, object as C, string as D, record as E, $ZodType as F, normalizeParams as H, parse$1 as I, parseAsync$1 as L, toJSONSchema as M, _coercedNumber as N, union as O, $ZodObject as P, safeParse$1 as R, number as S, preprocess as T, $constructor as U, defineLazy as V, NEVER as W, custom as _, generatedToolInputJsonSchemaForCaplet as a, literal as b, mcpOperations as c, ZodOptional as d, _enum as f, boolean as g, array as h, generatedToolInputJsonSchema as i, datetime as j, unknown as k, operations as l, any as m, completionRefSchema as n, generatedToolInputSchema as o, _null as p, generatedToolInputDescriptions as r, generatedToolInputSchemaForCaplet as s, completionArgumentSchema as t, ZodNumber as u, discriminatedUnion as v, optional as w, looseObject as x, intersection as y, safeParseAsync$1 as z };
4560
+ export { safeParseAsync$1 as A, toJSONSchema as C, parse$1 as D, $ZodType as E, NEVER as F, defineLazy as M, normalizeParams as N, parseAsync$1 as O, $constructor as P, datetime as S, $ZodObject as T, record as _, any as a, unknown as b, custom as c, literal as d, looseObject as f, preprocess as g, optional as h, _null as i, clone as j, safeParse$1 as k, discriminatedUnion as l, object as m, ZodOptional as n, array as o, number as p, _enum as r, boolean as s, ZodNumber as t, intersection as u, string as v, _coercedNumber as w, url as x, union as y };
@@ -0,0 +1,8 @@
1
+ import type { DaemonCommandPlan, ServeDaemonConfig, ServeDaemonPaths, ServeDaemonState, ServeDaemonStatus } from "./types";
2
+ export declare function readDaemonConfig(paths: ServeDaemonPaths): ServeDaemonConfig | undefined;
3
+ export declare function writeDaemonConfig(paths: ServeDaemonPaths, serve: ServeDaemonConfig["serve"], command: DaemonCommandPlan, now?: Date): ServeDaemonConfig;
4
+ export declare function readDaemonState(paths: ServeDaemonPaths): ServeDaemonState | undefined;
5
+ export declare function writeDaemonState(paths: ServeDaemonPaths, state: Omit<ServeDaemonState, "instance" | "updatedAt"> & {
6
+ updatedAt?: string;
7
+ }, now?: Date): ServeDaemonState;
8
+ export declare function redactDaemonStatus(status: ServeDaemonStatus): ServeDaemonStatus;
@@ -0,0 +1,16 @@
1
+ import { type RawServeOptions } from "../options";
2
+ import type { DaemonPlatformDescriptor, ServeDaemonOperationOptions, ServeDaemonOperationResult, ServeDaemonStatus } from "./types";
3
+ export type ServeDaemonServiceResult = {
4
+ enabled: boolean;
5
+ descriptor: DaemonPlatformDescriptor;
6
+ status: ServeDaemonStatus;
7
+ };
8
+ export declare function startDaemon(raw?: RawServeOptions, options?: ServeDaemonOperationOptions): Promise<ServeDaemonOperationResult>;
9
+ export declare function stopDaemon(options?: ServeDaemonOperationOptions): Promise<ServeDaemonOperationResult>;
10
+ export declare function restartDaemon(raw?: RawServeOptions, options?: ServeDaemonOperationOptions): Promise<ServeDaemonOperationResult>;
11
+ export declare function daemonStatus(options?: ServeDaemonOperationOptions): Promise<ServeDaemonStatus>;
12
+ export declare function enableDaemon(options?: ServeDaemonOperationOptions): Promise<ServeDaemonServiceResult>;
13
+ export declare function disableDaemon(options?: ServeDaemonOperationOptions): Promise<ServeDaemonServiceResult>;
14
+ export { buildDaemonPlatformDescriptor } from "./platform";
15
+ export { resolveServeDaemonPaths } from "./paths";
16
+ export type { DaemonPlatformDescriptor, DaemonProcessRunner, ServeDaemonConfig, ServeDaemonOperationOptions, ServeDaemonPaths, ServeDaemonState, ServeDaemonStatus, } from "./types";
@@ -0,0 +1,3 @@
1
+ import type { ServeDaemonOperationOptions, ServeDaemonPaths } from "./types";
2
+ export declare function resolveServeDaemonPaths(options?: Pick<ServeDaemonOperationOptions, "env" | "home" | "platform">): ServeDaemonPaths;
3
+ export declare function daemonServiceDescriptorPath(paths: ServeDaemonPaths, platform: NodeJS.Platform): string;
@@ -0,0 +1,2 @@
1
+ import type { DaemonCommandPlan, LaunchdUserAgentDescriptor, ServeDaemonPaths } from "./types";
2
+ export declare function buildLaunchdUserAgentDescriptor(paths: ServeDaemonPaths, command: DaemonCommandPlan): LaunchdUserAgentDescriptor;
@@ -0,0 +1,2 @@
1
+ import type { DaemonCommandPlan, ManualServiceDescriptor, ServeDaemonPaths, SystemdUserServiceDescriptor } from "./types";
2
+ export declare function buildLinuxServiceDescriptor(paths: ServeDaemonPaths, command: DaemonCommandPlan, serviceAvailable?: boolean): SystemdUserServiceDescriptor | ManualServiceDescriptor;
@@ -0,0 +1,2 @@
1
+ import type { DaemonCommandPlan, WindowsScheduledTaskDescriptor } from "./types";
2
+ export declare function buildWindowsScheduledTaskDescriptor(command: DaemonCommandPlan): WindowsScheduledTaskDescriptor;
@@ -0,0 +1,9 @@
1
+ import type { DaemonCommandPlan, DaemonPlatformDescriptor, ServeDaemonPaths } from "./types";
2
+ export type BuildDaemonPlatformDescriptorOptions = {
3
+ platform?: NodeJS.Platform;
4
+ serviceAvailable?: boolean;
5
+ paths: ServeDaemonPaths;
6
+ command: DaemonCommandPlan;
7
+ };
8
+ export declare function buildDaemonPlatformDescriptor(options: BuildDaemonPlatformDescriptorOptions): DaemonPlatformDescriptor;
9
+ export declare function escapeXml(value: string): string;
@@ -0,0 +1,5 @@
1
+ import type { HttpServeOptions } from "../options";
2
+ import type { DaemonCommandPlan, DaemonProcessRunner } from "./types";
3
+ export declare function daemonServeCommand(options: HttpServeOptions): DaemonCommandPlan;
4
+ export declare function daemonServeArgs(options: HttpServeOptions): string[];
5
+ export declare function createNodeDaemonProcessRunner(): DaemonProcessRunner;
@@ -0,0 +1,86 @@
1
+ import type { HttpServeOptions, RawServeOptions } from "../options";
2
+ export type ServeDaemonInstance = "default";
3
+ export type ServeDaemonPaths = {
4
+ instance: ServeDaemonInstance;
5
+ stateDir: string;
6
+ logDir: string;
7
+ stateFile: string;
8
+ pidFile: string;
9
+ stdoutLog: string;
10
+ stderrLog: string;
11
+ configFile: string;
12
+ };
13
+ export type ServeDaemonConfig = {
14
+ instance: ServeDaemonInstance;
15
+ serve: HttpServeOptions;
16
+ command: DaemonCommandPlan;
17
+ paths: ServeDaemonPaths;
18
+ updatedAt: string;
19
+ };
20
+ export type ServeDaemonState = {
21
+ instance: ServeDaemonInstance;
22
+ running: boolean;
23
+ pid?: number;
24
+ startedAt?: string;
25
+ updatedAt: string;
26
+ enabled: boolean;
27
+ };
28
+ export type ServeDaemonStatus = ServeDaemonState & {
29
+ paths: ServeDaemonPaths;
30
+ config?: ServeDaemonConfig;
31
+ };
32
+ export type DaemonCommandPlan = {
33
+ executable: string;
34
+ args: string[];
35
+ };
36
+ export type DaemonProcessStart = {
37
+ args: string[];
38
+ stdoutLog: string;
39
+ stderrLog: string;
40
+ configFile: string;
41
+ };
42
+ export type DaemonProcessRunner = {
43
+ isRunning(pid: number): Promise<boolean>;
44
+ start(command: DaemonProcessStart): Promise<number>;
45
+ stop(pid: number): Promise<void>;
46
+ };
47
+ export type ServeDaemonOperationOptions = {
48
+ env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
49
+ home?: string;
50
+ platform?: NodeJS.Platform;
51
+ process?: DaemonProcessRunner;
52
+ serviceAvailable?: boolean;
53
+ };
54
+ export type ServeDaemonStartOptions = ServeDaemonOperationOptions & {
55
+ raw?: RawServeOptions;
56
+ };
57
+ export type ServeDaemonOperationResult = {
58
+ status: ServeDaemonStatus;
59
+ };
60
+ export type LaunchdUserAgentDescriptor = {
61
+ kind: "launchd-user-agent";
62
+ label: string;
63
+ path: string;
64
+ plist: string;
65
+ };
66
+ export type SystemdUserServiceDescriptor = {
67
+ kind: "systemd-user";
68
+ unitName: string;
69
+ path: string;
70
+ unit: string;
71
+ };
72
+ export type ManualServiceDescriptor = {
73
+ kind: "manual";
74
+ reason: string;
75
+ command: DaemonCommandPlan;
76
+ };
77
+ export type WindowsScheduledTaskDescriptor = {
78
+ kind: "windows-scheduled-task";
79
+ taskName: string;
80
+ commands: {
81
+ register: string;
82
+ unregister: string;
83
+ query: string;
84
+ };
85
+ };
86
+ export type DaemonPlatformDescriptor = LaunchdUserAgentDescriptor | SystemdUserServiceDescriptor | ManualServiceDescriptor | WindowsScheduledTaskDescriptor;
@@ -1,3 +1,4 @@
1
+ import { StreamableHTTPTransport } from "@hono/mcp";
1
2
  import { Hono } from "hono";
2
3
  import { CapletsEngine, type CapletsEngineOptions } from "../engine";
3
4
  import { type RemoteControlDispatchContext } from "../remote-control/dispatch";
@@ -7,12 +8,19 @@ type HttpServeIo = {
7
8
  writeErr?: (value: string) => void;
8
9
  control?: Omit<RemoteControlDispatchContext, "writeErr">;
9
10
  authFlowStore?: RemoteAuthFlowStore;
11
+ sessionFactory?: HttpMcpSessionFactory;
10
12
  };
13
+ type HttpMcpSession = {
14
+ connect(transport: StreamableHTTPTransport): Promise<void>;
15
+ close(): Promise<void>;
16
+ };
17
+ export type HttpMcpSessionFactory = () => HttpMcpSession | Promise<HttpMcpSession>;
11
18
  export type CapletsHttpApp = Hono & {
12
19
  closeCapletsSessions: () => Promise<void>;
13
20
  };
14
21
  export declare function createHttpServeApp(options: HttpServeOptions, engine: CapletsEngine, io?: HttpServeIo): CapletsHttpApp;
15
22
  export declare function serveHttp(options: HttpServeOptions, engineOptions?: CapletsEngineOptions, writeErr?: (value: string) => void): Promise<void>;
23
+ export declare function serveHttpWithSessionFactory(options: HttpServeOptions, createSession: HttpMcpSessionFactory, writeErr?: (value: string) => void): Promise<void>;
16
24
  export declare function routePath(base: string, path: string): string;
17
25
  export declare function servicePaths(base: string): {
18
26
  base: string;
@@ -1,9 +1,13 @@
1
1
  import type { CapletsEngineOptions } from "../engine";
2
2
  import { type RawServeOptions, type ServeOptions } from "./options";
3
3
  export { serveHttp } from "./http";
4
- export { resolveServeOptions } from "./options";
4
+ export { resolveDaemonServeOptions, resolveServeOptions } from "./options";
5
5
  export type { HttpServeOptions, RawServeOptions, ServeOptions, StdioServeOptions } from "./options";
6
+ export { NativeCapletsMcpSession } from "./native-session";
7
+ export type { NativeCapletsMcpSessionOptions, NativeToolServer } from "./native-session";
6
8
  export { serveStdio } from "./stdio";
9
+ export { buildDaemonPlatformDescriptor, daemonStatus, disableDaemon, enableDaemon, resolveServeDaemonPaths, restartDaemon, startDaemon, stopDaemon, } from "./daemon";
10
+ export type { DaemonPlatformDescriptor, DaemonProcessRunner, ServeDaemonConfig, ServeDaemonOperationOptions, ServeDaemonPaths, ServeDaemonState, ServeDaemonStatus, } from "./daemon";
7
11
  export type ServeCapletsOptions = {
8
12
  raw: RawServeOptions;
9
13
  engine?: CapletsEngineOptions;
@@ -0,0 +1,19 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp";
2
+ import type { Transport } from "@modelcontextprotocol/sdk/shared/transport";
3
+ import type { NativeCapletsService } from "../native/service";
4
+ export type NativeToolServer = Pick<McpServer, "registerTool" | "connect" | "close">;
5
+ export type NativeCapletsMcpSessionOptions = {
6
+ server?: NativeToolServer;
7
+ };
8
+ export declare class NativeCapletsMcpSession {
9
+ private readonly service;
10
+ readonly server: NativeToolServer;
11
+ private readonly tools;
12
+ private readonly unsubscribe;
13
+ private closed;
14
+ constructor(service: NativeCapletsService, options?: NativeCapletsMcpSessionOptions);
15
+ connect(transport: Transport): Promise<void>;
16
+ close(): Promise<void>;
17
+ private reconcileTools;
18
+ private definition;
19
+ }
@@ -34,4 +34,5 @@ export type HttpBasicAuthOptions = {
34
34
  export type ServeOptions = StdioServeOptions | HttpServeOptions;
35
35
  export type ServeEnv = Partial<Record<"CAPLETS_SERVER_URL" | "CAPLETS_SERVER_USER" | "CAPLETS_SERVER_PASSWORD", string>>;
36
36
  export declare function resolveServeOptions(raw: RawServeOptions, env?: ServeEnv): ServeOptions;
37
+ export declare function resolveDaemonServeOptions(raw: RawServeOptions, env?: ServeEnv): HttpServeOptions;
37
38
  export declare function isLoopbackHost(host: string): boolean;
@@ -1,7 +1,8 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp";
2
2
  import type { Transport } from "@modelcontextprotocol/sdk/shared/transport";
3
+ import type { CapletsConfig } from "../config";
3
4
  import type { CapletsEngine } from "../engine";
4
- export type ToolServer = Pick<McpServer, "registerTool" | "connect" | "close">;
5
+ export type ToolServer = Pick<McpServer, "registerTool" | "connect" | "close"> & Partial<Pick<McpServer, "registerResource" | "registerPrompt">>;
5
6
  export type CapletsMcpSessionOptions = {
6
7
  server?: ToolServer;
7
8
  };
@@ -9,13 +10,24 @@ export declare class CapletsMcpSession {
9
10
  private readonly engine;
10
11
  readonly server: ToolServer;
11
12
  private readonly tools;
13
+ private readonly resources;
14
+ private readonly prompts;
15
+ private codeModeTool;
12
16
  private readonly unsubscribeReload;
13
17
  private closed;
14
18
  constructor(engine: CapletsEngine, options?: CapletsMcpSessionOptions);
15
19
  connect(transport: Transport): Promise<void>;
16
20
  registeredToolIds(): string[];
21
+ refreshExposure(_previous?: CapletsConfig | undefined, _next?: CapletsConfig): Promise<void>;
17
22
  close(): Promise<void>;
18
- private reconcileTools;
23
+ private reconcileFromSnapshot;
24
+ private clearRegistrations;
25
+ private registerCodeModeTool;
26
+ private handleCodeModeRunTool;
19
27
  private registerCapletTool;
20
- private handleTool;
28
+ private registerDirectTool;
29
+ private registerDirectResource;
30
+ private registerDirectResourceTemplate;
31
+ private registerDirectPrompt;
32
+ private directResourceResult;
21
33
  }
@@ -1,5 +1,5 @@
1
1
  export type CapletsMode = "auto" | "local" | "remote";
2
- export type CapletsServerEnv = Partial<Record<"CAPLETS_MODE" | "CAPLETS_SERVER_URL" | "CAPLETS_SERVER_USER" | "CAPLETS_SERVER_PASSWORD", string>>;
2
+ export type CapletsServerEnv = Partial<Record<"CAPLETS_MODE" | "CAPLETS_SERVER_URL" | "CAPLETS_SERVER_USER" | "CAPLETS_SERVER_PASSWORD" | "CAPLETS_CLOUD_URL" | "CAPLETS_CLOUD_TOKEN" | "CAPLETS_CLOUD_WORKSPACE_ID" | "CAPLETS_PROJECT_ROOT", string>>;
3
3
  export type CapletsModeInput = {
4
4
  mode?: string;
5
5
  serverUrl?: string;