New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@synstack/reforge

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@synstack/reforge - npm Package Compare versions

Comparing version
1.8.1
to
1.8.2
+191
dist/vscode.index-CURr6mfX.d.cts
import { z } from 'zod/v4';
/**
* Enumeration of VSCode symbol kinds.
* These values represent different types of symbols that can be found in code.
*/
declare const VscodeSymbolKind: {
readonly File: 0;
readonly Module: 1;
readonly Namespace: 2;
readonly Package: 3;
readonly Class: 4;
readonly Method: 5;
readonly Property: 6;
readonly Field: 7;
readonly Constructor: 8;
readonly Enum: 9;
readonly Interface: 10;
readonly Function: 11;
readonly Variable: 12;
readonly Constant: 13;
readonly String: 14;
readonly Number: 15;
readonly Boolean: 16;
readonly Array: 17;
readonly Object: 18;
readonly Key: 19;
readonly Null: 20;
readonly EnumMember: 21;
readonly Struct: 22;
readonly Event: 23;
readonly Operator: 24;
readonly TypeParameter: 25;
};
/**
* Enumeration of VSCode symbol tags.
* These values represent additional metadata that can be attached to symbols.
*/
declare const VscodeSymbolTag: {
readonly Deprecated: 1;
};
/**
* Schema for a position in a text document.
*/
declare const positionSchema: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
/** Type representing a position in a text document */
type Position = z.output<typeof positionSchema>;
/**
* Schema for a range in a text document.
*/
declare const rangeSchema: z.ZodObject<{
start: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
end: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
}, z.core.$strip>;
/** Type representing a range in a text document */
type Range = z.output<typeof rangeSchema>;
/**
* Schema for a call hierarchy item.
* Represents a programming construct that can be part of a call hierarchy.
*/
declare const callHierarchyItemSchema: z.ZodObject<{
kind: z.ZodNumber;
name: z.ZodString;
detail: z.ZodString;
uri: z.ZodString;
tags: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
range: z.ZodObject<{
start: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
end: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
}, z.core.$strip>;
selectionRange: z.ZodObject<{
start: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
end: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
}, z.core.$strip>;
}, z.core.$strip>;
/** Type representing a call hierarchy item */
type CallHierarchyItem = z.output<typeof callHierarchyItemSchema>;
/**
* Configuration for the executeCommand tool.
* Defines the schema for executing VSCode commands.
*/
declare const executeCommandConfig: {
name: string;
requestSchema: z.ZodObject<{
command: z.ZodString;
args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
type: z.ZodLiteral<"path">;
value: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"Uri">;
value: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"Range">;
value: z.ZodObject<{
start: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
end: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"Position">;
value: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"CallHierarchyItem">;
value: z.ZodObject<{
kind: z.ZodNumber;
name: z.ZodString;
detail: z.ZodString;
uri: z.ZodString;
tags: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
range: z.ZodObject<{
start: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
end: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
}, z.core.$strip>;
selectionRange: z.ZodObject<{
start: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
end: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
}, z.core.$strip>;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"primitive">;
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>;
}, z.core.$strip>]>>>>;
}, z.core.$strip>;
responseSchema: z.ZodOptional<z.ZodAny>;
};
/**
* Executes a command in the VSCode editor.
* Allows calling bundled VSCode commands as well as commands from other extensions.
*
* @template OUTPUT - The expected output type of the command
* @param {z.input<typeof executeCommandConfig.requestSchema>} args - The command arguments
* @returns {Promise<OUTPUT>} A promise that resolves with the command's output
*/
declare const executeCommand: <OUTPUT = any>(args: z.input<typeof executeCommandConfig.requestSchema>) => Promise<OUTPUT>;
type vscode_lib_CallHierarchyItem = CallHierarchyItem;
type vscode_lib_Position = Position;
type vscode_lib_Range = Range;
declare const vscode_lib_VscodeSymbolKind: typeof VscodeSymbolKind;
declare const vscode_lib_VscodeSymbolTag: typeof VscodeSymbolTag;
declare const vscode_lib_callHierarchyItemSchema: typeof callHierarchyItemSchema;
declare const vscode_lib_executeCommand: typeof executeCommand;
declare const vscode_lib_executeCommandConfig: typeof executeCommandConfig;
declare const vscode_lib_positionSchema: typeof positionSchema;
declare const vscode_lib_rangeSchema: typeof rangeSchema;
declare namespace vscode_lib {
export { type vscode_lib_CallHierarchyItem as CallHierarchyItem, type vscode_lib_Position as Position, type vscode_lib_Range as Range, vscode_lib_VscodeSymbolKind as VscodeSymbolKind, vscode_lib_VscodeSymbolTag as VscodeSymbolTag, vscode_lib_callHierarchyItemSchema as callHierarchyItemSchema, vscode_lib_executeCommand as executeCommand, vscode_lib_executeCommandConfig as executeCommandConfig, vscode_lib_positionSchema as positionSchema, vscode_lib_rangeSchema as rangeSchema };
}
export { type CallHierarchyItem as C, type Position as P, type Range as R, VscodeSymbolKind as V, VscodeSymbolTag as a, executeCommand as b, callHierarchyItemSchema as c, executeCommandConfig as e, positionSchema as p, rangeSchema as r, vscode_lib as v };
import { z } from 'zod/v4';
/**
* Enumeration of VSCode symbol kinds.
* These values represent different types of symbols that can be found in code.
*/
declare const VscodeSymbolKind: {
readonly File: 0;
readonly Module: 1;
readonly Namespace: 2;
readonly Package: 3;
readonly Class: 4;
readonly Method: 5;
readonly Property: 6;
readonly Field: 7;
readonly Constructor: 8;
readonly Enum: 9;
readonly Interface: 10;
readonly Function: 11;
readonly Variable: 12;
readonly Constant: 13;
readonly String: 14;
readonly Number: 15;
readonly Boolean: 16;
readonly Array: 17;
readonly Object: 18;
readonly Key: 19;
readonly Null: 20;
readonly EnumMember: 21;
readonly Struct: 22;
readonly Event: 23;
readonly Operator: 24;
readonly TypeParameter: 25;
};
/**
* Enumeration of VSCode symbol tags.
* These values represent additional metadata that can be attached to symbols.
*/
declare const VscodeSymbolTag: {
readonly Deprecated: 1;
};
/**
* Schema for a position in a text document.
*/
declare const positionSchema: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
/** Type representing a position in a text document */
type Position = z.output<typeof positionSchema>;
/**
* Schema for a range in a text document.
*/
declare const rangeSchema: z.ZodObject<{
start: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
end: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
}, z.core.$strip>;
/** Type representing a range in a text document */
type Range = z.output<typeof rangeSchema>;
/**
* Schema for a call hierarchy item.
* Represents a programming construct that can be part of a call hierarchy.
*/
declare const callHierarchyItemSchema: z.ZodObject<{
kind: z.ZodNumber;
name: z.ZodString;
detail: z.ZodString;
uri: z.ZodString;
tags: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
range: z.ZodObject<{
start: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
end: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
}, z.core.$strip>;
selectionRange: z.ZodObject<{
start: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
end: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
}, z.core.$strip>;
}, z.core.$strip>;
/** Type representing a call hierarchy item */
type CallHierarchyItem = z.output<typeof callHierarchyItemSchema>;
/**
* Configuration for the executeCommand tool.
* Defines the schema for executing VSCode commands.
*/
declare const executeCommandConfig: {
name: string;
requestSchema: z.ZodObject<{
command: z.ZodString;
args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
type: z.ZodLiteral<"path">;
value: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"Uri">;
value: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"Range">;
value: z.ZodObject<{
start: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
end: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"Position">;
value: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"CallHierarchyItem">;
value: z.ZodObject<{
kind: z.ZodNumber;
name: z.ZodString;
detail: z.ZodString;
uri: z.ZodString;
tags: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
range: z.ZodObject<{
start: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
end: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
}, z.core.$strip>;
selectionRange: z.ZodObject<{
start: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
end: z.ZodObject<{
line: z.ZodNumber;
character: z.ZodNumber;
}, z.core.$strip>;
}, z.core.$strip>;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"primitive">;
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>;
}, z.core.$strip>]>>>>;
}, z.core.$strip>;
responseSchema: z.ZodOptional<z.ZodAny>;
};
/**
* Executes a command in the VSCode editor.
* Allows calling bundled VSCode commands as well as commands from other extensions.
*
* @template OUTPUT - The expected output type of the command
* @param {z.input<typeof executeCommandConfig.requestSchema>} args - The command arguments
* @returns {Promise<OUTPUT>} A promise that resolves with the command's output
*/
declare const executeCommand: <OUTPUT = any>(args: z.input<typeof executeCommandConfig.requestSchema>) => Promise<OUTPUT>;
type vscode_lib_CallHierarchyItem = CallHierarchyItem;
type vscode_lib_Position = Position;
type vscode_lib_Range = Range;
declare const vscode_lib_VscodeSymbolKind: typeof VscodeSymbolKind;
declare const vscode_lib_VscodeSymbolTag: typeof VscodeSymbolTag;
declare const vscode_lib_callHierarchyItemSchema: typeof callHierarchyItemSchema;
declare const vscode_lib_executeCommand: typeof executeCommand;
declare const vscode_lib_executeCommandConfig: typeof executeCommandConfig;
declare const vscode_lib_positionSchema: typeof positionSchema;
declare const vscode_lib_rangeSchema: typeof rangeSchema;
declare namespace vscode_lib {
export { type vscode_lib_CallHierarchyItem as CallHierarchyItem, type vscode_lib_Position as Position, type vscode_lib_Range as Range, vscode_lib_VscodeSymbolKind as VscodeSymbolKind, vscode_lib_VscodeSymbolTag as VscodeSymbolTag, vscode_lib_callHierarchyItemSchema as callHierarchyItemSchema, vscode_lib_executeCommand as executeCommand, vscode_lib_executeCommandConfig as executeCommandConfig, vscode_lib_positionSchema as positionSchema, vscode_lib_rangeSchema as rangeSchema };
}
export { type CallHierarchyItem as C, type Position as P, type Range as R, VscodeSymbolKind as V, VscodeSymbolTag as a, executeCommand as b, callHierarchyItemSchema as c, executeCommandConfig as e, positionSchema as p, rangeSchema as r, vscode_lib as v };
+109
-107

@@ -84,3 +84,3 @@ "use strict";

// src/reforge.lib.ts
var import_zod2 = require("zod");
var import_v42 = require("zod/v4");

@@ -91,3 +91,3 @@ // src/tool.utils.ts

var import_pako = __toESM(require("pako"), 1);
var import_zod = require("zod");
var import_v4 = require("zod/v4");
var RESPONSE_SUFFIX = "_RESPONSE";

@@ -114,21 +114,21 @@ var memoize = (fn) => {

});
var baseResponseSchema = import_zod.z.object({
type: import_zod.z.string(),
id: import_zod.z.string(),
status: import_zod.z.union([import_zod.z.literal("ok"), import_zod.z.literal("error")])
var baseResponseSchema = import_v4.z.object({
type: import_v4.z.string(),
id: import_v4.z.string(),
status: import_v4.z.union([import_v4.z.literal("ok"), import_v4.z.literal("error")])
});
var toolFactory = (toolConfig) => {
const responseName = `${toolConfig.name}${RESPONSE_SUFFIX}`;
const responseSchema = import_zod.z.discriminatedUnion("status", [
import_zod.z.object({
type: import_zod.z.literal(responseName),
id: import_zod.z.string(),
status: import_zod.z.literal("ok"),
const responseSchema = import_v4.z.discriminatedUnion("status", [
import_v4.z.object({
status: import_v4.z.literal("ok"),
type: import_v4.z.literal(responseName),
id: import_v4.z.string(),
data: toolConfig.responseSchema
}),
import_zod.z.object({
type: import_zod.z.literal(responseName),
id: import_zod.z.string(),
status: import_zod.z.literal("error"),
data: import_zod.z.string()
import_v4.z.object({
status: import_v4.z.literal("error"),
type: import_v4.z.literal(responseName),
id: import_v4.z.string(),
data: import_v4.z.string()
})

@@ -156,3 +156,3 @@ ]);

if (parsedResponse.status === "ok") resolve(parsedResponse.data);
else reject(new Error(parsedResponse.status));
else reject(new Error(parsedResponse.data));
}

@@ -180,3 +180,3 @@ };

requestSchema: null,
responseSchema: import_zod2.z.string().nullable()
responseSchema: import_v42.z.string().nullable()
};

@@ -187,3 +187,3 @@ var getFocusedFile = toolFactory(getFocusedFileConfig);

requestSchema: null,
responseSchema: import_zod2.z.array(import_zod2.z.string())
responseSchema: import_v42.z.array(import_v42.z.string())
};

@@ -193,17 +193,17 @@ var getOpenedFiles = toolFactory(getOpenedFilesConfig);

name: "PROMPT_SELECT",
requestSchema: import_zod2.z.object({
requestSchema: import_v42.z.object({
/**
* The title of the prompt
*/
title: import_zod2.z.string().optional(),
title: import_v42.z.string().optional(),
/**
* The options to display in the prompt
*/
options: import_zod2.z.array(import_zod2.z.string()),
options: import_v42.z.array(import_v42.z.string()),
/**
* The placeholder text to display in the prompt
*/
placeHolder: import_zod2.z.string().optional()
placeHolder: import_v42.z.string().optional()
}),
responseSchema: import_zod2.z.string().nullable()
responseSchema: import_v42.z.string().nullable()
};

@@ -213,25 +213,25 @@ var promptSelect = toolFactory(promptSelectConfig);

name: "PROMPT_INPUT",
requestSchema: import_zod2.z.object({
requestSchema: import_v42.z.object({
/**
* The title of the prompt
*/
title: import_zod2.z.string().optional(),
title: import_v42.z.string().optional(),
/**
* The prompt to display in the prompt
*/
prompt: import_zod2.z.string().optional(),
prompt: import_v42.z.string().optional(),
/**
* The placeholder text to display in the prompt
*/
placeHolder: import_zod2.z.string().optional(),
placeHolder: import_v42.z.string().optional(),
/**
* The default input value
*/
defaultValue: import_zod2.z.string().optional(),
defaultValue: import_v42.z.string().optional(),
/**
* Whether the input should be a password and masked
*/
isPassword: import_zod2.z.boolean().optional().default(false)
isPassword: import_v42.z.boolean().optional().default(false)
}),
responseSchema: import_zod2.z.string().nullable()
responseSchema: import_v42.z.string().nullable()
};

@@ -241,17 +241,17 @@ var promptInput = toolFactory(promptInputConfig);

name: "PROMPT_MULTI_SELECT",
requestSchema: import_zod2.z.object({
requestSchema: import_v42.z.object({
/**
* The title of the prompt
*/
title: import_zod2.z.string().optional(),
title: import_v42.z.string().optional(),
/**
* The options to display in the prompt
*/
options: import_zod2.z.array(import_zod2.z.string()),
options: import_v42.z.array(import_v42.z.string()),
/**
* The placeholder text to display in the prompt
*/
placeHolder: import_zod2.z.string().optional()
placeHolder: import_v42.z.string().optional()
}),
responseSchema: import_zod2.z.array(import_zod2.z.string())
responseSchema: import_v42.z.array(import_v42.z.string())
};

@@ -261,11 +261,11 @@ var promptMultiSelect = toolFactory(promptMultiSelectConfig);

name: "NOTIFY",
requestSchema: import_zod2.z.object({
requestSchema: import_v42.z.object({
/**
* The title of the notification
*/
title: import_zod2.z.string().optional(),
title: import_v42.z.string().optional(),
/**
* The message to display in the notification
*/
message: import_zod2.z.string(),
message: import_v42.z.string(),
/**

@@ -278,12 +278,12 @@ * The type of notification

*/
type: import_zod2.z.enum(["info", "warning", "error"]).optional().default("info"),
type: import_v42.z.enum(["info", "warning", "error"]).optional().default("info"),
/**
* Buttons values to display in the notification
*/
buttons: import_zod2.z.array(import_zod2.z.string()).optional()
buttons: import_v42.z.array(import_v42.z.string()).optional()
}),
responseSchema: import_zod2.z.string().nullable()
responseSchema: import_v42.z.string().nullable()
};
var notify = toolFactory(notifyConfig);
var openFileRequest = import_zod2.z.object({
var openFileRequest = import_v42.z.object({
/**

@@ -293,3 +293,3 @@ * @default false

*/
force: import_zod2.z.boolean().default(false),
force: import_v42.z.boolean().default(false),
/**

@@ -300,3 +300,3 @@ * Whether to preview the file in the editor

*/
preview: import_zod2.z.boolean().optional().default(false),
preview: import_v42.z.boolean().optional().default(false),
/**

@@ -309,23 +309,25 @@ * The column to open the file in

*/
column: import_zod2.z.union([import_zod2.z.enum(["active", "beside"]), import_zod2.z.number().min(1).max(9)]).optional()
column: import_v42.z.union([import_v42.z.enum(["active", "beside"]), import_v42.z.number().min(1).max(9)]).optional()
}).default({
force: false,
preview: false,
column: "active"
});
var openFileResponse = import_zod2.z.object({
var openFileResponse = import_v42.z.object({
/**
* Absolute path to the file
*/
path: import_zod2.z.string(),
path: import_v42.z.string(),
/**
* Whether the file is already open in the editor
*/
isAlreadyOpened: import_zod2.z.boolean()
isAlreadyOpened: import_v42.z.boolean()
});
var openFileConfig = {
name: "OPEN_FILE",
requestSchema: import_zod2.z.object({
requestSchema: import_v42.z.object({
/**
* Absolute path to the file
*/
path: import_zod2.z.string(),
path: import_v42.z.string(),
config: openFileRequest

@@ -338,7 +340,7 @@ }),

name: "OPEN_FILES",
requestSchema: import_zod2.z.object({
requestSchema: import_v42.z.object({
/**
* Array of absolute paths to the files to open
*/
paths: import_zod2.z.array(import_zod2.z.string()),
paths: import_v42.z.array(import_v42.z.string()),
config: openFileRequest

@@ -349,18 +351,18 @@ }),

*/
responseSchema: import_zod2.z.array(openFileResponse)
responseSchema: import_v42.z.array(openFileResponse)
};
var openFiles = toolFactory(openFilesConfig);
var selectionPositionSchema = import_zod2.z.object({
var selectionPositionSchema = import_v42.z.object({
/**
* The position in the whole file
*/
character: import_zod2.z.number(),
character: import_v42.z.number(),
/**
* The line number of the position
*/
line: import_zod2.z.number(),
line: import_v42.z.number(),
/**
* The character position within the line
*/
lineCharacter: import_zod2.z.number()
lineCharacter: import_v42.z.number()
});

@@ -370,12 +372,12 @@ var getFocusedFileSelectionsConfig = {

requestSchema: null,
responseSchema: import_zod2.z.object({
responseSchema: import_v42.z.object({
/**
* Absolute path to the file
*/
path: import_zod2.z.string(),
path: import_v42.z.string(),
/**
* Array of active selections in the file
*/
selections: import_zod2.z.array(
import_zod2.z.object({
selections: import_v42.z.array(
import_v42.z.object({
/**

@@ -392,7 +394,7 @@ * The starting character position of the selection in the file

*/
content: import_zod2.z.string(),
content: import_v42.z.string(),
/**
* The length of the selection
*/
length: import_zod2.z.number()
length: import_v42.z.number()
})

@@ -408,3 +410,3 @@ )

requestSchema: null,
responseSchema: import_zod2.z.array(import_zod2.z.string())
responseSchema: import_v42.z.array(import_v42.z.string())
};

@@ -414,6 +416,6 @@ var getPinnedFiles = toolFactory(getPinnedFilesConfig);

name: "PIN_FILES",
requestSchema: import_zod2.z.object({
paths: import_zod2.z.array(import_zod2.z.string())
requestSchema: import_v42.z.object({
paths: import_v42.z.array(import_v42.z.string())
}),
responseSchema: import_zod2.z.array(import_zod2.z.string())
responseSchema: import_v42.z.array(import_v42.z.string())
};

@@ -423,6 +425,6 @@ var pinFiles = toolFactory(pinFilesConfig);

name: "UNPIN_FILES",
requestSchema: import_zod2.z.object({
paths: import_zod2.z.array(import_zod2.z.string())
requestSchema: import_v42.z.object({
paths: import_v42.z.array(import_v42.z.string())
}),
responseSchema: import_zod2.z.array(import_zod2.z.string())
responseSchema: import_v42.z.array(import_v42.z.string())
};

@@ -442,3 +444,3 @@ var unpinFiles = toolFactory(unpinFilesConfig);

});
var import_zod3 = require("zod");
var import_v43 = require("zod/v4");
var VscodeSymbolKind = {

@@ -475,9 +477,9 @@ File: 0,

};
var positionSchema = import_zod3.z.object({
var positionSchema = import_v43.z.object({
/** Zero-based line number */
line: import_zod3.z.number().int().min(0),
line: import_v43.z.number().int().min(0),
/** Zero-based character offset on the line */
character: import_zod3.z.number().int().min(0)
character: import_v43.z.number().int().min(0)
});
var rangeSchema = import_zod3.z.object({
var rangeSchema = import_v43.z.object({
/** The start position of the range */

@@ -488,13 +490,13 @@ start: positionSchema,

});
var callHierarchyItemSchema = import_zod3.z.object({
var callHierarchyItemSchema = import_v43.z.object({
/** The symbol kind of the item */
kind: import_zod3.z.number().int().min(0).max(25),
kind: import_v43.z.number().int().min(0).max(25),
/** The name of the item */
name: import_zod3.z.string(),
name: import_v43.z.string(),
/** Additional details about the item */
detail: import_zod3.z.string(),
detail: import_v43.z.string(),
/** The URI of the document containing the item */
uri: import_zod3.z.string(),
uri: import_v43.z.string(),
/** Optional tags associated with the item */
tags: import_zod3.z.array(import_zod3.z.number().int()).optional(),
tags: import_v43.z.array(import_v43.z.number().int()).optional(),
/** The full range of the item */

@@ -507,36 +509,36 @@ range: rangeSchema,

name: "EXECUTE_COMMAND",
requestSchema: import_zod3.z.object({
requestSchema: import_v43.z.object({
/** The vscode command to execute */
command: import_zod3.z.string(),
command: import_v43.z.string(),
/** List of args to be passed to the command */
args: import_zod3.z.array(
import_zod3.z.discriminatedUnion("type", [
import_zod3.z.object({
type: import_zod3.z.literal("path"),
value: import_zod3.z.string()
args: import_v43.z.array(
import_v43.z.discriminatedUnion("type", [
import_v43.z.object({
type: import_v43.z.literal("path"),
value: import_v43.z.string()
}),
import_zod3.z.object({
type: import_zod3.z.literal("Uri"),
value: import_zod3.z.string().describe("Absolute path to the file")
import_v43.z.object({
type: import_v43.z.literal("Uri"),
value: import_v43.z.string().describe("Absolute path to the file")
}),
import_zod3.z.object({
type: import_zod3.z.literal("Range"),
import_v43.z.object({
type: import_v43.z.literal("Range"),
value: rangeSchema
}),
import_zod3.z.object({
type: import_zod3.z.literal("Position"),
import_v43.z.object({
type: import_v43.z.literal("Position"),
value: positionSchema
}),
import_zod3.z.object({
type: import_zod3.z.literal("CallHierarchyItem"),
import_v43.z.object({
type: import_v43.z.literal("CallHierarchyItem"),
value: callHierarchyItemSchema
}),
import_zod3.z.object({
type: import_zod3.z.literal("primitive"),
value: import_zod3.z.union([
import_zod3.z.string(),
import_zod3.z.number(),
import_zod3.z.boolean(),
import_zod3.z.record(import_zod3.z.any()),
import_zod3.z.array(import_zod3.z.any())
import_v43.z.object({
type: import_v43.z.literal("primitive"),
value: import_v43.z.union([
import_v43.z.string(),
import_v43.z.number(),
import_v43.z.boolean(),
import_v43.z.record(import_v43.z.string(), import_v43.z.any()),
import_v43.z.array(import_v43.z.any())
])

@@ -547,3 +549,3 @@ })

}),
responseSchema: import_zod3.z.any().optional()
responseSchema: import_v43.z.any().optional()
};

@@ -550,0 +552,0 @@ var executeCommand = toolFactory(executeCommandConfig);

@@ -1,1 +0,1 @@

{"version":3,"sources":["../src/reforge.index.ts","../src/reforge.bundle.ts","../src/reforge.lib.ts","../src/tool.utils.ts","../src/vscode.lib.ts"],"sourcesContent":["export * as reforge from \"./reforge.bundle.ts\";\nexport * from \"./reforge.lib.ts\";\nexport * from \"./tool.utils.ts\";\n","export {\n getFocusedFile,\n getFocusedFileSelections,\n getOpenedFiles,\n getPinnedFiles,\n notify,\n openFile,\n openFiles,\n pinFiles,\n promptInput,\n promptMultiSelect,\n promptSelect,\n unpinFiles,\n} from \"./reforge.lib.ts\";\n\nexport * as vscode from \"./vscode.lib.ts\";\n","import { z } from \"zod\";\nimport { toolFactory } from \"./tool.utils.ts\";\n\nexport const getFocusedFileConfig = {\n name: \"GET_FOCUSED_FILE\",\n requestSchema: null,\n responseSchema: z.string().nullable(),\n} as const;\n\n/**\n * Retrieve the absolute path to the actively focused file in the editor\n */\nexport const getFocusedFile = toolFactory(getFocusedFileConfig);\n\nexport const getOpenedFilesConfig = {\n name: \"GET_OPENED_FILES\",\n requestSchema: null,\n responseSchema: z.array(z.string()),\n} as const;\n\n// TODO: Return a list of FsFile instances\n/**\n * Retrieve the absolute paths to all opened files in the editor\n *\n * @warning this list also includes the focused file\n */\nexport const getOpenedFiles = toolFactory(getOpenedFilesConfig);\n\nexport const promptSelectConfig = {\n name: \"PROMPT_SELECT\",\n requestSchema: z.object({\n /**\n * The title of the prompt\n */\n title: z.string().optional(),\n /**\n * The options to display in the prompt\n */\n options: z.array(z.string()),\n /**\n * The placeholder text to display in the prompt\n */\n placeHolder: z.string().optional(),\n }),\n responseSchema: z.string().nullable(),\n} as const;\n\n// TODO: Provide a complete API for choices\n/**\n * Prompts the user to select an option from a list of options\n * @returns The selected option or null if the user cancels the prompt\n */\nexport const promptSelect = toolFactory(promptSelectConfig);\n\nexport const promptInputConfig = {\n name: \"PROMPT_INPUT\",\n requestSchema: z.object({\n /**\n * The title of the prompt\n */\n title: z.string().optional(),\n /**\n * The prompt to display in the prompt\n */\n prompt: z.string().optional(),\n /**\n * The placeholder text to display in the prompt\n */\n placeHolder: z.string().optional(),\n /**\n * The default input value\n */\n defaultValue: z.string().optional(),\n /**\n * Whether the input should be a password and masked\n */\n isPassword: z.boolean().optional().default(false),\n }),\n responseSchema: z.string().nullable(),\n} as const;\n\n/**\n * Prompts the user to input a value\n * @returns The input value or null if the user cancels the prompt\n */\nexport const promptInput = toolFactory(promptInputConfig);\n\nexport const promptMultiSelectConfig = {\n name: \"PROMPT_MULTI_SELECT\",\n requestSchema: z.object({\n /**\n * The title of the prompt\n */\n title: z.string().optional(),\n /**\n * The options to display in the prompt\n */\n options: z.array(z.string()),\n /**\n * The placeholder text to display in the prompt\n */\n placeHolder: z.string().optional(),\n }),\n responseSchema: z.array(z.string()),\n} as const;\n\n// TODO: Provide a complete API for choices\n/**\n * Prompts the user to select multiple options from a list of options\n * @returns The selected options as an array\n */\nexport const promptMultiSelect = toolFactory(promptMultiSelectConfig);\n\nexport const notifyConfig = {\n name: \"NOTIFY\",\n requestSchema: z.object({\n /**\n * The title of the notification\n */\n title: z.string().optional(),\n /**\n * The message to display in the notification\n */\n message: z.string(),\n /**\n * The type of notification\n * @default info\n * @argument info - Informational notification\n * @argument warning - Warning notification\n * @argument error - Error notification\n */\n type: z.enum([\"info\", \"warning\", \"error\"]).optional().default(\"info\"),\n /**\n * Buttons values to display in the notification\n */\n buttons: z.array(z.string()).optional(),\n }),\n responseSchema: z.string().nullable(),\n} as const;\n\n/**\n * Displays a notification to the user\n * @returns the button clicked by the user or null if the user dismissed the notification\n */\nexport const notify = toolFactory(notifyConfig);\n\nconst openFileRequest = z\n .object({\n /**\n * @default false\n * Whether to force the file to open even if it is already open\n */\n force: z.boolean().default(false),\n /**\n * Whether to preview the file in the editor\n * @default false\n * @warning Check if the file type is supported by the editor\n */\n preview: z.boolean().optional().default(false),\n /**\n * The column to open the file in\n * @default active\n * @argument active - Open the file in the active column\n * @argument beside - Open the file beside the active column\n * @argument N - Open the file in the Nth column\n */\n column: z\n .union([z.enum([\"active\", \"beside\"]), z.number().min(1).max(9)])\n .optional(),\n })\n .default({\n column: \"active\",\n });\n\nconst openFileResponse = z.object({\n /**\n * Absolute path to the file\n */\n path: z.string(),\n /**\n * Whether the file is already open in the editor\n */\n isAlreadyOpened: z.boolean(),\n});\n\nexport const openFileConfig = {\n name: \"OPEN_FILE\",\n requestSchema: z.object({\n /**\n * Absolute path to the file\n */\n path: z.string(),\n config: openFileRequest,\n }),\n responseSchema: openFileResponse,\n};\n\n/**\n * Opens a file in the editor\n */\nexport const openFile = toolFactory(openFileConfig);\n\nexport const openFilesConfig = {\n name: \"OPEN_FILES\",\n requestSchema: z.object({\n /**\n * Array of absolute paths to the files to open\n */\n paths: z.array(z.string()),\n config: openFileRequest,\n }),\n /**\n * Array of absolute paths to the files & whether they were already open in the editor\n */\n responseSchema: z.array(openFileResponse),\n};\n\nexport const openFiles = toolFactory(openFilesConfig);\n\nconst selectionPositionSchema = z.object({\n /**\n * The position in the whole file\n */\n character: z.number(),\n /**\n * The line number of the position\n */\n line: z.number(),\n /**\n * The character position within the line\n */\n lineCharacter: z.number(),\n});\n\nexport const getFocusedFileSelectionsConfig = {\n name: \"GET_FOCUSED_FILE_SELECTION\",\n requestSchema: null,\n responseSchema: z\n .object({\n /**\n * Absolute path to the file\n */\n path: z.string(),\n /**\n * Array of active selections in the file\n */\n selections: z.array(\n z.object({\n /**\n * The starting character position of the selection in the file\n */\n start: selectionPositionSchema,\n /**\n * The ending character position of the selection in the file\n */\n end: selectionPositionSchema,\n /**\n * The string content of the selection\n */\n content: z.string(),\n /**\n * The length of the selection\n */\n length: z.number(),\n }),\n ),\n })\n .nullable(),\n};\n\n/**\n * Retrieve the active selections in the actively focused file in the editor\n */\nexport const getFocusedFileSelections = toolFactory(\n getFocusedFileSelectionsConfig,\n);\n\nexport const getPinnedFilesConfig = {\n name: \"GET_PINNED_FILES\",\n requestSchema: null,\n responseSchema: z.array(z.string()),\n};\n\n/**\n * Retrieve the list of pinned files in the editor\n * @returns The list of pinned files\n */\nexport const getPinnedFiles = toolFactory(getPinnedFilesConfig);\n\nexport const pinFilesConfig = {\n name: \"PIN_FILES\",\n requestSchema: z.object({\n paths: z.array(z.string()),\n }),\n responseSchema: z.array(z.string()),\n};\n\n/**\n * Pin a list of files in the editor\n * @returns The list of pinned files\n */\nexport const pinFiles = toolFactory(pinFilesConfig);\n\nexport const unpinFilesConfig = {\n name: \"UNPIN_FILES\",\n requestSchema: z.object({\n paths: z.array(z.string()),\n }),\n responseSchema: z.array(z.string()),\n};\n\n/**\n * Unpin a list of files in the editor\n * @returns The list of pinned files\n */\nexport const unpinFiles = toolFactory(unpinFilesConfig);\n","import { json } from \"@synstack/json\";\nimport * as net from \"net\";\nimport pako from \"pako\";\nimport { z } from \"zod\";\n\nexport const RESPONSE_SUFFIX = \"_RESPONSE\";\n\nconst memoize = <TArgs extends Array<any>, TValue>(\n fn: (...args: TArgs) => TValue,\n) => {\n let cache: { data: TValue } | undefined = undefined;\n return (...args: TArgs) => {\n if (cache === undefined) cache = { data: fn(...args) };\n return cache.data;\n };\n};\n\nexport const getIpcClient = memoize(() => {\n return new Promise<net.Socket>((resolve, reject) => {\n const port = process.env.REFORGE_IPC_PORT;\n\n if (!port)\n throw new Error(\"No IPC port provided, cannot connect to parent process\");\n\n const parsedPort = typeof port === \"string\" ? parseInt(port) : port;\n\n const client = net.connect(parsedPort, \"localhost\", () => {\n client.removeListener(\"error\", reject);\n resolve(client);\n });\n\n client.once(\"error\", reject);\n });\n});\n\nexport interface ToolConfig<\n TName extends string,\n TRequestSchema extends z.ZodSchema | null,\n TResponseSchema extends z.ZodSchema = any,\n> {\n name: TName;\n requestSchema: TRequestSchema;\n responseSchema: TResponseSchema;\n}\n\nexport type ToolFn<\n TRequestSchema extends z.ZodSchema | null,\n TResponseSchema extends z.ZodSchema,\n> = TRequestSchema extends z.ZodSchema\n ? (data: z.input<TRequestSchema>) => Promise<z.output<TResponseSchema>>\n : () => Promise<z.output<TResponseSchema>>;\n\nexport const baseResponseSchema = z.object({\n type: z.string(),\n id: z.string(),\n status: z.union([z.literal(\"ok\"), z.literal(\"error\")]),\n});\n\nexport const toolFactory = <\n TName extends string,\n TRequestSchema extends z.ZodSchema | null,\n TResponseSchema extends z.ZodSchema,\n>(\n toolConfig: ToolConfig<TName, TRequestSchema, TResponseSchema>,\n): ToolFn<TRequestSchema, TResponseSchema> => {\n const responseName = `${toolConfig.name}${RESPONSE_SUFFIX}` as const;\n const responseSchema = z.discriminatedUnion(\"status\", [\n z.object({\n type: z.literal(responseName),\n id: z.string(),\n status: z.literal(\"ok\"),\n data: toolConfig.responseSchema,\n }),\n z.object({\n type: z.literal(responseName),\n id: z.string(),\n status: z.literal(\"error\"),\n data: z.string(),\n }),\n ]);\n const exec = async (data: unknown) => {\n const validatedData = toolConfig.requestSchema\n ? toolConfig.requestSchema.parse(data)\n : undefined;\n const client = await getIpcClient();\n const id = crypto.randomUUID();\n return new Promise<z.output<TResponseSchema>>((resolve, reject) => {\n const errorHandler = (error: Error) => {\n client.removeListener(\"error\", errorHandler);\n client.removeListener(\"data\", responseHandler);\n reject(error);\n };\n\n const responseHandler = (response: Uint8Array) => {\n const resData = json.deserialize(\n pako.inflate(response, { to: \"string\" }),\n );\n const baseResponse = baseResponseSchema.parse(resData);\n if (baseResponse.type === responseName && baseResponse.id === id) {\n const parsedResponse = responseSchema.parse(resData);\n client.removeListener(\"error\", errorHandler);\n client.removeListener(\"data\", responseHandler);\n if (parsedResponse.status === \"ok\") resolve(parsedResponse.data);\n else reject(new Error(parsedResponse.status));\n }\n };\n\n client.once(\"error\", errorHandler);\n client.on(\"data\", responseHandler);\n client.write(\n pako.deflate(\n json.serialize({\n type: toolConfig.name,\n id,\n data: validatedData,\n }),\n ),\n );\n });\n };\n\n return exec as ToolFn<TRequestSchema, TResponseSchema>;\n};\n","import { z } from \"zod\";\nimport { toolFactory } from \"./tool.utils.ts\";\n\n/**\n * Enumeration of VSCode symbol kinds.\n * These values represent different types of symbols that can be found in code.\n */\nexport const VscodeSymbolKind = {\n File: 0,\n Module: 1,\n Namespace: 2,\n Package: 3,\n Class: 4,\n Method: 5,\n Property: 6,\n Field: 7,\n Constructor: 8,\n Enum: 9,\n Interface: 10,\n Function: 11,\n Variable: 12,\n Constant: 13,\n String: 14,\n Number: 15,\n Boolean: 16,\n Array: 17,\n Object: 18,\n Key: 19,\n Null: 20,\n EnumMember: 21,\n Struct: 22,\n Event: 23,\n Operator: 24,\n TypeParameter: 25,\n} as const;\n\n/**\n * Enumeration of VSCode symbol tags.\n * These values represent additional metadata that can be attached to symbols.\n */\nexport const VscodeSymbolTag = {\n Deprecated: 1,\n} as const;\n\n/**\n * Schema for a position in a text document.\n */\nexport const positionSchema = z.object({\n /** Zero-based line number */\n line: z.number().int().min(0),\n /** Zero-based character offset on the line */\n character: z.number().int().min(0),\n});\n\n/** Type representing a position in a text document */\nexport type Position = z.output<typeof positionSchema>;\n\n/**\n * Schema for a range in a text document.\n */\nexport const rangeSchema = z.object({\n /** The start position of the range */\n start: positionSchema,\n /** The end position of the range */\n end: positionSchema,\n});\n\n/** Type representing a range in a text document */\nexport type Range = z.output<typeof rangeSchema>;\n\n/**\n * Schema for a call hierarchy item.\n * Represents a programming construct that can be part of a call hierarchy.\n */\nexport const callHierarchyItemSchema = z.object({\n /** The symbol kind of the item */\n kind: z.number().int().min(0).max(25),\n /** The name of the item */\n name: z.string(),\n /** Additional details about the item */\n detail: z.string(),\n /** The URI of the document containing the item */\n uri: z.string(),\n /** Optional tags associated with the item */\n tags: z.array(z.number().int()).optional(),\n /** The full range of the item */\n range: rangeSchema,\n /** The range that should be selected when navigating to the item */\n selectionRange: rangeSchema,\n});\n\n/** Type representing a call hierarchy item */\nexport type CallHierarchyItem = z.output<typeof callHierarchyItemSchema>;\n\n/**\n * Configuration for the executeCommand tool.\n * Defines the schema for executing VSCode commands.\n */\nexport const executeCommandConfig = {\n name: \"EXECUTE_COMMAND\",\n requestSchema: z.object({\n /** The vscode command to execute */\n command: z.string(),\n /** List of args to be passed to the command */\n args: z\n .array(\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"path\"),\n value: z.string(),\n }),\n z.object({\n type: z.literal(\"Uri\"),\n value: z.string().describe(\"Absolute path to the file\"),\n }),\n z.object({\n type: z.literal(\"Range\"),\n value: rangeSchema,\n }),\n z.object({\n type: z.literal(\"Position\"),\n value: positionSchema,\n }),\n z.object({\n type: z.literal(\"CallHierarchyItem\"),\n value: callHierarchyItemSchema,\n }),\n z.object({\n type: z.literal(\"primitive\"),\n value: z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.record(z.any()),\n z.array(z.any()),\n ]),\n }),\n ]),\n )\n .optional()\n .default([]),\n }),\n responseSchema: z.any().optional(),\n};\n\n/**\n * Executes a command in the VSCode editor.\n * Allows calling bundled VSCode commands as well as commands from other extensions.\n *\n * @template OUTPUT - The expected output type of the command\n * @param {z.input<typeof executeCommandConfig.requestSchema>} args - The command arguments\n * @returns {Promise<OUTPUT>} A promise that resolves with the command's output\n */\nexport const executeCommand = toolFactory(executeCommandConfig) as <\n OUTPUT = any,\n>(\n args: z.input<typeof executeCommandConfig.requestSchema>,\n) => Promise<OUTPUT>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,cAAkB;;;ACAlB,kBAAqB;AACrB,UAAqB;AACrB,kBAAiB;AACjB,iBAAkB;AAEX,IAAM,kBAAkB;AAE/B,IAAM,UAAU,CACd,OACG;AACH,MAAI,QAAsC;AAC1C,SAAO,IAAI,SAAgB;AACzB,QAAI,UAAU,OAAW,SAAQ,EAAE,MAAM,GAAG,GAAG,IAAI,EAAE;AACrD,WAAO,MAAM;AAAA,EACf;AACF;AAEO,IAAM,eAAe,QAAQ,MAAM;AACxC,SAAO,IAAI,QAAoB,CAAC,SAA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AAC;AAAA,EACf,CAAC;AAAA,EACD,gBAAgB,cAAE,IAAI,EAAE,SAAS;AACnC;AAUO,IAAM,iBAAiB,YAAY,oBAAoB;","names":["import_zod","pako","import_zod"]}
{"version":3,"sources":["../src/reforge.index.ts","../src/reforge.bundle.ts","../src/reforge.lib.ts","../src/tool.utils.ts","../src/vscode.lib.ts"],"sourcesContent":["export * as reforge from \"./reforge.bundle.ts\";\nexport * from \"./reforge.lib.ts\";\nexport * from \"./tool.utils.ts\";\n","export {\n getFocusedFile,\n getFocusedFileSelections,\n getOpenedFiles,\n getPinnedFiles,\n notify,\n openFile,\n openFiles,\n pinFiles,\n promptInput,\n promptMultiSelect,\n promptSelect,\n unpinFiles,\n} from \"./reforge.lib.ts\";\n\nexport * as vscode from \"./vscode.lib.ts\";\n","import { z } from \"zod/v4\";\nimport { toolFactory } from \"./tool.utils.ts\";\n\nexport const getFocusedFileConfig = {\n name: \"GET_FOCUSED_FILE\",\n requestSchema: null,\n responseSchema: z.string().nullable(),\n} as const;\n\n/**\n * Retrieve the absolute path to the actively focused file in the editor\n */\nexport const getFocusedFile = toolFactory(getFocusedFileConfig);\n\nexport const getOpenedFilesConfig = {\n name: \"GET_OPENED_FILES\",\n requestSchema: null,\n responseSchema: z.array(z.string()),\n} as const;\n\n// TODO: Return a list of FsFile instances\n/**\n * Retrieve the absolute paths to all opened files in the editor\n *\n * @warning this list also includes the focused file\n */\nexport const getOpenedFiles = toolFactory(getOpenedFilesConfig);\n\nexport const promptSelectConfig = {\n name: \"PROMPT_SELECT\",\n requestSchema: z.object({\n /**\n * The title of the prompt\n */\n title: z.string().optional(),\n /**\n * The options to display in the prompt\n */\n options: z.array(z.string()),\n /**\n * The placeholder text to display in the prompt\n */\n placeHolder: z.string().optional(),\n }),\n responseSchema: z.string().nullable(),\n} as const;\n\n// TODO: Provide a complete API for choices\n/**\n * Prompts the user to select an option from a list of options\n * @returns The selected option or null if the user cancels the prompt\n */\nexport const promptSelect = toolFactory(promptSelectConfig);\n\nexport const promptInputConfig = {\n name: \"PROMPT_INPUT\",\n requestSchema: z.object({\n /**\n * The title of the prompt\n */\n title: z.string().optional(),\n /**\n * The prompt to display in the prompt\n */\n prompt: z.string().optional(),\n /**\n * The placeholder text to display in the prompt\n */\n placeHolder: z.string().optional(),\n /**\n * The default input value\n */\n defaultValue: z.string().optional(),\n /**\n * Whether the input should be a password and masked\n */\n isPassword: z.boolean().optional().default(false),\n }),\n responseSchema: z.string().nullable(),\n} as const;\n\n/**\n * Prompts the user to input a value\n * @returns The input value or null if the user cancels the prompt\n */\nexport const promptInput = toolFactory(promptInputConfig);\n\nexport const promptMultiSelectConfig = {\n name: \"PROMPT_MULTI_SELECT\",\n requestSchema: z.object({\n /**\n * The title of the prompt\n */\n title: z.string().optional(),\n /**\n * The options to display in the prompt\n */\n options: z.array(z.string()),\n /**\n * The placeholder text to display in the prompt\n */\n placeHolder: z.string().optional(),\n }),\n responseSchema: z.array(z.string()),\n} as const;\n\n// TODO: Provide a complete API for choices\n/**\n * Prompts the user to select multiple options from a list of options\n * @returns The selected options as an array\n */\nexport const promptMultiSelect = toolFactory(promptMultiSelectConfig);\n\nexport const notifyConfig = {\n name: \"NOTIFY\",\n requestSchema: z.object({\n /**\n * The title of the notification\n */\n title: z.string().optional(),\n /**\n * The message to display in the notification\n */\n message: z.string(),\n /**\n * The type of notification\n * @default info\n * @argument info - Informational notification\n * @argument warning - Warning notification\n * @argument error - Error notification\n */\n type: z.enum([\"info\", \"warning\", \"error\"]).optional().default(\"info\"),\n /**\n * Buttons values to display in the notification\n */\n buttons: z.array(z.string()).optional(),\n }),\n responseSchema: z.string().nullable(),\n} as const;\n\n/**\n * Displays a notification to the user\n * @returns the button clicked by the user or null if the user dismissed the notification\n */\nexport const notify = toolFactory(notifyConfig);\n\nconst openFileRequest = z\n .object({\n /**\n * @default false\n * Whether to force the file to open even if it is already open\n */\n force: z.boolean().default(false),\n /**\n * Whether to preview the file in the editor\n * @default false\n * @warning Check if the file type is supported by the editor\n */\n preview: z.boolean().optional().default(false),\n /**\n * The column to open the file in\n * @default active\n * @argument active - Open the file in the active column\n * @argument beside - Open the file beside the active column\n * @argument N - Open the file in the Nth column\n */\n column: z\n .union([z.enum([\"active\", \"beside\"]), z.number().min(1).max(9)])\n .optional(),\n })\n .default({\n force: false,\n preview: false,\n column: \"active\",\n });\n\nconst openFileResponse = z.object({\n /**\n * Absolute path to the file\n */\n path: z.string(),\n /**\n * Whether the file is already open in the editor\n */\n isAlreadyOpened: z.boolean(),\n});\n\nexport const openFileConfig = {\n name: \"OPEN_FILE\",\n requestSchema: z.object({\n /**\n * Absolute path to the file\n */\n path: z.string(),\n config: openFileRequest,\n }),\n responseSchema: openFileResponse,\n};\n\n/**\n * Opens a file in the editor\n */\nexport const openFile = toolFactory(openFileConfig);\n\nexport const openFilesConfig = {\n name: \"OPEN_FILES\",\n requestSchema: z.object({\n /**\n * Array of absolute paths to the files to open\n */\n paths: z.array(z.string()),\n config: openFileRequest,\n }),\n /**\n * Array of absolute paths to the files & whether they were already open in the editor\n */\n responseSchema: z.array(openFileResponse),\n};\n\nexport const openFiles = toolFactory(openFilesConfig);\n\nconst selectionPositionSchema = z.object({\n /**\n * The position in the whole file\n */\n character: z.number(),\n /**\n * The line number of the position\n */\n line: z.number(),\n /**\n * The character position within the line\n */\n lineCharacter: z.number(),\n});\n\nexport const getFocusedFileSelectionsConfig = {\n name: \"GET_FOCUSED_FILE_SELECTION\",\n requestSchema: null,\n responseSchema: z\n .object({\n /**\n * Absolute path to the file\n */\n path: z.string(),\n /**\n * Array of active selections in the file\n */\n selections: z.array(\n z.object({\n /**\n * The starting character position of the selection in the file\n */\n start: selectionPositionSchema,\n /**\n * The ending character position of the selection in the file\n */\n end: selectionPositionSchema,\n /**\n * The string content of the selection\n */\n content: z.string(),\n /**\n * The length of the selection\n */\n length: z.number(),\n }),\n ),\n })\n .nullable(),\n};\n\n/**\n * Retrieve the active selections in the actively focused file in the editor\n */\nexport const getFocusedFileSelections = toolFactory(\n getFocusedFileSelectionsConfig,\n);\n\nexport const getPinnedFilesConfig = {\n name: \"GET_PINNED_FILES\",\n requestSchema: null,\n responseSchema: z.array(z.string()),\n};\n\n/**\n * Retrieve the list of pinned files in the editor\n * @returns The list of pinned files\n */\nexport const getPinnedFiles = toolFactory(getPinnedFilesConfig);\n\nexport const pinFilesConfig = {\n name: \"PIN_FILES\",\n requestSchema: z.object({\n paths: z.array(z.string()),\n }),\n responseSchema: z.array(z.string()),\n};\n\n/**\n * Pin a list of files in the editor\n * @returns The list of pinned files\n */\nexport const pinFiles = toolFactory(pinFilesConfig);\n\nexport const unpinFilesConfig = {\n name: \"UNPIN_FILES\",\n requestSchema: z.object({\n paths: z.array(z.string()),\n }),\n responseSchema: z.array(z.string()),\n};\n\n/**\n * Unpin a list of files in the editor\n * @returns The list of pinned files\n */\nexport const unpinFiles = toolFactory(unpinFilesConfig);\n","import { json } from \"@synstack/json\";\nimport * as net from \"net\";\nimport pako from \"pako\";\nimport { z } from \"zod/v4\";\n\nexport const RESPONSE_SUFFIX = \"_RESPONSE\";\n\nconst memoize = <ARGS extends Array<any>, VALUE>(\n fn: (...args: ARGS) => VALUE,\n) => {\n let cache: { data: VALUE } | undefined = undefined;\n return (...args: ARGS) => {\n if (cache === undefined) cache = { data: fn(...args) };\n return cache.data;\n };\n};\n\nexport const getIpcClient = memoize(() => {\n return new Promise<net.Socket>((resolve, reject) => {\n const port = process.env.REFORGE_IPC_PORT;\n\n if (!port)\n throw new Error(\"No IPC port provided, cannot connect to parent process\");\n\n const parsedPort = typeof port === \"string\" ? parseInt(port) : port;\n\n const client = net.connect(parsedPort, \"localhost\", () => {\n client.removeListener(\"error\", reject);\n resolve(client);\n });\n\n client.once(\"error\", reject);\n });\n});\n\nexport interface ToolConfig<\n NAME extends string,\n REQUEST_SCHEMA extends z.ZodType | null,\n RESPONSE_SCHEMA extends z.ZodType = z.ZodAny,\n> {\n name: NAME;\n requestSchema: REQUEST_SCHEMA;\n responseSchema: RESPONSE_SCHEMA;\n}\n\nexport type ToolFn<\n REQUEST_SCHEMA extends z.ZodType | null,\n RESPONSE_SCHEMA extends z.ZodType = z.ZodTypeAny,\n> = REQUEST_SCHEMA extends z.ZodType\n ? (data: z.input<REQUEST_SCHEMA>) => Promise<z.output<RESPONSE_SCHEMA>>\n : () => Promise<z.output<RESPONSE_SCHEMA>>;\n\nexport const baseResponseSchema = z.object({\n type: z.string(),\n id: z.string(),\n status: z.union([z.literal(\"ok\"), z.literal(\"error\")]),\n});\n\nexport const toolFactory = <\n NAME extends string,\n REQUEST_SCHEMA extends z.ZodType | null,\n RESPONSE_SCHEMA extends z.ZodType = z.ZodAny,\n>(\n toolConfig: ToolConfig<NAME, REQUEST_SCHEMA, RESPONSE_SCHEMA>,\n): ToolFn<REQUEST_SCHEMA, RESPONSE_SCHEMA> => {\n const responseName = `${toolConfig.name}${RESPONSE_SUFFIX}` as const;\n const responseSchema = z.discriminatedUnion(\"status\", [\n z.object({\n status: z.literal(\"ok\"),\n type: z.literal(responseName),\n id: z.string(),\n data: toolConfig.responseSchema,\n }),\n z.object({\n status: z.literal(\"error\"),\n type: z.literal(responseName),\n id: z.string(),\n data: z.string(),\n }),\n ]);\n const exec = async (data: unknown) => {\n const validatedData = toolConfig.requestSchema\n ? toolConfig.requestSchema.parse(data)\n : undefined;\n const client = await getIpcClient();\n const id = crypto.randomUUID();\n return new Promise<z.output<RESPONSE_SCHEMA>>((resolve, reject) => {\n const errorHandler = (error: Error) => {\n client.removeListener(\"error\", errorHandler);\n client.removeListener(\"data\", responseHandler);\n reject(error);\n };\n\n const responseHandler = (response: Uint8Array) => {\n const resData = json.deserialize(\n pako.inflate(response, { to: \"string\" }),\n );\n const baseResponse = baseResponseSchema.parse(resData);\n if (baseResponse.type === responseName && baseResponse.id === id) {\n const parsedResponse = responseSchema.parse(resData);\n client.removeListener(\"error\", errorHandler);\n client.removeListener(\"data\", responseHandler);\n // @ts-expect-error - TODO: fix this\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n if (parsedResponse.status === \"ok\") resolve(parsedResponse.data);\n // @ts-expect-error - TODO: fix this\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n else reject(new Error(parsedResponse.data));\n }\n };\n\n client.once(\"error\", errorHandler);\n client.on(\"data\", responseHandler);\n client.write(\n pako.deflate(\n json.serialize({\n type: toolConfig.name,\n id,\n data: validatedData,\n }),\n ),\n );\n });\n };\n\n return exec as ToolFn<REQUEST_SCHEMA, RESPONSE_SCHEMA>;\n};\n","import { z } from \"zod/v4\";\nimport { toolFactory } from \"./tool.utils.ts\";\n\n/**\n * Enumeration of VSCode symbol kinds.\n * These values represent different types of symbols that can be found in code.\n */\nexport const VscodeSymbolKind = {\n File: 0,\n Module: 1,\n Namespace: 2,\n Package: 3,\n Class: 4,\n Method: 5,\n Property: 6,\n Field: 7,\n Constructor: 8,\n Enum: 9,\n Interface: 10,\n Function: 11,\n Variable: 12,\n Constant: 13,\n String: 14,\n Number: 15,\n Boolean: 16,\n Array: 17,\n Object: 18,\n Key: 19,\n Null: 20,\n EnumMember: 21,\n Struct: 22,\n Event: 23,\n Operator: 24,\n TypeParameter: 25,\n} as const;\n\n/**\n * Enumeration of VSCode symbol tags.\n * These values represent additional metadata that can be attached to symbols.\n */\nexport const VscodeSymbolTag = {\n Deprecated: 1,\n} as const;\n\n/**\n * Schema for a position in a text document.\n */\nexport const positionSchema = z.object({\n /** Zero-based line number */\n line: z.number().int().min(0),\n /** Zero-based character offset on the line */\n character: z.number().int().min(0),\n});\n\n/** Type representing a position in a text document */\nexport type Position = z.output<typeof positionSchema>;\n\n/**\n * Schema for a range in a text document.\n */\nexport const rangeSchema = z.object({\n /** The start position of the range */\n start: positionSchema,\n /** The end position of the range */\n end: positionSchema,\n});\n\n/** Type representing a range in a text document */\nexport type Range = z.output<typeof rangeSchema>;\n\n/**\n * Schema for a call hierarchy item.\n * Represents a programming construct that can be part of a call hierarchy.\n */\nexport const callHierarchyItemSchema = z.object({\n /** The symbol kind of the item */\n kind: z.number().int().min(0).max(25),\n /** The name of the item */\n name: z.string(),\n /** Additional details about the item */\n detail: z.string(),\n /** The URI of the document containing the item */\n uri: z.string(),\n /** Optional tags associated with the item */\n tags: z.array(z.number().int()).optional(),\n /** The full range of the item */\n range: rangeSchema,\n /** The range that should be selected when navigating to the item */\n selectionRange: rangeSchema,\n});\n\n/** Type representing a call hierarchy item */\nexport type CallHierarchyItem = z.output<typeof callHierarchyItemSchema>;\n\n/**\n * Configuration for the executeCommand tool.\n * Defines the schema for executing VSCode commands.\n */\nexport const executeCommandConfig = {\n name: \"EXECUTE_COMMAND\",\n requestSchema: z.object({\n /** The vscode command to execute */\n command: z.string(),\n /** List of args to be passed to the command */\n args: z\n .array(\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"path\"),\n value: z.string(),\n }),\n z.object({\n type: z.literal(\"Uri\"),\n value: z.string().describe(\"Absolute path to the file\"),\n }),\n z.object({\n type: z.literal(\"Range\"),\n value: rangeSchema,\n }),\n z.object({\n type: z.literal(\"Position\"),\n value: positionSchema,\n }),\n z.object({\n type: z.literal(\"CallHierarchyItem\"),\n value: callHierarchyItemSchema,\n }),\n z.object({\n type: z.literal(\"primitive\"),\n value: z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.record(z.string(), z.any()),\n z.array(z.any()),\n ]),\n }),\n ]),\n )\n .optional()\n .default([]),\n }),\n responseSchema: z.any().optional(),\n};\n\n/**\n * Executes a command in the VSCode editor.\n * Allows calling bundled VSCode commands as well as commands from other extensions.\n *\n * @template OUTPUT - The expected output type of the command\n * @param {z.input<typeof executeCommandConfig.requestSchema>} args - The command arguments\n * @returns {Promise<OUTPUT>} A promise that resolves with the command's output\n */\nexport const executeCommand = toolFactory(executeCommandConfig) as <\n OUTPUT = any,\n>(\n args: z.input<typeof executeCommandConfig.requestSchema>,\n) => Promise<OUTPUT>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA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E,SAAS,2BAA2B;AAAA,QACxD,CAAC;AAAA,QACD,aAAE,OAAO;AAAA,UACP,MAAM,aAAE,QAAQ,OAAO;AAAA,UACvB,OAAO;AAAA,QACT,CAAC;AAAA,QACD,aAAE,OAAO;AAAA,UACP,MAAM,aAAE,QAAQ,UAAU;AAAA,UAC1B,OAAO;AAAA,QACT,CAAC;AAAA,QACD,aAAE,OAAO;AAAA,UACP,MAAM,aAAE,QAAQ,mBAAmB;AAAA,UACnC,OAAO;AAAA,QACT,CAAC;AAAA,QACD,aAAE,OAAO;AAAA,UACP,MAAM,aAAE,QAAQ,WAAW;AAAA,UAC3B,OAAO,aAAE,MAAM;AAAA,YACb,aAAE,OAAO;AAAA,YACT,aAAE,OAAO;AAAA,YACT,aAAE,QAAQ;AAAA,YACV,aAAE,OAAO,aAAE,OAAO,GAAG,aAAE,IAAI,CAAC;AAAA,YAC5B,aAAE,MAAM,aAAE,IAAI,CAAC;AAAA,UACjB,CAAC;AAAA,QACH,CAAC;AAAA,MACH,CAAC;AAAA,IACH,EACC,SAAS,EACT,QAAQ,CAAC,CAAC;AAAA,EACf,CAAC;AAAA,EACD,gBAAgB,aAAE,IAAI,EAAE,SAAS;AACnC;AAUO,IAAM,iBAAiB,YAAY,oBAAoB;","names":["import_v4","pako","import_v4"]}

@@ -1,3 +0,3 @@

import { z } from 'zod';
import { v as vscode_lib } from './vscode.index-BrJSm0Dj.cjs';
import { z } from 'zod/v4';
import { v as vscode_lib } from './vscode.index-CURr6mfX.cjs';
import * as net from 'net';

@@ -17,3 +17,3 @@

readonly requestSchema: null;
readonly responseSchema: z.ZodArray<z.ZodString, "many">;
readonly responseSchema: z.ZodArray<z.ZodString>;
};

@@ -29,23 +29,6 @@ /**

readonly requestSchema: z.ZodObject<{
/**
* The title of the prompt
*/
title: z.ZodOptional<z.ZodString>;
/**
* The options to display in the prompt
*/
options: z.ZodArray<z.ZodString, "many">;
/**
* The placeholder text to display in the prompt
*/
options: z.ZodArray<z.ZodString>;
placeHolder: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
options: string[];
title?: string | undefined;
placeHolder?: string | undefined;
}, {
options: string[];
title?: string | undefined;
placeHolder?: string | undefined;
}>;
}, z.core.$strip>;
readonly responseSchema: z.ZodNullable<z.ZodString>;

@@ -65,35 +48,8 @@ };

readonly requestSchema: z.ZodObject<{
/**
* The title of the prompt
*/
title: z.ZodOptional<z.ZodString>;
/**
* The prompt to display in the prompt
*/
prompt: z.ZodOptional<z.ZodString>;
/**
* The placeholder text to display in the prompt
*/
placeHolder: z.ZodOptional<z.ZodString>;
/**
* The default input value
*/
defaultValue: z.ZodOptional<z.ZodString>;
/**
* Whether the input should be a password and masked
*/
isPassword: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
}, "strip", z.ZodTypeAny, {
isPassword: boolean;
title?: string | undefined;
placeHolder?: string | undefined;
prompt?: string | undefined;
defaultValue?: string | undefined;
}, {
title?: string | undefined;
placeHolder?: string | undefined;
prompt?: string | undefined;
defaultValue?: string | undefined;
isPassword?: boolean | undefined;
}>;
}, z.core.$strip>;
readonly responseSchema: z.ZodNullable<z.ZodString>;

@@ -107,4 +63,4 @@ };

title?: string | undefined;
prompt?: string | undefined;
placeHolder?: string | undefined;
prompt?: string | undefined;
defaultValue?: string | undefined;

@@ -116,24 +72,7 @@ isPassword?: boolean | undefined;

readonly requestSchema: z.ZodObject<{
/**
* The title of the prompt
*/
title: z.ZodOptional<z.ZodString>;
/**
* The options to display in the prompt
*/
options: z.ZodArray<z.ZodString, "many">;
/**
* The placeholder text to display in the prompt
*/
options: z.ZodArray<z.ZodString>;
placeHolder: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
options: string[];
title?: string | undefined;
placeHolder?: string | undefined;
}, {
options: string[];
title?: string | undefined;
placeHolder?: string | undefined;
}>;
readonly responseSchema: z.ZodArray<z.ZodString, "many">;
}, z.core.$strip>;
readonly responseSchema: z.ZodArray<z.ZodString>;
};

@@ -152,33 +91,11 @@ /**

readonly requestSchema: z.ZodObject<{
/**
* The title of the notification
*/
title: z.ZodOptional<z.ZodString>;
/**
* The message to display in the notification
*/
message: z.ZodString;
/**
* The type of notification
* @default info
* @argument info - Informational notification
* @argument warning - Warning notification
* @argument error - Error notification
*/
type: z.ZodDefault<z.ZodOptional<z.ZodEnum<["info", "warning", "error"]>>>;
/**
* Buttons values to display in the notification
*/
buttons: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, "strip", z.ZodTypeAny, {
message: string;
type: "error" | "info" | "warning";
title?: string | undefined;
buttons?: string[] | undefined;
}, {
message: string;
type?: "error" | "info" | "warning" | undefined;
title?: string | undefined;
buttons?: string[] | undefined;
}>;
type: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
error: "error";
info: "info";
warning: "warning";
}>>>;
buttons: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$strip>;
readonly responseSchema: z.ZodNullable<z.ZodString>;

@@ -192,4 +109,4 @@ };

message: string;
title?: string | undefined;
type?: "error" | "info" | "warning" | undefined;
title?: string | undefined;
buttons?: string[] | undefined;

@@ -200,66 +117,16 @@ }) => Promise<string | null>;

requestSchema: z.ZodObject<{
/**
* Absolute path to the file
*/
path: z.ZodString;
config: z.ZodDefault<z.ZodObject<{
/**
* @default false
* Whether to force the file to open even if it is already open
*/
force: z.ZodDefault<z.ZodBoolean>;
/**
* Whether to preview the file in the editor
* @default false
* @warning Check if the file type is supported by the editor
*/
preview: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
/**
* The column to open the file in
* @default active
* @argument active - Open the file in the active column
* @argument beside - Open the file beside the active column
* @argument N - Open the file in the Nth column
*/
column: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["active", "beside"]>, z.ZodNumber]>>;
}, "strip", z.ZodTypeAny, {
force: boolean;
preview: boolean;
column?: number | "active" | "beside" | undefined;
}, {
force?: boolean | undefined;
preview?: boolean | undefined;
column?: number | "active" | "beside" | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
path: string;
config: {
force: boolean;
preview: boolean;
column?: number | "active" | "beside" | undefined;
};
}, {
path: string;
config?: {
force?: boolean | undefined;
preview?: boolean | undefined;
column?: number | "active" | "beside" | undefined;
} | undefined;
}>;
column: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
active: "active";
beside: "beside";
}>, z.ZodNumber]>>;
}, z.core.$strip>>;
}, z.core.$strip>;
responseSchema: z.ZodObject<{
/**
* Absolute path to the file
*/
path: z.ZodString;
/**
* Whether the file is already open in the editor
*/
isAlreadyOpened: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
path: string;
isAlreadyOpened: boolean;
}, {
path: string;
isAlreadyOpened: boolean;
}>;
}, z.core.$strip>;
};

@@ -283,50 +150,12 @@ /**

requestSchema: z.ZodObject<{
/**
* Array of absolute paths to the files to open
*/
paths: z.ZodArray<z.ZodString, "many">;
paths: z.ZodArray<z.ZodString>;
config: z.ZodDefault<z.ZodObject<{
/**
* @default false
* Whether to force the file to open even if it is already open
*/
force: z.ZodDefault<z.ZodBoolean>;
/**
* Whether to preview the file in the editor
* @default false
* @warning Check if the file type is supported by the editor
*/
preview: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
/**
* The column to open the file in
* @default active
* @argument active - Open the file in the active column
* @argument beside - Open the file beside the active column
* @argument N - Open the file in the Nth column
*/
column: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["active", "beside"]>, z.ZodNumber]>>;
}, "strip", z.ZodTypeAny, {
force: boolean;
preview: boolean;
column?: number | "active" | "beside" | undefined;
}, {
force?: boolean | undefined;
preview?: boolean | undefined;
column?: number | "active" | "beside" | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
config: {
force: boolean;
preview: boolean;
column?: number | "active" | "beside" | undefined;
};
paths: string[];
}, {
paths: string[];
config?: {
force?: boolean | undefined;
preview?: boolean | undefined;
column?: number | "active" | "beside" | undefined;
} | undefined;
}>;
column: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
active: "active";
beside: "beside";
}>, z.ZodNumber]>>;
}, z.core.$strip>>;
}, z.core.$strip>;
/**

@@ -336,17 +165,5 @@ * Array of absolute paths to the files & whether they were already open in the editor

responseSchema: z.ZodArray<z.ZodObject<{
/**
* Absolute path to the file
*/
path: z.ZodString;
/**
* Whether the file is already open in the editor
*/
isAlreadyOpened: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
path: string;
isAlreadyOpened: boolean;
}, {
path: string;
isAlreadyOpened: boolean;
}>, "many">;
}, z.core.$strip>>;
};

@@ -368,128 +185,18 @@ declare const openFiles: (data: {

responseSchema: z.ZodNullable<z.ZodObject<{
/**
* Absolute path to the file
*/
path: z.ZodString;
/**
* Array of active selections in the file
*/
selections: z.ZodArray<z.ZodObject<{
/**
* The starting character position of the selection in the file
*/
start: z.ZodObject<{
/**
* The position in the whole file
*/
character: z.ZodNumber;
/**
* The line number of the position
*/
line: z.ZodNumber;
/**
* The character position within the line
*/
lineCharacter: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
lineCharacter: number;
}, {
character: number;
line: number;
lineCharacter: number;
}>;
/**
* The ending character position of the selection in the file
*/
}, z.core.$strip>;
end: z.ZodObject<{
/**
* The position in the whole file
*/
character: z.ZodNumber;
/**
* The line number of the position
*/
line: z.ZodNumber;
/**
* The character position within the line
*/
lineCharacter: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
lineCharacter: number;
}, {
character: number;
line: number;
lineCharacter: number;
}>;
/**
* The string content of the selection
*/
}, z.core.$strip>;
content: z.ZodString;
/**
* The length of the selection
*/
length: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
length: number;
end: {
character: number;
line: number;
lineCharacter: number;
};
start: {
character: number;
line: number;
lineCharacter: number;
};
content: string;
}, {
length: number;
end: {
character: number;
line: number;
lineCharacter: number;
};
start: {
character: number;
line: number;
lineCharacter: number;
};
content: string;
}>, "many">;
}, "strip", z.ZodTypeAny, {
path: string;
selections: {
length: number;
end: {
character: number;
line: number;
lineCharacter: number;
};
start: {
character: number;
line: number;
lineCharacter: number;
};
content: string;
}[];
}, {
path: string;
selections: {
length: number;
end: {
character: number;
line: number;
lineCharacter: number;
};
start: {
character: number;
line: number;
lineCharacter: number;
};
content: string;
}[];
}>>;
}, z.core.$strip>>;
}, z.core.$strip>>;
};

@@ -502,4 +209,3 @@ /**

selections: {
length: number;
end: {
start: {
character: number;

@@ -509,3 +215,3 @@ line: number;

};
start: {
end: {
character: number;

@@ -516,2 +222,3 @@ line: number;

content: string;
length: number;
}[];

@@ -522,3 +229,3 @@ } | null>;

requestSchema: null;
responseSchema: z.ZodArray<z.ZodString, "many">;
responseSchema: z.ZodArray<z.ZodString>;
};

@@ -533,9 +240,5 @@ /**

requestSchema: z.ZodObject<{
paths: z.ZodArray<z.ZodString, "many">;
}, "strip", z.ZodTypeAny, {
paths: string[];
}, {
paths: string[];
}>;
responseSchema: z.ZodArray<z.ZodString, "many">;
paths: z.ZodArray<z.ZodString>;
}, z.core.$strip>;
responseSchema: z.ZodArray<z.ZodString>;
};

@@ -552,9 +255,5 @@ /**

requestSchema: z.ZodObject<{
paths: z.ZodArray<z.ZodString, "many">;
}, "strip", z.ZodTypeAny, {
paths: string[];
}, {
paths: string[];
}>;
responseSchema: z.ZodArray<z.ZodString, "many">;
paths: z.ZodArray<z.ZodString>;
}, z.core.$strip>;
responseSchema: z.ZodArray<z.ZodString>;
};

@@ -587,23 +286,15 @@ /**

declare const getIpcClient: () => Promise<net.Socket>;
interface ToolConfig<TName extends string, TRequestSchema extends z.ZodSchema | null, TResponseSchema extends z.ZodSchema = any> {
name: TName;
requestSchema: TRequestSchema;
responseSchema: TResponseSchema;
interface ToolConfig<NAME extends string, REQUEST_SCHEMA extends z.ZodType | null, RESPONSE_SCHEMA extends z.ZodType = z.ZodAny> {
name: NAME;
requestSchema: REQUEST_SCHEMA;
responseSchema: RESPONSE_SCHEMA;
}
type ToolFn<TRequestSchema extends z.ZodSchema | null, TResponseSchema extends z.ZodSchema> = TRequestSchema extends z.ZodSchema ? (data: z.input<TRequestSchema>) => Promise<z.output<TResponseSchema>> : () => Promise<z.output<TResponseSchema>>;
type ToolFn<REQUEST_SCHEMA extends z.ZodType | null, RESPONSE_SCHEMA extends z.ZodType = z.ZodTypeAny> = REQUEST_SCHEMA extends z.ZodType ? (data: z.input<REQUEST_SCHEMA>) => Promise<z.output<RESPONSE_SCHEMA>> : () => Promise<z.output<RESPONSE_SCHEMA>>;
declare const baseResponseSchema: z.ZodObject<{
type: z.ZodString;
id: z.ZodString;
status: z.ZodUnion<[z.ZodLiteral<"ok">, z.ZodLiteral<"error">]>;
}, "strip", z.ZodTypeAny, {
type: string;
status: "ok" | "error";
id: string;
}, {
type: string;
status: "ok" | "error";
id: string;
}>;
declare const toolFactory: <TName extends string, TRequestSchema extends z.ZodSchema | null, TResponseSchema extends z.ZodSchema>(toolConfig: ToolConfig<TName, TRequestSchema, TResponseSchema>) => ToolFn<TRequestSchema, TResponseSchema>;
status: z.ZodUnion<readonly [z.ZodLiteral<"ok">, z.ZodLiteral<"error">]>;
}, z.core.$strip>;
declare const toolFactory: <NAME extends string, REQUEST_SCHEMA extends z.ZodType | null, RESPONSE_SCHEMA extends z.ZodType = z.ZodAny>(toolConfig: ToolConfig<NAME, REQUEST_SCHEMA, RESPONSE_SCHEMA>) => ToolFn<REQUEST_SCHEMA, RESPONSE_SCHEMA>;
export { RESPONSE_SUFFIX, type ToolConfig, type ToolFn, baseResponseSchema, getFocusedFile, getFocusedFileConfig, getFocusedFileSelections, getFocusedFileSelectionsConfig, getIpcClient, getOpenedFiles, getOpenedFilesConfig, getPinnedFiles, getPinnedFilesConfig, notify, notifyConfig, openFile, openFileConfig, openFiles, openFilesConfig, pinFiles, pinFilesConfig, promptInput, promptInputConfig, promptMultiSelect, promptMultiSelectConfig, promptSelect, promptSelectConfig, reforge_bundle as reforge, toolFactory, unpinFiles, unpinFilesConfig };

@@ -1,3 +0,3 @@

import { z } from 'zod';
import { v as vscode_lib } from './vscode.index-BrJSm0Dj.js';
import { z } from 'zod/v4';
import { v as vscode_lib } from './vscode.index-CURr6mfX.js';
import * as net from 'net';

@@ -17,3 +17,3 @@

readonly requestSchema: null;
readonly responseSchema: z.ZodArray<z.ZodString, "many">;
readonly responseSchema: z.ZodArray<z.ZodString>;
};

@@ -29,23 +29,6 @@ /**

readonly requestSchema: z.ZodObject<{
/**
* The title of the prompt
*/
title: z.ZodOptional<z.ZodString>;
/**
* The options to display in the prompt
*/
options: z.ZodArray<z.ZodString, "many">;
/**
* The placeholder text to display in the prompt
*/
options: z.ZodArray<z.ZodString>;
placeHolder: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
options: string[];
title?: string | undefined;
placeHolder?: string | undefined;
}, {
options: string[];
title?: string | undefined;
placeHolder?: string | undefined;
}>;
}, z.core.$strip>;
readonly responseSchema: z.ZodNullable<z.ZodString>;

@@ -65,35 +48,8 @@ };

readonly requestSchema: z.ZodObject<{
/**
* The title of the prompt
*/
title: z.ZodOptional<z.ZodString>;
/**
* The prompt to display in the prompt
*/
prompt: z.ZodOptional<z.ZodString>;
/**
* The placeholder text to display in the prompt
*/
placeHolder: z.ZodOptional<z.ZodString>;
/**
* The default input value
*/
defaultValue: z.ZodOptional<z.ZodString>;
/**
* Whether the input should be a password and masked
*/
isPassword: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
}, "strip", z.ZodTypeAny, {
isPassword: boolean;
title?: string | undefined;
placeHolder?: string | undefined;
prompt?: string | undefined;
defaultValue?: string | undefined;
}, {
title?: string | undefined;
placeHolder?: string | undefined;
prompt?: string | undefined;
defaultValue?: string | undefined;
isPassword?: boolean | undefined;
}>;
}, z.core.$strip>;
readonly responseSchema: z.ZodNullable<z.ZodString>;

@@ -107,4 +63,4 @@ };

title?: string | undefined;
prompt?: string | undefined;
placeHolder?: string | undefined;
prompt?: string | undefined;
defaultValue?: string | undefined;

@@ -116,24 +72,7 @@ isPassword?: boolean | undefined;

readonly requestSchema: z.ZodObject<{
/**
* The title of the prompt
*/
title: z.ZodOptional<z.ZodString>;
/**
* The options to display in the prompt
*/
options: z.ZodArray<z.ZodString, "many">;
/**
* The placeholder text to display in the prompt
*/
options: z.ZodArray<z.ZodString>;
placeHolder: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
options: string[];
title?: string | undefined;
placeHolder?: string | undefined;
}, {
options: string[];
title?: string | undefined;
placeHolder?: string | undefined;
}>;
readonly responseSchema: z.ZodArray<z.ZodString, "many">;
}, z.core.$strip>;
readonly responseSchema: z.ZodArray<z.ZodString>;
};

@@ -152,33 +91,11 @@ /**

readonly requestSchema: z.ZodObject<{
/**
* The title of the notification
*/
title: z.ZodOptional<z.ZodString>;
/**
* The message to display in the notification
*/
message: z.ZodString;
/**
* The type of notification
* @default info
* @argument info - Informational notification
* @argument warning - Warning notification
* @argument error - Error notification
*/
type: z.ZodDefault<z.ZodOptional<z.ZodEnum<["info", "warning", "error"]>>>;
/**
* Buttons values to display in the notification
*/
buttons: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, "strip", z.ZodTypeAny, {
message: string;
type: "error" | "info" | "warning";
title?: string | undefined;
buttons?: string[] | undefined;
}, {
message: string;
type?: "error" | "info" | "warning" | undefined;
title?: string | undefined;
buttons?: string[] | undefined;
}>;
type: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
error: "error";
info: "info";
warning: "warning";
}>>>;
buttons: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$strip>;
readonly responseSchema: z.ZodNullable<z.ZodString>;

@@ -192,4 +109,4 @@ };

message: string;
title?: string | undefined;
type?: "error" | "info" | "warning" | undefined;
title?: string | undefined;
buttons?: string[] | undefined;

@@ -200,66 +117,16 @@ }) => Promise<string | null>;

requestSchema: z.ZodObject<{
/**
* Absolute path to the file
*/
path: z.ZodString;
config: z.ZodDefault<z.ZodObject<{
/**
* @default false
* Whether to force the file to open even if it is already open
*/
force: z.ZodDefault<z.ZodBoolean>;
/**
* Whether to preview the file in the editor
* @default false
* @warning Check if the file type is supported by the editor
*/
preview: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
/**
* The column to open the file in
* @default active
* @argument active - Open the file in the active column
* @argument beside - Open the file beside the active column
* @argument N - Open the file in the Nth column
*/
column: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["active", "beside"]>, z.ZodNumber]>>;
}, "strip", z.ZodTypeAny, {
force: boolean;
preview: boolean;
column?: number | "active" | "beside" | undefined;
}, {
force?: boolean | undefined;
preview?: boolean | undefined;
column?: number | "active" | "beside" | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
path: string;
config: {
force: boolean;
preview: boolean;
column?: number | "active" | "beside" | undefined;
};
}, {
path: string;
config?: {
force?: boolean | undefined;
preview?: boolean | undefined;
column?: number | "active" | "beside" | undefined;
} | undefined;
}>;
column: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
active: "active";
beside: "beside";
}>, z.ZodNumber]>>;
}, z.core.$strip>>;
}, z.core.$strip>;
responseSchema: z.ZodObject<{
/**
* Absolute path to the file
*/
path: z.ZodString;
/**
* Whether the file is already open in the editor
*/
isAlreadyOpened: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
path: string;
isAlreadyOpened: boolean;
}, {
path: string;
isAlreadyOpened: boolean;
}>;
}, z.core.$strip>;
};

@@ -283,50 +150,12 @@ /**

requestSchema: z.ZodObject<{
/**
* Array of absolute paths to the files to open
*/
paths: z.ZodArray<z.ZodString, "many">;
paths: z.ZodArray<z.ZodString>;
config: z.ZodDefault<z.ZodObject<{
/**
* @default false
* Whether to force the file to open even if it is already open
*/
force: z.ZodDefault<z.ZodBoolean>;
/**
* Whether to preview the file in the editor
* @default false
* @warning Check if the file type is supported by the editor
*/
preview: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
/**
* The column to open the file in
* @default active
* @argument active - Open the file in the active column
* @argument beside - Open the file beside the active column
* @argument N - Open the file in the Nth column
*/
column: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["active", "beside"]>, z.ZodNumber]>>;
}, "strip", z.ZodTypeAny, {
force: boolean;
preview: boolean;
column?: number | "active" | "beside" | undefined;
}, {
force?: boolean | undefined;
preview?: boolean | undefined;
column?: number | "active" | "beside" | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
config: {
force: boolean;
preview: boolean;
column?: number | "active" | "beside" | undefined;
};
paths: string[];
}, {
paths: string[];
config?: {
force?: boolean | undefined;
preview?: boolean | undefined;
column?: number | "active" | "beside" | undefined;
} | undefined;
}>;
column: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
active: "active";
beside: "beside";
}>, z.ZodNumber]>>;
}, z.core.$strip>>;
}, z.core.$strip>;
/**

@@ -336,17 +165,5 @@ * Array of absolute paths to the files & whether they were already open in the editor

responseSchema: z.ZodArray<z.ZodObject<{
/**
* Absolute path to the file
*/
path: z.ZodString;
/**
* Whether the file is already open in the editor
*/
isAlreadyOpened: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
path: string;
isAlreadyOpened: boolean;
}, {
path: string;
isAlreadyOpened: boolean;
}>, "many">;
}, z.core.$strip>>;
};

@@ -368,128 +185,18 @@ declare const openFiles: (data: {

responseSchema: z.ZodNullable<z.ZodObject<{
/**
* Absolute path to the file
*/
path: z.ZodString;
/**
* Array of active selections in the file
*/
selections: z.ZodArray<z.ZodObject<{
/**
* The starting character position of the selection in the file
*/
start: z.ZodObject<{
/**
* The position in the whole file
*/
character: z.ZodNumber;
/**
* The line number of the position
*/
line: z.ZodNumber;
/**
* The character position within the line
*/
lineCharacter: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
lineCharacter: number;
}, {
character: number;
line: number;
lineCharacter: number;
}>;
/**
* The ending character position of the selection in the file
*/
}, z.core.$strip>;
end: z.ZodObject<{
/**
* The position in the whole file
*/
character: z.ZodNumber;
/**
* The line number of the position
*/
line: z.ZodNumber;
/**
* The character position within the line
*/
lineCharacter: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
lineCharacter: number;
}, {
character: number;
line: number;
lineCharacter: number;
}>;
/**
* The string content of the selection
*/
}, z.core.$strip>;
content: z.ZodString;
/**
* The length of the selection
*/
length: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
length: number;
end: {
character: number;
line: number;
lineCharacter: number;
};
start: {
character: number;
line: number;
lineCharacter: number;
};
content: string;
}, {
length: number;
end: {
character: number;
line: number;
lineCharacter: number;
};
start: {
character: number;
line: number;
lineCharacter: number;
};
content: string;
}>, "many">;
}, "strip", z.ZodTypeAny, {
path: string;
selections: {
length: number;
end: {
character: number;
line: number;
lineCharacter: number;
};
start: {
character: number;
line: number;
lineCharacter: number;
};
content: string;
}[];
}, {
path: string;
selections: {
length: number;
end: {
character: number;
line: number;
lineCharacter: number;
};
start: {
character: number;
line: number;
lineCharacter: number;
};
content: string;
}[];
}>>;
}, z.core.$strip>>;
}, z.core.$strip>>;
};

@@ -502,4 +209,3 @@ /**

selections: {
length: number;
end: {
start: {
character: number;

@@ -509,3 +215,3 @@ line: number;

};
start: {
end: {
character: number;

@@ -516,2 +222,3 @@ line: number;

content: string;
length: number;
}[];

@@ -522,3 +229,3 @@ } | null>;

requestSchema: null;
responseSchema: z.ZodArray<z.ZodString, "many">;
responseSchema: z.ZodArray<z.ZodString>;
};

@@ -533,9 +240,5 @@ /**

requestSchema: z.ZodObject<{
paths: z.ZodArray<z.ZodString, "many">;
}, "strip", z.ZodTypeAny, {
paths: string[];
}, {
paths: string[];
}>;
responseSchema: z.ZodArray<z.ZodString, "many">;
paths: z.ZodArray<z.ZodString>;
}, z.core.$strip>;
responseSchema: z.ZodArray<z.ZodString>;
};

@@ -552,9 +255,5 @@ /**

requestSchema: z.ZodObject<{
paths: z.ZodArray<z.ZodString, "many">;
}, "strip", z.ZodTypeAny, {
paths: string[];
}, {
paths: string[];
}>;
responseSchema: z.ZodArray<z.ZodString, "many">;
paths: z.ZodArray<z.ZodString>;
}, z.core.$strip>;
responseSchema: z.ZodArray<z.ZodString>;
};

@@ -587,23 +286,15 @@ /**

declare const getIpcClient: () => Promise<net.Socket>;
interface ToolConfig<TName extends string, TRequestSchema extends z.ZodSchema | null, TResponseSchema extends z.ZodSchema = any> {
name: TName;
requestSchema: TRequestSchema;
responseSchema: TResponseSchema;
interface ToolConfig<NAME extends string, REQUEST_SCHEMA extends z.ZodType | null, RESPONSE_SCHEMA extends z.ZodType = z.ZodAny> {
name: NAME;
requestSchema: REQUEST_SCHEMA;
responseSchema: RESPONSE_SCHEMA;
}
type ToolFn<TRequestSchema extends z.ZodSchema | null, TResponseSchema extends z.ZodSchema> = TRequestSchema extends z.ZodSchema ? (data: z.input<TRequestSchema>) => Promise<z.output<TResponseSchema>> : () => Promise<z.output<TResponseSchema>>;
type ToolFn<REQUEST_SCHEMA extends z.ZodType | null, RESPONSE_SCHEMA extends z.ZodType = z.ZodTypeAny> = REQUEST_SCHEMA extends z.ZodType ? (data: z.input<REQUEST_SCHEMA>) => Promise<z.output<RESPONSE_SCHEMA>> : () => Promise<z.output<RESPONSE_SCHEMA>>;
declare const baseResponseSchema: z.ZodObject<{
type: z.ZodString;
id: z.ZodString;
status: z.ZodUnion<[z.ZodLiteral<"ok">, z.ZodLiteral<"error">]>;
}, "strip", z.ZodTypeAny, {
type: string;
status: "ok" | "error";
id: string;
}, {
type: string;
status: "ok" | "error";
id: string;
}>;
declare const toolFactory: <TName extends string, TRequestSchema extends z.ZodSchema | null, TResponseSchema extends z.ZodSchema>(toolConfig: ToolConfig<TName, TRequestSchema, TResponseSchema>) => ToolFn<TRequestSchema, TResponseSchema>;
status: z.ZodUnion<readonly [z.ZodLiteral<"ok">, z.ZodLiteral<"error">]>;
}, z.core.$strip>;
declare const toolFactory: <NAME extends string, REQUEST_SCHEMA extends z.ZodType | null, RESPONSE_SCHEMA extends z.ZodType = z.ZodAny>(toolConfig: ToolConfig<NAME, REQUEST_SCHEMA, RESPONSE_SCHEMA>) => ToolFn<REQUEST_SCHEMA, RESPONSE_SCHEMA>;
export { RESPONSE_SUFFIX, type ToolConfig, type ToolFn, baseResponseSchema, getFocusedFile, getFocusedFileConfig, getFocusedFileSelections, getFocusedFileSelectionsConfig, getIpcClient, getOpenedFiles, getOpenedFilesConfig, getPinnedFiles, getPinnedFilesConfig, notify, notifyConfig, openFile, openFileConfig, openFiles, openFilesConfig, pinFiles, pinFilesConfig, promptInput, promptInputConfig, promptMultiSelect, promptMultiSelectConfig, promptSelect, promptSelectConfig, reforge_bundle as reforge, toolFactory, unpinFiles, unpinFilesConfig };

@@ -26,3 +26,3 @@ var __defProp = Object.defineProperty;

// src/reforge.lib.ts
import { z as z2 } from "zod";
import { z as z2 } from "zod/v4";

@@ -33,3 +33,3 @@ // src/tool.utils.ts

import pako from "pako";
import { z } from "zod";
import { z } from "zod/v4";
var RESPONSE_SUFFIX = "_RESPONSE";

@@ -65,11 +65,11 @@ var memoize = (fn) => {

z.object({
status: z.literal("ok"),
type: z.literal(responseName),
id: z.string(),
status: z.literal("ok"),
data: toolConfig.responseSchema
}),
z.object({
status: z.literal("error"),
type: z.literal(responseName),
id: z.string(),
status: z.literal("error"),
data: z.string()

@@ -98,3 +98,3 @@ })

if (parsedResponse.status === "ok") resolve(parsedResponse.data);
else reject(new Error(parsedResponse.status));
else reject(new Error(parsedResponse.data));
}

@@ -244,2 +244,4 @@ };

}).default({
force: false,
preview: false,
column: "active"

@@ -368,3 +370,3 @@ });

});
import { z as z3 } from "zod";
import { z as z3 } from "zod/v4";
var VscodeSymbolKind = {

@@ -463,3 +465,3 @@ File: 0,

z3.boolean(),
z3.record(z3.any()),
z3.record(z3.string(), z3.any()),
z3.array(z3.any())

@@ -466,0 +468,0 @@ ])

@@ -1,1 +0,1 @@

{"version":3,"sources":["../src/reforge.bundle.ts","../src/reforge.lib.ts","../src/tool.utils.ts","../src/vscode.lib.ts"],"sourcesContent":["export {\n getFocusedFile,\n getFocusedFileSelections,\n getOpenedFiles,\n getPinnedFiles,\n notify,\n openFile,\n openFiles,\n pinFiles,\n promptInput,\n promptMultiSelect,\n promptSelect,\n unpinFiles,\n} from \"./reforge.lib.ts\";\n\nexport * as vscode from \"./vscode.lib.ts\";\n","import { z } from \"zod\";\nimport { toolFactory } from \"./tool.utils.ts\";\n\nexport const getFocusedFileConfig = {\n name: \"GET_FOCUSED_FILE\",\n requestSchema: null,\n responseSchema: z.string().nullable(),\n} as const;\n\n/**\n * Retrieve the absolute path to the actively focused file in the editor\n */\nexport const getFocusedFile = toolFactory(getFocusedFileConfig);\n\nexport const getOpenedFilesConfig = {\n name: \"GET_OPENED_FILES\",\n requestSchema: null,\n responseSchema: z.array(z.string()),\n} as const;\n\n// TODO: Return a list of FsFile instances\n/**\n * Retrieve the absolute paths to all opened files in the editor\n *\n * @warning this list also includes the focused file\n */\nexport const getOpenedFiles = toolFactory(getOpenedFilesConfig);\n\nexport const promptSelectConfig = {\n name: \"PROMPT_SELECT\",\n requestSchema: z.object({\n /**\n * The title of the prompt\n */\n title: z.string().optional(),\n /**\n * The options to display in the prompt\n */\n options: z.array(z.string()),\n /**\n * The placeholder text to display in the prompt\n */\n placeHolder: z.string().optional(),\n }),\n responseSchema: z.string().nullable(),\n} as const;\n\n// TODO: Provide a complete API for choices\n/**\n * Prompts the user to select an option from a list of options\n * @returns The selected option or null if the user cancels the prompt\n */\nexport const promptSelect = toolFactory(promptSelectConfig);\n\nexport const promptInputConfig = {\n name: \"PROMPT_INPUT\",\n requestSchema: z.object({\n /**\n * The title of the prompt\n */\n title: z.string().optional(),\n /**\n * The prompt to display in the prompt\n */\n prompt: z.string().optional(),\n /**\n * The placeholder text to display in the prompt\n */\n placeHolder: z.string().optional(),\n /**\n * The default input value\n */\n defaultValue: z.string().optional(),\n /**\n * Whether the input should be a password and masked\n */\n isPassword: z.boolean().optional().default(false),\n }),\n responseSchema: z.string().nullable(),\n} as const;\n\n/**\n * Prompts the user to input a value\n * @returns The input value or null if the user cancels the prompt\n */\nexport const promptInput = toolFactory(promptInputConfig);\n\nexport const promptMultiSelectConfig = {\n name: \"PROMPT_MULTI_SELECT\",\n requestSchema: z.object({\n /**\n * The title of the prompt\n */\n title: z.string().optional(),\n /**\n * The options to display in the prompt\n */\n options: z.array(z.string()),\n /**\n * The placeholder text to display in the prompt\n */\n placeHolder: z.string().optional(),\n }),\n responseSchema: z.array(z.string()),\n} as const;\n\n// TODO: Provide a complete API for choices\n/**\n * Prompts the user to select multiple options from a list of options\n * @returns The selected options as an array\n */\nexport const promptMultiSelect = toolFactory(promptMultiSelectConfig);\n\nexport const notifyConfig = {\n name: \"NOTIFY\",\n requestSchema: z.object({\n /**\n * The title of the notification\n */\n title: z.string().optional(),\n /**\n * The message to display in the notification\n */\n message: z.string(),\n /**\n * The type of notification\n * @default info\n * @argument info - Informational notification\n * @argument warning - Warning notification\n * @argument error - Error notification\n */\n type: z.enum([\"info\", \"warning\", \"error\"]).optional().default(\"info\"),\n /**\n * Buttons values to display in the notification\n */\n buttons: z.array(z.string()).optional(),\n }),\n responseSchema: z.string().nullable(),\n} as const;\n\n/**\n * Displays a notification to the user\n * @returns the button clicked by the user or null if the user dismissed the notification\n */\nexport const notify = toolFactory(notifyConfig);\n\nconst openFileRequest = z\n .object({\n /**\n * @default false\n * Whether to force the file to open even if it is already open\n */\n force: z.boolean().default(false),\n /**\n * Whether to preview the file in the editor\n * @default false\n * @warning Check if the file type is supported by the editor\n */\n preview: z.boolean().optional().default(false),\n /**\n * The column to open the file in\n * @default active\n * @argument active - Open the file in the active column\n * @argument beside - Open the file beside the active column\n * @argument N - Open the file in the Nth column\n */\n column: z\n .union([z.enum([\"active\", \"beside\"]), z.number().min(1).max(9)])\n .optional(),\n })\n .default({\n column: \"active\",\n });\n\nconst openFileResponse = z.object({\n /**\n * Absolute path to the file\n */\n path: z.string(),\n /**\n * Whether the file is already open in the editor\n */\n isAlreadyOpened: z.boolean(),\n});\n\nexport const openFileConfig = {\n name: \"OPEN_FILE\",\n requestSchema: z.object({\n /**\n * Absolute path to the file\n */\n path: z.string(),\n config: openFileRequest,\n }),\n responseSchema: openFileResponse,\n};\n\n/**\n * Opens a file in the editor\n */\nexport const openFile = toolFactory(openFileConfig);\n\nexport const openFilesConfig = {\n name: \"OPEN_FILES\",\n requestSchema: z.object({\n /**\n * Array of absolute paths to the files to open\n */\n paths: z.array(z.string()),\n config: openFileRequest,\n }),\n /**\n * Array of absolute paths to the files & whether they were already open in the editor\n */\n responseSchema: z.array(openFileResponse),\n};\n\nexport const openFiles = toolFactory(openFilesConfig);\n\nconst selectionPositionSchema = z.object({\n /**\n * The position in the whole file\n */\n character: z.number(),\n /**\n * The line number of the position\n */\n line: z.number(),\n /**\n * The character position within the line\n */\n lineCharacter: z.number(),\n});\n\nexport const getFocusedFileSelectionsConfig = {\n name: \"GET_FOCUSED_FILE_SELECTION\",\n requestSchema: null,\n responseSchema: z\n .object({\n /**\n * Absolute path to the file\n */\n path: z.string(),\n /**\n * Array of active selections in the file\n */\n selections: z.array(\n z.object({\n /**\n * The starting character position of the selection in the file\n */\n start: selectionPositionSchema,\n /**\n * The ending character position of the selection in the file\n */\n end: selectionPositionSchema,\n /**\n * The string content of the selection\n */\n content: z.string(),\n /**\n * The length of the selection\n */\n length: z.number(),\n }),\n ),\n })\n .nullable(),\n};\n\n/**\n * Retrieve the active selections in the actively focused file in the editor\n */\nexport const getFocusedFileSelections = toolFactory(\n getFocusedFileSelectionsConfig,\n);\n\nexport const getPinnedFilesConfig = {\n name: \"GET_PINNED_FILES\",\n requestSchema: null,\n responseSchema: z.array(z.string()),\n};\n\n/**\n * Retrieve the list of pinned files in the editor\n * @returns The list of pinned files\n */\nexport const getPinnedFiles = toolFactory(getPinnedFilesConfig);\n\nexport const pinFilesConfig = {\n name: \"PIN_FILES\",\n requestSchema: z.object({\n paths: z.array(z.string()),\n }),\n responseSchema: z.array(z.string()),\n};\n\n/**\n * Pin a list of files in the editor\n * @returns The list of pinned files\n */\nexport const pinFiles = toolFactory(pinFilesConfig);\n\nexport const unpinFilesConfig = {\n name: \"UNPIN_FILES\",\n requestSchema: z.object({\n paths: z.array(z.string()),\n }),\n responseSchema: z.array(z.string()),\n};\n\n/**\n * Unpin a list of files in the editor\n * @returns The list of pinned files\n */\nexport const unpinFiles = toolFactory(unpinFilesConfig);\n","import { json } from \"@synstack/json\";\nimport * as net from \"net\";\nimport pako from \"pako\";\nimport { z } from \"zod\";\n\nexport const RESPONSE_SUFFIX = \"_RESPONSE\";\n\nconst memoize = <TArgs extends Array<any>, TValue>(\n fn: (...args: TArgs) => TValue,\n) => {\n let cache: { data: TValue } | undefined = undefined;\n return (...args: TArgs) => {\n if (cache === undefined) cache = { data: fn(...args) };\n return cache.data;\n };\n};\n\nexport const getIpcClient = memoize(() => {\n return new Promise<net.Socket>((resolve, reject) => {\n const port = process.env.REFORGE_IPC_PORT;\n\n if (!port)\n throw new Error(\"No IPC port provided, cannot connect to parent process\");\n\n const parsedPort = typeof port === \"string\" ? parseInt(port) : port;\n\n const client = net.connect(parsedPort, \"localhost\", () => {\n client.removeListener(\"error\", reject);\n resolve(client);\n });\n\n client.once(\"error\", reject);\n });\n});\n\nexport interface ToolConfig<\n TName extends string,\n TRequestSchema extends z.ZodSchema | null,\n TResponseSchema extends z.ZodSchema = any,\n> {\n name: TName;\n requestSchema: TRequestSchema;\n responseSchema: TResponseSchema;\n}\n\nexport type ToolFn<\n TRequestSchema extends z.ZodSchema | null,\n TResponseSchema extends z.ZodSchema,\n> = TRequestSchema extends z.ZodSchema\n ? (data: z.input<TRequestSchema>) => Promise<z.output<TResponseSchema>>\n : () => Promise<z.output<TResponseSchema>>;\n\nexport const baseResponseSchema = z.object({\n type: z.string(),\n id: z.string(),\n status: z.union([z.literal(\"ok\"), z.literal(\"error\")]),\n});\n\nexport const toolFactory = <\n TName extends string,\n TRequestSchema extends z.ZodSchema | null,\n TResponseSchema extends z.ZodSchema,\n>(\n toolConfig: ToolConfig<TName, TRequestSchema, TResponseSchema>,\n): ToolFn<TRequestSchema, TResponseSchema> => {\n const responseName = `${toolConfig.name}${RESPONSE_SUFFIX}` as const;\n const responseSchema = z.discriminatedUnion(\"status\", [\n z.object({\n type: z.literal(responseName),\n id: z.string(),\n status: z.literal(\"ok\"),\n data: toolConfig.responseSchema,\n }),\n z.object({\n type: z.literal(responseName),\n id: z.string(),\n status: z.literal(\"error\"),\n data: z.string(),\n }),\n ]);\n const exec = async (data: unknown) => {\n const validatedData = toolConfig.requestSchema\n ? toolConfig.requestSchema.parse(data)\n : undefined;\n const client = await getIpcClient();\n const id = crypto.randomUUID();\n return new Promise<z.output<TResponseSchema>>((resolve, reject) => {\n const errorHandler = (error: Error) => {\n client.removeListener(\"error\", errorHandler);\n client.removeListener(\"data\", responseHandler);\n reject(error);\n };\n\n const responseHandler = (response: Uint8Array) => {\n const resData = json.deserialize(\n pako.inflate(response, { to: \"string\" }),\n );\n const baseResponse = baseResponseSchema.parse(resData);\n if (baseResponse.type === responseName && baseResponse.id === id) {\n const parsedResponse = responseSchema.parse(resData);\n client.removeListener(\"error\", errorHandler);\n client.removeListener(\"data\", responseHandler);\n if (parsedResponse.status === \"ok\") resolve(parsedResponse.data);\n else reject(new Error(parsedResponse.status));\n }\n };\n\n client.once(\"error\", errorHandler);\n client.on(\"data\", responseHandler);\n client.write(\n pako.deflate(\n json.serialize({\n type: toolConfig.name,\n id,\n data: validatedData,\n }),\n ),\n );\n });\n };\n\n return exec as ToolFn<TRequestSchema, TResponseSchema>;\n};\n","import { z } from \"zod\";\nimport { toolFactory } from \"./tool.utils.ts\";\n\n/**\n * Enumeration of VSCode symbol kinds.\n * These values represent different types of symbols that can be found in code.\n */\nexport const VscodeSymbolKind = {\n File: 0,\n Module: 1,\n Namespace: 2,\n Package: 3,\n Class: 4,\n Method: 5,\n Property: 6,\n Field: 7,\n Constructor: 8,\n Enum: 9,\n Interface: 10,\n Function: 11,\n Variable: 12,\n Constant: 13,\n String: 14,\n Number: 15,\n Boolean: 16,\n Array: 17,\n Object: 18,\n Key: 19,\n Null: 20,\n EnumMember: 21,\n Struct: 22,\n Event: 23,\n Operator: 24,\n TypeParameter: 25,\n} as const;\n\n/**\n * Enumeration of VSCode symbol tags.\n * These values represent additional metadata that can be attached to symbols.\n */\nexport const VscodeSymbolTag = {\n Deprecated: 1,\n} as const;\n\n/**\n * Schema for a position in a text document.\n */\nexport const positionSchema = z.object({\n /** Zero-based line number */\n line: z.number().int().min(0),\n /** Zero-based character offset on the line */\n character: z.number().int().min(0),\n});\n\n/** Type representing a position in a text document */\nexport type Position = z.output<typeof positionSchema>;\n\n/**\n * Schema for a range in a text document.\n */\nexport const rangeSchema = z.object({\n /** The start position of the range */\n start: positionSchema,\n /** The end position of the range */\n end: positionSchema,\n});\n\n/** Type representing a range in a text document */\nexport type Range = z.output<typeof rangeSchema>;\n\n/**\n * Schema for a call hierarchy item.\n * Represents a programming construct that can be part of a call hierarchy.\n */\nexport const callHierarchyItemSchema = z.object({\n /** The symbol kind of the item */\n kind: z.number().int().min(0).max(25),\n /** The name of the item */\n name: z.string(),\n /** Additional details about the item */\n detail: z.string(),\n /** The URI of the document containing the item */\n uri: z.string(),\n /** Optional tags associated with the item */\n tags: z.array(z.number().int()).optional(),\n /** The full range of the item */\n range: rangeSchema,\n /** The range that should be selected when navigating to the item */\n selectionRange: rangeSchema,\n});\n\n/** Type representing a call hierarchy item */\nexport type CallHierarchyItem = z.output<typeof callHierarchyItemSchema>;\n\n/**\n * Configuration for the executeCommand tool.\n * Defines the schema for executing VSCode commands.\n */\nexport const executeCommandConfig = {\n name: \"EXECUTE_COMMAND\",\n requestSchema: z.object({\n /** The vscode command to execute */\n command: z.string(),\n /** List of args to be passed to the command */\n args: z\n .array(\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"path\"),\n value: z.string(),\n }),\n z.object({\n type: z.literal(\"Uri\"),\n value: z.string().describe(\"Absolute path to the file\"),\n }),\n z.object({\n type: z.literal(\"Range\"),\n value: rangeSchema,\n }),\n z.object({\n type: z.literal(\"Position\"),\n value: positionSchema,\n }),\n z.object({\n type: z.literal(\"CallHierarchyItem\"),\n value: callHierarchyItemSchema,\n }),\n z.object({\n type: z.literal(\"primitive\"),\n value: z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.record(z.any()),\n z.array(z.any()),\n ]),\n }),\n ]),\n )\n .optional()\n .default([]),\n }),\n responseSchema: z.any().optional(),\n};\n\n/**\n * Executes a command in the VSCode editor.\n * Allows calling bundled VSCode commands as well as commands from other extensions.\n *\n * @template OUTPUT - The expected output type of the command\n * @param {z.input<typeof executeCommandConfig.requestSchema>} args - The command arguments\n * @returns {Promise<OUTPUT>} A promise that resolves with the command's output\n */\nexport const executeCommand = toolFactory(executeCommandConfig) as <\n OUTPUT = any,\n>(\n args: z.input<typeof executeCommandConfig.requestSchema>,\n) => Promise<OUTPUT>;\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,YAAY;AACrB,YAAY,SAAS;AACrB,OAAO,UAAU;AACjB,SAAS,SAAS;AAEX,IAAM,kBAAkB;AAE/B,IAAM,UAAU,CACd,OACG;AACH,MAAI,QAAsC;AAC1C,SAAO,IAAI,SAAgB;AACzB,QAAI,UAAU,OAAW,SAAQ,EAAE,MAAM,GAAG,GAAG,IAAI,EAAE;AACrD,WAAO,MAAM;AAAA,EACf;AACF;AAEO,IAAM,eAAe,QAAQ,MAAM;AACxC,SAAO,IAAI,QAAoB,CAAC,SAAS,WAAW;AAClD,UAAM,OAAO,QAAQ,IAAI;AAEzB,QAAI,CAAC;AACH,YAAM,IAAI,MAAM,wDAAwD;AAE1E,UAAM,aAAa,OAAO,SAAS,WAAW,SAAS,IAAI,IAAI;AAE/D,UAAM,SAAa,YAAQ,YAAY,aAAa,MAAM;AACxD,aAAO,eAAe,SAAS,MAAM;AACrC,cAAQ,MAAM;AAAA,IAChB,CAAC;A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ge.lib.ts","../src/tool.utils.ts","../src/vscode.lib.ts"],"sourcesContent":["export {\n getFocusedFile,\n getFocusedFileSelections,\n getOpenedFiles,\n getPinnedFiles,\n notify,\n openFile,\n openFiles,\n pinFiles,\n promptInput,\n promptMultiSelect,\n promptSelect,\n unpinFiles,\n} from \"./reforge.lib.ts\";\n\nexport * as vscode from \"./vscode.lib.ts\";\n","import { z } from \"zod/v4\";\nimport { toolFactory } from \"./tool.utils.ts\";\n\nexport const getFocusedFileConfig = {\n name: \"GET_FOCUSED_FILE\",\n requestSchema: null,\n responseSchema: z.string().nullable(),\n} as const;\n\n/**\n * Retrieve the absolute path to the actively focused file in the editor\n */\nexport const getFocusedFile = toolFactory(getFocusedFileConfig);\n\nexport const getOpenedFilesConfig = {\n name: \"GET_OPENED_FILES\",\n requestSchema: null,\n responseSchema: z.array(z.string()),\n} as const;\n\n// TODO: Return a list of FsFile instances\n/**\n * Retrieve the absolute paths to all opened files in the editor\n *\n * @warning this list also includes the focused file\n */\nexport const getOpenedFiles = toolFactory(getOpenedFilesConfig);\n\nexport const promptSelectConfig = {\n name: \"PROMPT_SELECT\",\n requestSchema: z.object({\n /**\n * The title of the prompt\n */\n title: z.string().optional(),\n /**\n * The options to display in the prompt\n */\n options: z.array(z.string()),\n /**\n * The placeholder text to display in the prompt\n */\n placeHolder: z.string().optional(),\n }),\n responseSchema: z.string().nullable(),\n} as const;\n\n// TODO: Provide a complete API for choices\n/**\n * Prompts the user to select an option from a list of options\n * @returns The selected option or null if the user cancels the prompt\n */\nexport const promptSelect = toolFactory(promptSelectConfig);\n\nexport const promptInputConfig = {\n name: \"PROMPT_INPUT\",\n requestSchema: z.object({\n /**\n * The title of the prompt\n */\n title: z.string().optional(),\n /**\n * The prompt to display in the prompt\n */\n prompt: z.string().optional(),\n /**\n * The placeholder text to display in the prompt\n */\n placeHolder: z.string().optional(),\n /**\n * The default input value\n */\n defaultValue: z.string().optional(),\n /**\n * Whether the input should be a password and masked\n */\n isPassword: z.boolean().optional().default(false),\n }),\n responseSchema: z.string().nullable(),\n} as const;\n\n/**\n * Prompts the user to input a value\n * @returns The input value or null if the user cancels the prompt\n */\nexport const promptInput = toolFactory(promptInputConfig);\n\nexport const promptMultiSelectConfig = {\n name: \"PROMPT_MULTI_SELECT\",\n requestSchema: z.object({\n /**\n * The title of the prompt\n */\n title: z.string().optional(),\n /**\n * The options to display in the prompt\n */\n options: z.array(z.string()),\n /**\n * The placeholder text to display in the prompt\n */\n placeHolder: z.string().optional(),\n }),\n responseSchema: z.array(z.string()),\n} as const;\n\n// TODO: Provide a complete API for choices\n/**\n * Prompts the user to select multiple options from a list of options\n * @returns The selected options as an array\n */\nexport const promptMultiSelect = toolFactory(promptMultiSelectConfig);\n\nexport const notifyConfig = {\n name: \"NOTIFY\",\n requestSchema: z.object({\n /**\n * The title of the notification\n */\n title: z.string().optional(),\n /**\n * The message to display in the notification\n */\n message: z.string(),\n /**\n * The type of notification\n * @default info\n * @argument info - Informational notification\n * @argument warning - Warning notification\n * @argument error - Error notification\n */\n type: z.enum([\"info\", \"warning\", \"error\"]).optional().default(\"info\"),\n /**\n * Buttons values to display in the notification\n */\n buttons: z.array(z.string()).optional(),\n }),\n responseSchema: z.string().nullable(),\n} as const;\n\n/**\n * Displays a notification to the user\n * @returns the button clicked by the user or null if the user dismissed the notification\n */\nexport const notify = toolFactory(notifyConfig);\n\nconst openFileRequest = z\n .object({\n /**\n * @default false\n * Whether to force the file to open even if it is already open\n */\n force: z.boolean().default(false),\n /**\n * Whether to preview the file in the editor\n * @default false\n * @warning Check if the file type is supported by the editor\n */\n preview: z.boolean().optional().default(false),\n /**\n * The column to open the file in\n * @default active\n * @argument active - Open the file in the active column\n * @argument beside - Open the file beside the active column\n * @argument N - Open the file in the Nth column\n */\n column: z\n .union([z.enum([\"active\", \"beside\"]), z.number().min(1).max(9)])\n .optional(),\n })\n .default({\n force: false,\n preview: false,\n column: \"active\",\n });\n\nconst openFileResponse = z.object({\n /**\n * Absolute path to the file\n */\n path: z.string(),\n /**\n * Whether the file is already open in the editor\n */\n isAlreadyOpened: z.boolean(),\n});\n\nexport const openFileConfig = {\n name: \"OPEN_FILE\",\n requestSchema: z.object({\n /**\n * Absolute path to the file\n */\n path: z.string(),\n config: openFileRequest,\n }),\n responseSchema: openFileResponse,\n};\n\n/**\n * Opens a file in the editor\n */\nexport const openFile = toolFactory(openFileConfig);\n\nexport const openFilesConfig = {\n name: \"OPEN_FILES\",\n requestSchema: z.object({\n /**\n * Array of absolute paths to the files to open\n */\n paths: z.array(z.string()),\n config: openFileRequest,\n }),\n /**\n * Array of absolute paths to the files & whether they were already open in the editor\n */\n responseSchema: z.array(openFileResponse),\n};\n\nexport const openFiles = toolFactory(openFilesConfig);\n\nconst selectionPositionSchema = z.object({\n /**\n * The position in the whole file\n */\n character: z.number(),\n /**\n * The line number of the position\n */\n line: z.number(),\n /**\n * The character position within the line\n */\n lineCharacter: z.number(),\n});\n\nexport const getFocusedFileSelectionsConfig = {\n name: \"GET_FOCUSED_FILE_SELECTION\",\n requestSchema: null,\n responseSchema: z\n .object({\n /**\n * Absolute path to the file\n */\n path: z.string(),\n /**\n * Array of active selections in the file\n */\n selections: z.array(\n z.object({\n /**\n * The starting character position of the selection in the file\n */\n start: selectionPositionSchema,\n /**\n * The ending character position of the selection in the file\n */\n end: selectionPositionSchema,\n /**\n * The string content of the selection\n */\n content: z.string(),\n /**\n * The length of the selection\n */\n length: z.number(),\n }),\n ),\n })\n .nullable(),\n};\n\n/**\n * Retrieve the active selections in the actively focused file in the editor\n */\nexport const getFocusedFileSelections = toolFactory(\n getFocusedFileSelectionsConfig,\n);\n\nexport const getPinnedFilesConfig = {\n name: \"GET_PINNED_FILES\",\n requestSchema: null,\n responseSchema: z.array(z.string()),\n};\n\n/**\n * Retrieve the list of pinned files in the editor\n * @returns The list of pinned files\n */\nexport const getPinnedFiles = toolFactory(getPinnedFilesConfig);\n\nexport const pinFilesConfig = {\n name: \"PIN_FILES\",\n requestSchema: z.object({\n paths: z.array(z.string()),\n }),\n responseSchema: z.array(z.string()),\n};\n\n/**\n * Pin a list of files in the editor\n * @returns The list of pinned files\n */\nexport const pinFiles = toolFactory(pinFilesConfig);\n\nexport const unpinFilesConfig = {\n name: \"UNPIN_FILES\",\n requestSchema: z.object({\n paths: z.array(z.string()),\n }),\n responseSchema: z.array(z.string()),\n};\n\n/**\n * Unpin a list of files in the editor\n * @returns The list of pinned files\n */\nexport const unpinFiles = toolFactory(unpinFilesConfig);\n","import { json } from \"@synstack/json\";\nimport * as net from \"net\";\nimport pako from \"pako\";\nimport { z } from \"zod/v4\";\n\nexport const RESPONSE_SUFFIX = \"_RESPONSE\";\n\nconst memoize = <ARGS extends Array<any>, VALUE>(\n fn: (...args: ARGS) => VALUE,\n) => {\n let cache: { data: VALUE } | undefined = undefined;\n return (...args: ARGS) => {\n if (cache === undefined) cache = { data: fn(...args) };\n return cache.data;\n };\n};\n\nexport const getIpcClient = memoize(() => {\n return new Promise<net.Socket>((resolve, reject) => {\n const port = process.env.REFORGE_IPC_PORT;\n\n if (!port)\n throw new Error(\"No IPC port provided, cannot connect to parent process\");\n\n const parsedPort = typeof port === \"string\" ? parseInt(port) : port;\n\n const client = net.connect(parsedPort, \"localhost\", () => {\n client.removeListener(\"error\", reject);\n resolve(client);\n });\n\n client.once(\"error\", reject);\n });\n});\n\nexport interface ToolConfig<\n NAME extends string,\n REQUEST_SCHEMA extends z.ZodType | null,\n RESPONSE_SCHEMA extends z.ZodType = z.ZodAny,\n> {\n name: NAME;\n requestSchema: REQUEST_SCHEMA;\n responseSchema: RESPONSE_SCHEMA;\n}\n\nexport type ToolFn<\n REQUEST_SCHEMA extends z.ZodType | null,\n RESPONSE_SCHEMA extends z.ZodType = z.ZodTypeAny,\n> = REQUEST_SCHEMA extends z.ZodType\n ? (data: z.input<REQUEST_SCHEMA>) => Promise<z.output<RESPONSE_SCHEMA>>\n : () => Promise<z.output<RESPONSE_SCHEMA>>;\n\nexport const baseResponseSchema = z.object({\n type: z.string(),\n id: z.string(),\n status: z.union([z.literal(\"ok\"), z.literal(\"error\")]),\n});\n\nexport const toolFactory = <\n NAME extends string,\n REQUEST_SCHEMA extends z.ZodType | null,\n RESPONSE_SCHEMA extends z.ZodType = z.ZodAny,\n>(\n toolConfig: ToolConfig<NAME, REQUEST_SCHEMA, RESPONSE_SCHEMA>,\n): ToolFn<REQUEST_SCHEMA, RESPONSE_SCHEMA> => {\n const responseName = `${toolConfig.name}${RESPONSE_SUFFIX}` as const;\n const responseSchema = z.discriminatedUnion(\"status\", [\n z.object({\n status: z.literal(\"ok\"),\n type: z.literal(responseName),\n id: z.string(),\n data: toolConfig.responseSchema,\n }),\n z.object({\n status: z.literal(\"error\"),\n type: z.literal(responseName),\n id: z.string(),\n data: z.string(),\n }),\n ]);\n const exec = async (data: unknown) => {\n const validatedData = toolConfig.requestSchema\n ? toolConfig.requestSchema.parse(data)\n : undefined;\n const client = await getIpcClient();\n const id = crypto.randomUUID();\n return new Promise<z.output<RESPONSE_SCHEMA>>((resolve, reject) => {\n const errorHandler = (error: Error) => {\n client.removeListener(\"error\", errorHandler);\n client.removeListener(\"data\", responseHandler);\n reject(error);\n };\n\n const responseHandler = (response: Uint8Array) => {\n const resData = json.deserialize(\n pako.inflate(response, { to: \"string\" }),\n );\n const baseResponse = baseResponseSchema.parse(resData);\n if (baseResponse.type === responseName && baseResponse.id === id) {\n const parsedResponse = responseSchema.parse(resData);\n client.removeListener(\"error\", errorHandler);\n client.removeListener(\"data\", responseHandler);\n // @ts-expect-error - TODO: fix this\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n if (parsedResponse.status === \"ok\") resolve(parsedResponse.data);\n // @ts-expect-error - TODO: fix this\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n else reject(new Error(parsedResponse.data));\n }\n };\n\n client.once(\"error\", errorHandler);\n client.on(\"data\", responseHandler);\n client.write(\n pako.deflate(\n json.serialize({\n type: toolConfig.name,\n id,\n data: validatedData,\n }),\n ),\n );\n });\n };\n\n return exec as ToolFn<REQUEST_SCHEMA, RESPONSE_SCHEMA>;\n};\n","import { z } from \"zod/v4\";\nimport { toolFactory } from \"./tool.utils.ts\";\n\n/**\n * Enumeration of VSCode symbol kinds.\n * These values represent different types of symbols that can be found in code.\n */\nexport const VscodeSymbolKind = {\n File: 0,\n Module: 1,\n Namespace: 2,\n Package: 3,\n Class: 4,\n Method: 5,\n Property: 6,\n Field: 7,\n Constructor: 8,\n Enum: 9,\n Interface: 10,\n Function: 11,\n Variable: 12,\n Constant: 13,\n String: 14,\n Number: 15,\n Boolean: 16,\n Array: 17,\n Object: 18,\n Key: 19,\n Null: 20,\n EnumMember: 21,\n Struct: 22,\n Event: 23,\n Operator: 24,\n TypeParameter: 25,\n} as const;\n\n/**\n * Enumeration of VSCode symbol tags.\n * These values represent additional metadata that can be attached to symbols.\n */\nexport const VscodeSymbolTag = {\n Deprecated: 1,\n} as const;\n\n/**\n * Schema for a position in a text document.\n */\nexport const positionSchema = z.object({\n /** Zero-based line number */\n line: z.number().int().min(0),\n /** Zero-based character offset on the line */\n character: z.number().int().min(0),\n});\n\n/** Type representing a position in a text document */\nexport type Position = z.output<typeof positionSchema>;\n\n/**\n * Schema for a range in a text document.\n */\nexport const rangeSchema = z.object({\n /** The start position of the range */\n start: positionSchema,\n /** The end position of the range */\n end: positionSchema,\n});\n\n/** Type representing a range in a text document */\nexport type Range = z.output<typeof rangeSchema>;\n\n/**\n * Schema for a call hierarchy item.\n * Represents a programming construct that can be part of a call hierarchy.\n */\nexport const callHierarchyItemSchema = z.object({\n /** The symbol kind of the item */\n kind: z.number().int().min(0).max(25),\n /** The name of the item */\n name: z.string(),\n /** Additional details about the item */\n detail: z.string(),\n /** The URI of the document containing the item */\n uri: z.string(),\n /** Optional tags associated with the item */\n tags: z.array(z.number().int()).optional(),\n /** The full range of the item */\n range: rangeSchema,\n /** The range that should be selected when navigating to the item */\n selectionRange: rangeSchema,\n});\n\n/** Type representing a call hierarchy item */\nexport type CallHierarchyItem = z.output<typeof callHierarchyItemSchema>;\n\n/**\n * Configuration for the executeCommand tool.\n * Defines the schema for executing VSCode commands.\n */\nexport const executeCommandConfig = {\n name: \"EXECUTE_COMMAND\",\n requestSchema: z.object({\n /** The vscode command to execute */\n command: z.string(),\n /** List of args to be passed to the command */\n args: z\n .array(\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"path\"),\n value: z.string(),\n }),\n z.object({\n type: z.literal(\"Uri\"),\n value: z.string().describe(\"Absolute path to the file\"),\n }),\n z.object({\n type: z.literal(\"Range\"),\n value: rangeSchema,\n }),\n z.object({\n type: z.literal(\"Position\"),\n value: positionSchema,\n }),\n z.object({\n type: z.literal(\"CallHierarchyItem\"),\n value: callHierarchyItemSchema,\n }),\n z.object({\n type: z.literal(\"primitive\"),\n value: z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.record(z.string(), z.any()),\n z.array(z.any()),\n ]),\n }),\n ]),\n )\n .optional()\n .default([]),\n }),\n responseSchema: z.any().optional(),\n};\n\n/**\n * Executes a command in the VSCode editor.\n * Allows calling bundled VSCode commands as well as commands from other extensions.\n *\n * @template OUTPUT - The expected output type of the command\n * @param {z.input<typeof executeCommandConfig.requestSchema>} args - The command arguments\n * @returns {Promise<OUTPUT>} A promise that resolves with the command's output\n */\nexport const executeCommand = toolFactory(executeCommandConfig) as <\n OUTPUT = any,\n>(\n args: z.input<typeof executeCommandConfig.requestSchema>,\n) => Promise<OUTPUT>;\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,YAAY;AACrB,YAAY,SAAS;AACrB,OAAO,UAAU;AACjB,SAAS,SAAS;AAEX,IAAM,kBAAkB;AAE/B,IAAM,UAAU,CACd,OACG;AACH,MAAI,QAAqC;AACzC,SAAO,IAAI,SAAe;AACxB,QAAI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;AAAA,UAC3B,OAAOA,GAAE,MAAM;AAAA,YACbA,GAAE,OAAO;AAAA,YACTA,GAAE,OAAO;AAAA,YACTA,GAAE,QAAQ;AAAA,YACVA,GAAE,OAAOA,GAAE,OAAO,GAAGA,GAAE,IAAI,CAAC;AAAA,YAC5BA,GAAE,MAAMA,GAAE,IAAI,CAAC;AAAA,UACjB,CAAC;AAAA,QACH,CAAC;AAAA,MACH,CAAC;AAAA,IACH,EACC,SAAS,EACT,QAAQ,CAAC,CAAC;AAAA,EACf,CAAC;AAAA,EACD,gBAAgBA,GAAE,IAAI,EAAE,SAAS;AACnC;AAUO,IAAM,iBAAiB,YAAY,oBAAoB;","names":["z","z","z","z"]}

@@ -44,3 +44,3 @@ "use strict";

// src/vscode.lib.ts
var import_zod2 = require("zod");
var import_v42 = require("zod/v4");

@@ -51,3 +51,3 @@ // src/tool.utils.ts

var import_pako = __toESM(require("pako"), 1);
var import_zod = require("zod");
var import_v4 = require("zod/v4");
var RESPONSE_SUFFIX = "_RESPONSE";

@@ -74,21 +74,21 @@ var memoize = (fn) => {

});
var baseResponseSchema = import_zod.z.object({
type: import_zod.z.string(),
id: import_zod.z.string(),
status: import_zod.z.union([import_zod.z.literal("ok"), import_zod.z.literal("error")])
var baseResponseSchema = import_v4.z.object({
type: import_v4.z.string(),
id: import_v4.z.string(),
status: import_v4.z.union([import_v4.z.literal("ok"), import_v4.z.literal("error")])
});
var toolFactory = (toolConfig) => {
const responseName = `${toolConfig.name}${RESPONSE_SUFFIX}`;
const responseSchema = import_zod.z.discriminatedUnion("status", [
import_zod.z.object({
type: import_zod.z.literal(responseName),
id: import_zod.z.string(),
status: import_zod.z.literal("ok"),
const responseSchema = import_v4.z.discriminatedUnion("status", [
import_v4.z.object({
status: import_v4.z.literal("ok"),
type: import_v4.z.literal(responseName),
id: import_v4.z.string(),
data: toolConfig.responseSchema
}),
import_zod.z.object({
type: import_zod.z.literal(responseName),
id: import_zod.z.string(),
status: import_zod.z.literal("error"),
data: import_zod.z.string()
import_v4.z.object({
status: import_v4.z.literal("error"),
type: import_v4.z.literal(responseName),
id: import_v4.z.string(),
data: import_v4.z.string()
})

@@ -116,3 +116,3 @@ ]);

if (parsedResponse.status === "ok") resolve(parsedResponse.data);
else reject(new Error(parsedResponse.status));
else reject(new Error(parsedResponse.data));
}

@@ -168,9 +168,9 @@ };

};
var positionSchema = import_zod2.z.object({
var positionSchema = import_v42.z.object({
/** Zero-based line number */
line: import_zod2.z.number().int().min(0),
line: import_v42.z.number().int().min(0),
/** Zero-based character offset on the line */
character: import_zod2.z.number().int().min(0)
character: import_v42.z.number().int().min(0)
});
var rangeSchema = import_zod2.z.object({
var rangeSchema = import_v42.z.object({
/** The start position of the range */

@@ -181,13 +181,13 @@ start: positionSchema,

});
var callHierarchyItemSchema = import_zod2.z.object({
var callHierarchyItemSchema = import_v42.z.object({
/** The symbol kind of the item */
kind: import_zod2.z.number().int().min(0).max(25),
kind: import_v42.z.number().int().min(0).max(25),
/** The name of the item */
name: import_zod2.z.string(),
name: import_v42.z.string(),
/** Additional details about the item */
detail: import_zod2.z.string(),
detail: import_v42.z.string(),
/** The URI of the document containing the item */
uri: import_zod2.z.string(),
uri: import_v42.z.string(),
/** Optional tags associated with the item */
tags: import_zod2.z.array(import_zod2.z.number().int()).optional(),
tags: import_v42.z.array(import_v42.z.number().int()).optional(),
/** The full range of the item */

@@ -200,36 +200,36 @@ range: rangeSchema,

name: "EXECUTE_COMMAND",
requestSchema: import_zod2.z.object({
requestSchema: import_v42.z.object({
/** The vscode command to execute */
command: import_zod2.z.string(),
command: import_v42.z.string(),
/** List of args to be passed to the command */
args: import_zod2.z.array(
import_zod2.z.discriminatedUnion("type", [
import_zod2.z.object({
type: import_zod2.z.literal("path"),
value: import_zod2.z.string()
args: import_v42.z.array(
import_v42.z.discriminatedUnion("type", [
import_v42.z.object({
type: import_v42.z.literal("path"),
value: import_v42.z.string()
}),
import_zod2.z.object({
type: import_zod2.z.literal("Uri"),
value: import_zod2.z.string().describe("Absolute path to the file")
import_v42.z.object({
type: import_v42.z.literal("Uri"),
value: import_v42.z.string().describe("Absolute path to the file")
}),
import_zod2.z.object({
type: import_zod2.z.literal("Range"),
import_v42.z.object({
type: import_v42.z.literal("Range"),
value: rangeSchema
}),
import_zod2.z.object({
type: import_zod2.z.literal("Position"),
import_v42.z.object({
type: import_v42.z.literal("Position"),
value: positionSchema
}),
import_zod2.z.object({
type: import_zod2.z.literal("CallHierarchyItem"),
import_v42.z.object({
type: import_v42.z.literal("CallHierarchyItem"),
value: callHierarchyItemSchema
}),
import_zod2.z.object({
type: import_zod2.z.literal("primitive"),
value: import_zod2.z.union([
import_zod2.z.string(),
import_zod2.z.number(),
import_zod2.z.boolean(),
import_zod2.z.record(import_zod2.z.any()),
import_zod2.z.array(import_zod2.z.any())
import_v42.z.object({
type: import_v42.z.literal("primitive"),
value: import_v42.z.union([
import_v42.z.string(),
import_v42.z.number(),
import_v42.z.boolean(),
import_v42.z.record(import_v42.z.string(), import_v42.z.any()),
import_v42.z.array(import_v42.z.any())
])

@@ -240,3 +240,3 @@ })

}),
responseSchema: import_zod2.z.any().optional()
responseSchema: import_v42.z.any().optional()
};

@@ -243,0 +243,0 @@ var executeCommand = toolFactory(executeCommandConfig);

@@ -1,1 +0,1 @@

{"version":3,"sources":["../src/vscode.index.ts","../src/vscode.lib.ts","../src/tool.utils.ts"],"sourcesContent":["export * from \"./vscode.lib.ts\";\n","import { z } from \"zod\";\nimport { toolFactory } from \"./tool.utils.ts\";\n\n/**\n * Enumeration of VSCode symbol kinds.\n * These values represent different types of symbols that can be found in code.\n */\nexport const VscodeSymbolKind = {\n File: 0,\n Module: 1,\n Namespace: 2,\n Package: 3,\n Class: 4,\n Method: 5,\n Property: 6,\n Field: 7,\n Constructor: 8,\n Enum: 9,\n Interface: 10,\n Function: 11,\n Variable: 12,\n Constant: 13,\n String: 14,\n Number: 15,\n Boolean: 16,\n Array: 17,\n Object: 18,\n Key: 19,\n Null: 20,\n EnumMember: 21,\n Struct: 22,\n Event: 23,\n Operator: 24,\n TypeParameter: 25,\n} as const;\n\n/**\n * Enumeration of VSCode symbol tags.\n * These values represent additional metadata that can be attached to symbols.\n */\nexport const VscodeSymbolTag = {\n Deprecated: 1,\n} as const;\n\n/**\n * Schema for a position in a text document.\n */\nexport const positionSchema = z.object({\n /** Zero-based line number */\n line: z.number().int().min(0),\n /** Zero-based character offset on the line */\n character: z.number().int().min(0),\n});\n\n/** Type representing a position in a text document */\nexport type Position = z.output<typeof positionSchema>;\n\n/**\n * Schema for a range in a text document.\n */\nexport const rangeSchema = z.object({\n /** The start position of the range */\n start: positionSchema,\n /** The end position of the range */\n end: positionSchema,\n});\n\n/** Type representing a range in a text document */\nexport type Range = z.output<typeof rangeSchema>;\n\n/**\n * Schema for a call hierarchy item.\n * Represents a programming construct that can be part of a call hierarchy.\n */\nexport const callHierarchyItemSchema = z.object({\n /** The symbol kind of the item */\n kind: z.number().int().min(0).max(25),\n /** The name of the item */\n name: z.string(),\n /** Additional details about the item */\n detail: z.string(),\n /** The URI of the document containing the item */\n uri: z.string(),\n /** Optional tags associated with the item */\n tags: z.array(z.number().int()).optional(),\n /** The full range of the item */\n range: rangeSchema,\n /** The range that should be selected when navigating to the item */\n selectionRange: rangeSchema,\n});\n\n/** Type representing a call hierarchy item */\nexport type CallHierarchyItem = z.output<typeof callHierarchyItemSchema>;\n\n/**\n * Configuration for the executeCommand tool.\n * Defines the schema for executing VSCode commands.\n */\nexport const executeCommandConfig = {\n name: \"EXECUTE_COMMAND\",\n requestSchema: z.object({\n /** The vscode command to execute */\n command: z.string(),\n /** List of args to be passed to the command */\n args: z\n .array(\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"path\"),\n value: z.string(),\n }),\n z.object({\n type: z.literal(\"Uri\"),\n value: z.string().describe(\"Absolute path to the file\"),\n }),\n z.object({\n type: z.literal(\"Range\"),\n value: rangeSchema,\n }),\n z.object({\n type: z.literal(\"Position\"),\n value: positionSchema,\n }),\n z.object({\n type: z.literal(\"CallHierarchyItem\"),\n value: callHierarchyItemSchema,\n }),\n z.object({\n type: z.literal(\"primitive\"),\n value: z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.record(z.any()),\n z.array(z.any()),\n ]),\n }),\n ]),\n )\n .optional()\n .default([]),\n }),\n responseSchema: z.any().optional(),\n};\n\n/**\n * Executes a command in the VSCode editor.\n * Allows calling bundled VSCode commands as well as commands from other extensions.\n *\n * @template OUTPUT - The expected output type of the command\n * @param {z.input<typeof executeCommandConfig.requestSchema>} args - The command arguments\n * @returns {Promise<OUTPUT>} A promise that resolves with the command's output\n */\nexport const executeCommand = toolFactory(executeCommandConfig) as <\n OUTPUT = any,\n>(\n args: z.input<typeof executeCommandConfig.requestSchema>,\n) => Promise<OUTPUT>;\n","import { json } from \"@synstack/json\";\nimport * as net from \"net\";\nimport pako from \"pako\";\nimport { z } from \"zod\";\n\nexport const RESPONSE_SUFFIX = \"_RESPONSE\";\n\nconst memoize = <TArgs extends Array<any>, TValue>(\n fn: (...args: TArgs) => TValue,\n) => {\n let cache: { data: TValue } | undefined = undefined;\n return (...args: TArgs) => {\n if (cache === undefined) cache = { data: fn(...args) };\n return cache.data;\n };\n};\n\nexport const getIpcClient = memoize(() => {\n return new Promise<net.Socket>((resolve, reject) => {\n const port = process.env.REFORGE_IPC_PORT;\n\n if (!port)\n throw new Error(\"No IPC port provided, cannot connect to parent process\");\n\n const parsedPort = typeof port === \"string\" ? parseInt(port) : port;\n\n const client = net.connect(parsedPort, \"localhost\", () => {\n client.removeListener(\"error\", reject);\n resolve(client);\n });\n\n client.once(\"error\", reject);\n });\n});\n\nexport interface ToolConfig<\n TName extends string,\n TRequestSchema extends z.ZodSchema | null,\n TResponseSchema extends z.ZodSchema = any,\n> {\n name: TName;\n requestSchema: TRequestSchema;\n responseSchema: TResponseSchema;\n}\n\nexport type ToolFn<\n TRequestSchema extends z.ZodSchema | null,\n TResponseSchema extends z.ZodSchema,\n> = TRequestSchema extends z.ZodSchema\n ? (data: z.input<TRequestSchema>) => Promise<z.output<TResponseSchema>>\n : () => Promise<z.output<TResponseSchema>>;\n\nexport const baseResponseSchema = z.object({\n type: z.string(),\n id: z.string(),\n status: z.union([z.literal(\"ok\"), z.literal(\"error\")]),\n});\n\nexport const toolFactory = <\n TName extends string,\n TRequestSchema extends z.ZodSchema | null,\n TResponseSchema extends z.ZodSchema,\n>(\n toolConfig: ToolConfig<TName, TRequestSchema, TResponseSchema>,\n): ToolFn<TRequestSchema, TResponseSchema> => {\n const responseName = `${toolConfig.name}${RESPONSE_SUFFIX}` as const;\n const responseSchema = z.discriminatedUnion(\"status\", [\n z.object({\n type: z.literal(responseName),\n id: z.string(),\n status: z.literal(\"ok\"),\n data: toolConfig.responseSchema,\n }),\n z.object({\n type: z.literal(responseName),\n id: z.string(),\n status: z.literal(\"error\"),\n data: z.string(),\n }),\n ]);\n const exec = async (data: unknown) => {\n const validatedData = toolConfig.requestSchema\n ? toolConfig.requestSchema.parse(data)\n : undefined;\n const client = await getIpcClient();\n const id = crypto.randomUUID();\n return new Promise<z.output<TResponseSchema>>((resolve, reject) => {\n const errorHandler = (error: Error) => {\n client.removeListener(\"error\", errorHandler);\n client.removeListener(\"data\", responseHandler);\n reject(error);\n };\n\n const responseHandler = (response: Uint8Array) => {\n const resData = json.deserialize(\n pako.inflate(response, { to: \"string\" }),\n );\n const baseResponse = baseResponseSchema.parse(resData);\n if (baseResponse.type === responseName && baseResponse.id === id) {\n const parsedResponse = responseSchema.parse(resData);\n client.removeListener(\"error\", errorHandler);\n client.removeListener(\"data\", responseHandler);\n if (parsedResponse.status === \"ok\") resolve(parsedResponse.data);\n else reject(new Error(parsedResponse.status));\n }\n };\n\n client.once(\"error\", errorHandler);\n client.on(\"data\", responseHandler);\n client.write(\n pako.deflate(\n json.serialize({\n type: toolConfig.name,\n id,\n data: validatedData,\n }),\n ),\n );\n });\n };\n\n return exec as ToolFn<TRequestSchema, TResponseSchema>;\n};\n"],"mappings":";;;;;;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AAAA;AAAA,IAEtB,SAAS,cAAE,OAAO;AAAA;AAAA,IAElB,MAAM,cACH;AAAA,MACC,cAAE,mBAAmB,QAAQ;AAAA,QAC3B,cAAE,OAAO;AAAA,UACP,MAAM,cAAE,QAAQ,MAAM;AAAA,UACtB,OAAO,cAAE,OAAO;AAAA,QAClB,CAAC;AAAA,QACD,cAAE,OAAO;AAAA,UACP,MAAM,cAAE,QAAQ,KAAK;AAAA,UACrB,OAAO,cAAE,OAAO,EAAE,SAAS,2BAA2B;AAAA,QACxD,CAAC;AAAA,QACD,cAAE,OAAO;AAAA,UACP,MAAM,cAAE,QAAQ,OAAO;AAAA,UACvB,OAAO;AAAA,QACT,CAAC;AAAA,QACD,cAAE,OAAO;AAAA,UACP,MAAM,cAAE,QAAQ,UAAU;AAAA,UAC1B,OAAO;AAAA,QACT,CAAC;AAAA,QACD,cAAE,OAAO;AAAA,UACP,MAAM,cAAE,QAAQ,mBAAmB;AAAA,UACnC,OAAO;AAAA,QACT,CAAC;AAAA,QACD,cAAE,OAAO;AAAA,UACP,MAAM,cAAE,QAAQ,WAAW;AAAA,UAC3B,OAAO,cAAE,MAAM;AAAA,YACb,cAAE,OAAO;AAAA,YACT,cAAE,OAAO;AAAA,YACT,cAAE,QAAQ;AAAA,YACV,cAAE,OAAO,cAAE,IAAI,CAAC;AAAA,YAChB,cAAE,MAAM,cAAE,IAAI,CAAC;AAAA,UACjB,CAAC;AAAA,QACH,CAAC;AAAA,MACH,CAAC;AAAA,IACH,EACC,SAAS,EACT,QAAQ,CAAC,CAAC;AAAA,EACf,CAAC;AAAA,EACD,gBAAgB,cAAE,IAAI,EAAE,SAAS;AACnC;AAUO,IAAM,iBAAiB,YAAY,oBAAoB;","names":["import_zod","pako"]}
{"version":3,"sources":["../src/vscode.index.ts","../src/vscode.lib.ts","../src/tool.utils.ts"],"sourcesContent":["export * from \"./vscode.lib.ts\";\n","import { z } from \"zod/v4\";\nimport { toolFactory } from \"./tool.utils.ts\";\n\n/**\n * Enumeration of VSCode symbol kinds.\n * These values represent different types of symbols that can be found in code.\n */\nexport const VscodeSymbolKind = {\n File: 0,\n Module: 1,\n Namespace: 2,\n Package: 3,\n Class: 4,\n Method: 5,\n Property: 6,\n Field: 7,\n Constructor: 8,\n Enum: 9,\n Interface: 10,\n Function: 11,\n Variable: 12,\n Constant: 13,\n String: 14,\n Number: 15,\n Boolean: 16,\n Array: 17,\n Object: 18,\n Key: 19,\n Null: 20,\n EnumMember: 21,\n Struct: 22,\n Event: 23,\n Operator: 24,\n TypeParameter: 25,\n} as const;\n\n/**\n * Enumeration of VSCode symbol tags.\n * These values represent additional metadata that can be attached to symbols.\n */\nexport const VscodeSymbolTag = {\n Deprecated: 1,\n} as const;\n\n/**\n * Schema for a position in a text document.\n */\nexport const positionSchema = z.object({\n /** Zero-based line number */\n line: z.number().int().min(0),\n /** Zero-based character offset on the line */\n character: z.number().int().min(0),\n});\n\n/** Type representing a position in a text document */\nexport type Position = z.output<typeof positionSchema>;\n\n/**\n * Schema for a range in a text document.\n */\nexport const rangeSchema = z.object({\n /** The start position of the range */\n start: positionSchema,\n /** The end position of the range */\n end: positionSchema,\n});\n\n/** Type representing a range in a text document */\nexport type Range = z.output<typeof rangeSchema>;\n\n/**\n * Schema for a call hierarchy item.\n * Represents a programming construct that can be part of a call hierarchy.\n */\nexport const callHierarchyItemSchema = z.object({\n /** The symbol kind of the item */\n kind: z.number().int().min(0).max(25),\n /** The name of the item */\n name: z.string(),\n /** Additional details about the item */\n detail: z.string(),\n /** The URI of the document containing the item */\n uri: z.string(),\n /** Optional tags associated with the item */\n tags: z.array(z.number().int()).optional(),\n /** The full range of the item */\n range: rangeSchema,\n /** The range that should be selected when navigating to the item */\n selectionRange: rangeSchema,\n});\n\n/** Type representing a call hierarchy item */\nexport type CallHierarchyItem = z.output<typeof callHierarchyItemSchema>;\n\n/**\n * Configuration for the executeCommand tool.\n * Defines the schema for executing VSCode commands.\n */\nexport const executeCommandConfig = {\n name: \"EXECUTE_COMMAND\",\n requestSchema: z.object({\n /** The vscode command to execute */\n command: z.string(),\n /** List of args to be passed to the command */\n args: z\n .array(\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"path\"),\n value: z.string(),\n }),\n z.object({\n type: z.literal(\"Uri\"),\n value: z.string().describe(\"Absolute path to the file\"),\n }),\n z.object({\n type: z.literal(\"Range\"),\n value: rangeSchema,\n }),\n z.object({\n type: z.literal(\"Position\"),\n value: positionSchema,\n }),\n z.object({\n type: z.literal(\"CallHierarchyItem\"),\n value: callHierarchyItemSchema,\n }),\n z.object({\n type: z.literal(\"primitive\"),\n value: z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.record(z.string(), z.any()),\n z.array(z.any()),\n ]),\n }),\n ]),\n )\n .optional()\n .default([]),\n }),\n responseSchema: z.any().optional(),\n};\n\n/**\n * Executes a command in the VSCode editor.\n * Allows calling bundled VSCode commands as well as commands from other extensions.\n *\n * @template OUTPUT - The expected output type of the command\n * @param {z.input<typeof executeCommandConfig.requestSchema>} args - The command arguments\n * @returns {Promise<OUTPUT>} A promise that resolves with the command's output\n */\nexport const executeCommand = toolFactory(executeCommandConfig) as <\n OUTPUT = any,\n>(\n args: z.input<typeof executeCommandConfig.requestSchema>,\n) => Promise<OUTPUT>;\n","import { json } from \"@synstack/json\";\nimport * as net from \"net\";\nimport pako from \"pako\";\nimport { z } from \"zod/v4\";\n\nexport const RESPONSE_SUFFIX = \"_RESPONSE\";\n\nconst memoize = <ARGS extends Array<any>, VALUE>(\n fn: (...args: ARGS) => VALUE,\n) => {\n let cache: { data: VALUE } | undefined = undefined;\n return (...args: ARGS) => {\n if (cache === undefined) cache = { data: fn(...args) };\n return cache.data;\n };\n};\n\nexport const getIpcClient = memoize(() => {\n return new Promise<net.Socket>((resolve, reject) => {\n const port = process.env.REFORGE_IPC_PORT;\n\n if (!port)\n throw new Error(\"No IPC port provided, cannot connect to parent process\");\n\n const parsedPort = typeof port === \"string\" ? parseInt(port) : port;\n\n const client = net.connect(parsedPort, \"localhost\", () => {\n client.removeListener(\"error\", reject);\n resolve(client);\n });\n\n client.once(\"error\", reject);\n });\n});\n\nexport interface ToolConfig<\n NAME extends string,\n REQUEST_SCHEMA extends z.ZodType | null,\n RESPONSE_SCHEMA extends z.ZodType = z.ZodAny,\n> {\n name: NAME;\n requestSchema: REQUEST_SCHEMA;\n responseSchema: RESPONSE_SCHEMA;\n}\n\nexport type ToolFn<\n REQUEST_SCHEMA extends z.ZodType | null,\n RESPONSE_SCHEMA extends z.ZodType = z.ZodTypeAny,\n> = REQUEST_SCHEMA extends z.ZodType\n ? (data: z.input<REQUEST_SCHEMA>) => Promise<z.output<RESPONSE_SCHEMA>>\n : () => Promise<z.output<RESPONSE_SCHEMA>>;\n\nexport const baseResponseSchema = z.object({\n type: z.string(),\n id: z.string(),\n status: z.union([z.literal(\"ok\"), z.literal(\"error\")]),\n});\n\nexport const toolFactory = <\n NAME extends string,\n REQUEST_SCHEMA extends z.ZodType | null,\n RESPONSE_SCHEMA extends z.ZodType = z.ZodAny,\n>(\n toolConfig: ToolConfig<NAME, REQUEST_SCHEMA, RESPONSE_SCHEMA>,\n): ToolFn<REQUEST_SCHEMA, RESPONSE_SCHEMA> => {\n const responseName = `${toolConfig.name}${RESPONSE_SUFFIX}` as const;\n const responseSchema = z.discriminatedUnion(\"status\", [\n z.object({\n status: z.literal(\"ok\"),\n type: z.literal(responseName),\n id: z.string(),\n data: toolConfig.responseSchema,\n }),\n z.object({\n status: z.literal(\"error\"),\n type: z.literal(responseName),\n id: z.string(),\n data: z.string(),\n }),\n ]);\n const exec = async (data: unknown) => {\n const validatedData = toolConfig.requestSchema\n ? toolConfig.requestSchema.parse(data)\n : undefined;\n const client = await getIpcClient();\n const id = crypto.randomUUID();\n return new Promise<z.output<RESPONSE_SCHEMA>>((resolve, reject) => {\n const errorHandler = (error: Error) => {\n client.removeListener(\"error\", errorHandler);\n client.removeListener(\"data\", responseHandler);\n reject(error);\n };\n\n const responseHandler = (response: Uint8Array) => {\n const resData = json.deserialize(\n pako.inflate(response, { to: \"string\" }),\n );\n const baseResponse = baseResponseSchema.parse(resData);\n if (baseResponse.type === responseName && baseResponse.id === id) {\n const parsedResponse = responseSchema.parse(resData);\n client.removeListener(\"error\", errorHandler);\n client.removeListener(\"data\", responseHandler);\n // @ts-expect-error - TODO: fix this\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n if (parsedResponse.status === \"ok\") resolve(parsedResponse.data);\n // @ts-expect-error - TODO: fix this\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n else reject(new Error(parsedResponse.data));\n }\n };\n\n client.once(\"error\", errorHandler);\n client.on(\"data\", responseHandler);\n client.write(\n pako.deflate(\n json.serialize({\n type: toolConfig.name,\n id,\n data: validatedData,\n }),\n ),\n );\n });\n };\n\n return exec as ToolFn<REQUEST_SCHEMA, RESPONSE_SCHEMA>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,aAAkB;;;ACAlB,kBAAqB;AACrB,UAAqB;AACrB,kBAAiB;AACjB,gBAAkB;AAEX,IAAM,kBAAkB;AAE/B,IAAM,UAAU,CACd,OACG;AACH,MAAI,QAAqC;AACzC,SAAO,IAAI,SAAe;AACxB,QAAI,UAAU,OAAW,SAAQ,EAAE,MAAM,GAAG,GAAG,IAAI,EAAE;AACrD,WAAO,MAAM;AAAA,EACf;AACF;AAEO,IAAM,eAAe,QAAQ,MAAM;AACxC,SAAO,IAAI,QAAoB,CAAC,SAAS,WAAW;AAClD,UAAM,OAAO,QAAQ,IAAI;AAEzB,QAAI,CAAC;AACH,YAAM,IAAI,MAAM,wDAAwD;AAE1E,UAAM,aAAa,OAAO,SAAS,WAAW,SAAS,IAAI,IAAI;AAE/D,UAAM,SAAa,YAAQ,YAAY,aAAa,MAAM;AACxD,aAAO,eAAe,SAAS,MAAM;AACrC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E,QAAQ,WAAW;AAAA,UAC3B,OAAO,aAAE,MAAM;AAAA,YACb,aAAE,OAAO;AAAA,YACT,aAAE,OAAO;AAAA,YACT,aAAE,QAAQ;AAAA,YACV,aAAE,OAAO,aAAE,OAAO,GAAG,aAAE,IAAI,CAAC;AAAA,YAC5B,aAAE,MAAM,aAAE,IAAI,CAAC;AAAA,UACjB,CAAC;AAAA,QACH,CAAC;AAAA,MACH,CAAC;AAAA,IACH,EACC,SAAS,EACT,QAAQ,CAAC,CAAC;AAAA,EACf,CAAC;AAAA,EACD,gBAAgB,aAAE,IAAI,EAAE,SAAS;AACnC;AAUO,IAAM,iBAAiB,YAAY,oBAAoB;","names":["import_v4","pako"]}

@@ -1,2 +0,2 @@

export { C as CallHierarchyItem, P as Position, R as Range, V as VscodeSymbolKind, a as VscodeSymbolTag, c as callHierarchyItemSchema, b as executeCommand, e as executeCommandConfig, p as positionSchema, r as rangeSchema } from './vscode.index-BrJSm0Dj.cjs';
import 'zod';
export { C as CallHierarchyItem, P as Position, R as Range, V as VscodeSymbolKind, a as VscodeSymbolTag, c as callHierarchyItemSchema, b as executeCommand, e as executeCommandConfig, p as positionSchema, r as rangeSchema } from './vscode.index-CURr6mfX.cjs';
import 'zod/v4';

@@ -1,2 +0,2 @@

export { C as CallHierarchyItem, P as Position, R as Range, V as VscodeSymbolKind, a as VscodeSymbolTag, c as callHierarchyItemSchema, b as executeCommand, e as executeCommandConfig, p as positionSchema, r as rangeSchema } from './vscode.index-BrJSm0Dj.js';
import 'zod';
export { C as CallHierarchyItem, P as Position, R as Range, V as VscodeSymbolKind, a as VscodeSymbolTag, c as callHierarchyItemSchema, b as executeCommand, e as executeCommandConfig, p as positionSchema, r as rangeSchema } from './vscode.index-CURr6mfX.js';
import 'zod/v4';
// src/vscode.lib.ts
import { z as z2 } from "zod";
import { z as z2 } from "zod/v4";

@@ -8,3 +8,3 @@ // src/tool.utils.ts

import pako from "pako";
import { z } from "zod";
import { z } from "zod/v4";
var RESPONSE_SUFFIX = "_RESPONSE";

@@ -40,11 +40,11 @@ var memoize = (fn) => {

z.object({
status: z.literal("ok"),
type: z.literal(responseName),
id: z.string(),
status: z.literal("ok"),
data: toolConfig.responseSchema
}),
z.object({
status: z.literal("error"),
type: z.literal(responseName),
id: z.string(),
status: z.literal("error"),
data: z.string()

@@ -73,3 +73,3 @@ })

if (parsedResponse.status === "ok") resolve(parsedResponse.data);
else reject(new Error(parsedResponse.status));
else reject(new Error(parsedResponse.data));
}

@@ -187,3 +187,3 @@ };

z2.boolean(),
z2.record(z2.any()),
z2.record(z2.string(), z2.any()),
z2.array(z2.any())

@@ -190,0 +190,0 @@ ])

@@ -1,1 +0,1 @@

{"version":3,"sources":["../src/vscode.lib.ts","../src/tool.utils.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { toolFactory } from \"./tool.utils.ts\";\n\n/**\n * Enumeration of VSCode symbol kinds.\n * These values represent different types of symbols that can be found in code.\n */\nexport const VscodeSymbolKind = {\n File: 0,\n Module: 1,\n Namespace: 2,\n Package: 3,\n Class: 4,\n Method: 5,\n Property: 6,\n Field: 7,\n Constructor: 8,\n Enum: 9,\n Interface: 10,\n Function: 11,\n Variable: 12,\n Constant: 13,\n String: 14,\n Number: 15,\n Boolean: 16,\n Array: 17,\n Object: 18,\n Key: 19,\n Null: 20,\n EnumMember: 21,\n Struct: 22,\n Event: 23,\n Operator: 24,\n TypeParameter: 25,\n} as const;\n\n/**\n * Enumeration of VSCode symbol tags.\n * These values represent additional metadata that can be attached to symbols.\n */\nexport const VscodeSymbolTag = {\n Deprecated: 1,\n} as const;\n\n/**\n * Schema for a position in a text document.\n */\nexport const positionSchema = z.object({\n /** Zero-based line number */\n line: z.number().int().min(0),\n /** Zero-based character offset on the line */\n character: z.number().int().min(0),\n});\n\n/** Type representing a position in a text document */\nexport type Position = z.output<typeof positionSchema>;\n\n/**\n * Schema for a range in a text document.\n */\nexport const rangeSchema = z.object({\n /** The start position of the range */\n start: positionSchema,\n /** The end position of the range */\n end: positionSchema,\n});\n\n/** Type representing a range in a text document */\nexport type Range = z.output<typeof rangeSchema>;\n\n/**\n * Schema for a call hierarchy item.\n * Represents a programming construct that can be part of a call hierarchy.\n */\nexport const callHierarchyItemSchema = z.object({\n /** The symbol kind of the item */\n kind: z.number().int().min(0).max(25),\n /** The name of the item */\n name: z.string(),\n /** Additional details about the item */\n detail: z.string(),\n /** The URI of the document containing the item */\n uri: z.string(),\n /** Optional tags associated with the item */\n tags: z.array(z.number().int()).optional(),\n /** The full range of the item */\n range: rangeSchema,\n /** The range that should be selected when navigating to the item */\n selectionRange: rangeSchema,\n});\n\n/** Type representing a call hierarchy item */\nexport type CallHierarchyItem = z.output<typeof callHierarchyItemSchema>;\n\n/**\n * Configuration for the executeCommand tool.\n * Defines the schema for executing VSCode commands.\n */\nexport const executeCommandConfig = {\n name: \"EXECUTE_COMMAND\",\n requestSchema: z.object({\n /** The vscode command to execute */\n command: z.string(),\n /** List of args to be passed to the command */\n args: z\n .array(\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"path\"),\n value: z.string(),\n }),\n z.object({\n type: z.literal(\"Uri\"),\n value: z.string().describe(\"Absolute path to the file\"),\n }),\n z.object({\n type: z.literal(\"Range\"),\n value: rangeSchema,\n }),\n z.object({\n type: z.literal(\"Position\"),\n value: positionSchema,\n }),\n z.object({\n type: z.literal(\"CallHierarchyItem\"),\n value: callHierarchyItemSchema,\n }),\n z.object({\n type: z.literal(\"primitive\"),\n value: z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.record(z.any()),\n z.array(z.any()),\n ]),\n }),\n ]),\n )\n .optional()\n .default([]),\n }),\n responseSchema: z.any().optional(),\n};\n\n/**\n * Executes a command in the VSCode editor.\n * Allows calling bundled VSCode commands as well as commands from other extensions.\n *\n * @template OUTPUT - The expected output type of the command\n * @param {z.input<typeof executeCommandConfig.requestSchema>} args - The command arguments\n * @returns {Promise<OUTPUT>} A promise that resolves with the command's output\n */\nexport const executeCommand = toolFactory(executeCommandConfig) as <\n OUTPUT = any,\n>(\n args: z.input<typeof executeCommandConfig.requestSchema>,\n) => Promise<OUTPUT>;\n","import { json } from \"@synstack/json\";\nimport * as net from \"net\";\nimport pako from \"pako\";\nimport { z } from \"zod\";\n\nexport const RESPONSE_SUFFIX = \"_RESPONSE\";\n\nconst memoize = <TArgs extends Array<any>, TValue>(\n fn: (...args: TArgs) => TValue,\n) => {\n let cache: { data: TValue } | undefined = undefined;\n return (...args: TArgs) => {\n if (cache === undefined) cache = { data: fn(...args) };\n return cache.data;\n };\n};\n\nexport const getIpcClient = memoize(() => {\n return new Promise<net.Socket>((resolve, reject) => {\n const port = process.env.REFORGE_IPC_PORT;\n\n if (!port)\n throw new Error(\"No IPC port provided, cannot connect to parent process\");\n\n const parsedPort = typeof port === \"string\" ? parseInt(port) : port;\n\n const client = net.connect(parsedPort, \"localhost\", () => {\n client.removeListener(\"error\", reject);\n resolve(client);\n });\n\n client.once(\"error\", reject);\n });\n});\n\nexport interface ToolConfig<\n TName extends string,\n TRequestSchema extends z.ZodSchema | null,\n TResponseSchema extends z.ZodSchema = any,\n> {\n name: TName;\n requestSchema: TRequestSchema;\n responseSchema: TResponseSchema;\n}\n\nexport type ToolFn<\n TRequestSchema extends z.ZodSchema | null,\n TResponseSchema extends z.ZodSchema,\n> = TRequestSchema extends z.ZodSchema\n ? (data: z.input<TRequestSchema>) => Promise<z.output<TResponseSchema>>\n : () => Promise<z.output<TResponseSchema>>;\n\nexport const baseResponseSchema = z.object({\n type: z.string(),\n id: z.string(),\n status: z.union([z.literal(\"ok\"), z.literal(\"error\")]),\n});\n\nexport const toolFactory = <\n TName extends string,\n TRequestSchema extends z.ZodSchema | null,\n TResponseSchema extends z.ZodSchema,\n>(\n toolConfig: ToolConfig<TName, TRequestSchema, TResponseSchema>,\n): ToolFn<TRequestSchema, TResponseSchema> => {\n const responseName = `${toolConfig.name}${RESPONSE_SUFFIX}` as const;\n const responseSchema = z.discriminatedUnion(\"status\", [\n z.object({\n type: z.literal(responseName),\n id: z.string(),\n status: z.literal(\"ok\"),\n data: toolConfig.responseSchema,\n }),\n z.object({\n type: z.literal(responseName),\n id: z.string(),\n status: z.literal(\"error\"),\n data: z.string(),\n }),\n ]);\n const exec = async (data: unknown) => {\n const validatedData = toolConfig.requestSchema\n ? toolConfig.requestSchema.parse(data)\n : undefined;\n const client = await getIpcClient();\n const id = crypto.randomUUID();\n return new Promise<z.output<TResponseSchema>>((resolve, reject) => {\n const errorHandler = (error: Error) => {\n client.removeListener(\"error\", errorHandler);\n client.removeListener(\"data\", responseHandler);\n reject(error);\n };\n\n const responseHandler = (response: Uint8Array) => {\n const resData = json.deserialize(\n pako.inflate(response, { to: \"string\" }),\n );\n const baseResponse = baseResponseSchema.parse(resData);\n if (baseResponse.type === responseName && baseResponse.id === id) {\n const parsedResponse = responseSchema.parse(resData);\n client.removeListener(\"error\", errorHandler);\n client.removeListener(\"data\", responseHandler);\n if (parsedResponse.status === \"ok\") resolve(parsedResponse.data);\n else reject(new Error(parsedResponse.status));\n }\n };\n\n client.once(\"error\", errorHandler);\n client.on(\"data\", responseHandler);\n client.write(\n pako.deflate(\n json.serialize({\n type: toolConfig.name,\n id,\n data: validatedData,\n }),\n ),\n );\n });\n };\n\n return exec as ToolFn<TRequestSchema, TResponseSchema>;\n};\n"],"mappings":";AAAA,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,YAAY;AACrB,YAAY,SAAS;AACrB,OAAO,UAAU;AACjB,SAAS,SAAS;AAEX,IAAM,kBAAkB;AAE/B,IAAM,UAAU,CACd,OACG;AACH,MAAI,QAAsC;AAC1C,SAAO,IAAI,SAAgB;AACzB,QAAI,UAAU,OAAW,SAAQ,EAAE,MAAM,GAAG,GAAG,IAAI,EAAE;AACrD,WAAO,MAAM;AAAA,EACf;AACF;AAEO,IAAM,eAAe,QAAQ,MAAM;AACxC,SAAO,IAAI,QAAoB,CAAC,SAAS,WAAW;AAClD,UAAM,OAAO,QAAQ,IAAI;AAEzB,QA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AQ,UAAU;AAAA,UAC1B,OAAO;AAAA,QACT,CAAC;AAAA,QACDA,GAAE,OAAO;AAAA,UACP,MAAMA,GAAE,QAAQ,mBAAmB;AAAA,UACnC,OAAO;AAAA,QACT,CAAC;AAAA,QACDA,GAAE,OAAO;AAAA,UACP,MAAMA,GAAE,QAAQ,WAAW;AAAA,UAC3B,OAAOA,GAAE,MAAM;AAAA,YACbA,GAAE,OAAO;AAAA,YACTA,GAAE,OAAO;AAAA,YACTA,GAAE,QAAQ;AAAA,YACVA,GAAE,OAAOA,GAAE,IAAI,CAAC;AAAA,YAChBA,GAAE,MAAMA,GAAE,IAAI,CAAC;AAAA,UACjB,CAAC;AAAA,QACH,CAAC;AAAA,MACH,CAAC;AAAA,IACH,EACC,SAAS,EACT,QAAQ,CAAC,CAAC;AAAA,EACf,CAAC;AAAA,EACD,gBAAgBA,GAAE,IAAI,EAAE,SAAS;AACnC;AAUO,IAAM,iBAAiB,YAAY,oBAAoB;","names":["z","z"]}
{"version":3,"sources":["../src/vscode.lib.ts","../src/tool.utils.ts"],"sourcesContent":["import { z } from \"zod/v4\";\nimport { toolFactory } from \"./tool.utils.ts\";\n\n/**\n * Enumeration of VSCode symbol kinds.\n * These values represent different types of symbols that can be found in code.\n */\nexport const VscodeSymbolKind = {\n File: 0,\n Module: 1,\n Namespace: 2,\n Package: 3,\n Class: 4,\n Method: 5,\n Property: 6,\n Field: 7,\n Constructor: 8,\n Enum: 9,\n Interface: 10,\n Function: 11,\n Variable: 12,\n Constant: 13,\n String: 14,\n Number: 15,\n Boolean: 16,\n Array: 17,\n Object: 18,\n Key: 19,\n Null: 20,\n EnumMember: 21,\n Struct: 22,\n Event: 23,\n Operator: 24,\n TypeParameter: 25,\n} as const;\n\n/**\n * Enumeration of VSCode symbol tags.\n * These values represent additional metadata that can be attached to symbols.\n */\nexport const VscodeSymbolTag = {\n Deprecated: 1,\n} as const;\n\n/**\n * Schema for a position in a text document.\n */\nexport const positionSchema = z.object({\n /** Zero-based line number */\n line: z.number().int().min(0),\n /** Zero-based character offset on the line */\n character: z.number().int().min(0),\n});\n\n/** Type representing a position in a text document */\nexport type Position = z.output<typeof positionSchema>;\n\n/**\n * Schema for a range in a text document.\n */\nexport const rangeSchema = z.object({\n /** The start position of the range */\n start: positionSchema,\n /** The end position of the range */\n end: positionSchema,\n});\n\n/** Type representing a range in a text document */\nexport type Range = z.output<typeof rangeSchema>;\n\n/**\n * Schema for a call hierarchy item.\n * Represents a programming construct that can be part of a call hierarchy.\n */\nexport const callHierarchyItemSchema = z.object({\n /** The symbol kind of the item */\n kind: z.number().int().min(0).max(25),\n /** The name of the item */\n name: z.string(),\n /** Additional details about the item */\n detail: z.string(),\n /** The URI of the document containing the item */\n uri: z.string(),\n /** Optional tags associated with the item */\n tags: z.array(z.number().int()).optional(),\n /** The full range of the item */\n range: rangeSchema,\n /** The range that should be selected when navigating to the item */\n selectionRange: rangeSchema,\n});\n\n/** Type representing a call hierarchy item */\nexport type CallHierarchyItem = z.output<typeof callHierarchyItemSchema>;\n\n/**\n * Configuration for the executeCommand tool.\n * Defines the schema for executing VSCode commands.\n */\nexport const executeCommandConfig = {\n name: \"EXECUTE_COMMAND\",\n requestSchema: z.object({\n /** The vscode command to execute */\n command: z.string(),\n /** List of args to be passed to the command */\n args: z\n .array(\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"path\"),\n value: z.string(),\n }),\n z.object({\n type: z.literal(\"Uri\"),\n value: z.string().describe(\"Absolute path to the file\"),\n }),\n z.object({\n type: z.literal(\"Range\"),\n value: rangeSchema,\n }),\n z.object({\n type: z.literal(\"Position\"),\n value: positionSchema,\n }),\n z.object({\n type: z.literal(\"CallHierarchyItem\"),\n value: callHierarchyItemSchema,\n }),\n z.object({\n type: z.literal(\"primitive\"),\n value: z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.record(z.string(), z.any()),\n z.array(z.any()),\n ]),\n }),\n ]),\n )\n .optional()\n .default([]),\n }),\n responseSchema: z.any().optional(),\n};\n\n/**\n * Executes a command in the VSCode editor.\n * Allows calling bundled VSCode commands as well as commands from other extensions.\n *\n * @template OUTPUT - The expected output type of the command\n * @param {z.input<typeof executeCommandConfig.requestSchema>} args - The command arguments\n * @returns {Promise<OUTPUT>} A promise that resolves with the command's output\n */\nexport const executeCommand = toolFactory(executeCommandConfig) as <\n OUTPUT = any,\n>(\n args: z.input<typeof executeCommandConfig.requestSchema>,\n) => Promise<OUTPUT>;\n","import { json } from \"@synstack/json\";\nimport * as net from \"net\";\nimport pako from \"pako\";\nimport { z } from \"zod/v4\";\n\nexport const RESPONSE_SUFFIX = \"_RESPONSE\";\n\nconst memoize = <ARGS extends Array<any>, VALUE>(\n fn: (...args: ARGS) => VALUE,\n) => {\n let cache: { data: VALUE } | undefined = undefined;\n return (...args: ARGS) => {\n if (cache === undefined) cache = { data: fn(...args) };\n return cache.data;\n };\n};\n\nexport const getIpcClient = memoize(() => {\n return new Promise<net.Socket>((resolve, reject) => {\n const port = process.env.REFORGE_IPC_PORT;\n\n if (!port)\n throw new Error(\"No IPC port provided, cannot connect to parent process\");\n\n const parsedPort = typeof port === \"string\" ? parseInt(port) : port;\n\n const client = net.connect(parsedPort, \"localhost\", () => {\n client.removeListener(\"error\", reject);\n resolve(client);\n });\n\n client.once(\"error\", reject);\n });\n});\n\nexport interface ToolConfig<\n NAME extends string,\n REQUEST_SCHEMA extends z.ZodType | null,\n RESPONSE_SCHEMA extends z.ZodType = z.ZodAny,\n> {\n name: NAME;\n requestSchema: REQUEST_SCHEMA;\n responseSchema: RESPONSE_SCHEMA;\n}\n\nexport type ToolFn<\n REQUEST_SCHEMA extends z.ZodType | null,\n RESPONSE_SCHEMA extends z.ZodType = z.ZodTypeAny,\n> = REQUEST_SCHEMA extends z.ZodType\n ? (data: z.input<REQUEST_SCHEMA>) => Promise<z.output<RESPONSE_SCHEMA>>\n : () => Promise<z.output<RESPONSE_SCHEMA>>;\n\nexport const baseResponseSchema = z.object({\n type: z.string(),\n id: z.string(),\n status: z.union([z.literal(\"ok\"), z.literal(\"error\")]),\n});\n\nexport const toolFactory = <\n NAME extends string,\n REQUEST_SCHEMA extends z.ZodType | null,\n RESPONSE_SCHEMA extends z.ZodType = z.ZodAny,\n>(\n toolConfig: ToolConfig<NAME, REQUEST_SCHEMA, RESPONSE_SCHEMA>,\n): ToolFn<REQUEST_SCHEMA, RESPONSE_SCHEMA> => {\n const responseName = `${toolConfig.name}${RESPONSE_SUFFIX}` as const;\n const responseSchema = z.discriminatedUnion(\"status\", [\n z.object({\n status: z.literal(\"ok\"),\n type: z.literal(responseName),\n id: z.string(),\n data: toolConfig.responseSchema,\n }),\n z.object({\n status: z.literal(\"error\"),\n type: z.literal(responseName),\n id: z.string(),\n data: z.string(),\n }),\n ]);\n const exec = async (data: unknown) => {\n const validatedData = toolConfig.requestSchema\n ? toolConfig.requestSchema.parse(data)\n : undefined;\n const client = await getIpcClient();\n const id = crypto.randomUUID();\n return new Promise<z.output<RESPONSE_SCHEMA>>((resolve, reject) => {\n const errorHandler = (error: Error) => {\n client.removeListener(\"error\", errorHandler);\n client.removeListener(\"data\", responseHandler);\n reject(error);\n };\n\n const responseHandler = (response: Uint8Array) => {\n const resData = json.deserialize(\n pako.inflate(response, { to: \"string\" }),\n );\n const baseResponse = baseResponseSchema.parse(resData);\n if (baseResponse.type === responseName && baseResponse.id === id) {\n const parsedResponse = responseSchema.parse(resData);\n client.removeListener(\"error\", errorHandler);\n client.removeListener(\"data\", responseHandler);\n // @ts-expect-error - TODO: fix this\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n if (parsedResponse.status === \"ok\") resolve(parsedResponse.data);\n // @ts-expect-error - TODO: fix this\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n else reject(new Error(parsedResponse.data));\n }\n };\n\n client.once(\"error\", errorHandler);\n client.on(\"data\", responseHandler);\n client.write(\n pako.deflate(\n json.serialize({\n type: toolConfig.name,\n id,\n data: validatedData,\n }),\n ),\n );\n });\n };\n\n return ex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,GAAE,OAAO;AAAA;AAAA,IAElB,MAAMA,GACH;AAAA,MACCA,GAAE,mBAAmB,QAAQ;AAAA,QAC3BA,GAAE,OAAO;AAAA,UACP,MAAMA,GAAE,QAAQ,MAAM;AAAA,UACtB,OAAOA,GAAE,OAAO;AAAA,QAClB,CAAC;AAAA,QACDA,GAAE,OAAO;AAAA,UACP,MAAMA,GAAE,QAAQ,KAAK;AAAA,UACrB,OAAOA,GAAE,OAAO,EAAE,SAAS,2BAA2B;AAAA,QACxD,CAAC;AAAA,QACDA,GAAE,OAAO;AAAA,UACP,MAAMA,GAAE,QAAQ,OAAO;AAAA,UACvB,OAAO;AAAA,QACT,CAAC;AAAA,QACDA,GAAE,OAAO;AAAA,UACP,MAAMA,GAAE,QAAQ,UAAU;AAAA,UAC1B,OAAO;AAAA,QACT,CAAC;AAAA,QACDA,GAAE,OAAO;AAAA,UACP,MAAMA,GAAE,QAAQ,mBAAmB;AAAA,UACnC,OAAO;AAAA,QACT,CAAC;AAAA,QACDA,GAAE,OAAO;AAAA,UACP,MAAMA,GAAE,QAAQ,WAAW;AAAA,UAC3B,OAAOA,GAAE,MAAM;AAAA,YACbA,GAAE,OAAO;AAAA,YACTA,GAAE,OAAO;AAAA,YACTA,GAAE,QAAQ;AAAA,YACVA,GAAE,OAAOA,GAAE,OAAO,GAAGA,GAAE,IAAI,CAAC;AAAA,YAC5BA,GAAE,MAAMA,GAAE,IAAI,CAAC;AAAA,UACjB,CAAC;AAAA,QACH,CAAC;AAAA,MACH,CAAC;AAAA,IACH,EACC,SAAS,EACT,QAAQ,CAAC,CAAC;AAAA,EACf,CAAC;AAAA,EACD,gBAAgBA,GAAE,IAAI,EAAE,SAAS;AACnC;AAUO,IAAM,iBAAiB,YAAY,oBAAoB;","names":["z","z"]}

@@ -7,3 +7,3 @@ {

},
"version": "1.8.1",
"version": "1.8.2",
"description": "Runtime tools for interactive DevX with the ReForge IDE extension",

@@ -35,4 +35,3 @@ "keywords": [

"test:unit:watch": "node --experimental-strip-types --experimental-test-snapshots --no-warnings --watch --test --watch src/**/*.test.ts",
"test": "yarn test:types && yarn test:unit",
"prepare": "yarn test && yarn build"
"test": "pnpm test:types && pnpm test:unit"
},

@@ -62,13 +61,16 @@ "exports": {

"dependencies": {
"@synstack/json": "1.1.9",
"@synstack/json": "^1.1.10",
"pako": "^2.1.0"
},
"devDependencies": {
"@types/node": "^22.15.18",
"@types/node": "^22.15.32",
"@types/pako": "^2.0.3",
"@types/vscode": "^1.100.0",
"tsup": "^8.4.0",
"@types/vscode": "^1.101.0",
"tsup": "^8.5.0",
"typescript": "^5.8.3",
"zod": "^3.24.4"
"zod": "^3.25.67"
},
"peerDependencies": {
"zod": "^3.25.0"
},
"files": [

@@ -79,6 +81,3 @@ "src/**/*.ts",

],
"peerDependencies": {
"zod": "*"
},
"gitHead": "e1e1af9e37deafae1ff7e22df9874af26941ae6b"
"gitHead": "f0daeeb6dd582a265033f020ba5e4baef3ff2a94"
}

@@ -1,2 +0,2 @@

import { z } from "zod";
import { z } from "zod/v4";
import { toolFactory } from "./tool.utils.ts";

@@ -172,2 +172,4 @@

.default({
force: false,
preview: false,
column: "active",

@@ -174,0 +176,0 @@ });

import { json } from "@synstack/json";
import * as net from "net";
import pako from "pako";
import { z } from "zod";
import { z } from "zod/v4";
export const RESPONSE_SUFFIX = "_RESPONSE";
const memoize = <TArgs extends Array<any>, TValue>(
fn: (...args: TArgs) => TValue,
const memoize = <ARGS extends Array<any>, VALUE>(
fn: (...args: ARGS) => VALUE,
) => {
let cache: { data: TValue } | undefined = undefined;
return (...args: TArgs) => {
let cache: { data: VALUE } | undefined = undefined;
return (...args: ARGS) => {
if (cache === undefined) cache = { data: fn(...args) };

@@ -37,17 +37,17 @@ return cache.data;

export interface ToolConfig<
TName extends string,
TRequestSchema extends z.ZodSchema | null,
TResponseSchema extends z.ZodSchema = any,
NAME extends string,
REQUEST_SCHEMA extends z.ZodType | null,
RESPONSE_SCHEMA extends z.ZodType = z.ZodAny,
> {
name: TName;
requestSchema: TRequestSchema;
responseSchema: TResponseSchema;
name: NAME;
requestSchema: REQUEST_SCHEMA;
responseSchema: RESPONSE_SCHEMA;
}
export type ToolFn<
TRequestSchema extends z.ZodSchema | null,
TResponseSchema extends z.ZodSchema,
> = TRequestSchema extends z.ZodSchema
? (data: z.input<TRequestSchema>) => Promise<z.output<TResponseSchema>>
: () => Promise<z.output<TResponseSchema>>;
REQUEST_SCHEMA extends z.ZodType | null,
RESPONSE_SCHEMA extends z.ZodType = z.ZodTypeAny,
> = REQUEST_SCHEMA extends z.ZodType
? (data: z.input<REQUEST_SCHEMA>) => Promise<z.output<RESPONSE_SCHEMA>>
: () => Promise<z.output<RESPONSE_SCHEMA>>;

@@ -61,20 +61,20 @@ export const baseResponseSchema = z.object({

export const toolFactory = <
TName extends string,
TRequestSchema extends z.ZodSchema | null,
TResponseSchema extends z.ZodSchema,
NAME extends string,
REQUEST_SCHEMA extends z.ZodType | null,
RESPONSE_SCHEMA extends z.ZodType = z.ZodAny,
>(
toolConfig: ToolConfig<TName, TRequestSchema, TResponseSchema>,
): ToolFn<TRequestSchema, TResponseSchema> => {
toolConfig: ToolConfig<NAME, REQUEST_SCHEMA, RESPONSE_SCHEMA>,
): ToolFn<REQUEST_SCHEMA, RESPONSE_SCHEMA> => {
const responseName = `${toolConfig.name}${RESPONSE_SUFFIX}` as const;
const responseSchema = z.discriminatedUnion("status", [
z.object({
status: z.literal("ok"),
type: z.literal(responseName),
id: z.string(),
status: z.literal("ok"),
data: toolConfig.responseSchema,
}),
z.object({
status: z.literal("error"),
type: z.literal(responseName),
id: z.string(),
status: z.literal("error"),
data: z.string(),

@@ -89,3 +89,3 @@ }),

const id = crypto.randomUUID();
return new Promise<z.output<TResponseSchema>>((resolve, reject) => {
return new Promise<z.output<RESPONSE_SCHEMA>>((resolve, reject) => {
const errorHandler = (error: Error) => {

@@ -106,4 +106,8 @@ client.removeListener("error", errorHandler);

client.removeListener("data", responseHandler);
// @ts-expect-error - TODO: fix this
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
if (parsedResponse.status === "ok") resolve(parsedResponse.data);
else reject(new Error(parsedResponse.status));
// @ts-expect-error - TODO: fix this
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
else reject(new Error(parsedResponse.data));
}

@@ -126,3 +130,3 @@ };

return exec as ToolFn<TRequestSchema, TResponseSchema>;
return exec as ToolFn<REQUEST_SCHEMA, RESPONSE_SCHEMA>;
};

@@ -1,2 +0,2 @@

import { z } from "zod";
import { z } from "zod/v4";
import { toolFactory } from "./tool.utils.ts";

@@ -134,3 +134,3 @@

z.boolean(),
z.record(z.any()),
z.record(z.string(), z.any()),
z.array(z.any()),

@@ -137,0 +137,0 @@ ]),

import { z } from 'zod';
/**
* Enumeration of VSCode symbol kinds.
* These values represent different types of symbols that can be found in code.
*/
declare const VscodeSymbolKind: {
readonly File: 0;
readonly Module: 1;
readonly Namespace: 2;
readonly Package: 3;
readonly Class: 4;
readonly Method: 5;
readonly Property: 6;
readonly Field: 7;
readonly Constructor: 8;
readonly Enum: 9;
readonly Interface: 10;
readonly Function: 11;
readonly Variable: 12;
readonly Constant: 13;
readonly String: 14;
readonly Number: 15;
readonly Boolean: 16;
readonly Array: 17;
readonly Object: 18;
readonly Key: 19;
readonly Null: 20;
readonly EnumMember: 21;
readonly Struct: 22;
readonly Event: 23;
readonly Operator: 24;
readonly TypeParameter: 25;
};
/**
* Enumeration of VSCode symbol tags.
* These values represent additional metadata that can be attached to symbols.
*/
declare const VscodeSymbolTag: {
readonly Deprecated: 1;
};
/**
* Schema for a position in a text document.
*/
declare const positionSchema: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
/** Type representing a position in a text document */
type Position = z.output<typeof positionSchema>;
/**
* Schema for a range in a text document.
*/
declare const rangeSchema: z.ZodObject<{
/** The start position of the range */
start: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
/** The end position of the range */
end: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
}, "strip", z.ZodTypeAny, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}>;
/** Type representing a range in a text document */
type Range = z.output<typeof rangeSchema>;
/**
* Schema for a call hierarchy item.
* Represents a programming construct that can be part of a call hierarchy.
*/
declare const callHierarchyItemSchema: z.ZodObject<{
/** The symbol kind of the item */
kind: z.ZodNumber;
/** The name of the item */
name: z.ZodString;
/** Additional details about the item */
detail: z.ZodString;
/** The URI of the document containing the item */
uri: z.ZodString;
/** Optional tags associated with the item */
tags: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
/** The full range of the item */
range: z.ZodObject<{
/** The start position of the range */
start: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
/** The end position of the range */
end: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
}, "strip", z.ZodTypeAny, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}>;
/** The range that should be selected when navigating to the item */
selectionRange: z.ZodObject<{
/** The start position of the range */
start: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
/** The end position of the range */
end: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
}, "strip", z.ZodTypeAny, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}>;
}, "strip", z.ZodTypeAny, {
kind: number;
name: string;
detail: string;
uri: string;
range: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
selectionRange: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
tags?: number[] | undefined;
}, {
kind: number;
name: string;
detail: string;
uri: string;
range: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
selectionRange: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
tags?: number[] | undefined;
}>;
/** Type representing a call hierarchy item */
type CallHierarchyItem = z.output<typeof callHierarchyItemSchema>;
/**
* Configuration for the executeCommand tool.
* Defines the schema for executing VSCode commands.
*/
declare const executeCommandConfig: {
name: string;
requestSchema: z.ZodObject<{
/** The vscode command to execute */
command: z.ZodString;
/** List of args to be passed to the command */
args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"path">;
value: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "path";
value: string;
}, {
type: "path";
value: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"Uri">;
value: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "Uri";
value: string;
}, {
type: "Uri";
value: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"Range">;
value: z.ZodObject<{
/** The start position of the range */
start: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
/** The end position of the range */
end: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
}, "strip", z.ZodTypeAny, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}>;
}, "strip", z.ZodTypeAny, {
type: "Range";
value: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
}, {
type: "Range";
value: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
}>, z.ZodObject<{
type: z.ZodLiteral<"Position">;
value: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
}, "strip", z.ZodTypeAny, {
type: "Position";
value: {
character: number;
line: number;
};
}, {
type: "Position";
value: {
character: number;
line: number;
};
}>, z.ZodObject<{
type: z.ZodLiteral<"CallHierarchyItem">;
value: z.ZodObject<{
/** The symbol kind of the item */
kind: z.ZodNumber;
/** The name of the item */
name: z.ZodString;
/** Additional details about the item */
detail: z.ZodString;
/** The URI of the document containing the item */
uri: z.ZodString;
/** Optional tags associated with the item */
tags: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
/** The full range of the item */
range: z.ZodObject<{
/** The start position of the range */
start: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
/** The end position of the range */
end: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
}, "strip", z.ZodTypeAny, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}>;
/** The range that should be selected when navigating to the item */
selectionRange: z.ZodObject<{
/** The start position of the range */
start: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
/** The end position of the range */
end: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
}, "strip", z.ZodTypeAny, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}>;
}, "strip", z.ZodTypeAny, {
kind: number;
name: string;
detail: string;
uri: string;
range: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
selectionRange: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
tags?: number[] | undefined;
}, {
kind: number;
name: string;
detail: string;
uri: string;
range: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
selectionRange: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
tags?: number[] | undefined;
}>;
}, "strip", z.ZodTypeAny, {
type: "CallHierarchyItem";
value: {
kind: number;
name: string;
detail: string;
uri: string;
range: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
selectionRange: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
tags?: number[] | undefined;
};
}, {
type: "CallHierarchyItem";
value: {
kind: number;
name: string;
detail: string;
uri: string;
range: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
selectionRange: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
tags?: number[] | undefined;
};
}>, z.ZodObject<{
type: z.ZodLiteral<"primitive">;
value: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny, "many">]>;
}, "strip", z.ZodTypeAny, {
type: "primitive";
value: string | number | boolean | any[] | Record<string, any>;
}, {
type: "primitive";
value: string | number | boolean | any[] | Record<string, any>;
}>]>, "many">>>;
}, "strip", z.ZodTypeAny, {
command: string;
args: ({
type: "path";
value: string;
} | {
type: "Uri";
value: string;
} | {
type: "Range";
value: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
} | {
type: "Position";
value: {
character: number;
line: number;
};
} | {
type: "CallHierarchyItem";
value: {
kind: number;
name: string;
detail: string;
uri: string;
range: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
selectionRange: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
tags?: number[] | undefined;
};
} | {
type: "primitive";
value: string | number | boolean | any[] | Record<string, any>;
})[];
}, {
command: string;
args?: ({
type: "path";
value: string;
} | {
type: "Uri";
value: string;
} | {
type: "Range";
value: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
} | {
type: "Position";
value: {
character: number;
line: number;
};
} | {
type: "CallHierarchyItem";
value: {
kind: number;
name: string;
detail: string;
uri: string;
range: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
selectionRange: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
tags?: number[] | undefined;
};
} | {
type: "primitive";
value: string | number | boolean | any[] | Record<string, any>;
})[] | undefined;
}>;
responseSchema: z.ZodOptional<z.ZodAny>;
};
/**
* Executes a command in the VSCode editor.
* Allows calling bundled VSCode commands as well as commands from other extensions.
*
* @template OUTPUT - The expected output type of the command
* @param {z.input<typeof executeCommandConfig.requestSchema>} args - The command arguments
* @returns {Promise<OUTPUT>} A promise that resolves with the command's output
*/
declare const executeCommand: <OUTPUT = any>(args: z.input<typeof executeCommandConfig.requestSchema>) => Promise<OUTPUT>;
type vscode_lib_CallHierarchyItem = CallHierarchyItem;
type vscode_lib_Position = Position;
type vscode_lib_Range = Range;
declare const vscode_lib_VscodeSymbolKind: typeof VscodeSymbolKind;
declare const vscode_lib_VscodeSymbolTag: typeof VscodeSymbolTag;
declare const vscode_lib_callHierarchyItemSchema: typeof callHierarchyItemSchema;
declare const vscode_lib_executeCommand: typeof executeCommand;
declare const vscode_lib_executeCommandConfig: typeof executeCommandConfig;
declare const vscode_lib_positionSchema: typeof positionSchema;
declare const vscode_lib_rangeSchema: typeof rangeSchema;
declare namespace vscode_lib {
export { type vscode_lib_CallHierarchyItem as CallHierarchyItem, type vscode_lib_Position as Position, type vscode_lib_Range as Range, vscode_lib_VscodeSymbolKind as VscodeSymbolKind, vscode_lib_VscodeSymbolTag as VscodeSymbolTag, vscode_lib_callHierarchyItemSchema as callHierarchyItemSchema, vscode_lib_executeCommand as executeCommand, vscode_lib_executeCommandConfig as executeCommandConfig, vscode_lib_positionSchema as positionSchema, vscode_lib_rangeSchema as rangeSchema };
}
export { type CallHierarchyItem as C, type Position as P, type Range as R, VscodeSymbolKind as V, VscodeSymbolTag as a, executeCommand as b, callHierarchyItemSchema as c, executeCommandConfig as e, positionSchema as p, rangeSchema as r, vscode_lib as v };
import { z } from 'zod';
/**
* Enumeration of VSCode symbol kinds.
* These values represent different types of symbols that can be found in code.
*/
declare const VscodeSymbolKind: {
readonly File: 0;
readonly Module: 1;
readonly Namespace: 2;
readonly Package: 3;
readonly Class: 4;
readonly Method: 5;
readonly Property: 6;
readonly Field: 7;
readonly Constructor: 8;
readonly Enum: 9;
readonly Interface: 10;
readonly Function: 11;
readonly Variable: 12;
readonly Constant: 13;
readonly String: 14;
readonly Number: 15;
readonly Boolean: 16;
readonly Array: 17;
readonly Object: 18;
readonly Key: 19;
readonly Null: 20;
readonly EnumMember: 21;
readonly Struct: 22;
readonly Event: 23;
readonly Operator: 24;
readonly TypeParameter: 25;
};
/**
* Enumeration of VSCode symbol tags.
* These values represent additional metadata that can be attached to symbols.
*/
declare const VscodeSymbolTag: {
readonly Deprecated: 1;
};
/**
* Schema for a position in a text document.
*/
declare const positionSchema: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
/** Type representing a position in a text document */
type Position = z.output<typeof positionSchema>;
/**
* Schema for a range in a text document.
*/
declare const rangeSchema: z.ZodObject<{
/** The start position of the range */
start: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
/** The end position of the range */
end: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
}, "strip", z.ZodTypeAny, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}>;
/** Type representing a range in a text document */
type Range = z.output<typeof rangeSchema>;
/**
* Schema for a call hierarchy item.
* Represents a programming construct that can be part of a call hierarchy.
*/
declare const callHierarchyItemSchema: z.ZodObject<{
/** The symbol kind of the item */
kind: z.ZodNumber;
/** The name of the item */
name: z.ZodString;
/** Additional details about the item */
detail: z.ZodString;
/** The URI of the document containing the item */
uri: z.ZodString;
/** Optional tags associated with the item */
tags: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
/** The full range of the item */
range: z.ZodObject<{
/** The start position of the range */
start: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
/** The end position of the range */
end: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
}, "strip", z.ZodTypeAny, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}>;
/** The range that should be selected when navigating to the item */
selectionRange: z.ZodObject<{
/** The start position of the range */
start: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
/** The end position of the range */
end: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
}, "strip", z.ZodTypeAny, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}>;
}, "strip", z.ZodTypeAny, {
kind: number;
name: string;
detail: string;
uri: string;
range: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
selectionRange: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
tags?: number[] | undefined;
}, {
kind: number;
name: string;
detail: string;
uri: string;
range: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
selectionRange: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
tags?: number[] | undefined;
}>;
/** Type representing a call hierarchy item */
type CallHierarchyItem = z.output<typeof callHierarchyItemSchema>;
/**
* Configuration for the executeCommand tool.
* Defines the schema for executing VSCode commands.
*/
declare const executeCommandConfig: {
name: string;
requestSchema: z.ZodObject<{
/** The vscode command to execute */
command: z.ZodString;
/** List of args to be passed to the command */
args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"path">;
value: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "path";
value: string;
}, {
type: "path";
value: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"Uri">;
value: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "Uri";
value: string;
}, {
type: "Uri";
value: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"Range">;
value: z.ZodObject<{
/** The start position of the range */
start: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
/** The end position of the range */
end: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
}, "strip", z.ZodTypeAny, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}>;
}, "strip", z.ZodTypeAny, {
type: "Range";
value: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
}, {
type: "Range";
value: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
}>, z.ZodObject<{
type: z.ZodLiteral<"Position">;
value: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
}, "strip", z.ZodTypeAny, {
type: "Position";
value: {
character: number;
line: number;
};
}, {
type: "Position";
value: {
character: number;
line: number;
};
}>, z.ZodObject<{
type: z.ZodLiteral<"CallHierarchyItem">;
value: z.ZodObject<{
/** The symbol kind of the item */
kind: z.ZodNumber;
/** The name of the item */
name: z.ZodString;
/** Additional details about the item */
detail: z.ZodString;
/** The URI of the document containing the item */
uri: z.ZodString;
/** Optional tags associated with the item */
tags: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
/** The full range of the item */
range: z.ZodObject<{
/** The start position of the range */
start: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
/** The end position of the range */
end: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
}, "strip", z.ZodTypeAny, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}>;
/** The range that should be selected when navigating to the item */
selectionRange: z.ZodObject<{
/** The start position of the range */
start: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
/** The end position of the range */
end: z.ZodObject<{
/** Zero-based line number */
line: z.ZodNumber;
/** Zero-based character offset on the line */
character: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
character: number;
line: number;
}, {
character: number;
line: number;
}>;
}, "strip", z.ZodTypeAny, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}, {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
}>;
}, "strip", z.ZodTypeAny, {
kind: number;
name: string;
detail: string;
uri: string;
range: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
selectionRange: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
tags?: number[] | undefined;
}, {
kind: number;
name: string;
detail: string;
uri: string;
range: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
selectionRange: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
tags?: number[] | undefined;
}>;
}, "strip", z.ZodTypeAny, {
type: "CallHierarchyItem";
value: {
kind: number;
name: string;
detail: string;
uri: string;
range: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
selectionRange: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
tags?: number[] | undefined;
};
}, {
type: "CallHierarchyItem";
value: {
kind: number;
name: string;
detail: string;
uri: string;
range: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
selectionRange: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
tags?: number[] | undefined;
};
}>, z.ZodObject<{
type: z.ZodLiteral<"primitive">;
value: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny, "many">]>;
}, "strip", z.ZodTypeAny, {
type: "primitive";
value: string | number | boolean | any[] | Record<string, any>;
}, {
type: "primitive";
value: string | number | boolean | any[] | Record<string, any>;
}>]>, "many">>>;
}, "strip", z.ZodTypeAny, {
command: string;
args: ({
type: "path";
value: string;
} | {
type: "Uri";
value: string;
} | {
type: "Range";
value: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
} | {
type: "Position";
value: {
character: number;
line: number;
};
} | {
type: "CallHierarchyItem";
value: {
kind: number;
name: string;
detail: string;
uri: string;
range: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
selectionRange: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
tags?: number[] | undefined;
};
} | {
type: "primitive";
value: string | number | boolean | any[] | Record<string, any>;
})[];
}, {
command: string;
args?: ({
type: "path";
value: string;
} | {
type: "Uri";
value: string;
} | {
type: "Range";
value: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
} | {
type: "Position";
value: {
character: number;
line: number;
};
} | {
type: "CallHierarchyItem";
value: {
kind: number;
name: string;
detail: string;
uri: string;
range: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
selectionRange: {
end: {
character: number;
line: number;
};
start: {
character: number;
line: number;
};
};
tags?: number[] | undefined;
};
} | {
type: "primitive";
value: string | number | boolean | any[] | Record<string, any>;
})[] | undefined;
}>;
responseSchema: z.ZodOptional<z.ZodAny>;
};
/**
* Executes a command in the VSCode editor.
* Allows calling bundled VSCode commands as well as commands from other extensions.
*
* @template OUTPUT - The expected output type of the command
* @param {z.input<typeof executeCommandConfig.requestSchema>} args - The command arguments
* @returns {Promise<OUTPUT>} A promise that resolves with the command's output
*/
declare const executeCommand: <OUTPUT = any>(args: z.input<typeof executeCommandConfig.requestSchema>) => Promise<OUTPUT>;
type vscode_lib_CallHierarchyItem = CallHierarchyItem;
type vscode_lib_Position = Position;
type vscode_lib_Range = Range;
declare const vscode_lib_VscodeSymbolKind: typeof VscodeSymbolKind;
declare const vscode_lib_VscodeSymbolTag: typeof VscodeSymbolTag;
declare const vscode_lib_callHierarchyItemSchema: typeof callHierarchyItemSchema;
declare const vscode_lib_executeCommand: typeof executeCommand;
declare const vscode_lib_executeCommandConfig: typeof executeCommandConfig;
declare const vscode_lib_positionSchema: typeof positionSchema;
declare const vscode_lib_rangeSchema: typeof rangeSchema;
declare namespace vscode_lib {
export { type vscode_lib_CallHierarchyItem as CallHierarchyItem, type vscode_lib_Position as Position, type vscode_lib_Range as Range, vscode_lib_VscodeSymbolKind as VscodeSymbolKind, vscode_lib_VscodeSymbolTag as VscodeSymbolTag, vscode_lib_callHierarchyItemSchema as callHierarchyItemSchema, vscode_lib_executeCommand as executeCommand, vscode_lib_executeCommandConfig as executeCommandConfig, vscode_lib_positionSchema as positionSchema, vscode_lib_rangeSchema as rangeSchema };
}
export { type CallHierarchyItem as C, type Position as P, type Range as R, VscodeSymbolKind as V, VscodeSymbolTag as a, executeCommand as b, callHierarchyItemSchema as c, executeCommandConfig as e, positionSchema as p, rangeSchema as r, vscode_lib as v };