Initial commit
No files matched your search
@@ -0,0 +1,32 @@
|
|||||||
|
# Directories that Ren'Py changes files in.
|
||||||
|
/game/saves
|
||||||
|
/game/cache
|
||||||
|
|
||||||
|
# Compiled script files. These are important for saving, and so should
|
||||||
|
# be preserved by developer and build systems after the game has been released.
|
||||||
|
/game/**/*.rpyc
|
||||||
|
/game/**/*.rpymc
|
||||||
|
|
||||||
|
# Files Ren'Py can generate.
|
||||||
|
/game/**/*.bak
|
||||||
|
/game/**/*.new
|
||||||
|
/game/**/*.old
|
||||||
|
|
||||||
|
# Error, log, and output files.
|
||||||
|
/errors.txt
|
||||||
|
/files.txt
|
||||||
|
/image_cache.txt
|
||||||
|
/log.txt
|
||||||
|
/save_dump.txt
|
||||||
|
/traceback.txt
|
||||||
|
|
||||||
|
# Launcher-generated files.
|
||||||
|
/dialogue.tab
|
||||||
|
/dialogue.txt
|
||||||
|
/strings.json
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Ignore Smart Environment folder
|
||||||
|
.smart-env
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"files.exclude": {
|
||||||
|
"**/*.rpyc": true,
|
||||||
|
"**/*.rpa": true,
|
||||||
|
"**/*.rpymc": true,
|
||||||
|
"**/cache/": true
|
||||||
|
},
|
||||||
|
"renpyWarp.sdkPath": "/Applications/renpy-8.5.2-sdk",
|
||||||
|
"renpyWarp.renpyExtensionsEnabled": "Enabled"
|
||||||
|
}
|
||||||
@@ -0,0 +1,480 @@
|
|||||||
|
################################################################################
|
||||||
|
## Initialization
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
## The init offset statement causes the initialization statements in this file
|
||||||
|
## to run before init statements in any other file.
|
||||||
|
init offset = -2
|
||||||
|
|
||||||
|
## Calling gui.init resets the styles to sensible default values, and sets the
|
||||||
|
## width and height of the game.
|
||||||
|
init python:
|
||||||
|
gui.init(1920, 1080)
|
||||||
|
|
||||||
|
## Enable checks for invalid or unstable properties in screens or transforms
|
||||||
|
define config.check_conflicting_properties = True
|
||||||
|
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
## GUI Configuration Variables
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
## Colors ######################################################################
|
||||||
|
##
|
||||||
|
## The colors of text in the interface.
|
||||||
|
|
||||||
|
## An accent color used throughout the interface to label and highlight text.
|
||||||
|
define gui.accent_color = '#00cc99'
|
||||||
|
|
||||||
|
## The color used for a text button when it is neither selected nor hovered.
|
||||||
|
define gui.idle_color = '#888888'
|
||||||
|
|
||||||
|
## The small color is used for small text, which needs to be brighter/darker to
|
||||||
|
## achieve the same effect.
|
||||||
|
define gui.idle_small_color = '#aaaaaa'
|
||||||
|
|
||||||
|
## The color that is used for buttons and bars that are hovered.
|
||||||
|
define gui.hover_color = '#66e0c1'
|
||||||
|
|
||||||
|
## The color used for a text button when it is selected but not focused. A
|
||||||
|
## button is selected if it is the current screen or preference value.
|
||||||
|
define gui.selected_color = '#ffffff'
|
||||||
|
|
||||||
|
## The color used for a text button when it cannot be selected.
|
||||||
|
define gui.insensitive_color = '#8888887f'
|
||||||
|
|
||||||
|
## Colors used for the portions of bars that are not filled in. These are not
|
||||||
|
## used directly, but are used when re-generating bar image files.
|
||||||
|
define gui.muted_color = '#00513d'
|
||||||
|
define gui.hover_muted_color = '#007a5b'
|
||||||
|
|
||||||
|
## The colors used for dialogue and menu choice text.
|
||||||
|
define gui.text_color = '#ffffff'
|
||||||
|
define gui.interface_text_color = '#ffffff'
|
||||||
|
|
||||||
|
|
||||||
|
## Fonts and Font Sizes ########################################################
|
||||||
|
|
||||||
|
## The font used for in-game text.
|
||||||
|
define gui.text_font = "DejaVuSans.ttf"
|
||||||
|
|
||||||
|
## The font used for character names.
|
||||||
|
define gui.name_text_font = "DejaVuSans.ttf"
|
||||||
|
|
||||||
|
## The font used for out-of-game text.
|
||||||
|
define gui.interface_text_font = "DejaVuSans.ttf"
|
||||||
|
|
||||||
|
## The size of normal dialogue text.
|
||||||
|
define gui.text_size = 33
|
||||||
|
|
||||||
|
## The size of character names.
|
||||||
|
define gui.name_text_size = 45
|
||||||
|
|
||||||
|
## The size of text in the game's user interface.
|
||||||
|
define gui.interface_text_size = 33
|
||||||
|
|
||||||
|
## The size of labels in the game's user interface.
|
||||||
|
define gui.label_text_size = 36
|
||||||
|
|
||||||
|
## The size of text on the notify screen.
|
||||||
|
define gui.notify_text_size = 24
|
||||||
|
|
||||||
|
## The size of the game's title.
|
||||||
|
define gui.title_text_size = 75
|
||||||
|
|
||||||
|
|
||||||
|
## Main and Game Menus #########################################################
|
||||||
|
|
||||||
|
## The images used for the main and game menus.
|
||||||
|
define gui.main_menu_background = "gui/main_menu.png"
|
||||||
|
define gui.game_menu_background = "gui/game_menu.png"
|
||||||
|
|
||||||
|
|
||||||
|
## Dialogue ####################################################################
|
||||||
|
##
|
||||||
|
## These variables control how dialogue is displayed on the screen one line at a
|
||||||
|
## time.
|
||||||
|
|
||||||
|
## The height of the textbox containing dialogue.
|
||||||
|
define gui.textbox_height = 278
|
||||||
|
|
||||||
|
## The placement of the textbox vertically on the screen. 0.0 is the top, 0.5 is
|
||||||
|
## center, and 1.0 is the bottom.
|
||||||
|
define gui.textbox_yalign = 1.0
|
||||||
|
|
||||||
|
|
||||||
|
## The placement of the speaking character's name, relative to the textbox.
|
||||||
|
## These can be a whole number of pixels from the left or top, or 0.5 to center.
|
||||||
|
define gui.name_xpos = 360
|
||||||
|
define gui.name_ypos = 0
|
||||||
|
|
||||||
|
## The horizontal alignment of the character's name. This can be 0.0 for left-
|
||||||
|
## aligned, 0.5 for centered, and 1.0 for right-aligned.
|
||||||
|
define gui.name_xalign = 0.0
|
||||||
|
|
||||||
|
## The width, height, and borders of the box containing the character's name, or
|
||||||
|
## None to automatically size it.
|
||||||
|
define gui.namebox_width = None
|
||||||
|
define gui.namebox_height = None
|
||||||
|
|
||||||
|
## The borders of the box containing the character's name, in left, top, right,
|
||||||
|
## bottom order.
|
||||||
|
define gui.namebox_borders = Borders(5, 5, 5, 5)
|
||||||
|
|
||||||
|
## If True, the background of the namebox will be tiled, if False, the
|
||||||
|
## background of the namebox will be scaled.
|
||||||
|
define gui.namebox_tile = False
|
||||||
|
|
||||||
|
|
||||||
|
## The placement of dialogue relative to the textbox. These can be a whole
|
||||||
|
## number of pixels relative to the left or top side of the textbox, or 0.5 to
|
||||||
|
## center.
|
||||||
|
define gui.dialogue_xpos = 402
|
||||||
|
define gui.dialogue_ypos = 75
|
||||||
|
|
||||||
|
## The maximum width of dialogue text, in pixels.
|
||||||
|
define gui.dialogue_width = 1116
|
||||||
|
|
||||||
|
## The horizontal alignment of the dialogue text. This can be 0.0 for left-
|
||||||
|
## aligned, 0.5 for centered, and 1.0 for right-aligned.
|
||||||
|
define gui.dialogue_text_xalign = 0.0
|
||||||
|
|
||||||
|
|
||||||
|
## Buttons #####################################################################
|
||||||
|
##
|
||||||
|
## These variables, along with the image files in gui/button, control aspects of
|
||||||
|
## how buttons are displayed.
|
||||||
|
|
||||||
|
## The width and height of a button, in pixels. If None, Ren'Py computes a size.
|
||||||
|
define gui.button_width = None
|
||||||
|
define gui.button_height = None
|
||||||
|
|
||||||
|
## The borders on each side of the button, in left, top, right, bottom order.
|
||||||
|
define gui.button_borders = Borders(6, 6, 6, 6)
|
||||||
|
|
||||||
|
## If True, the background image will be tiled. If False, the background image
|
||||||
|
## will be linearly scaled.
|
||||||
|
define gui.button_tile = False
|
||||||
|
|
||||||
|
## The font used by the button.
|
||||||
|
define gui.button_text_font = gui.interface_text_font
|
||||||
|
|
||||||
|
## The size of the text used by the button.
|
||||||
|
define gui.button_text_size = gui.interface_text_size
|
||||||
|
|
||||||
|
## The color of button text in various states.
|
||||||
|
define gui.button_text_idle_color = gui.idle_color
|
||||||
|
define gui.button_text_hover_color = gui.hover_color
|
||||||
|
define gui.button_text_selected_color = gui.selected_color
|
||||||
|
define gui.button_text_insensitive_color = gui.insensitive_color
|
||||||
|
|
||||||
|
## The horizontal alignment of the button text. (0.0 is left, 0.5 is center, 1.0
|
||||||
|
## is right).
|
||||||
|
define gui.button_text_xalign = 0.0
|
||||||
|
|
||||||
|
|
||||||
|
## These variables override settings for different kinds of buttons. Please see
|
||||||
|
## the gui documentation for the kinds of buttons available, and what each is
|
||||||
|
## used for.
|
||||||
|
##
|
||||||
|
## These customizations are used by the default interface:
|
||||||
|
|
||||||
|
define gui.radio_button_borders = Borders(27, 6, 6, 6)
|
||||||
|
|
||||||
|
define gui.check_button_borders = Borders(27, 6, 6, 6)
|
||||||
|
|
||||||
|
define gui.confirm_button_text_xalign = 0.5
|
||||||
|
|
||||||
|
define gui.page_button_borders = Borders(15, 6, 15, 6)
|
||||||
|
|
||||||
|
define gui.quick_button_borders = Borders(15, 6, 15, 0)
|
||||||
|
define gui.quick_button_text_size = 21
|
||||||
|
define gui.quick_button_text_idle_color = gui.idle_small_color
|
||||||
|
define gui.quick_button_text_selected_color = gui.accent_color
|
||||||
|
|
||||||
|
## You can also add your own customizations, by adding properly-named variables.
|
||||||
|
## For example, you can uncomment the following line to set the width of a
|
||||||
|
## navigation button.
|
||||||
|
|
||||||
|
# define gui.navigation_button_width = 250
|
||||||
|
|
||||||
|
|
||||||
|
## Choice Buttons ##############################################################
|
||||||
|
##
|
||||||
|
## Choice buttons are used in the in-game menus.
|
||||||
|
|
||||||
|
define gui.choice_button_width = 1185
|
||||||
|
define gui.choice_button_height = None
|
||||||
|
define gui.choice_button_tile = False
|
||||||
|
define gui.choice_button_borders = Borders(150, 8, 150, 8)
|
||||||
|
define gui.choice_button_text_font = gui.text_font
|
||||||
|
define gui.choice_button_text_size = gui.text_size
|
||||||
|
define gui.choice_button_text_xalign = 0.5
|
||||||
|
define gui.choice_button_text_idle_color = '#888888'
|
||||||
|
define gui.choice_button_text_hover_color = "#ffffff"
|
||||||
|
define gui.choice_button_text_insensitive_color = '#8888887f'
|
||||||
|
|
||||||
|
|
||||||
|
## File Slot Buttons ###########################################################
|
||||||
|
##
|
||||||
|
## A file slot button is a special kind of button. It contains a thumbnail
|
||||||
|
## image, and text describing the contents of the save slot. A save slot uses
|
||||||
|
## image files in gui/button, like the other kinds of buttons.
|
||||||
|
|
||||||
|
## The save slot button.
|
||||||
|
define gui.slot_button_width = 414
|
||||||
|
define gui.slot_button_height = 309
|
||||||
|
define gui.slot_button_borders = Borders(15, 15, 15, 15)
|
||||||
|
define gui.slot_button_text_size = 21
|
||||||
|
define gui.slot_button_text_xalign = 0.5
|
||||||
|
define gui.slot_button_text_idle_color = gui.idle_small_color
|
||||||
|
define gui.slot_button_text_selected_idle_color = gui.selected_color
|
||||||
|
define gui.slot_button_text_selected_hover_color = gui.hover_color
|
||||||
|
|
||||||
|
## The width and height of thumbnails used by the save slots.
|
||||||
|
define config.thumbnail_width = 384
|
||||||
|
define config.thumbnail_height = 216
|
||||||
|
|
||||||
|
## The number of columns and rows in the grid of save slots.
|
||||||
|
define gui.file_slot_cols = 3
|
||||||
|
define gui.file_slot_rows = 2
|
||||||
|
|
||||||
|
|
||||||
|
## Positioning and Spacing #####################################################
|
||||||
|
##
|
||||||
|
## These variables control the positioning and spacing of various user interface
|
||||||
|
## elements.
|
||||||
|
|
||||||
|
## The position of the left side of the navigation buttons, relative to the left
|
||||||
|
## side of the screen.
|
||||||
|
define gui.navigation_xpos = 60
|
||||||
|
|
||||||
|
## The vertical position of the skip indicator.
|
||||||
|
define gui.skip_ypos = 15
|
||||||
|
|
||||||
|
## The vertical position of the notify screen.
|
||||||
|
define gui.notify_ypos = 68
|
||||||
|
|
||||||
|
## The spacing between menu choices.
|
||||||
|
define gui.choice_spacing = 33
|
||||||
|
|
||||||
|
## Buttons in the navigation section of the main and game menus.
|
||||||
|
define gui.navigation_spacing = 6
|
||||||
|
|
||||||
|
## Controls the amount of spacing between preferences.
|
||||||
|
define gui.pref_spacing = 15
|
||||||
|
|
||||||
|
## Controls the amount of spacing between preference buttons.
|
||||||
|
define gui.pref_button_spacing = 0
|
||||||
|
|
||||||
|
## The spacing between file page buttons.
|
||||||
|
define gui.page_spacing = 0
|
||||||
|
|
||||||
|
## The spacing between file slots.
|
||||||
|
define gui.slot_spacing = 15
|
||||||
|
|
||||||
|
## The position of the main menu text.
|
||||||
|
define gui.main_menu_text_xalign = 1.0
|
||||||
|
|
||||||
|
|
||||||
|
## Frames ######################################################################
|
||||||
|
##
|
||||||
|
## These variables control the look of frames that can contain user interface
|
||||||
|
## components when an overlay or window is not present.
|
||||||
|
|
||||||
|
## Generic frames.
|
||||||
|
define gui.frame_borders = Borders(6, 6, 6, 6)
|
||||||
|
|
||||||
|
## The frame that is used as part of the confirm screen.
|
||||||
|
define gui.confirm_frame_borders = Borders(60, 60, 60, 60)
|
||||||
|
|
||||||
|
## The frame that is used as part of the skip screen.
|
||||||
|
define gui.skip_frame_borders = Borders(24, 8, 75, 8)
|
||||||
|
|
||||||
|
## The frame that is used as part of the notify screen.
|
||||||
|
define gui.notify_frame_borders = Borders(24, 8, 60, 8)
|
||||||
|
|
||||||
|
## Should frame backgrounds be tiled?
|
||||||
|
define gui.frame_tile = False
|
||||||
|
|
||||||
|
|
||||||
|
## Bars, Scrollbars, and Sliders ###############################################
|
||||||
|
##
|
||||||
|
## These control the look and size of bars, scrollbars, and sliders.
|
||||||
|
##
|
||||||
|
## The default GUI only uses sliders and vertical scrollbars. All of the other
|
||||||
|
## bars are only used in creator-written screens.
|
||||||
|
|
||||||
|
## The height of horizontal bars, scrollbars, and sliders. The width of vertical
|
||||||
|
## bars, scrollbars, and sliders.
|
||||||
|
define gui.bar_size = 38
|
||||||
|
define gui.scrollbar_size = 18
|
||||||
|
define gui.slider_size = 38
|
||||||
|
|
||||||
|
## True if bar images should be tiled. False if they should be linearly scaled.
|
||||||
|
define gui.bar_tile = False
|
||||||
|
define gui.scrollbar_tile = False
|
||||||
|
define gui.slider_tile = False
|
||||||
|
|
||||||
|
## Horizontal borders.
|
||||||
|
define gui.bar_borders = Borders(6, 6, 6, 6)
|
||||||
|
define gui.scrollbar_borders = Borders(6, 6, 6, 6)
|
||||||
|
define gui.slider_borders = Borders(6, 6, 6, 6)
|
||||||
|
|
||||||
|
## Vertical borders.
|
||||||
|
define gui.vbar_borders = Borders(6, 6, 6, 6)
|
||||||
|
define gui.vscrollbar_borders = Borders(6, 6, 6, 6)
|
||||||
|
define gui.vslider_borders = Borders(6, 6, 6, 6)
|
||||||
|
|
||||||
|
## What to do with unscrollable scrollbars in the game menu. "hide" hides them,
|
||||||
|
## while None shows them.
|
||||||
|
define gui.unscrollable = "hide"
|
||||||
|
|
||||||
|
|
||||||
|
## History #####################################################################
|
||||||
|
##
|
||||||
|
## The history screen displays dialogue that the player has already dismissed.
|
||||||
|
|
||||||
|
## The number of blocks of dialogue history Ren'Py will keep.
|
||||||
|
define config.history_length = 250
|
||||||
|
|
||||||
|
## The height of a history screen entry, or None to make the height variable at
|
||||||
|
## the cost of performance.
|
||||||
|
define gui.history_height = 210
|
||||||
|
|
||||||
|
## Additional space to add between history screen entries.
|
||||||
|
define gui.history_spacing = 0
|
||||||
|
|
||||||
|
## The position, width, and alignment of the label giving the name of the
|
||||||
|
## speaking character.
|
||||||
|
define gui.history_name_xpos = 233
|
||||||
|
define gui.history_name_ypos = 0
|
||||||
|
define gui.history_name_width = 233
|
||||||
|
define gui.history_name_xalign = 1.0
|
||||||
|
|
||||||
|
## The position, width, and alignment of the dialogue text.
|
||||||
|
define gui.history_text_xpos = 255
|
||||||
|
define gui.history_text_ypos = 3
|
||||||
|
define gui.history_text_width = 1110
|
||||||
|
define gui.history_text_xalign = 0.0
|
||||||
|
|
||||||
|
|
||||||
|
## NVL-Mode ####################################################################
|
||||||
|
##
|
||||||
|
## The NVL-mode screen displays the dialogue spoken by NVL-mode characters.
|
||||||
|
|
||||||
|
## The borders of the background of the NVL-mode background window.
|
||||||
|
define gui.nvl_borders = Borders(0, 15, 0, 30)
|
||||||
|
|
||||||
|
## The maximum number of NVL-mode entries Ren'Py will display. When more entries
|
||||||
|
## than this are to be show, the oldest entry will be removed.
|
||||||
|
define gui.nvl_list_length = 6
|
||||||
|
|
||||||
|
## The height of an NVL-mode entry. Set this to None to have the entries
|
||||||
|
## dynamically adjust height.
|
||||||
|
define gui.nvl_height = 173
|
||||||
|
|
||||||
|
## The spacing between NVL-mode entries when gui.nvl_height is None, and between
|
||||||
|
## NVL-mode entries and an NVL-mode menu.
|
||||||
|
define gui.nvl_spacing = 15
|
||||||
|
|
||||||
|
## The position, width, and alignment of the label giving the name of the
|
||||||
|
## speaking character.
|
||||||
|
define gui.nvl_name_xpos = 645
|
||||||
|
define gui.nvl_name_ypos = 0
|
||||||
|
define gui.nvl_name_width = 225
|
||||||
|
define gui.nvl_name_xalign = 1.0
|
||||||
|
|
||||||
|
## The position, width, and alignment of the dialogue text.
|
||||||
|
define gui.nvl_text_xpos = 675
|
||||||
|
define gui.nvl_text_ypos = 12
|
||||||
|
define gui.nvl_text_width = 885
|
||||||
|
define gui.nvl_text_xalign = 0.0
|
||||||
|
|
||||||
|
## The position, width, and alignment of nvl_thought text (the text said by the
|
||||||
|
## nvl_narrator character.)
|
||||||
|
define gui.nvl_thought_xpos = 360
|
||||||
|
define gui.nvl_thought_ypos = 0
|
||||||
|
define gui.nvl_thought_width = 1170
|
||||||
|
define gui.nvl_thought_xalign = 0.0
|
||||||
|
|
||||||
|
## The position of nvl menu_buttons.
|
||||||
|
define gui.nvl_button_xpos = 675
|
||||||
|
define gui.nvl_button_xalign = 0.0
|
||||||
|
|
||||||
|
|
||||||
|
## Localization ################################################################
|
||||||
|
|
||||||
|
## This controls where a line break is permitted. The default is suitable
|
||||||
|
## for most languages. A list of available values can be found at https://
|
||||||
|
## www.renpy.org/doc/html/style_properties.html#style-property-language
|
||||||
|
|
||||||
|
define gui.language = "unicode"
|
||||||
|
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
## Mobile devices
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
init python:
|
||||||
|
|
||||||
|
## This increases the size of the quick buttons to make them easier to touch
|
||||||
|
## on tablets and phones.
|
||||||
|
@gui.variant
|
||||||
|
def touch():
|
||||||
|
|
||||||
|
gui.quick_button_borders = Borders(60, 21, 60, 0)
|
||||||
|
|
||||||
|
## This changes the size and spacing of various GUI elements to ensure they
|
||||||
|
## are easily visible on phones.
|
||||||
|
@gui.variant
|
||||||
|
def small():
|
||||||
|
|
||||||
|
## Font sizes.
|
||||||
|
gui.text_size = 45
|
||||||
|
gui.name_text_size = 54
|
||||||
|
gui.notify_text_size = 38
|
||||||
|
gui.interface_text_size = 45
|
||||||
|
gui.button_text_size = 45
|
||||||
|
gui.label_text_size = 51
|
||||||
|
|
||||||
|
## Adjust the location of the textbox.
|
||||||
|
gui.textbox_height = 360
|
||||||
|
gui.name_xpos = 120
|
||||||
|
gui.dialogue_xpos = 135
|
||||||
|
gui.dialogue_width = 1650
|
||||||
|
|
||||||
|
## Change the size and spacing of various things.
|
||||||
|
gui.slider_size = 54
|
||||||
|
|
||||||
|
gui.choice_button_width = 1860
|
||||||
|
gui.choice_button_text_size = 45
|
||||||
|
|
||||||
|
gui.navigation_spacing = 30
|
||||||
|
gui.pref_button_spacing = 15
|
||||||
|
|
||||||
|
gui.history_height = 285
|
||||||
|
gui.history_text_width = 1035
|
||||||
|
|
||||||
|
gui.quick_button_text_size = 30
|
||||||
|
|
||||||
|
## File button layout.
|
||||||
|
gui.file_slot_cols = 2
|
||||||
|
gui.file_slot_rows = 2
|
||||||
|
|
||||||
|
## NVL-mode.
|
||||||
|
gui.nvl_height = 255
|
||||||
|
|
||||||
|
gui.nvl_name_width = 458
|
||||||
|
gui.nvl_name_xpos = 488
|
||||||
|
|
||||||
|
gui.nvl_text_width = 1373
|
||||||
|
gui.nvl_text_xpos = 518
|
||||||
|
gui.nvl_text_ypos = 8
|
||||||
|
|
||||||
|
gui.nvl_thought_width = 1860
|
||||||
|
gui.nvl_thought_xpos = 30
|
||||||
|
|
||||||
|
gui.nvl_button_width = 1860
|
||||||
|
gui.nvl_button_xpos = 30
|
||||||
|
After Width: | Height: | Size: 838 B |
|
After Width: | Height: | Size: 522 B |
|
After Width: | Height: | Size: 522 B |
|
After Width: | Height: | Size: 838 B |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 104 B |
|
After Width: | Height: | Size: 158 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 465 B |
|
After Width: | Height: | Size: 465 B |
|
After Width: | Height: | Size: 198 B |
|
After Width: | Height: | Size: 198 B |
|
After Width: | Height: | Size: 104 B |
|
After Width: | Height: | Size: 158 B |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 503 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 838 B |
|
After Width: | Height: | Size: 522 B |
|
After Width: | Height: | Size: 522 B |
|
After Width: | Height: | Size: 838 B |
|
After Width: | Height: | Size: 111 B |
|
After Width: | Height: | Size: 176 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 583 B |
|
After Width: | Height: | Size: 583 B |
|
After Width: | Height: | Size: 111 B |
|
After Width: | Height: | Size: 176 B |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 462 B |
|
After Width: | Height: | Size: 465 B |
|
After Width: | Height: | Size: 464 B |
|
After Width: | Height: | Size: 464 B |
|
After Width: | Height: | Size: 803 B |
|
After Width: | Height: | Size: 805 B |
|
After Width: | Height: | Size: 804 B |
|
After Width: | Height: | Size: 804 B |
|
After Width: | Height: | Size: 702 B |
|
After Width: | Height: | Size: 141 B |
|
After Width: | Height: | Size: 703 B |
|
After Width: | Height: | Size: 140 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 146 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 145 B |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 462 B |
|
After Width: | Height: | Size: 465 B |
|
After Width: | Height: | Size: 464 B |
|
After Width: | Height: | Size: 464 B |
|
After Width: | Height: | Size: 803 B |
|
After Width: | Height: | Size: 805 B |
|
After Width: | Height: | Size: 804 B |
|
After Width: | Height: | Size: 804 B |
|
After Width: | Height: | Size: 721 B |
|
After Width: | Height: | Size: 521 B |
|
After Width: | Height: | Size: 114 B |
|
After Width: | Height: | Size: 522 B |
|
After Width: | Height: | Size: 114 B |
|
After Width: | Height: | Size: 836 B |
|
After Width: | Height: | Size: 111 B |
|
After Width: | Height: | Size: 838 B |
|
After Width: | Height: | Size: 111 B |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 18 KiB |
@@ -0,0 +1,6 @@
|
|||||||
|
The game/libs/ directory is meant for third-party libraries that ask to be
|
||||||
|
put in game/libs.
|
||||||
|
|
||||||
|
When this file (game/libs/libs.txt) is present, Ren'Py will load all files
|
||||||
|
in libs before any other file in game/, and will ignore the first directory
|
||||||
|
name under game/libs when determining the order to load files.
|
||||||
@@ -0,0 +1,277 @@
|
|||||||
|
# This file managed by the Ren'Py Launch and Sync Visual Studio Code extension.
|
||||||
|
#
|
||||||
|
# This script provides a mechanism for your Ren'Py game to connect to VS Code
|
||||||
|
# via a websocket server. It is automatically excluded from builds of your game.
|
||||||
|
# You can delete this file if you do not want to use the features provided by
|
||||||
|
# the extension.
|
||||||
|
#
|
||||||
|
# This file should not be checked into source control. You can add it to your
|
||||||
|
# `.gitignore` file by adding the following line:
|
||||||
|
#
|
||||||
|
# vscode_renpy_warp_*.rpe*
|
||||||
|
#
|
||||||
|
# For more information, see https://github.com/furudean/vscode-renpy-warp
|
||||||
|
#
|
||||||
|
|
||||||
|
import renpy # type: ignore
|
||||||
|
from time import sleep
|
||||||
|
import textwrap
|
||||||
|
import threading
|
||||||
|
import json
|
||||||
|
import functools
|
||||||
|
import re
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logging.basicConfig()
|
||||||
|
|
||||||
|
logger = logging.getLogger("renpy_warp_service")
|
||||||
|
|
||||||
|
try:
|
||||||
|
logger.setLevel(level=os.getenv('WARP_LOGLEVEL', logging.INFO))
|
||||||
|
except ValueError:
|
||||||
|
logger.setLevel(level=logging.INFO)
|
||||||
|
|
||||||
|
|
||||||
|
class RenpyWarpQuitAction(renpy.ui.Action):
|
||||||
|
def __call__(self):
|
||||||
|
renpy.exports.quit()
|
||||||
|
|
||||||
|
|
||||||
|
original_quit_action = renpy.config.quit_action
|
||||||
|
|
||||||
|
|
||||||
|
def get_meta():
|
||||||
|
RPE_FILE_PATTERN = re.compile(
|
||||||
|
r"(?:vscode_)?renpy_warp_(?P<version>\d+\.\d+\.\d+)(?:_(?P<checksum>[a-z0-9]+))?\.rpe(?:\.py)?")
|
||||||
|
|
||||||
|
file = Path(__file__) if __file__.endswith(
|
||||||
|
'.rpe.py') else Path(__file__).parent
|
||||||
|
|
||||||
|
filename = os.path.basename(file)
|
||||||
|
match = RPE_FILE_PATTERN.match(filename)
|
||||||
|
|
||||||
|
if not match:
|
||||||
|
raise Exception(
|
||||||
|
f"could not parse filename '{filename}'"
|
||||||
|
f" with pattern '{RPE_FILE_PATTERN.pattern}'")
|
||||||
|
|
||||||
|
d = match.groupdict()
|
||||||
|
|
||||||
|
return d["version"], d["checksum"]
|
||||||
|
|
||||||
|
|
||||||
|
def py_exec(text):
|
||||||
|
while renpy.exports.is_init_phase():
|
||||||
|
logger.debug("in init phase, waiting...")
|
||||||
|
sleep(0.2)
|
||||||
|
|
||||||
|
fn = functools.partial(renpy.python.py_exec, text)
|
||||||
|
renpy.exports.invoke_in_main_thread(fn)
|
||||||
|
|
||||||
|
|
||||||
|
def socket_send(message, websocket):
|
||||||
|
"""sends a message to the socket server"""
|
||||||
|
stringified = json.dumps(message)
|
||||||
|
websocket.send(stringified)
|
||||||
|
logger.debug(f"sent message: {stringified}")
|
||||||
|
|
||||||
|
|
||||||
|
def socket_listener(websocket):
|
||||||
|
"""listens for messages from the socket server"""
|
||||||
|
for message in websocket:
|
||||||
|
logger.debug(f"receive message: {message}")
|
||||||
|
payload = json.loads(message)
|
||||||
|
|
||||||
|
if payload["type"] == "warp_to_line":
|
||||||
|
file = payload["file"]
|
||||||
|
line = payload["line"]
|
||||||
|
|
||||||
|
py_exec(f"renpy.warp_to_line('{file}:{line}')")
|
||||||
|
|
||||||
|
elif payload["type"] == "set_autoreload":
|
||||||
|
script = textwrap.dedent("""
|
||||||
|
if renpy.get_autoreload() == False:
|
||||||
|
renpy.set_autoreload(True)
|
||||||
|
renpy.reload_script()
|
||||||
|
""")
|
||||||
|
py_exec(script)
|
||||||
|
|
||||||
|
elif payload["type"] == "jump_to_label":
|
||||||
|
label = payload["label"]
|
||||||
|
|
||||||
|
script = textwrap.dedent(f"""
|
||||||
|
if renpy.context_nesting_level() > 0:
|
||||||
|
renpy.jump_out_of_context('{label}')
|
||||||
|
else:
|
||||||
|
renpy.jump('{label}')
|
||||||
|
""")
|
||||||
|
|
||||||
|
py_exec(script)
|
||||||
|
|
||||||
|
else:
|
||||||
|
logger.warning(f"unhandled message type '{payload['type']}'")
|
||||||
|
|
||||||
|
|
||||||
|
def socket_producer(websocket):
|
||||||
|
"""produces messages to the socket server"""
|
||||||
|
from websockets.exceptions import ConnectionClosed # type: ignore
|
||||||
|
|
||||||
|
send = functools.partial(socket_send, websocket=websocket)
|
||||||
|
|
||||||
|
# report current line to warp server
|
||||||
|
def fn(event, interact=True, **kwargs):
|
||||||
|
if not interact:
|
||||||
|
return
|
||||||
|
|
||||||
|
if event == "begin":
|
||||||
|
filename, line = renpy.exports.get_filename_line()
|
||||||
|
relative_filename = Path(filename).relative_to('game')
|
||||||
|
filename_abs = Path(renpy.config.gamedir, relative_filename)
|
||||||
|
|
||||||
|
message = {
|
||||||
|
"type": "current_line",
|
||||||
|
"line": line,
|
||||||
|
"path": filename_abs.resolve().as_posix(),
|
||||||
|
"relative_path": relative_filename.resolve().as_posix(),
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
send(message)
|
||||||
|
except ConnectionClosed:
|
||||||
|
# socket is closed, remove the callback
|
||||||
|
renpy.config.all_character_callbacks.remove(fn)
|
||||||
|
|
||||||
|
renpy.config.all_character_callbacks.append(fn)
|
||||||
|
|
||||||
|
def label_callback(name, abnormal):
|
||||||
|
try:
|
||||||
|
send({"type": "current_label", "label": name})
|
||||||
|
except ConnectionClosed:
|
||||||
|
# socket is closed, remove the callback
|
||||||
|
renpy.config.label_callbacks.remove(label_callback)
|
||||||
|
|
||||||
|
renpy.config.label_callbacks.append(label_callback)
|
||||||
|
|
||||||
|
send({"type": "list_labels", "labels": list(renpy.exports.get_all_labels())})
|
||||||
|
|
||||||
|
|
||||||
|
def socket_service(port, version, checksum):
|
||||||
|
"""connects to the socket server. returns True if the connection has completed its lifecycle"""
|
||||||
|
# websockets module is bundled with renpy on versions >=8.2.0
|
||||||
|
from websockets.sync.client import connect # type: ignore
|
||||||
|
from websockets.exceptions import ( # type: ignore
|
||||||
|
WebSocketException,
|
||||||
|
ConnectionClosedOK,
|
||||||
|
ConnectionClosedError
|
||||||
|
)
|
||||||
|
|
||||||
|
logger.debug(f"try port {port}")
|
||||||
|
|
||||||
|
try:
|
||||||
|
headers = {
|
||||||
|
"pid": str(os.getpid()),
|
||||||
|
"warp-project-root": Path(renpy.config.gamedir).parent.resolve().as_posix(),
|
||||||
|
"warp-version": version,
|
||||||
|
"warp-checksum": checksum,
|
||||||
|
}
|
||||||
|
|
||||||
|
if os.getenv("WARP_WS_NONCE"):
|
||||||
|
headers["warp-nonce"] = os.getenv("WARP_WS_NONCE")
|
||||||
|
|
||||||
|
with connect(
|
||||||
|
f"ws://localhost:{port}",
|
||||||
|
additional_headers=headers,
|
||||||
|
open_timeout=None,
|
||||||
|
close_timeout=5,
|
||||||
|
) as websocket:
|
||||||
|
quitting = False
|
||||||
|
|
||||||
|
def renpy_warp_quit_callback():
|
||||||
|
nonlocal quitting
|
||||||
|
quitting = True
|
||||||
|
logger.info(f"closing websocket connection :{port}")
|
||||||
|
websocket.close(4000, 'renpy quit')
|
||||||
|
|
||||||
|
renpy.config.quit_callbacks.append(renpy_warp_quit_callback)
|
||||||
|
renpy.config.quit_action = RenpyWarpQuitAction()
|
||||||
|
|
||||||
|
logger.info(f"connected to renpy warp socket server on :{port}")
|
||||||
|
py_exec("renpy.notify(\"Connected to Ren'Py Launch and Sync\")")
|
||||||
|
|
||||||
|
socket_producer(websocket)
|
||||||
|
socket_listener(websocket) # this blocks until socket is closed
|
||||||
|
|
||||||
|
renpy.config.quit_callbacks.remove(renpy_warp_quit_callback)
|
||||||
|
renpy.config.quit_action = original_quit_action
|
||||||
|
logger.info(f"socket service on :{port} exited")
|
||||||
|
|
||||||
|
if not quitting:
|
||||||
|
py_exec(
|
||||||
|
"renpy.notify(\"Disconnected from Ren'Py Launch and Sync\")")
|
||||||
|
|
||||||
|
except ConnectionClosedOK:
|
||||||
|
logger.info(f"socket service on :{port} was terminated by server")
|
||||||
|
pass
|
||||||
|
|
||||||
|
except ConnectionClosedError:
|
||||||
|
logger.info("connection replaced, service exiting")
|
||||||
|
return True
|
||||||
|
|
||||||
|
except WebSocketException as e:
|
||||||
|
logger.exception("unexpected websocket error", exc_info=e)
|
||||||
|
|
||||||
|
except (ConnectionError, TimeoutError) as e:
|
||||||
|
logger.debug(
|
||||||
|
f"{e.__class__.__name__}: could not establish connection to socket server")
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def try_socket_ports_forever():
|
||||||
|
version, checksum = get_meta()
|
||||||
|
service_closed = False
|
||||||
|
|
||||||
|
while service_closed is False:
|
||||||
|
for port in range(40111, 40121):
|
||||||
|
service_closed = socket_service(
|
||||||
|
port=port, version=version, checksum=checksum)
|
||||||
|
|
||||||
|
if service_closed:
|
||||||
|
break
|
||||||
|
|
||||||
|
if service_closed:
|
||||||
|
break
|
||||||
|
|
||||||
|
logger.debug(
|
||||||
|
"exhausted all ports, waiting 3 seconds before retrying")
|
||||||
|
sleep(3)
|
||||||
|
|
||||||
|
logger.info("service closed")
|
||||||
|
|
||||||
|
|
||||||
|
def start_renpy_warp_service():
|
||||||
|
if renpy.config.developer:
|
||||||
|
renpy_warp_thread = threading.Thread(
|
||||||
|
target=try_socket_ports_forever, daemon=True)
|
||||||
|
renpy_warp_thread.start()
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
"service thread started. periodically scanning ports for warp server")
|
||||||
|
|
||||||
|
|
||||||
|
def declassify():
|
||||||
|
"""
|
||||||
|
removes `renpy_warp_*.rpe{.py}` from build
|
||||||
|
|
||||||
|
on renpy 8.3 and later, this is automatically done by the renpy build system
|
||||||
|
"""
|
||||||
|
|
||||||
|
classify = renpy.python.store_dicts["store.build"]["classify"]
|
||||||
|
classify("game/renpy_warp_*.rpe", None)
|
||||||
|
classify("game/renpy_warp_*.rpe.py", None)
|
||||||
|
|
||||||
|
|
||||||
|
renpy.game.post_init.append(declassify)
|
||||||
|
renpy.config.display_start_callbacks.append(start_renpy_warp_service)
|
||||||
@@ -0,0 +1,209 @@
|
|||||||
|
## This file contains options that can be changed to customize your game.
|
||||||
|
##
|
||||||
|
## Lines beginning with two '#' marks are comments, and you shouldn't uncomment
|
||||||
|
## them. Lines beginning with a single '#' mark are commented-out code, and you
|
||||||
|
## may want to uncomment them when appropriate.
|
||||||
|
|
||||||
|
|
||||||
|
## Basics ######################################################################
|
||||||
|
|
||||||
|
## A human-readable name of the game. This is used to set the default window
|
||||||
|
## title, and shows up in the interface and error reports.
|
||||||
|
##
|
||||||
|
## The _() surrounding the string marks it as eligible for translation.
|
||||||
|
|
||||||
|
define config.name = _("Visual Novel")
|
||||||
|
|
||||||
|
|
||||||
|
## Determines if the title given above is shown on the main menu screen. Set
|
||||||
|
## this to False to hide the title.
|
||||||
|
|
||||||
|
define gui.show_name = True
|
||||||
|
|
||||||
|
|
||||||
|
## The version of the game.
|
||||||
|
|
||||||
|
define config.version = "1.0"
|
||||||
|
|
||||||
|
|
||||||
|
## Text that is placed on the game's about screen. Place the text between the
|
||||||
|
## triple-quotes, and leave a blank line between paragraphs.
|
||||||
|
|
||||||
|
define gui.about = _p("""
|
||||||
|
""")
|
||||||
|
|
||||||
|
|
||||||
|
## A short name for the game used for executables and directories in the built
|
||||||
|
## distribution. This must be ASCII-only, and must not contain spaces, colons,
|
||||||
|
## or semicolons.
|
||||||
|
|
||||||
|
define build.name = "VisualNovel"
|
||||||
|
|
||||||
|
|
||||||
|
## Sounds and music ############################################################
|
||||||
|
|
||||||
|
## These three variables control, among other things, which mixers are shown
|
||||||
|
## to the player by default. Setting one of these to False will hide the
|
||||||
|
## appropriate mixer.
|
||||||
|
|
||||||
|
define config.has_sound = True
|
||||||
|
define config.has_music = True
|
||||||
|
define config.has_voice = True
|
||||||
|
|
||||||
|
|
||||||
|
## To allow the user to play a test sound on the sound or voice channel,
|
||||||
|
## uncomment a line below and use it to set a sample sound to play.
|
||||||
|
|
||||||
|
# define config.sample_sound = "sample-sound.ogg"
|
||||||
|
# define config.sample_voice = "sample-voice.ogg"
|
||||||
|
|
||||||
|
|
||||||
|
## Uncomment the following line to set an audio file that will be played while
|
||||||
|
## the player is at the main menu. This file will continue playing into the
|
||||||
|
## game, until it is stopped or another file is played.
|
||||||
|
|
||||||
|
# define config.main_menu_music = "main-menu-theme.ogg"
|
||||||
|
|
||||||
|
|
||||||
|
## Transitions #################################################################
|
||||||
|
##
|
||||||
|
## These variables set transitions that are used when certain events occur.
|
||||||
|
## Each variable should be set to a transition, or None to indicate that no
|
||||||
|
## transition should be used.
|
||||||
|
|
||||||
|
## Entering or exiting the game menu.
|
||||||
|
|
||||||
|
define config.enter_transition = dissolve
|
||||||
|
define config.exit_transition = dissolve
|
||||||
|
|
||||||
|
|
||||||
|
## Between screens of the game menu.
|
||||||
|
|
||||||
|
define config.intra_transition = dissolve
|
||||||
|
|
||||||
|
|
||||||
|
## A transition that is used after a game has been loaded.
|
||||||
|
|
||||||
|
define config.after_load_transition = None
|
||||||
|
|
||||||
|
|
||||||
|
## Used when entering the main menu after the game has ended.
|
||||||
|
|
||||||
|
define config.end_game_transition = None
|
||||||
|
|
||||||
|
|
||||||
|
## A variable to set the transition used when the game starts does not exist.
|
||||||
|
## Instead, use a with statement after showing the initial scene.
|
||||||
|
|
||||||
|
|
||||||
|
## Window management ###########################################################
|
||||||
|
##
|
||||||
|
## This controls when the dialogue window is displayed. If "show", it is always
|
||||||
|
## displayed. If "hide", it is only displayed when dialogue is present. If
|
||||||
|
## "auto", the window is hidden before scene statements and shown again once
|
||||||
|
## dialogue is displayed.
|
||||||
|
##
|
||||||
|
## After the game has started, this can be changed with the "window show",
|
||||||
|
## "window hide", and "window auto" statements.
|
||||||
|
|
||||||
|
define config.window = "auto"
|
||||||
|
|
||||||
|
|
||||||
|
## Transitions used to show and hide the dialogue window
|
||||||
|
|
||||||
|
define config.window_show_transition = Dissolve(.2)
|
||||||
|
define config.window_hide_transition = Dissolve(.2)
|
||||||
|
|
||||||
|
|
||||||
|
## Preference defaults #########################################################
|
||||||
|
|
||||||
|
## Controls the default text speed. The default, 0, is infinite, while any other
|
||||||
|
## number is the number of characters per second to type out.
|
||||||
|
|
||||||
|
default preferences.text_cps = 0
|
||||||
|
|
||||||
|
|
||||||
|
## The default auto-forward delay. Larger numbers lead to longer waits, with 0
|
||||||
|
## to 30 being the valid range.
|
||||||
|
|
||||||
|
default preferences.afm_time = 15
|
||||||
|
|
||||||
|
|
||||||
|
## Save directory ##############################################################
|
||||||
|
##
|
||||||
|
## Controls the platform-specific place Ren'Py will place the save files for
|
||||||
|
## this game. The save files will be placed in:
|
||||||
|
##
|
||||||
|
## Windows: %APPDATA\RenPy\<config.save_directory>
|
||||||
|
##
|
||||||
|
## Macintosh: $HOME/Library/RenPy/<config.save_directory>
|
||||||
|
##
|
||||||
|
## Linux: $HOME/.renpy/<config.save_directory>
|
||||||
|
##
|
||||||
|
## This generally should not be changed, and if it is, should always be a
|
||||||
|
## literal string, not an expression.
|
||||||
|
|
||||||
|
define config.save_directory = "VisualNovel-1778518659"
|
||||||
|
|
||||||
|
|
||||||
|
## Icon ########################################################################
|
||||||
|
##
|
||||||
|
## The icon displayed on the taskbar or dock.
|
||||||
|
|
||||||
|
define config.window_icon = "gui/window_icon.png"
|
||||||
|
|
||||||
|
|
||||||
|
## Build configuration #########################################################
|
||||||
|
##
|
||||||
|
## This section controls how Ren'Py turns your project into distribution files.
|
||||||
|
|
||||||
|
init python:
|
||||||
|
|
||||||
|
## The following functions take file patterns. File patterns are case-
|
||||||
|
## insensitive, and matched against the path relative to the base directory,
|
||||||
|
## with and without a leading /. If multiple patterns match, the first is
|
||||||
|
## used.
|
||||||
|
##
|
||||||
|
## In a pattern:
|
||||||
|
##
|
||||||
|
## / is the directory separator.
|
||||||
|
##
|
||||||
|
## * matches all characters, except the directory separator.
|
||||||
|
##
|
||||||
|
## ** matches all characters, including the directory separator.
|
||||||
|
##
|
||||||
|
## For example, "*.txt" matches txt files in the base directory, "game/
|
||||||
|
## **.ogg" matches ogg files in the game directory or any of its
|
||||||
|
## subdirectories, and "**.psd" matches psd files anywhere in the project.
|
||||||
|
|
||||||
|
## Classify files as None to exclude them from the built distributions.
|
||||||
|
|
||||||
|
build.classify('**~', None)
|
||||||
|
build.classify('**.bak', None)
|
||||||
|
build.classify('**/.**', None)
|
||||||
|
build.classify('**/#**', None)
|
||||||
|
build.classify('**/thumbs.db', None)
|
||||||
|
|
||||||
|
## To archive files, classify them as 'archive'.
|
||||||
|
|
||||||
|
# build.classify('game/**.png', 'archive')
|
||||||
|
# build.classify('game/**.jpg', 'archive')
|
||||||
|
|
||||||
|
## Files matching documentation patterns are duplicated in a mac app build,
|
||||||
|
## so they appear in both the app and the zip file.
|
||||||
|
|
||||||
|
build.documentation('*.html')
|
||||||
|
build.documentation('*.txt')
|
||||||
|
|
||||||
|
|
||||||
|
## A Google Play license key is required to perform in-app purchases. It can be
|
||||||
|
## found in the Google Play developer console, under "Monetize" > "Monetization
|
||||||
|
## Setup" > "Licensing".
|
||||||
|
|
||||||
|
# define build.google_play_key = "..."
|
||||||
|
|
||||||
|
|
||||||
|
## The username and project name associated with an itch.io project, separated
|
||||||
|
## by a slash.
|
||||||
|
|
||||||
|
# define build.itch_project = "renpytom/test-project"
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# The script of the game goes in this file.
|
||||||
|
|
||||||
|
# Declare characters used by this game. The color argument colorizes the
|
||||||
|
# name of the character.
|
||||||
|
|
||||||
|
define s = Character("Sara")
|
||||||
|
|
||||||
|
|
||||||
|
# The game starts here.
|
||||||
|
|
||||||
|
label start:
|
||||||
|
|
||||||
|
# Show a background. This uses a placeholder by default, but you can
|
||||||
|
# add a file (named either "bg room.png" or "bg room.jpg") to the
|
||||||
|
# images directory to show it.
|
||||||
|
|
||||||
|
scene bg room
|
||||||
|
|
||||||
|
# This shows a character sprite. A placeholder is used, but you can
|
||||||
|
# replace it by adding a file named "eileen happy.png" to the images
|
||||||
|
# directory.
|
||||||
|
|
||||||
|
show eileen happy
|
||||||
|
|
||||||
|
# These display lines of dialogue.
|
||||||
|
|
||||||
|
s "You've created a new Ren'Py game."
|
||||||
|
|
||||||
|
s "Once you add a story, pictures, and music, you can release it to the world!"
|
||||||
|
|
||||||
|
# This ends the game.
|
||||||
|
|
||||||
|
return
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[
|
||||||
|
"yolo"
|
||||||
|
]
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"internalDocumentIDStore":{"internalIdToId":["c1aa7d5b9157e851549771ce36b9a82d","10f909b338807868764b0637c85918c5","8cf4d5a491b063fbbb56d6ff96eb7262","eb011816dd7511f83d63fa505ba588b3","693f84abf3ffb4995745057deb0f05e5","54a262b34ff8a6f837752b6b9879e03b","8db7f57e30c15caaaf13a484ce1c0d5e","a8fba41cf8b76f8d0ecf1abce2953314","f7f305919da4639f8406da23d17c48ef","258392362f83bd9bf7f12a3e527004df","c61d9e960f88b0a7d74b5377f0153582","4e47dda7f91a8b9479115856974d9cab","855ca31374cfb34b901ed56a4f9ee91b","34ccf3e71f7c926e8b4b09f69cb2480e","d92ce40d09eb56a006e981d918143236"]},"index":{"indexes":{"id":{"type":"Radix","node":{"w":"","s":"","c":{"1":{"w":"10f909b338807868764b0637c85918c5","s":"10f909b338807868764b0637c85918c5","c":{},"d":[2],"e":true},"2":{"w":"258392362f83bd9bf7f12a3e527004df","s":"258392362f83bd9bf7f12a3e527004df","c":{},"d":[10],"e":true},"3":{"w":"34ccf3e71f7c926e8b4b09f69cb2480e","s":"34ccf3e71f7c926e8b4b09f69cb2480e","c":{},"d":[14],"e":true},"4":{"w":"4e47dda7f91a8b9479115856974d9cab","s":"4e47dda7f91a8b9479115856974d9cab","c":{},"d":[12],"e":true},"5":{"w":"54a262b34ff8a6f837752b6b9879e03b","s":"54a262b34ff8a6f837752b6b9879e03b","c":{},"d":[6],"e":true},"6":{"w":"693f84abf3ffb4995745057deb0f05e5","s":"693f84abf3ffb4995745057deb0f05e5","c":{},"d":[5],"e":true},"8":{"w":"8","s":"8","c":{"5":{"w":"855ca31374cfb34b901ed56a4f9ee91b","s":"55ca31374cfb34b901ed56a4f9ee91b","c":{},"d":[13],"e":true},"c":{"w":"8cf4d5a491b063fbbb56d6ff96eb7262","s":"cf4d5a491b063fbbb56d6ff96eb7262","c":{},"d":[3],"e":true},"d":{"w":"8db7f57e30c15caaaf13a484ce1c0d5e","s":"db7f57e30c15caaaf13a484ce1c0d5e","c":{},"d":[7],"e":true}},"d":[],"e":false},"c":{"w":"c","s":"c","c":{"1":{"w":"c1aa7d5b9157e851549771ce36b9a82d","s":"1aa7d5b9157e851549771ce36b9a82d","c":{},"d":[1],"e":true},"6":{"w":"c61d9e960f88b0a7d74b5377f0153582","s":"61d9e960f88b0a7d74b5377f0153582","c":{},"d":[11],"e":true}},"d":[],"e":false},"e":{"w":"eb011816dd7511f83d63fa505ba588b3","s":"eb011816dd7511f83d63fa505ba588b3","c":{},"d":[4],"e":true},"a":{"w":"a8fba41cf8b76f8d0ecf1abce2953314","s":"a8fba41cf8b76f8d0ecf1abce2953314","c":{},"d":[8],"e":true},"f":{"w":"f7f305919da4639f8406da23d17c48ef","s":"f7f305919da4639f8406da23d17c48ef","c":{},"d":[9],"e":true},"d":{"w":"d92ce40d09eb56a006e981d918143236","s":"d92ce40d09eb56a006e981d918143236","c":{},"d":[15],"e":true}},"d":[],"e":false},"isArray":false},"title":{"type":"Radix","node":{"w":"","s":"","c":{"w":{"w":"world","s":"world","c":{},"d":[1,9],"e":true},"m":{"w":"m","s":"m","c":{"o":{"w":"mora","s":"ora","c":{},"d":[2],"e":true},"e":{"w":"mechanics","s":"echanics","c":{},"d":[10],"e":true}},"d":[],"e":false},"b":{"w":"b","s":"b","c":{"l":{"w":"blessing","s":"lessing","c":{"s":{"w":"blessings","s":"s","c":{},"d":[3],"e":true}},"d":[4],"e":true},"a":{"w":"basics","s":"asics","c":{},"d":[5,6,7,8,15],"e":true}},"d":[],"e":false},"i":{"w":"ideas","s":"ideas","c":{},"d":[4],"e":true},"g":{"w":"gameplay","s":"gameplay","c":{},"d":[10],"e":true},"c":{"w":"conversation","s":"conversation","c":{},"d":[11,12,13,14],"e":true}},"d":[],"e":false},"isArray":false},"path":{"type":"Radix","node":{"w":"","s":"","c":{"w":{"w":"world","s":"world","c":{},"d":[1,9],"e":true},"m":{"w":"m","s":"m","c":{"d":{"w":"md","s":"d","c":{},"d":[1,2,3,4,5,6,7,8,10,11,12,13,14,15,9],"e":true},"o":{"w":"mora","s":"ora","c":{},"d":[2],"e":true},"e":{"w":"mechanics","s":"echanics","c":{},"d":[10],"e":true}},"d":[],"e":false},"b":{"w":"b","s":"b","c":{"l":{"w":"blessing","s":"lessing","c":{"s":{"w":"blessings","s":"s","c":{},"d":[3],"e":true}},"d":[4],"e":true},"a":{"w":"basics","s":"asics","c":{},"d":[5,6,7,8,15],"e":true}},"d":[],"e":false},"i":{"w":"ideas","s":"ideas","c":{},"d":[4],"e":true},"g":{"w":"gameplay","s":"gameplay","c":{},"d":[10],"e":true},"c":{"w":"conversation","s":"conversation","c":{},"d":[11,12,13,14],"e":true}},"d":[],"e":false},"isArray":false},"content":{"type":"Radix","node":{"w":"","s":"","c":{"0":{"w":"0","s":"0","c":{"0":{"w":"00","s":"0","c":{},"d":[5,6,7,8,11,12,13,14,15],"e":true},"5":{"w":"05","s":"5","c":{},"d":[1,2,3,4,5,6,7,8,10,11,12,13,14,15,9],"e":true}},"d":[1,2,3,4,5,10,11,15,9],"e":true},"1":{"w":"1","s":"1","c":{"0":{"w":"10","s":"0","c":{},"d":[1,2,3,4,5,6,7,8,10,11,12,13,14,15,9],"e":true},"1":{"w":"11","s":"1","c":{},"d":[2,3,4,5,6,7,8,11,12,13,14,15],"e":true},"3":{"w":"13","s":"3","c":{},"d":[3],"e":true},"4":{"w":"14","s":"4","c":{},"d":[3,5,6,7,8,11,12,13,14,15],"e":true},"6":{"w":"16","s":"6","c":{},"d":[3],"e":true},"7":{"w":"17","s":"7","c":{},"d":[1,9],"e":true},"8":{"w":"18","s":"8","c":{},"d":[1,2,5,6,7,8,11,12,13,14,15],"e":true}},"d":[6,12],"e":true},"2":{"w":"2","s":"2","c":{"0":{"w":"20","s":"0","c":{"2":{"w":"2026","s":"26","c":{},"d":[1,2,3,4,5,6,7,8,10,11,12,13,14,15,9],"e":true}},"d":[4,10,15,9],"e":true},"2":{"w":"22","s":"2","c":{},"d":[10],"e":true},"4":{"w":"24","s":"4","c":{},"d":[15],"e":true},"5":{"w":"25","s":"5","c":{},"d":[10],"e":true},"6":{"w":"26","s":"6","c":{},"d":[6,12,Line truncated
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"file-explorer": true,
|
||||||
|
"global-search": true,
|
||||||
|
"switcher": true,
|
||||||
|
"graph": true,
|
||||||
|
"backlink": true,
|
||||||
|
"canvas": true,
|
||||||
|
"outgoing-link": true,
|
||||||
|
"tag-pane": true,
|
||||||
|
"footnotes": false,
|
||||||
|
"properties": true,
|
||||||
|
"page-preview": true,
|
||||||
|
"daily-notes": true,
|
||||||
|
"templates": true,
|
||||||
|
"note-composer": true,
|
||||||
|
"command-palette": true,
|
||||||
|
"slash-command": false,
|
||||||
|
"editor-status": true,
|
||||||
|
"bookmarks": true,
|
||||||
|
"markdown-importer": false,
|
||||||
|
"zk-prefixer": false,
|
||||||
|
"random-note": false,
|
||||||
|
"outline": true,
|
||||||
|
"word-count": true,
|
||||||
|
"slides": false,
|
||||||
|
"audio-recorder": false,
|
||||||
|
"workspaces": false,
|
||||||
|
"file-recovery": true,
|
||||||
|
"publish": false,
|
||||||
|
"sync": true,
|
||||||
|
"bases": true,
|
||||||
|
"webviewer": false
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"collapse-filter": true,
|
||||||
|
"search": "",
|
||||||
|
"showTags": false,
|
||||||
|
"showAttachments": false,
|
||||||
|
"hideUnresolved": false,
|
||||||
|
"showOrphans": true,
|
||||||
|
"collapse-color-groups": true,
|
||||||
|
"colorGroups": [],
|
||||||
|
"collapse-display": true,
|
||||||
|
"showArrow": false,
|
||||||
|
"textFadeMultiplier": 0,
|
||||||
|
"nodeSizeMultiplier": 1,
|
||||||
|
"lineSizeMultiplier": 1,
|
||||||
|
"collapse-forces": true,
|
||||||
|
"centerStrength": 0.518713248970312,
|
||||||
|
"repelStrength": 10,
|
||||||
|
"linkStrength": 1,
|
||||||
|
"linkDistance": 250,
|
||||||
|
"scale": 1,
|
||||||
|
"close": true
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
{
|
||||||
|
"claude": {
|
||||||
|
"id": "claude-code-acp",
|
||||||
|
"displayName": "Claude Code",
|
||||||
|
"apiKey": "",
|
||||||
|
"command": "claude-agent-acp",
|
||||||
|
"args": [],
|
||||||
|
"env": []
|
||||||
|
},
|
||||||
|
"codex": {
|
||||||
|
"id": "codex-acp",
|
||||||
|
"displayName": "Codex",
|
||||||
|
"apiKey": "",
|
||||||
|
"command": "codex-acp",
|
||||||
|
"args": [],
|
||||||
|
"env": []
|
||||||
|
},
|
||||||
|
"gemini": {
|
||||||
|
"id": "gemini-cli",
|
||||||
|
"displayName": "Gemini CLI",
|
||||||
|
"apiKey": "",
|
||||||
|
"command": "gemini",
|
||||||
|
"args": [
|
||||||
|
"--experimental-acp"
|
||||||
|
],
|
||||||
|
"env": []
|
||||||
|
},
|
||||||
|
"customAgents": [
|
||||||
|
{
|
||||||
|
"id": "llama3.1",
|
||||||
|
"displayName": "Llama3.1",
|
||||||
|
"command": "opencode",
|
||||||
|
"args": [
|
||||||
|
"acp"
|
||||||
|
],
|
||||||
|
"env": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"defaultAgentId": "llama3.1",
|
||||||
|
"autoAllowPermissions": false,
|
||||||
|
"autoMentionActiveNote": true,
|
||||||
|
"enableSystemNotifications": true,
|
||||||
|
"debugMode": false,
|
||||||
|
"nodePath": "/usr/bin/node",
|
||||||
|
"exportSettings": {
|
||||||
|
"defaultFolder": "Agent Client",
|
||||||
|
"filenameTemplate": "agent_client_{date}_{time}",
|
||||||
|
"autoExportOnNewChat": false,
|
||||||
|
"autoExportOnCloseChat": false,
|
||||||
|
"openFileAfterExport": true,
|
||||||
|
"includeImages": true,
|
||||||
|
"imageLocation": "obsidian",
|
||||||
|
"imageCustomFolder": "Agent Client",
|
||||||
|
"frontmatterTag": "agent-client"
|
||||||
|
},
|
||||||
|
"windowsWslMode": false,
|
||||||
|
"sendMessageShortcut": "enter",
|
||||||
|
"chatViewLocation": "right-tab",
|
||||||
|
"displaySettings": {
|
||||||
|
"autoCollapseDiffs": false,
|
||||||
|
"diffCollapseThreshold": 10,
|
||||||
|
"maxNoteLength": 10000,
|
||||||
|
"maxSelectionLength": 10000,
|
||||||
|
"showEmojis": true,
|
||||||
|
"fontSize": null
|
||||||
|
},
|
||||||
|
"savedSessions": [
|
||||||
|
{
|
||||||
|
"sessionId": "ses_1ed40d9d9ffe6xBP145sV755Wk",
|
||||||
|
"agentId": "llama3.1",
|
||||||
|
"cwd": "/home/dynamitos/Documents/VNGame",
|
||||||
|
"title": "organize the following conversation into structure...",
|
||||||
|
"createdAt": "2026-05-10T16:36:35.882Z",
|
||||||
|
"updatedAt": "2026-05-10T16:36:35.882Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sessionId": "ses_1ed41b31affepnZGfYVduv4th2",
|
||||||
|
"agentId": "llama3.1",
|
||||||
|
"cwd": "/home/dynamitos/Documents/VNGame",
|
||||||
|
"title": "organize the following conversation into structure...",
|
||||||
|
"createdAt": "2026-05-10T16:36:15.735Z",
|
||||||
|
"updatedAt": "2026-05-10T16:36:15.735Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sessionId": "ses_1ed449357ffeiuGN2CvVk6WjzN",
|
||||||
|
"agentId": "llama3.1",
|
||||||
|
"cwd": "/home/dynamitos/Documents/VNGame",
|
||||||
|
"title": "I had the following conversation with you in the c...",
|
||||||
|
"createdAt": "2026-05-10T16:33:29.641Z",
|
||||||
|
"updatedAt": "2026-05-10T16:33:29.641Z"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lastUsedModels": {
|
||||||
|
"llama3.1": "ollama/llama3.1"
|
||||||
|
},
|
||||||
|
"lastUsedModes": {},
|
||||||
|
"enableFloatingChat": false,
|
||||||
|
"floatingButtonImage": "",
|
||||||
|
"floatingWindowSize": {
|
||||||
|
"width": 400,
|
||||||
|
"height": 500
|
||||||
|
},
|
||||||
|
"floatingWindowPosition": null,
|
||||||
|
"floatingButtonPosition": null
|
||||||
|
}
|
||||||
@@ -0,0 +1,218 @@
|
|||||||
|
/*
|
||||||
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||||
|
if you want to view the source, please visit the github repository of this plugin
|
||||||
|
*/
|
||||||
|
|
||||||
|
var sM=Object.create;var Cs=Object.defineProperty;var lM=Object.getOwnPropertyDescriptor;var cM=Object.getOwnPropertyNames;var uM=Object.getPrototypeOf,dM=Object.prototype.hasOwnProperty;var fM=(e,t,n)=>t in e?Cs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var te=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ei=(e,t)=>{for(var n in t)Cs(e,n,{get:t[n],enumerable:!0})},g$=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of cM(t))!dM.call(e,i)&&i!==n&&Cs(e,i,{get:()=>t[i],enumerable:!(r=lM(t,i))||r.enumerable});return e};var G=(e,t,n)=>(n=e!=null?sM(uM(e)):{},g$(t||!e||!e.__esModule?Cs(n,"default",{value:e,enumerable:!0}):n,e)),mM=e=>g$(Cs({},"__esModule",{value:!0}),e);var qc=(e,t,n)=>(fM(e,typeof t!="symbol"?t+"":t,n),n),kp=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var ie=(e,t,n)=>(kp(e,t,"read from private field"),n?n.call(e):t.get(e)),pt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Fn=(e,t,n,r)=>(kp(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),h$=(e,t,n,r)=>({set _(i){Fn(e,t,i,n)},get _(){return ie(e,t,r)}}),ti=(e,t,n)=>(kp(e,t,"access private method"),n);var Es=te((J3,v$)=>{"use strict";var pM="2.0.0",gM=Number.MAX_SAFE_INTEGER||9007199254740991,hM=16,vM=256-6,yM=["major","premajor","minor","preminor","patch","prepatch","prerelease"];v$.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:hM,MAX_SAFE_BUILD_LENGTH:vM,MAX_SAFE_INTEGER:gM,RELEASE_TYPES:yM,SEMVER_SPEC_VERSION:pM,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var As=te((K3,y$)=>{"use strict";var SM=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};y$.exports=SM});var Po=te((ni,S$)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Np,MAX_SAFE_BUILD_LENGTH:bM,MAX_LENGTH:xM}=Es(),_M=As();ni=S$.exports={};var wM=ni.re=[],$M=ni.safeRe=[],X=ni.src=[],CM=ni.safeSrc=[],Y=ni.t={},EM=0,Op="[a-zA-Z0-9-]",AM=[["\\s",1],["\\d",xM],[Op,bM]],zM=e=>{for(let[t,n]of AM)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},le=(e,t,n)=>{let r=zM(t),i=EM++;_M(e,i,t),Y[e]=i,X[i]=t,CM[i]=r,wM[i]=new RegExp(t,n?"g":void 0),$M[i]=new RegExp(r,n?"g":void 0)};le("NUMERICIDENTIFIER","0|[1-9]\\d*");le("NUMERICIDENTIFIERLOOSE","\\d+");le("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Op}*`);le("MAINVERSION",`(${X[Y.NUMERICIDENTIFIER]})\\.(${X[Y.NUMERICIDENTIFIER]})\\.(${X[Y.NUMERICIDENTIFIER]})`);le("MAINVERSIONLOOSE",`(${X[Y.NUMERICIDENTIFIERLOOSE]})\\.(${X[Y.NUMERICIDENTIFIERLOOSE]})\\.(${X[Y.NUMERICIDENTIFIERLOOSE]})`);le("PRERELEASEIDENTIFIER",`(?:${X[Y.NONNUMERICIDENTIFIER]}|${X[Y.NUMERICIDENTIFIER]})`);le("PRERELEASEIDENTIFIERLOOSE",`(?:${X[Y.NONNUMERICIDENTIFIER]}|${X[Y.NUMERICIDENTIFIERLOOSE]})`);le("PRERELEASE",`(?:-(${X[Y.PRERELEASEIDENTIFIER]}(?:\\.${X[Y.PRERELEASEIDENTIFIER]})*))`);le("PRERELEASELOOSE",`(?:-?(${X[Y.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${X[Y.PRERELEASEIDENTIFIERLOOSE]})*))`);le("BUILDIDENTIFIER",`${Op}+`);le("BUILD",`(?:\\+(${X[Y.BUILDIDENTIFIER]}(?:\\.${X[Y.BUILDIDENTIFIER]})*))`);le("FULLPLAIN",`v?${X[Y.MAINVERSION]}${X[Y.PRERELEASE]}?${X[Y.BUILD]}?`);le("FULL",`^${X[Y.FULLPLAIN]}$`);le("LOOSEPLAIN",`[v=\\s]*${X[Y.MAINVERSIONLOOSE]}${X[Y.PRERELEASELOOSE]}?${X[Y.BUILD]}?`);le("LOOSE",`^${X[Y.LOOSEPLAIN]}$`);le("GTLT","((?:<|>)?=?)");le("XRANGEIDENTIFIERLOOSE",`${X[Y.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);le("XRANGEIDENTIFIER",`${X[Y.NUMERICIDENTIFIER]}|x|X|\\*`);le("XRANGEPLAIN",`[v=\\s]*(${X[Y.XRANGEIDENTIFIER]})(?:\\.(${X[Y.XRANGEIDENTIFIER]})(?:\\.(${X[Y.XRANGEIDENTIFIER]})(?:${X[Y.PRERELEASE]})?${X[Y.BUILD]}?)?)?`);le("XRANGEPLAINLOOSE",`[v=\\s]*(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:${X[Y.PRERELEASELOOSE]})?${X[Y.BUILD]}?)?)?`);le("XRANGE",`^${X[Y.GTLT]}\\s*${X[Y.XRANGEPLAIN]}$`);le("XRANGELOOSE",`^${X[Y.GTLT]}\\s*${X[Y.XRANGEPLAINLOOSE]}$`);le("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Np}})(?:\\.(\\d{1,${Np}}))?(?:\\.(\\d{1,${Np}}))?`);le("COERCE",`${X[Y.COERCEPLAIN]}(?:$|[^\\d])`);le("COERCEFULL",X[Y.COERCEPLAIN]+`(?:${X[Y.PRERELEASE]})?(?:${X[Y.BUILD]})?(?:$|[^\\d])`);le("COERCERTL",X[Y.COERCE],!0);le("COERCERTLFULL",X[Y.COERCEFULL],!0);le("LONETILDE","(?:~>?)");le("TILDETRIM",`(\\s*)${X[Y.LONETILDE]}\\s+`,!0);ni.tildeTrimReplace="$1~";le("TILDE",`^${X[Y.LONETILDE]}${X[Y.XRANGEPLAIN]}$`);le("TILDELOOSE",`^${X[Y.LONETILDE]}${X[Y.XRANGEPLAINLOOSE]}$`);le("LONECARET","(?:\\^)");le("CARETTRIM",`(\\s*)${X[Y.LONECARET]}\\s+`,!0);ni.caretTrimReplace="$1^";le("CARET",`^${X[Y.LONECARET]}${X[Y.XRANGEPLAIN]}$`);le("CARETLOOSE",`^${X[Y.LONECARET]}${X[Y.XRANGEPLAINLOOSE]}$`);le("COMPARATORLOOSE",`^${X[Y.GTLT]}\\s*(${X[Y.LOOSEPLAIN]})$|^$`);le("COMPARATOR",`^${X[Y.GTLT]}\\s*(${X[Y.FULLPLAIN]})$|^$`);le("COMPARATORTRIM",`(\\s*)${X[Y.GTLT]}\\s*(${X[Y.LOOSEPLAIN]}|${X[Y.XRANGEPLAIN]})`,!0);ni.comparatorTrimReplace="$1$2$3";le("HYPHELine truncated
|
||||||
|
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||||||
|
`+dg+e+DC}var fg=!1;function mg(e,t){if(!e||fg)return"";fg=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var l=function(){throw Error()};if(Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(p){var f=p}Reflect.construct(e,[],l)}else{try{l.call()}catch(p){f=p}e.call(l.prototype)}}else{try{throw Error()}catch(p){f=p}(l=e())&&typeof l.catch=="function"&&l.catch(function(){})}}catch(p){if(p&&f&&typeof p.stack=="string")return[p.stack,f.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=r.DetermineComponentFrameRoot(),a=o[0],s=o[1];if(a&&s){var c=a.split(`
|
||||||
|
`),d=s.split(`
|
||||||
|
`);for(i=r=0;r<c.length&&!c[r].includes("DetermineComponentFrameRoot");)r++;for(;i<d.length&&!d[i].includes("DetermineComponentFrameRoot");)i++;if(r===c.length||i===d.length)for(r=c.length-1,i=d.length-1;1<=r&&0<=i&&c[r]!==d[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==d[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==d[i]){var m=`
|
||||||
|
`+c[r].replace(" at new "," at ");return e.displayName&&m.includes("<anonymous>")&&(m=m.replace("<anonymous>",e.displayName)),m}while(1<=r&&0<=i);break}}}finally{fg=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Yr(n):""}function MU(e,t){switch(e.tag){case 26:case 27:case 5:return Yr(e.type);case 16:return Yr("Lazy");case 13:return e.child!==t&&t!==null?Yr("Suspense Fallback"):Yr("Suspense");case 19:return Yr("SuspenseList");case 0:case 15:return mg(e.type,!1);case 11:return mg(e.type.render,!1);case 1:return mg(e.type,!0);case 31:return Yr("Activity");default:return""}}function RC(e){try{var t="",n=null;do t+=MU(e,n),n=e,e=e.return;while(e);return t}catch(r){return`
|
||||||
|
Error generating stack: `+r.message+`
|
||||||
|
`+r.stack}}var Kg=Object.prototype.hasOwnProperty,Zh=ht.unstable_scheduleCallback,pg=ht.unstable_cancelCallback,DU=ht.unstable_shouldYield,RU=ht.unstable_requestPaint,mn=ht.unstable_now,UU=ht.unstable_getCurrentPriorityLevel,dA=ht.unstable_ImmediatePriority,fA=ht.unstable_UserBlockingPriority,qu=ht.unstable_NormalPriority,PU=ht.unstable_LowPriority,mA=ht.unstable_IdlePriority,LU=ht.log,jU=ht.unstable_setDisableYieldValue,wl=null,pn=null;function cr(e){if(typeof LU=="function"&&jU(e),pn&&typeof pn.setStrictMode=="function")try{pn.setStrictMode(wl,e)}catch(t){}}var gn=Math.clz32?Math.clz32:VU,ZU=Math.log,qU=Math.LN2;function VU(e){return e>>>=0,e===0?32:31-(ZU(e)/qU|0)|0}var su=256,lu=262144,cu=4194304;function Jr(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function pd(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,o=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s!==0?(r=s&~o,r!==0?i=Jr(r):(a&=s,a!==0?i=Jr(a):n||(n=s&~e,n!==0&&(i=Jr(n))))):(s=r&~o,s!==0?i=Jr(s):a!==0?i=Jr(a):n||(n=r&~e,n!==0&&(i=Jr(n)))),i===0?0:t!==0&&t!==i&&!(t&o)&&(o=i&-i,n=t&-t,o>=n||o===32&&(n&4194048)!==0)?t:i}function $l(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function FU(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function pA(){var e=cu;return cu<<=1,!(cu&62914560)&&(cu=4194304),e}function gg(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Cl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function HU(e,t,n,r,i,o){var a=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,d=e.hiddenUpdates;for(n=a&~n;0<n;){var m=31-gn(n),l=1<<m;s[m]=0,c[m]=-1;var f=d[m];if(f!==null)for(d[m]=null,m=0;m<f.length;m++){var p=f[m];p!==null&&(p.lane&=-536870913)}n&=~l}r!==0&&gA(e,r,0),o!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=o&~(a&~t))}function gA(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-gn(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function hA(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-gn(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function vA(e,t){var n=t&-t;return n=n&42?1:qh(n),n&(e.suspendedLanes|t)?0:n}function qh(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Vh(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function yA(){var e=_e.p;return e!==0?e:(e=window.event,e===void 0?32:ZT(e.type))}function UC(e,t){var n=_e.p;try{return _e.p=e,t()}finally{_e.p=n}}var Ar=Math.random().toString(36).slice(2),Ct="__reactFiber$"+Ar,Wt="__reactProps$"+Ar,Ca="__reactContainer$"+Ar,Wg="__reactEvents$"+Ar,BU="__reactListeners$"+Ar,GU="__reactHandles$"+Ar,PC="__reactResources$"+Ar,El="__reactMarker$"+Ar;function Fh(e){delete e[Ct],delete e[Wt],delete e[Wg],delete e[BU],delete e[GU]}function Ko(e){var t=e[Ct];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ca]||n[Ct]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=BE(e);e!==null;){if(n=e[Ct])return n;e=BE(e)}return t}e=n,n=e.parentNode}return null}function Ea(e){if(e=e[Ct]||e[Ca]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Bs(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(I(33))}function sa(e){var t=e[PC];return t||(t=e[PC]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function xt(e){e[El]=!0}var SA=new Set,bA={};function co(e,t){ga(e,t),ga(e+"Capture",t)}function ga(e,t){for(bA[e]=t,e=0;e<t.length;e++)SA.add(t[e])}var XU=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\Line truncated
|
||||||
|
`).replace(wP,"")}function TT(e,t){return t=LE(t),LE(e)===t}function Ie(e,t,n,r,i,o){switch(n){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||ha(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&ha(e,""+r);break;case"className":uu(e,"class",r);break;case"tabIndex":uu(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":uu(e,n,r);break;case"style":EA(e,r,o);break;case"data":if(t!=="object"){uu(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=Cu(""+r),e.setAttribute(n,r);break;case"action":case"formAction":if(typeof r=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof o=="function"&&(n==="formAction"?(t!=="input"&&Ie(e,t,"name",i.name,i,null),Ie(e,t,"formEncType",i.formEncType,i,null),Ie(e,t,"formMethod",i.formMethod,i,null),Ie(e,t,"formTarget",i.formTarget,i,null)):(Ie(e,t,"encType",i.encType,i,null),Ie(e,t,"method",i.method,i,null),Ie(e,t,"target",i.target,i,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=Cu(""+r),e.setAttribute(n,r);break;case"onClick":r!=null&&(e.onclick=ki);break;case"onScroll":r!=null&&ge("scroll",e);break;case"onScrollEnd":r!=null&&ge("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(I(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(I(60));e.innerHTML=n}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}n=Cu(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,""+r):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":r===!0?e.setAttribute(n,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,r):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case"popover":ge("beforetoggle",e),ge("toggle",e),$u(e,"popover",r);break;case"xlinkActuate":wi(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":wi(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":wi(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":wi(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":wi(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":wi(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":wi(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":wi(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":wi(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":$u(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=QU.get(n)||n,$u(e,n,r))}}function Th(e,t,n,r,i,o){switch(n){case"style":EA(e,r,o);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(I(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(I(60));e.innerHTML=n}}break;case"children":typeof r=="string"?ha(e,r):(typeof r=="number"||typeof r=="bigint")&&ha(e,""+r);break;case"onScroll":r!=null&&ge("scroll",e);break;case"onScrollEnd":r!=null&&ge("scrollend",e);break;case"onClick":r!=null&&(e.onclick=ki);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"inne
Line truncated
|
||||||
|
|
||||||
|
${p}`,y=this.plugin.app.vault.getAbstractFileByPath(l),x;return y instanceof Dl.TFile?(await this.plugin.app.vault.modify(y,h),x=y):x=await this.plugin.app.vault.create(l,h),a&&await this.plugin.app.workspace.getLeaf(!1).openFile(x),this.logger.log(`Chat exported to: ${l}`),l}catch(f){throw this.logger.error("Export error:",f),f}}async ensureFolderExists(t){this.plugin.app.vault.getAbstractFileByPath(t)||await this.plugin.app.vault.createFolder(t)}getSessionIdFromFile(t){var i;let n=this.plugin.app.metadataCache.getFileCache(t),r=(i=n==null?void 0:n.frontmatter)==null?void 0:i.session_id;return r!=null?r:null}resolveExportFilePath(t,n,r){let i=`${t}/${n}.md`,o=this.plugin.app.vault.getAbstractFileByPath(i);if(!(o instanceof Dl.TFile)||this.getSessionIdFromFile(o)===r)return i;for(let s=2;s<=100;s++){let c=`${t}/${n}_${s}.md`,d=this.plugin.app.vault.getAbstractFileByPath(c);if(!(d instanceof Dl.TFile)||this.getSessionIdFromFile(d)===r)return c}return this.logger.warn(`Too many export files with same base name: ${n}`),`${t}/${n}_101.md`}generateFileName(t){let r=this.plugin.settings.exportSettings.filenameTemplate||"agent_client_{date}_{time}",i=t.getFullYear(),o=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0"),s=`${i}${o}${a}`,c=String(t.getHours()).padStart(2,"0"),d=String(t.getMinutes()).padStart(2,"0"),m=String(t.getSeconds()).padStart(2,"0"),l=`${c}${d}${m}`;return r.replace("{date}",s).replace("{time}",l)}generateFrontmatter(t,n,r,i){let o=this.plugin.settings.exportSettings,a=i.getFullYear(),s=String(i.getMonth()+1).padStart(2,"0"),c=String(i.getDate()).padStart(2,"0"),d=String(i.getHours()).padStart(2,"0"),m=String(i.getMinutes()).padStart(2,"0"),l=String(i.getSeconds()).padStart(2,"0"),f=`${a}-${s}-${c}T${d}:${m}:${l}`,p=o.frontmatterTag.trim()?`
|
||||||
|
tags: [${o.frontmatterTag.trim()}]`:"";return`---
|
||||||
|
created: ${f}
|
||||||
|
agentDisplayName: ${t}
|
||||||
|
agentId: ${n}
|
||||||
|
session_id: ${r}${p}
|
||||||
|
---`}async convertMessagesToMarkdown(t,n,r){let i=this.plugin.settings.exportSettings,o={exportFilePath:r,imageIndex:0,includeImages:i.includeImages,imageLocation:i.imageLocation,imageCustomFolder:i.imageCustomFolder},a=`# ${n}
|
||||||
|
|
||||||
|
`;for(let s of t){let c=s.timestamp.toLocaleTimeString(),d=s.role==="user"?"User":"Assistant";a+=`## ${c} - ${d}
|
||||||
|
|
||||||
|
`;for(let m of s.content)a+=await this.convertContentToMarkdown(m,o);a+=`
|
||||||
|
---
|
||||||
|
|
||||||
|
`}return a}async convertContentToMarkdown(t,n){switch(t.type){case"text":return t.text+`
|
||||||
|
|
||||||
|
`;case"text_with_context":{let r="";if(t.autoMentionContext){let{noteName:i,selection:o}=t.autoMentionContext;o?r+=`@[[${i}]]:${o.fromLine}-${o.toLine}
|
||||||
|
`:r+=`@[[${i}]]
|
||||||
|
`}return r+=t.text+`
|
||||||
|
|
||||||
|
`,r}case"agent_thought":return`> [!info]- Thinking
|
||||||
|
> ${t.text.split(`
|
||||||
|
`).join(`
|
||||||
|
> `)}
|
||||||
|
|
||||||
|
`;case"tool_call":return this.convertToolCallToMarkdown(t);case"terminal":return`### \u{1F5A5}\uFE0F Terminal: ${t.terminalId.slice(0,8)}
|
||||||
|
|
||||||
|
`;case"plan":return this.convertPlanToMarkdown(t);case"permission_request":return this.convertPermissionRequestToMarkdown(t);case"resource_link":return`[${t.name}](${t.uri})
|
||||||
|
|
||||||
|
`;case"image":if(!n.includeImages)return"";if(t.uri)return`
|
||||||
|
|
||||||
|
`;if(n.imageLocation==="base64")return`
|
||||||
|
|
||||||
|
`;try{return n.imageIndex++,`![[${(await this.saveImageAsAttachment(t.data,t.mimeType,n.exportFilePath,n.imageIndex,n.imageLocation,n.imageCustomFolder)).split("/").pop()}]]
|
||||||
|
|
||||||
|
`}catch(r){return this.logger.error(`Failed to save image as attachment: ${r}`),`
|
||||||
|
|
||||||
|
`}default:return""}}convertToolCallToMarkdown(t){let n=`### \u{1F527} ${t.title||"Tool"}
|
||||||
|
|
||||||
|
`;if(t.locations&&t.locations.length>0){let r=t.locations.map(i=>i.line!=null?`\`${i.path}:${i.line}\``:`\`${i.path}\``);n+=`**Locations**: ${r.join(", ")}
|
||||||
|
|
||||||
|
`}if(n+=`**Status**: ${t.status}
|
||||||
|
|
||||||
|
`,t.content&&t.content.length>0)for(let r of t.content)r.type==="diff"&&(n+=this.convertDiffToMarkdown(r));return n}convertDiffToMarkdown(t){let n=`**File**: \`${t.path}\`
|
||||||
|
|
||||||
|
`;if(t.oldText===null||t.oldText===void 0||t.oldText==="")return n+="```diff\n",t.newText.split(`
|
||||||
|
`).forEach(o=>{n+=`+ ${o}
|
||||||
|
`}),n+="```\n\n",n;let r=t.oldText.split(`
|
||||||
|
`),i=t.newText.split(`
|
||||||
|
`);return n+="```diff\n",r.forEach(o=>{n+=`- ${o}
|
||||||
|
`}),i.forEach(o=>{n+=`+ ${o}
|
||||||
|
`}),n+="```\n\n",n}convertPlanToMarkdown(t){let n=`> [!plan] Plan
|
||||||
|
`;for(let r of t.entries){let i=r.status==="completed"?"\u2705":r.status==="in_progress"?"\u{1F504}":"\u23F3";n+=`> ${i} ${r.content}
|
||||||
|
`}return n+=`
|
||||||
|
`,n}convertPermissionRequestToMarkdown(t){let n=t.isCancelled?"Cancelled":"Requested";return`### \u26A0\uFE0F Permission: ${t.toolCall.title||"Unknown"} (${n})
|
||||||
|
|
||||||
|
`}async saveImageAsAttachment(t,n,r,i,o,a){let s=this.getExtensionFromMimeType(n),m=`${r.replace(/\.md$/,"").split("/").pop()||"image"}_${String(i).padStart(3,"0")}.${s}`,l;if(o==="custom"){let p=a||"Agent Client";if(await this.ensureFolderExists(p),l=`${p}/${m}`,this.plugin.app.vault.getAbstractFileByPath(l)instanceof Dl.TFile)return this.logger.log(`Image already exists, skipping: ${l}`),l}else if(l=await this.plugin.app.fileManager.getAvailablePathForAttachment(m,r),!l.endsWith(m)){let p=l.replace(/ \d+(\.[^.]+)$/,"$1");return this.logger.log(`Image already exists, skipping: ${p}`),p}let f=this.base64ToArrayBuffer(t);return await this.plugin.app.vault.createBinary(l,f),this.logger.log(`Image saved as attachment: ${l}`),l}getExtensionFromMimeType(t){return{"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp"}[t]||"png"}base64ToArrayBuffer(t){let n=atob(t),r=new Uint8Array(n.length);for(let i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return r.buffer}};var Zd=require("child_process"),rI=require("obsidian");var Pv=require("child_process"),go=require("obsidian");function tI(e){let t=e.replace(/%/g,"%%").replace(/"/g,'""');return/[\s&()<>|^]/.test(e)?`"${t}"`:t}function jv(){return process.env.SHELL?process.env.SHELL:go.Platform.isMacOS?"/bin/zsh":"/bin/sh"}function Lv(e){return`'${e.replace(/'/g,"'\\''")}'`}var Pd=null;function s6(){if(!go.Platform.isWin)return null;if(Pd!==null)return Pd;try{let e=(0,Pv.execSync)('reg query "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment" /v Path',{encoding:"utf8",windowsHide:!0}),t=(0,Pv.execSync)('reg query "HKCU\\Environment" /v Path',{encoding:"utf8",windowsHide:!0}),n=nI(e),r=nI(t),i=[];return r&&i.push(r),n&&i.push(n),Pd=i.join(";"),Pd}catch(e){return null}}function nI(e){let t=e.split(`
|
||||||
|
`);for(let n of t){let r=n.trim();if(r.toLowerCase().startsWith("path")){let i=r.match(/Path\s+REG_(?:EXPAND_)?SZ\s+(.+)/i);if(i)return i[1].trim()}}return null}function Ld(e){if(!go.Platform.isWin)return e;let t=s6();if(!t)return e;let r=(e.PATH||"").split(";").filter(a=>a.length>0),i=t.split(";").filter(a=>a.length>0),o=[...r];for(let a of i)o.some(s=>s.toLowerCase()===a.toLowerCase())||o.push(a);return{...e,PATH:o.join(";")}}function Pn(e){let n=e.replace(/\\/g,"/").match(/^([A-Za-z]):(\/.*)/);if(n){let r=n[1].toLowerCase(),i=n[2];return`/mnt/${r}${i}`}return e}function iI(e){let t=e.match(/^\/mnt\/([a-zA-Z])\/(.*)/);if(t){let n=t[1].toUpperCase(),r=t[2].replace(/\//g,"\\");return`${n}:\\${r}`}return e}function Zv(e){let t=e.replace(/'/g,"'\\''");return`. ~/.profile 2>/dev/null; case \${SHELL:-/bin/sh} in */fish|*/elvish|*/nushell|*/xonsh) exec /bin/sh -l -c '${t}';; *) exec \${SHELL:-/bin/sh} -l -c '${t}';; esac`}function l6(e,t,n,r,i){if(/^\\\\/.test(n))throw new Error(`UNC paths are not supported in WSL mode: ${n}. Please use a local drive path.`);let o=Pn(n);if(o===n&&/^[A-Za-z]:[\\/]/.test(n))throw new Error(`Failed to convert Windows path to WSL format: ${n}`);let a=[];if(r){if(!/^[a-zA-Z0-9._-]+$/.test(r))throw new Error(`Invalid WSL distribution name: ${r}`);a.push("-d",r)}let s=t.map(Lv).join(" "),c=s.length>0?` ${s}`:"",d="";if(i){let l=Pn(i);d=`export PATH="${c6(l)}:$PATH"; `}let m=`${d}cd ${Lv(o)} && ${e}${c}`;return a.push("sh","-c",Zv(m)),{command:"C:\\Windows\\System32\\wsl.exe",args:a}}function c6(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function jd(e,t,n,r){var o;let i=(o=r.alwaysEscape)!=null?o:!0;if(go.Platform.isWin&&r.wslMode){let a=l6(e,t,n,r.wslDistribution,r.nodeDir);return{command:a.command,args:a.args,needsShell:!1}}if(go.Platform.isMacOS||go.Platform.isLinux){let a=jv(),s;return t.length>0||i?s=[e,...t].map(Lv).join(" "):s=e,r.nodeDir&&(s=`export PATH='${r.nodeDir.replace(/'/g,"'\\''")}':"$PATH"; ${s}`),{command:a,args:["-l","-c",s],needsShell:!1}}return t.length>0||i?{command:tI(e),args:t.map(tI),needsShell:!0}:{command:e,args:t,needsShell:!0}}function Ul(e){return e.startsWith("/")||/^[A-Za-z]:[\\/]/.test(e)}function oI(e){if(!e||e.trim().length===0)return Promise.resolve(null);let t=e.trim();return Ul(t)?Promise.resolve(t):new Promise(n=>{if(rI.Platform.isWin)(0,Zd.execFile)("where",[t],{timeout:5e3,windowsHide:!0},(r,i)=>{if(r){n(null);return}let o=i.split(`
|
||||||
|
`)[0].trim();n(o.length>0?o:null)});else{let r=jv(),i=t.replace(/'/g,"'\\''");(0,Zd.execFile)(r,["-l","-c",`which '${i}'`],{timeout:5e3},(o,a)=>{if(o){n(null);return}let s=a.split(`
|
||||||
|
`)[0].trim();n(s.length>0?s:null)})}})}function aI(e,t){if(!e||e.trim().length===0)return Promise.resolve(null);let n=e.trim();return Ul(n)?Promise.resolve(n):new Promise(r=>{let i=n.replace(/'/g,"'\\''"),o=[];t&&o.push("-d",t);let a=`which '${i}'`;o.push("sh","-c",Zv(a)),(0,Zd.execFile)("C:\\Windows\\System32\\wsl.exe",o,{timeout:5e3},(s,c)=>{if(s){r(null);return}let d=c.split(`
|
||||||
|
`)[0].trim();r(d.length>0?d:null)})})}function u6(e){if(!e)return null;let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t<=0?null:e.slice(0,t)}function qd(e){if(!e)return;let t=e.trim();if(Ul(t))return u6(t)||void 0}function sI(e,t){let n=t.replace(/\/+$/,""),r=e.replace(/\/+$/,"");return r.startsWith(n+"/")?r.slice(n.length+1):e}function Pl(e){let t=e.replace(/\\/g,"/");return/^[A-Za-z]:/.test(t)?`file:///${t}`:`file://${t}`}function lI(e,t,n,r,i,o,a,s){let c=Ne(),[d,m]=(0,Tt.useState)(null),[l,f]=(0,Tt.useState)(null),p=(0,Tt.useCallback)(async(P,V,O)=>{if((P==="newChat"?e.settings.exportSettings.autoExportOnNewChat:e.settings.exportSettings.autoExportOnCloseChat)&&V.length!==0&&O.sessionId)try{let w=new Rl(e),k=e.settings.exportSettings.openFileAfterExport,N=await w.exportToMarkdown(V,O.agentDisplayName,O.agentId,O.sessionId,O.createdAt,k);if(N){let j=P==="newChat"?"new session":"closing chat";new Xn.Notice(`[Agent Client] Chat exported to ${N}`),c.log(`Chat auto-exported before ${j}`)}}catch(w){new Xn.Notice("[Agent Client] Failed to export chat")}},[e,c]),h=Xn.Platform.isWin&&a.windowsWslMode,y=(0,Tt.useCallback)(async(P,V)=>{var k,N;t.clearError(),f(null);let O=o.length===0,L=[],w=[];if(V){for(let j of V)if(j.kind==="image"&&j.data)L.push({type:"image",data:j.data,mimeType:j.mimeType});else if(j.kind==="file"&&j.path){let F=j.path;h&&(F=Pn(F)),w.push({type:"resource_link",uri:Pl(F),name:(N=(k=j.name)!=null?k:j.path.split("/").pop())!=null?N:"file",mimeType:j.mimeType||void 0,size:j.size})}}await t.sendMessage(P,{activeNote:a.autoMentionActiveNote?r.mentions.activeNote:null,vaultBasePath:s,isAutoMentionDisabled:r.mentions.isAutoMentionDisabled,images:L.length>0?L:void 0,resourceLinks:w.length>0?w:void 0}),O&&i.sessionId&&(await n.saveSessionLocally(i.sessionId,P),c.log(`[ChatPanel] Session saved locally: ${i.sessionId}`))},[t.clearError,t.sendMessage,o.length,i.sessionId,n.saveSessionLocally,c,a.autoMentionActiveNote,r.mentions.activeNote,r.mentions.isAutoMentionDisabled,h,s]),x=(0,Tt.useCallback)(async()=>{c.log("Cancelling current operation...");let P=t.lastUserMessage;await t.cancelOperation(),P&&m(P)},[c,t.cancelOperation,t.lastUserMessage]),S=(0,Tt.useCallback)(async P=>{let V=P&&P!==i.agentId;if(o.length===0&&!V){new Xn.Notice("[Agent Client] Already a new session");return}t.isSending&&await t.cancelOperation(),c.log(`[Debug] Creating new session${V?` with agent: ${P}`:""}...`),o.length>0&&await p("newChat",o,i),r.mentions.toggleAutoMention(!1),t.clearMessages();let O=V?P:i.agentId;await t.restartSession(O),n.invalidateCache()},[o,i,c,p,t.isSending,t.cancelOperation,t.clearMessages,t.restartSession,r.mentions.toggleAutoMention,n.invalidateCache]),g=(0,Tt.useCallback)(async()=>{if(o.length===0){new Xn.Notice("[Agent Client] No messages to export");return}try{let P=new Rl(e),V=e.settings.exportSettings.openFileAfterExport,O=await P.exportToMarkdown(o,i.agentDisplayName,i.agentId,i.sessionId||"unknown",i.createdAt,V);new Xn.Notice(`[Agent Client] Chat exported to ${O}`)}catch(P){new Xn.Notice("[Agent Client] Failed to export chat"),c.error("Export error:",P)}},[o,i,e,c]),b=(0,Tt.useCallback)(async P=>{P!==i.agentId&&await S(P)},[i.agentId,S]),v=(0,Tt.useCallback)(async()=>{c.log("[ChatPanel] Restarting agent process..."),o.length>0&&await p("newChat",o,i),t.clearMessages();try{await t.forceRestartAgent(),new Xn.Notice("[Agent Client] Agent restarted")}catch(P){new Xn.Notice("[Agent Client] Failed to restart agent"),c.error("Restart error:",P)}},[c,o,i,p,t.clearMessages,t.forceRestartAgent]),_=(0,Tt.useCallback)(async P=>{await t.setMode(P)},[t.setMode]),C=(0,Tt.useCallback)(async P=>{await t.setModel(P)},[t.setModel]),E=(0,Tt.useCallback)(async(P,V)=>{await t.setConfigOption(P,V)},[t.setConfigOption]),A=(0,Tt.useCallback)(()=>{t.clearError()},[t.clearError]),T=(0,Tt.useCallback)(()=>{f(null)},[]),M=(0,Tt.useCallback)(()=>{m(null)},[]);return{handleSendMessage:y,handleStopGeneration:x,handleNewChat:S,handleExportChat:g,handleSwitchAgent:b,handleRestartAgent:v,handleSetMode:_,handleSetModel:C,handleSetConfigOption:E,handleClearError:A,handleClearAgentUpdate:T,handleRestoredMessageConsumed:M,restoredMessage:d,agentUpdateNotification:l,setAgentUpdateNotification:f,autoExportIfEnabled:p}}var cI=require("obsidian"),Ll=class extends cI.Modal{constructor(n,r,i){super(n);this.currentPath=r,this.onSelect=i}onOpen(){let{contentEl:n}=this;n.empty(),n.createEl("h2",{text:"New chat in directory"}),n.createEl("p",{text:"Start a new chat session with the agent working in the specified directory.",cls:"agent-client-change-dir-description"});let r=n.createDiv({cls:"agent-client-change-dir-input-row"}),i=r.createEl("input",{type:"text",cls:"agent-client-change-dir-input",placeholder:"/path/to/directory"});i.value=this.currentPath,r.createEl("button",{text:"Browse..."}).addEventListener("click",()=>{this.openFolderPicker().then(s=>{s&&(i.value=s)})}),setTimeout(()=>{i.focus(),i.select()},10),i.addEventLis
Line truncated
|
||||||
|
`))return null;a=o,s=t}let c={start:i,end:s,query:a};return n.log("[detectMention] Mention context:",c),c}function fI(e,t,n){let r=e.slice(0,t.start),i=e.slice(t.end),o=` @[[${n}]] `,a=r+o+i,s=t.start+o.length;return{newText:a,newCursorPos:s}}function mI(e,t){let n=/@\[\[([^\]]+)\]\]/g,r=Array.from(e.matchAll(n)),i=[],o=new Set;for(let a of r){let s=a[1];if(o.has(s))continue;o.add(s);let c=t.getAllFiles().find(d=>d.basename===s);i.push({noteTitle:s,file:c})}return i}function pI(e,t,n){let[r,i]=(0,Xe.useState)([]),[o,a]=(0,Xe.useState)(0),[s,c]=(0,Xe.useState)(null),[d,m]=(0,Xe.useState)(null),[l,f]=(0,Xe.useState)(!1),p=r.length>0&&s!==null,[h,y]=(0,Xe.useState)([]),[x,S]=(0,Xe.useState)(0),g=h.length>0,b=(0,Xe.useCallback)(w=>{f(w===void 0?k=>!k:w)},[]),v=(0,Xe.useCallback)(async(w,k)=>{let N=dI(w,k);if(!N){i([]),a(0),c(null);return}let j=await e.searchNotes(N.query);i(j),a(0),c(N)},[e,t]),_=(0,Xe.useCallback)((w,k)=>{if(!s)return w;let{newText:N}=fI(w,s,k.name);return i([]),a(0),c(null),N},[s]),C=(0,Xe.useCallback)(w=>{if(!p)return;let k=r.length-1;a(N=>w==="down"?Math.min(N+1,k):Math.max(N-1,0))},[p,r.length]),E=(0,Xe.useCallback)(()=>{i([]),a(0),c(null)},[]),A=(0,Xe.useCallback)(async()=>{let w=await e.getActiveNote();m(w)},[e]),T=(0,Xe.useCallback)((w,k)=>{let N=h.length>0;if(!w.startsWith("/")){N&&b(!1),y([]),S(0);return}let F=w.slice(0,k).slice(1);if(F.includes(" ")){y([]),S(0),b(!0);return}let K=F.toLowerCase(),ne=n.filter(ue=>ue.name.toLowerCase().includes(K));y(ne),S(0),b(!0)},[n,b,h.length]),M=(0,Xe.useCallback)((w,k)=>{let N=`/${k.name} `;return y([]),S(0),N},[]),P=(0,Xe.useCallback)(w=>{if(h.length===0)return;let k=h.length-1;S(N=>w==="down"?Math.min(N+1,k):Math.max(N-1,0))},[h.length]),V=(0,Xe.useCallback)(()=>{y([]),S(0)},[]),O=(0,Xe.useMemo)(()=>({suggestions:r,selectedIndex:o,isOpen:p,context:s,updateSuggestions:v,selectSuggestion:_,navigate:C,close:E,activeNote:d,isAutoMentionDisabled:l,toggleAutoMention:b,updateActiveNote:A}),[r,o,p,s,v,_,C,E,d,l,b,A]),L=(0,Xe.useMemo)(()=>({suggestions:h,selectedIndex:x,isOpen:g,updateSuggestions:T,selectSuggestion:M,navigate:P,close:V}),[h,x,g,T,M,P,V]);return(0,Xe.useMemo)(()=>({mentions:O,commands:L}),[O,L])}var A6=G(Ce());var d6=G(Ce());var jl=e=>{if(e==null)return null;let t=(()=>{if(typeof e=="number")return e;if(typeof e=="string"){let n=e.trim();return n.length===0||!/^-?\d+$/.test(n)?Number.NaN:Number.parseInt(n,10)}return Number.NaN})();return Number.isFinite(t)?Math.min(30,Math.max(10,Math.round(t))):null},Oa=e=>Array.isArray(e)?e.map(t=>typeof t=="string"?t.trim():"").filter(t=>t.length>0):typeof e=="string"?e.split(/\r?\n/).map(t=>t.trim()).filter(t=>t.length>0):[],ho=e=>{let t=[];if(!e)return t;if(Array.isArray(e)){for(let r of e)if(r&&typeof r=="object"){let i=r,o="key"in i?i.key:void 0,a="value"in i?i.value:void 0;typeof o=="string"&&o.trim().length>0&&t.push({key:o.trim(),value:typeof a=="string"?a:""})}}else if(typeof e=="object")for(let[r,i]of Object.entries(e))typeof r=="string"&&r.trim().length>0&&t.push({key:r.trim(),value:typeof i=="string"?i:""});let n=new Set;return t.filter(r=>n.has(r.key)?!1:(n.add(r.key),!0))},gI=e=>{let t=e&&typeof e.id=="string"&&e.id.trim().length>0?e.id.trim():"custom-agent",n=e&&typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName.trim():t;return{id:t,displayName:n,command:e&&typeof e.command=="string"&&e.command.trim().length>0?e.command.trim():"",args:Oa(e==null?void 0:e.args),env:ho(e==null?void 0:e.env)}},hI=e=>{let t=new Set;return e.map(n=>{let r=n.id&&n.id.trim().length>0?n.id.trim():"custom-agent",i=r,o=2;for(;t.has(i);)i=`${r}-${o}`,o+=1;return t.add(i),{...n,id:i}})},vI=(e,t)=>{let n=e.env.reduce((r,{key:i,value:o})=>(r[i]=o,r),{});return{id:e.id,displayName:e.displayName,command:e.command,args:e.args,env:n,workingDirectory:t}};function tt(e,t){return typeof e=="string"?e:t}function en(e,t){return typeof e=="boolean"?e:t}function Vd(e,t,n){return typeof e!="number"||n!==void 0&&e<n?t:e}function Fd(e,t,n){return t.includes(e)?e:n}function di(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function qv(e){let t={},n=di(e);if(!n)return t;for(let[r,i]of Object.entries(n))typeof r=="string"&&r.length>0&&typeof i=="string"&&i.length>0&&(t[r]=i);return t}function Vv(e){let t=di(e);return!t||typeof t.x!="number"||typeof t.y!="number"?null:{x:t.x,y:t.y}}function Hd(e){return e.defaultAgentId||e.claude.id}function Fv(e){return[{id:e.claude.id,displayName:e.claude.displayName||e.claude.id},{id:e.codex.id,displayName:e.codex.displayName||e.codex.id},{id:e.gemini.id,displayName:e.gemini.displayName||e.gemini.id},...e.customAgents.map(t=>({id:t.id,displayName:t.displayName||t.id}))]}function Hv(e,t){let n=t||Hd(e);return Fv(e).find(i=>i.id===n)||{id:n,displayName:n}}function yI(e,t){return t===e.claude.id?e.claude:t===e.codex.id?e.codex:t===e.gemini.id?e.gemini:e.customAgents.find(r=>r.id===t)||null}function SI(e,t,n,r){let i=vI(t,r);if(n===e.claude.id){let o=t;return{...i,env
Line truncated
|
||||||
|
`).slice(t.from.line,t.to.line+1).join(`
|
||||||
|
`),c=s.length>r;return{text:c?s.substring(0,r):s,wasTruncated:c,originalLength:s.length}}catch(i){return console.error(`Failed to read selection from ${e}:`,i),null}}function TI(e,t){return!e||t?"":e.selection?`@[[${e.name}]]:${e.selection.from.line+1}-${e.selection.to.line+1}
|
||||||
|
`:`@[[${e.name}]]
|
||||||
|
`}function II(e){return[...e.message?[{type:"text",text:e.message}]:[],...e.images||[],...e.resourceLinks||[]]}function kI(e,t){if(!(!e||t))return{noteName:e.name,notePath:e.path,selection:e.selection?{fromLine:e.selection.from.line+1,toLine:e.selection.to.line+1}:void 0}}function NI(e,t,n){let r=t?`${t}/${e}`:e;return n&&(r=Pn(r)),r}async function OI(e,t,n){let r=mI(e.message,n);return e.supportsEmbeddedContext?v6(e,t,r):y6(e,t,r)}async function v6(e,t,n){var c,d,m,l;let r=(c=e.maxNoteLength)!=null?c:CI,i=[];for(let{file:f}of n){if(!f)continue;let p=await AI(f,e.vaultBasePath,t,(d=e.convertToWsl)!=null?d:!1,r);if(!p)continue;let h=p.wasTruncated?p.content+`
|
||||||
|
|
||||||
|
[Note: Truncated from ${p.originalLength} to ${r} characters]`:p.content;i.push({type:"resource",resource:{uri:p.uri,mimeType:"text/markdown",text:h},annotations:{audience:["assistant"],priority:1,lastModified:p.lastModified}})}let o=[];if(e.activeNote&&!e.isAutoMentionDisabled){let f=await S6(e.activeNote,e.vaultBasePath,t,(m=e.convertToWsl)!=null?m:!1,(l=e.maxSelectionLength)!=null?l:EI);o.push(...f)}let a=TI(e.activeNote,e.isAutoMentionDisabled),s=[...i,...o,...e.message||a?[{type:"text",text:a+e.message}]:[],...e.images||[],...e.resourceLinks||[]];return{displayContent:II(e),agentContent:s,autoMentionContext:kI(e.activeNote,e.isAutoMentionDisabled)}}async function y6(e,t,n){var c,d,m,l;let r=(c=e.maxNoteLength)!=null?c:CI,i=[];for(let{file:f}of n){if(!f)continue;let p=await AI(f,e.vaultBasePath,t,(d=e.convertToWsl)!=null?d:!1,r);if(!p)continue;let h=p.wasTruncated?`
|
||||||
|
|
||||||
|
[Note: This note was truncated. Original length: ${p.originalLength} characters, showing first ${r} characters]`:"";i.push(`<obsidian_mentioned_note ref="${p.absolutePath}">
|
||||||
|
${p.content}${h}
|
||||||
|
</obsidian_mentioned_note>`)}if(e.activeNote&&!e.isAutoMentionDisabled){let f=await b6(e.activeNote.path,e.vaultBasePath,t,(m=e.convertToWsl)!=null?m:!1,e.activeNote.selection,(l=e.maxSelectionLength)!=null?l:EI);i.push(f)}let o=TI(e.activeNote,e.isAutoMentionDisabled),a=i.length>0?i.join(`
|
||||||
|
`)+`
|
||||||
|
|
||||||
|
`+o+e.message:o+e.message,s=[...a?[{type:"text",text:a}]:[],...e.images||[],...e.resourceLinks||[]];return{displayContent:II(e),agentContent:s,autoMentionContext:kI(e.activeNote,e.isAutoMentionDisabled)}}async function S6(e,t,n,r,i){let o=NI(e.path,t,r),a=Pl(o);if(e.selection){let s=e.selection.from.line+1,c=e.selection.to.line+1,d=await zI(e.path,e.selection,n,i);if(!d)return[{type:"text",text:`The user has selected lines ${s}-${c} in ${a}. If relevant, use the Read tool to examine the specific lines.`}];let m=d.wasTruncated?d.text+`
|
||||||
|
|
||||||
|
[Note: Truncated from ${d.originalLength} to ${i} characters]`:d.text;return[{type:"resource",resource:{uri:a,mimeType:"text/markdown",text:m},annotations:{audience:["assistant"],priority:.8,lastModified:new Date(e.modified).toISOString()}},{type:"text",text:`The user has selected lines ${s}-${c} in the above note. This is what they are currently focusing on.`}]}return[{type:"text",text:`The user has opened the note ${a} in Obsidian. This may or may not be related to the current conversation. If it seems relevant, consider using the Read tool to examine its content.`}]}async function b6(e,t,n,r,i,o){let a=NI(e,t,r);if(i){let s=i.from.line+1,c=i.to.line+1,d=await zI(e,i,n,o);if(!d)return`<obsidian_opened_note selection="lines ${s}-${c}">The user opened the note ${a} in Obsidian and is focusing on lines ${s}-${c}. This may or may not be related to the current conversation. If it seems relevant, consider using the Read tool to examine the specific lines.</obsidian_opened_note>`;let m=d.wasTruncated?`
|
||||||
|
|
||||||
|
[Note: The selection was truncated. Original length: ${d.originalLength} characters, showing first ${o} characters]`:"";return`<obsidian_opened_note selection="lines ${s}-${c}">
|
||||||
|
The user opened the note ${a} in Obsidian and selected the following text (lines ${s}-${c}):
|
||||||
|
|
||||||
|
${d.text}${m}
|
||||||
|
|
||||||
|
This is what the user is currently focusing on.
|
||||||
|
</obsidian_opened_note>`}return`<obsidian_opened_note>The user opened the note ${a} in Obsidian. This may or may not be related to the current conversation. If it seems relevant, consider using the Read tool to examine the content.</obsidian_opened_note>`}async function MI(e,t){try{return await t.sendPrompt(e.sessionId,e.agentContent),{success:!0,displayContent:e.displayContent,agentContent:e.agentContent}}catch(n){return await x6(n,e.sessionId,e.agentContent,e.displayContent,e.authMethods,t)}}async function x6(e,t,n,r,i,o){if(Gd(e))return{success:!0,displayContent:r,agentContent:n};if(Vl(e)===lt.AUTHENTICATION_REQUIRED&&i&&i.length>0){if(i.length===1){let s=await _6(t,n,r,i[0].id,o);if(s)return s}return{success:!1,displayContent:r,agentContent:n,requiresAuth:!0,error:Bd(e,t)}}return{success:!1,displayContent:r,agentContent:n,error:Bd(e,t)}}async function _6(e,t,n,r,i){try{return await i.authenticate(r)?(await i.sendPrompt(e,t),{success:!0,displayContent:n,agentContent:t,retriedSuccessfully:!0}):null}catch(o){return{success:!1,displayContent:n,agentContent:t,error:Bd(o,e)}}}var LI=require("obsidian");function DI(e,t){let n=e.content||[];if(t.content!==void 0){let r=t.content||[];r.some(o=>o.type==="diff")&&(n=n.filter(o=>o.type!=="diff")),n=[...n,...r]}return{...e,toolCallId:t.toolCallId,title:t.title!==void 0?t.title:e.title,kind:t.kind!==void 0?t.kind:e.kind,status:t.status!==void 0?t.status:e.status,content:n,locations:t.locations!==void 0?t.locations:e.locations,rawInput:t.rawInput!==void 0&&Object.keys(t.rawInput).length>0?t.rawInput:e.rawInput,permissionRequest:t.permissionRequest!==void 0?t.permissionRequest:e.permissionRequest}}function Jv(e,t){if(e.length===0||e[e.length-1].role!=="assistant"){let i={id:crypto.randomUUID(),role:"assistant",content:[t],timestamp:new Date};return[...e,i]}let r={...e[e.length-1]};if(t.type==="text"||t.type==="agent_thought"){let i=r.content.findIndex(o=>o.type===t.type);if(i>=0){let o=r.content[i];(o.type==="text"||o.type==="agent_thought")&&(r.content[i]={type:t.type,text:o.text+t.text})}else r.content.push(t)}else{let i=r.content.findIndex(o=>o.type===t.type);i>=0?r.content[i]=t:r.content.push(t)}return[...e.slice(0,-1),r]}function w6(e,t){if(e.length===0||e[e.length-1].role!=="user"){let i={id:crypto.randomUUID(),role:"user",content:[t],timestamp:new Date};return[...e,i]}let r={...e[e.length-1]};if(t.type==="text"){let i=r.content.findIndex(o=>o.type==="text");if(i>=0){let o=r.content[i];o.type==="text"&&(r.content[i]={type:"text",text:o.text+t.text})}else r.content.push(t)}else{let i=r.content.findIndex(o=>o.type===t.type);i>=0?r.content[i]=t:r.content.push(t)}return[...e.slice(0,-1),r]}function $6(e,t,n){let r=n.get(t.toolCallId);if(r!==void 0&&r<e.length){let a=e[r];if(a.content.some(c=>c.type==="tool_call"&&c.toolCallId===t.toolCallId)){let c={...a,content:a.content.map(m=>m.type==="tool_call"&&m.toolCallId===t.toolCallId?DI(m,t):m)},d=[...e];return d[r]=c,d}}let i=!1,o=e.map((a,s)=>a.content.some(d=>d.type==="tool_call"&&d.toolCallId===t.toolCallId)?(i=!0,n.set(t.toolCallId,s),{...a,content:a.content.map(d=>d.type==="tool_call"&&d.toolCallId===t.toolCallId?DI(d,t):d)}):a);return i?o:(n.set(t.toolCallId,e.length),[...e,{id:crypto.randomUUID(),role:"assistant",content:[t],timestamp:new Date}])}function Kv(e,t){t.clear(),e.forEach((n,r)=>{for(let i of n.content)i.type==="tool_call"&&t.set(i.toolCallId,r)})}function RI(e,t,n){switch(t.type){case"agent_message_chunk":return Jv(e,{type:"text",text:t.text});case"agent_thought_chunk":return Jv(e,{type:"agent_thought",text:t.text});case"user_message_chunk":return w6(e,{type:"text",text:t.text});case"tool_call":case"tool_call_update":return $6(e,{type:"tool_call",toolCallId:t.toolCallId,title:t.title,status:t.status||"pending",kind:t.kind,content:t.content,locations:t.locations,rawInput:t.rawInput,permissionRequest:t.permissionRequest},n);case"plan":return Jv(e,{type:"plan",entries:t.entries});default:return e}}function UI(e){for(let t of e)for(let n of t.content)if(n.type==="tool_call"){let r=n.permissionRequest;if(r!=null&&r.isActive)return{requestId:r.requestId,toolCallId:n.toolCallId,options:r.options}}return null}function Wv(e,t,n){for(let r of t){let i=e.find(o=>o.kind===r);if(i)return i}if(n){let r=e.find(n);if(r)return r}return e[0]}var{useState:Qv,useCallback:jn,useMemo:PI,useRef:Xd,useEffect:E6}=C6;function jI(e,t,n,r,i){let[o,a]=Qv([]),[s,c]=Qv(!1),[d,m]=Qv(null),l=Xd(new Map),f=Xd(!1),p=Xd([]),h=Xd(!1),y=jn(()=>{h.current=!1;let L=p.current;L.length!==0&&(p.current=[],a(w=>{let k=w;for(let N of L)k=RI(k,N,l.current);return k}))},[]),x=jn(L=>{f.current||(p.current.push(L),h.current||(h.current=!0,requestAnimationFrame(y)))},[y]);E6(()=>()=>{p.current=[],h.current=!1,l.current.clear()},[]);let S=jn(L=>{a(w=>[...w,L])},[]),g=jn(L=>{f.current=L},[]),b=jn(()=>{a([]),l.current.clear(),m(null),c(!1),i(null)},[i]),v=jn(L=>{let w=L.map(k=>({id:crypto.randomUUID(),role:k.role,content:k.content.map(N=>({type:N.type,teLine truncated
|
||||||
|
Run the following in your terminal:`,suggestion:`npm uninstall -g ${e.name} && npm install -g ${t}`};let n=M6[e.name];if(!n||!e.version)return null;try{let r=await R6(n);if(r&&Da.valid(e.version)&&Da.gt(r,e.version))return{variant:"info",title:"Agent Update Available",message:`${n}: ${e.version} \u2192 ${r}.
|
||||||
|
Run the following in your terminal:`,suggestion:`npm install -g ${n}@latest`}}catch(r){}return null}async function R6(e){var r;let n=(await(0,VI.requestUrl)({url:`https://registry.npmjs.org/${e}/latest`})).json;return n.version&&(r=Da.clean(n.version))!=null?r:null}var j6=G(Ce()),Fl=require("obsidian");var U6=G(Ce()),ty=require("obsidian"),ny=G(ve()),{useRef:HI,useEffect:BI,useImperativeHandle:P6,forwardRef:L6}=U6;function Yn({name:e,className:t}){let n=HI(null);return BI(()=>{n.current&&(0,ty.setIcon)(n.current,e)},[e]),(0,ny.jsx)("span",{ref:n,className:t})}var Yd=L6(function({iconName:t,tooltip:n,onClick:r},i){let o=HI(null);return P6(i,()=>o.current,[]),BI(()=>{o.current&&(0,ty.setIcon)(o.current,t)},[t]),(0,ny.jsx)("button",{ref:o,title:n,onClick:r,className:"clickable-icon agent-client-header-button"})});var Ge=G(ve()),{useRef:Kd,useEffect:iy}=j6;function Jd({icon:e,label:t,onClick:n}){let r=Kd(null);return iy(()=>{r.current&&(0,Fl.setIcon)(r.current,e)},[e]),(0,Ge.jsx)("div",{ref:r,className:"clickable-icon nav-action-button","aria-label":t,onClick:n})}function Z6({agentLabel:e,isUpdateAvailable:t,hasHistoryCapability:n=!1,onNewChat:r,onExportChat:i,onShowMenu:o,onOpenHistory:a}){return(0,Ge.jsx)("div",{className:"nav-header agent-client-chat-view-header",children:(0,Ge.jsxs)("div",{className:"nav-buttons-container",children:[(0,Ge.jsx)("span",{className:"agent-client-chat-view-header-title",children:e}),t&&(0,Ge.jsx)("span",{className:"agent-client-chat-view-header-update",children:"Plugin update available!"}),(0,Ge.jsx)(Jd,{icon:"plus",label:"New chat",onClick:r}),a&&(0,Ge.jsx)(Jd,{icon:"history",label:"Session history",onClick:a}),(0,Ge.jsx)(Jd,{icon:"save",label:"Export chat to Markdown",onClick:i}),(0,Ge.jsx)(Jd,{icon:"more-vertical",label:"More",onClick:o})]})})}function q6({agentLabel:e,availableAgents:t,currentAgentId:n,isUpdateAvailable:r,onAgentChange:i,onShowMenu:o,onMinimize:a,onClose:s}){let c=Kd(null),d=Kd(null),m=Kd(i);return m.current=i,iy(()=>{let l=c.current;if(l){if(t.length<=1){d.current&&(l.empty(),d.current=null);return}if(!d.current){let f=new Fl.DropdownComponent(l);d.current=f;for(let p of t)f.addOption(p.id,p.displayName);n&&f.setValue(n),f.onChange(p=>{var h;(h=m.current)==null||h.call(m,p)})}return()=>{d.current&&(l.empty(),d.current=null)}}},[t]),iy(()=>{d.current&&n&&d.current.setValue(n)},[n]),(0,Ge.jsxs)("div",{className:"agent-client-inline-header agent-client-inline-header-floating",children:[(0,Ge.jsx)("div",{className:"agent-client-inline-header-main",children:t.length>1?(0,Ge.jsxs)("div",{className:"agent-client-agent-selector",children:[(0,Ge.jsx)("div",{ref:c}),(0,Ge.jsx)("span",{className:"agent-client-agent-selector-icon",ref:l=>{l&&(0,Fl.setIcon)(l,"chevron-down")}})]}):(0,Ge.jsx)("span",{className:"agent-client-agent-label",children:e})}),r&&(0,Ge.jsx)("p",{className:"agent-client-chat-view-header-update",children:"Plugin update available!"}),(0,Ge.jsxs)("div",{className:"agent-client-inline-header-actions",children:[(0,Ge.jsx)(Yd,{iconName:"more-vertical",tooltip:"More",onClick:o}),a&&(0,Ge.jsx)(Yd,{iconName:"minimize-2",tooltip:"Minimize",onClick:a}),s&&(0,Ge.jsx)(Yd,{iconName:"x",tooltip:"Close",onClick:s})]})]})}function ry(e){return e.variant==="floating"?(0,Ge.jsx)(q6,{...e}):(0,Ge.jsx)(Z6,{...e})}var fL=G(Ce()),_k=require("obsidian");var by=G(Ce()),xy=require("obsidian");var V6=G(Ce()),Ir=require("obsidian");var GI=G(ve()),{useRef:F6,useEffect:H6}=V6;function oy({text:e,plugin:t}){let n=F6(null);return H6(()=>{var d;let r=n.current;if(!r)return;(d=r.empty)==null||d.call(r),r.classList.add("markdown-rendered");let i=new Ir.Component;i.load(),Ir.MarkdownRenderer.render(t.app,e,r,"",i);let o=t.app.vault.adapter instanceof Ir.FileSystemAdapter?t.app.vault.adapter.getBasePath():null,a=Ir.Platform.isWin&&t.settings.windowsWslMode,s=o?o.replace(/\\/g,"/").replace(/\/+$/,""):null,c=m=>{let f=m.target.closest("a.internal-link");if(f){m.preventDefault();let p=f.getAttribute("data-href");if(p){let h=decodeURIComponent(p);a&&h.startsWith("/mnt/")&&(h=iI(h));let y=h.replace(/\\/g,"/");if(s&&y.startsWith(s+"/")){let x=y.slice(s.length+1);t.app.workspace.openLinkText(x,"")}else Ul(h)||t.app.workspace.openLinkText(h,"")}}};return r.addEventListener("click",c),()=>{r.removeEventListener("click",c),i.unload()}},[e,t]),(0,GI.jsx)("div",{ref:n,className:"agent-client-markdown-text-renderer"})}var ly=G(Ce());var sy=G(ve()),{useState:ay,useRef:B6,useEffect:XI}=ly,Wd=ly.memo(function({terminalId:t,terminalClient:n,plugin:r}){let i=Ne(),[o,a]=ay(""),[s,c]=ay(null),[d,m]=ay(!0),l=B6(null);return i.log(`[TerminalBlock] Component rendered for terminal ${t}, terminalClient: ${!!n}`),XI(()=>{if(i.log(`[TerminalBlock] useEffect triggered for ${t}, terminalClient: ${!!n}`),!t||!n)return;let f=async()=>{var p,h;try{let y=await n.getTerminalOutput(t);i.log(`[TerminalBlock] Poll result for ${t}:`,y),a(y.output),y.exitStatus&&(c({exitCode:(p=y.exitStatus.exitCode)!=null?p:null,signal:
Line truncated
|
||||||
|
`))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
|
||||||
|
`))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
|
||||||
|
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
||||||
|
`)&&(n=n.slice(0,-1))),super.equals(t,n,r)}},Y6=new vy;function yy(e,t,n){return Y6.diff(e,t,n)}function J6(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
||||||
|
`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let i=0;i<r.length;i++){let o=r[i];i%2&&!t.newlineIsToken?n[n.length-1]+=o:n.push(o)}return n}function Sy(e,t,n,r,i,o,a){let s;a?typeof a=="function"?s={callback:a}:s=a:s={},typeof s.context=="undefined"&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(s.callback){let{callback:m}=s;yy(n,r,Object.assign(Object.assign({},s),{callback:l=>{let f=d(l);m(f)}}))}else return d(yy(n,r,s));function d(m){if(!m)return;m.push({value:"",lines:[]});function l(g){return g.map(function(b){return" "+b})}let f=[],p=0,h=0,y=[],x=1,S=1;for(let g=0;g<m.length;g++){let b=m[g],v=b.lines||K6(b.value);if(b.lines=v,b.added||b.removed){if(!p){let _=m[g-1];p=x,h=S,_&&(y=c>0?l(_.lines.slice(-c)):[],p-=y.length,h-=y.length)}for(let _ of v)y.push((b.added?"+":"-")+_);b.added?S+=v.length:x+=v.length}else{if(p)if(v.length<=c*2&&g<m.length-2)for(let _ of l(v))y.push(_);else{let _=Math.min(v.length,c);for(let E of l(v.slice(0,_)))y.push(E);let C={oldStart:p,oldLines:x-p+_,newStart:h,newLines:S-h+_,lines:y};f.push(C),p=0,h=0,y=[]}x+=v.length,S+=v.length}}for(let g of f)for(let b=0;b<g.lines.length;b++)g.lines[b].endsWith(`
|
||||||
|
`)?g.lines[b]=g.lines[b].slice(0,-1):(g.lines.splice(b+1,0,"\\ No newline at end of file"),b++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:o,hunks:f}}}function K6(e){let t=e.endsWith(`
|
||||||
|
`),n=e.split(`
|
||||||
|
`).map(r=>r+`
|
||||||
|
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}var we=G(ve()),{useState:tk,useMemo:nk}=Bl,rk=Bl.memo(function({content:t,plugin:n,terminalClient:r,onApprovePermission:i}){let{kind:o,title:a,status:s,toolCallId:c,permissionRequest:d,locations:m,rawInput:l,content:f}=t,[p,h]=tk(d==null?void 0:d.selectedOptionId);Bl.useEffect(()=>{(d==null?void 0:d.selectedOptionId)!==p&&h(d==null?void 0:d.selectedOptionId)},[d==null?void 0:d.selectedOptionId]);let y=nk(()=>{let g=n.app.vault.adapter;return g instanceof ik.FileSystemAdapter?g.getBasePath():""},[n]),x=n.settings.displaySettings.showEmojis;return(0,we.jsxs)("div",{className:"agent-client-message-tool-call",children:[(0,we.jsxs)("div",{className:"agent-client-message-tool-call-header",children:[(0,we.jsxs)("div",{className:"agent-client-message-tool-call-title",children:[x&&(0,we.jsx)(Yn,{name:(g=>{switch(g){case"read":return"book-open";case"edit":return"pencil";case"delete":return"trash";case"move":return"folder-open";case"search":return"search";case"execute":return"square-terminal";case"think":return"message-circle-more";case"fetch":return"globe";case"switch_mode":return"arrow-left-right";default:return"hammer"}})(o),className:"agent-client-message-tool-call-icon"}),(0,we.jsx)("span",{className:"agent-client-message-tool-call-title-text",children:a}),s!=="completed"&&(0,we.jsx)(Yn,{name:s==="failed"?"x":"ellipsis",className:`agent-client-message-tool-call-status-icon agent-client-status-${s}`})]}),o==="execute"&&l&&typeof l.command=="string"&&(0,we.jsx)("div",{className:"agent-client-message-tool-call-command",children:(0,we.jsxs)("code",{children:[l.command,Array.isArray(l.args)&&l.args.length>0&&` ${l.args.join(" ")}`]})}),m&&m.length>0&&(0,we.jsx)("div",{className:"agent-client-message-tool-call-locations",children:m.map((g,b)=>(0,we.jsxs)("span",{className:"agent-client-message-tool-call-location",children:[sI(g.path,y),g.line!=null&&`:${g.line}`]},b))})]}),f&&f.map((g,b)=>g.type==="terminal"?(0,we.jsx)(Wd,{terminalId:g.terminalId,terminalClient:r||null,plugin:n},b):g.type==="diff"?(0,we.jsx)(nL,{diff:g,plugin:n,autoCollapse:n.settings.displaySettings.autoCollapseDiffs,collapseThreshold:n.settings.displaySettings.diffCollapseThreshold},b):null),d&&(0,we.jsx)(YI,{permissionRequest:{...d,selectedOptionId:p},toolCallId:c,plugin:n,onApprovePermission:i,onOptionSelected:h})]})});function ek(e){return e.oldText===null||e.oldText===void 0||e.oldText===""}function Q6(e){return e.map(t=>({type:t.added?"added":t.removed?"removed":"context",value:t.value}))}function eL(e,t){let n=e.filter(r=>!(t==="removed"&&r.type==="added"||t==="added"&&r.type==="removed"));return(0,we.jsx)(we.Fragment,{children:n.map((r,i)=>r.type==="added"?(0,we.jsx)("span",{className:"agent-client-diff-word-added",children:r.value},i):r.type==="removed"?(0,we.jsx)("span",{className:"agent-client-diff-word-removed",children:r.value},i):(0,we.jsx)("span",{children:r.value},i))})}var tL=3;function nL({diff:e,autoCollapse:t=!1,collapseThreshold:n=10}){let r=nk(()=>{if(ek(e))return e.newText.split(`
|
||||||
|
`).map((x,S)=>({type:"added",newLineNumber:S+1,content:x}));let m=e.oldText||"",l=Sy("old","new",m,e.newText,"","",{context:tL}),f=[],p=0,h=0;for(let y of l.hunks){l.hunks.length>1&&f.push({type:"context",content:`@@ -${y.oldStart},${y.oldLines} +${y.newStart},${y.newLines} @@`}),p=y.oldStart,h=y.newStart;for(let x of y.lines){let S=x[0],g=x.substring(1);S==="+"?f.push({type:"added",newLineNumber:h++,content:g}):S==="-"?f.push({type:"removed",oldLineNumber:p++,content:g}):f.push({type:"context",oldLineNumber:p++,newLineNumber:h++,content:g})}}for(let y=0;y<f.length-1;y++){let x=f[y],S=f[y+1];if(x.type==="removed"&&S.type==="added"){let g=hy(x.content,S.content),b=Q6(g);x.wordDiff=b,S.wordDiff=b}}return f},[e.oldText,e.newText]),i=(m,l)=>{if(m.type==="context"&&m.content.startsWith("@@"))return(0,we.jsx)("div",{className:"agent-client-diff-hunk-header",children:m.content},l);let p="agent-client-diff-line";return m.type==="added"?p+=" agent-client-diff-line-added":m.type==="removed"?p+=" agent-client-diff-line-removed":p+=" agent-client-diff-line-context",(0,we.jsx)("div",{className:p,children:(0,we.jsx)("span",{className:"agent-client-diff-line-content",children:m.wordDiff&&(m.type==="added"||m.type==="removed")?eL(m.wordDiff,m.type):m.content})},l)},o=t&&r.length>n,[a,s]=tk(o),c=a?r.slice(0,n):r,d=r.length-n;return(0,we.jsxs)("div",{className:"agent-client-tool-call-diff",children:[ek(e)?(0,we.jsx)("div",{className:"agent-client-diff-line-info",children:"New file"}):null,(0,we.jsx)("div",{className:"agent-client-tool-call-diff-content",children:c.map((m,l)=>i(m,l))}),o&&(0,we.jsxs)("div",{className:"agent-client-diff-expand-bar",onClick:()=>s(!a),children:[(0,we.jsx)("span",{className:"agent-client-diff-expand-text",children:a?`${d} more lines`:"Collapse"}),(0,we.jsx)(Yn,{name:a?"chevron-right":"chevron-up",className:"agent-client-diff-expand-icon"})]})]})}var ye=G(ve()),{useState:lk,useCallback:ok}=by;function ak({text:e,plugin:t,autoMentionContext:n}){let r=/@\[\[([^\]]+)\]\]/g,i=[];if(n){let s=n.selection?`@${n.noteName}:${n.selection.fromLine}-${n.selection.toLine}`:`@${n.noteName}`;i.push((0,ye.jsx)("span",{className:"agent-client-text-mention",onClick:()=>{t.app.workspace.openLinkText(n.notePath,"")},children:s},"auto-mention")),i.push(`
|
||||||
|
`)}let o=0,a;for(;(a=r.exec(e))!==null;){a.index>o&&i.push(e.slice(o,a.index));let s=a[1],c=t.app.vault.getMarkdownFiles().find(d=>d.basename===s);c?i.push((0,ye.jsxs)("span",{className:"agent-client-text-mention",onClick:()=>{t.app.workspace.openLinkText(c.path,"")},children:["@",s]},a.index)):i.push(`@${s}`),o=a.index+a[0].length}return o<e.length&&i.push(e.slice(o)),(0,ye.jsx)("div",{className:"agent-client-text-with-mentions",children:i})}function iL({text:e,plugin:t}){let[n,r]=lk(!1),i=t.settings.displaySettings.showEmojis;return(0,ye.jsxs)("div",{className:"agent-client-collapsible-thought",onClick:()=>r(!n),children:[(0,ye.jsxs)("div",{className:"agent-client-collapsible-thought-header",children:[i&&(0,ye.jsx)(Yn,{name:"lightbulb",className:"agent-client-collapsible-thought-label-icon"}),"Thinking",(0,ye.jsx)(Yn,{name:n?"chevron-down":"chevron-right",className:"agent-client-collapsible-thought-icon"})]}),n&&(0,ye.jsx)("div",{className:"agent-client-collapsible-thought-content",children:(0,ye.jsx)(oy,{text:e,plugin:t})})]})}function sk({content:e,plugin:t,messageId:n,messageRole:r,terminalClient:i,onApprovePermission:o}){switch(e.type){case"text":return r==="user"?(0,ye.jsx)(ak,{text:e.text,plugin:t}):(0,ye.jsx)(oy,{text:e.text,plugin:t});case"text_with_context":return(0,ye.jsx)(ak,{text:e.text,autoMentionContext:e.autoMentionContext,plugin:t});case"agent_thought":return(0,ye.jsx)(iL,{text:e.text,plugin:t});case"tool_call":return(0,ye.jsx)(rk,{content:e,plugin:t,terminalClient:i,onApprovePermission:o});case"plan":{let a=t.settings.displaySettings.showEmojis;return(0,ye.jsxs)("div",{className:"agent-client-message-plan",children:[(0,ye.jsxs)("div",{className:"agent-client-message-plan-title",children:[a&&(0,ye.jsx)(Yn,{name:"list-checks",className:"agent-client-message-plan-label-icon"}),"Plan"]}),e.entries.map((s,c)=>(0,ye.jsxs)("div",{className:`agent-client-message-plan-entry agent-client-plan-status-${s.status}`,children:[a&&(0,ye.jsx)("span",{className:`agent-client-message-plan-entry-icon agent-client-status-${s.status}`,children:(0,ye.jsx)(Yn,{name:s.status==="completed"?"check":s.status==="in_progress"?"loader":"circle"})})," ",s.content]},c))]})}case"terminal":return(0,ye.jsx)(Wd,{terminalId:e.terminalId,terminalClient:i||null,plugin:t});case"image":return(0,ye.jsx)("div",{className:"agent-client-message-image",children:(0,ye.jsx)("img",{src:`data:${e.mimeType};base64,${e.data}`,alt:"Attached image",className:"agent-client-message-image-thumbnail"})});case"resource_link":return(0,ye.jsxs)("div",{className:"agent-client-message-resource-link",children:[(0,ye.jsx)("span",{className:"agent-client-message-resource-link-icon",ref:a=>{a&&(0,xy.setIcon)(a,"file")}}),(0,ye.jsx)("span",{className:"agent-client-message-resource-link-name",children:e.name})]});default:return(0,ye.jsx)("span",{children:"Unsupported content type"})}}function rL(e){return e.filter(t=>t.type==="text"||t.type==="text_with_context").map(t=>"text"in t?t.text:"").join(`
|
||||||
|
`)}function oL({contents:e}){let[t,n]=lk(!1),r=ok(()=>{let o=rL(e);o&&navigator.clipboard.writeText(o).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})},[e]),i=ok(o=>{o&&(0,xy.setIcon)(o,t?"check":"copy")},[t]);return(0,ye.jsx)("button",{className:"clickable-icon agent-client-message-action-button",onClick:r,"aria-label":"Copy message",ref:i})}function aL(e){let t=[],n=[];for(let r of e)r.type==="image"||r.type==="resource_link"?n.push(r):(n.length>0&&(t.push({type:"attachments",items:n}),n=[]),t.push({type:"single",item:r}));return n.length>0&&t.push({type:"attachments",items:n}),t}var ck=by.memo(function({message:t,plugin:n,terminalClient:r,onApprovePermission:i}){let o=aL(t.content);return(0,ye.jsxs)("div",{className:`agent-client-message-renderer ${t.role==="user"?"agent-client-message-user":"agent-client-message-assistant"}`,children:[o.map((a,s)=>a.type==="attachments"?(0,ye.jsx)("div",{className:"agent-client-message-images-strip",children:a.items.map((c,d)=>(0,ye.jsx)(sk,{content:c,plugin:n,messageId:t.id,messageRole:t.role,terminalClient:r,onApprovePermission:i},d))},s):(0,ye.jsx)("div",{children:(0,ye.jsx)(sk,{content:a.item,plugin:n,messageId:t.id,messageRole:t.role,terminalClient:r,onApprovePermission:i})},s)),t.content.some(a=>(a.type==="text"||a.type==="text_with_context")&&a.text)&&(0,ye.jsx)("div",{className:"agent-client-message-actions",children:(0,ye.jsx)(oL,{contents:t.content})})]})});var Nr=G(Ce(),1),bk=G(ug(),1);function yo(e,t,n){var s;let r=(s=n.initialDeps)!=null?s:[],i,o=!0;function a(){var c,d,m;let l;n.key&&((c=n.debug)!=null&&c.call(n))&&(l=Date.now());let f=e();if(!(f.length!==r.length||f.some((y,x)=>r[x]!==y)))return i;r=f;let h;if(n.key&&((d=n.debug)!=null&&d.call(n))&&(h=Date.now()),i=t(...f),n.key&&((m=n.debug)!=null&&m.call(n))){let y=Math.round((Date.now()-l)*100)/100,x=Math.round((Date.now()-h)*100)/100,S=x/16,g=(b,v)=>{for(b=String(b);b.length<v;)b=" "+b;return b};console.info(`%c\u23F1 ${g(x,5)} /${g(y,5)} ms`,`
|
||||||
|
font-size: .6rem;
|
||||||
|
font-weight: bold;
|
||||||
|
color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,n==null?void 0:n.key)}return n!=null&&n.onChange&&!(o&&n.skipInitialOnChange)&&n.onChange(i),o=!1,i}return a.updateDeps=c=>{r=c},a}function _y(e,t){if(e===void 0)throw new Error(`Unexpected undefined${t?`: ${t}`:""}`);return e}var uk=(e,t)=>Math.abs(e-t)<1.01,dk=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}};var fk=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},sL=e=>e,lL=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let i=t;i<=n;i++)r.push(i);return r},gk=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=a=>{let{width:s,height:c}=a;t({width:Math.round(s),height:Math.round(c)})};if(i(fk(n)),!r.ResizeObserver)return()=>{};let o=new r.ResizeObserver(a=>{let s=()=>{let c=a[0];if(c!=null&&c.borderBoxSize){let d=c.borderBoxSize[0];if(d){i({width:d.inlineSize,height:d.blockSize});return}}i(fk(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},mk={passive:!0};var pk=typeof window=="undefined"?!0:"onscrollend"in window,hk=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=0,o=e.options.useScrollendEvent&&pk?()=>{}:dk(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),a=m=>()=>{let{horizontal:l,isRtl:f}=e.options;i=l?n.scrollLeft*(f&&-1||1):n.scrollTop,o(),t(i,m)},s=a(!0),c=a(!1);n.addEventListener("scroll",s,mk);let d=e.options.useScrollendEvent&&pk;return d&&n.addEventListener("scrollend",c,mk),()=>{n.removeEventListener("scroll",s),d&&n.removeEventListener("scrollend",c)}};var cL=(e,t,n)=>{if(t!=null&&t.borderBoxSize){let r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]};var vk=(e,{adjustments:t=0,behavior:n},r)=>{var i,o;let a=e+t;(o=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||o.call(i,{[r.options.horizontal?"left":"top"]:a,behavior:n})},rf=class{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var o;var n,r,i;return(o=(i=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:i.call(r))!=null?o:Date.now()},this.observer=(()=>{let n=null,r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(o=>{let a=()=>{let s=o.target,c=this.indexFromElement(s);if(!s.isConnected){this.observer.unobserve(s);return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(s,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),n=null},observe:i=>{var o;return(o=r())==null?void 0:o.observe(i,{box:"border-box"})},unobserve:i=>{var o;return(o=r())==null?void 0:o.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,i])=>{typeof i=="undefined"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:sL,rangeExtractor:lL,onChange:()=>{},measureElement:cL,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=yo(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var i;var n;let r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(i=(n=this.scrollElement)==null?void 0:n.window)!=nu
Line truncated
|
||||||
|
$${m.cost.amount.toFixed(2)}`:`${sf(m.used)} / ${sf(m.size)} tokens`,children:[Math.round(m.used/m.size*100),"%"]}),c&&c.length>0?(0,qt.jsx)("div",{ref:y,className:"agent-client-config-options-container"}):(0,qt.jsxs)(qt.Fragment,{children:[i&&i.availableModes.length>1&&(0,qt.jsxs)("div",{className:"agent-client-mode-selector",title:(M=(T=i.availableModes.find(O=>O.id===i.currentModeId))==null?void 0:T.description)!=null?M:"Select mode",children:[(0,qt.jsx)("div",{ref:p}),(0,qt.jsx)("span",{className:"agent-client-mode-selector-icon",ref:O=>{O&&(0,Or.setIcon)(O,"chevron-down")}})]}),a&&a.availableModels.length>1&&(0,qt.jsxs)("div",{className:"agent-client-model-selector",title:(V=(P=a.availableModels.find(O=>O.modelId===a.currentModelId))==null?void 0:P.description)!=null?V:"Select model",children:[(0,qt.jsx)("div",{ref:h}),(0,qt.jsx)("span",{className:"agent-client-model-selector-icon",ref:O=>{O&&(0,Or.setIcon)(O,"chevron-down")}})]})]}),(0,qt.jsx)("button",{ref:f,onClick:r,disabled:t,className:`agent-client-chat-send-button ${e?"sending":""} ${t?"agent-client-disabled":""}`,title:l?e?"Stop generation":"Send message":"Connecting..."})]})}var vt=G(ve()),{useRef:cf,useState:Ey,useEffect:lf,useCallback:ct,useMemo:wL}=_L,Ik=5,$L=Ik*1024*1024,Ay=10,Tk=["image/png","image/jpeg","image/gif","image/webp"];function CL(e,t){let n=cf(-1),r=cf(null),i=wL(()=>e.filter(s=>s.role==="user").map(s=>{let c=s.content.find(d=>d.type==="text"||d.type==="text_with_context");return c&&"text"in c?c.text:""}).filter(s=>s.trim()!==""),[e]),o=ct((s,c)=>{if(!c||s.nativeEvent.isComposing||i.length===0)return!1;if(n.current!==-1&&(s.key==="ArrowLeft"||s.key==="ArrowRight"||r.current!==null&&c.value!==r.current))return n.current=-1,r.current=null,!1;if(s.key==="ArrowUp"){if(c.value.trim()!==""&&n.current===-1)return!1;s.preventDefault();let d=n.current+1;if(d>=i.length)return!0;n.current=d;let m=i[i.length-1-d];return r.current=m,t(m),window.setTimeout(()=>{c.selectionStart=m.length,c.selectionEnd=m.length},0),!0}if(s.key==="ArrowDown"){let d=n.current;if(d===-1)return!1;s.preventDefault();let m=d-1;if(n.current=m,m===-1)r.current=null,t("");else{let l=i[i.length-1-m];r.current=l,t(l),window.setTimeout(()=>{c.selectionStart=l.length,c.selectionEnd=l.length},0)}return!0}return!1},[i,t]),a=ct(()=>{n.current=-1,r.current=null},[]);return{handleHistoryKeyDown:o,resetHistory:a}}function kk({isSending:e,isSessionReady:t,isRestoringSession:n,agentLabel:r,availableCommands:i,autoMentionEnabled:o,restoredMessage:a,suggestions:s,plugin:c,view:d,onSendMessage:m,onStopGeneration:l,onRestoredMessageConsumed:f,modes:p,onModeChange:h,models:y,onModelChange:x,configOptions:S,onConfigOptionChange:g,usage:b,supportsImages:v=!1,agentId:_,inputValue:C,onInputChange:E,attachedFiles:A,onAttachedFilesChange:T,errorInfo:M,onClearError:P,agentUpdateNotification:V,onClearAgentUpdate:O,messages:L}){var $s;let{mentions:w,commands:k}=s,N=Ne(),j=Tr(c),F=c.settings.displaySettings.showEmojis,K=($s=c.app.vault.getConfig("spellcheck"))!=null?$s:!0,[ne,ue]=Ey(null),[Ue,ft]=Ey(""),[Wn,wt]=Ey(!1),{handleHistoryKeyDown:Qn,resetHistory:No}=CL(L,E),mt=cf(null),xi=cf(0);lf(()=>{T([])},[_,T]);let Oo=ct(q=>{if(q.length===0)return;let Q=Ay-A.length;if(Q<=0){new mi.Notice(`[Agent Client] Maximum ${Ay} attachments allowed`);return}let se=q.slice(0,Q);se.length<q.length&&new mi.Notice(`[Agent Client] Maximum ${Ay} attachments allowed`),T([...A,...se])},[A,T]),Cp=ct(q=>{T(A.filter(Q=>Q.id!==q))},[A,T]),Mc=ct(async q=>new Promise((Q,se)=>{let pe=new FileReader;pe.onload=()=>{let _n=pe.result.split(",")[1];Q(_n)},pe.onerror=se,pe.readAsDataURL(q)}),[]),Mo=ct(async q=>{let Q=[];for(let se of q){if(se.size>$L){new mi.Notice(`[Agent Client] Image too large (max ${Ik}MB)`);continue}try{let pe=await Mc(se);Q.push({id:crypto.randomUUID(),kind:"image",data:pe,mimeType:se.type})}catch(pe){console.error("Failed to convert image:",pe),new mi.Notice("[Agent Client] Failed to attach image")}}return Q},[Mc]),Ji=ct(q=>{let{webUtils:Q}=require("electron"),se=[];for(let pe of q){let St=Q.getPathForFile(pe);if(!St){new mi.Notice("[Agent Client] Could not determine file path");continue}se.push({id:crypto.randomUUID(),kind:"file",mimeType:pe.type||"application/octet-stream",name:pe.name,path:St,size:pe.size})}return se},[]),Ep=ct(async q=>{var _n;let Q=(_n=q.clipboardData)==null?void 0:_n.items;if(!Q)return;let se=[],pe=[];for(let sn of Array.from(Q)){if(sn.kind!=="file")continue;let wn=sn.getAsFile();wn&&(Tk.includes(sn.type)?se.push(wn):pe.push(wn))}if(se.length===0&&pe.length===0)return;q.preventDefault();let St=[];if(se.length>0)if(v)St.push(...await Mo(se));else{let sn=Ji(se);sn.length>0?St.push(...sn):new mi.Notice("[Agent Client] This agent does not support image paste. Try drag & drop instead.")}pe.length>0&&St.push(...Ji(pe)),Oo(St)},[v,Mo,Ji,Oo]),Ap=ct(q=>{var Q;(Q=q.dataTransfer)!=null&&Q.types.includes("Files")&&(q.preventDefault(),q.dataTransfer.dropEffect="copy")},[]),zp=ct(q=>{var Q;(Q=q
Line truncated
|
||||||
|
--another=value`).setValue(this.formatArgs(r.args)).onChange(async c=>{this.plugin.settings.customAgents[i].args=this.parseArgs(c),await this.plugin.saveSettings()}),s.inputEl.rows=3}),new J.Setting(o).setName("Environment variables").setDesc("Enter KEY=VALUE pairs, one per line. (Stored as plain text)").addTextArea(s=>{s.setPlaceholder("TOKEN=...").setValue(this.formatEnv(r.env)).onChange(async c=>{this.plugin.settings.customAgents[i].env=this.parseEnv(c),await this.plugin.saveSettings()}),s.inputEl.rows=3})}generateCustomAgentDisplayName(){let n="Custom agent",r=new Set;r.add(this.plugin.settings.claude.displayName||this.plugin.settings.claude.id),r.add(this.plugin.settings.codex.displayName||this.plugin.settings.codex.id),r.add(this.plugin.settings.gemini.displayName||this.plugin.settings.gemini.id);for(let a of this.plugin.settings.customAgents)r.add(a.displayName||a.id);if(!r.has(n))return n;let i=2,o=`${n} ${i}`;for(;r.has(o);)i+=1,o=`${n} ${i}`;return o}generateCustomAgentId(){let n="custom-agent",r=new Set(this.plugin.settings.customAgents.map(a=>a.id));if(!r.has(n))return n;let i=2,o=`${n}-${i}`;for(;r.has(o);)i+=1,o=`${n}-${i}`;return o}addInstallHint(n,r){let i=`npm install -g ${r}@latest`,o=document.createDocumentFragment();o.append("Not installed? Run in terminal: "),o.appendChild(document.createElement("code")).textContent=i,new J.Setting(n).setDesc(o).addButton(a=>{a.setButtonText("Copy").onClick(()=>{navigator.clipboard.writeText(i).then(()=>{a.setButtonText("Copied!"),setTimeout(()=>{a.setButtonText("Copy")},1500)},()=>{})})})}addAutoDetectButton(n,r,i){n.addButton(o=>{let a=J.Platform.isWin&&this.plugin.settings.windowsWslMode,s=J.Platform.isWin&&!a?"where":"which";o.setButtonText("Auto-detect").setTooltip(`Run \`${s} ${r}\` to find the path`).onClick(async()=>{o.setButtonText("Detecting\u2026"),o.setDisabled(!0);try{let c=a?await aI(r,this.plugin.settings.windowsWslDistribution||void 0):await oI(r);c?(await i(c),this.display()):(o.setButtonText("Not found"),setTimeout(()=>{o.setButtonText("Auto-detect"),o.setDisabled(!1)},2e3))}catch(c){o.setButtonText("Error"),setTimeout(()=>{o.setButtonText("Auto-detect"),o.setDisabled(!1)},2e3)}})})}formatArgs(n){return n.join(`
|
||||||
|
`)}parseArgs(n){return n.split(/\r?\n/).map(r=>r.trim()).filter(r=>r.length>0)}formatEnv(n){return n.map(r=>{var i;return`${r.key}=${(i=r.value)!=null?i:""}`}).join(`
|
||||||
|
`)}parseEnv(n){let r=[];for(let i of n.split(/\r?\n/)){let o=i.trim();if(!o)continue;let a=o.indexOf("=");if(a===-1)continue;let s=o.slice(0,a).trim(),c=o.slice(a+1).trim();s&&r.push({key:s,value:c})}return ho(r)}};var a$=require("child_process");var u={};ei(u,{$brand:()=>_f,$input:()=>ex,$output:()=>Qb,NEVER:()=>Dy,TimePrecision:()=>rx,ZodAny:()=>X_,ZodArray:()=>W_,ZodBase64:()=>Ym,ZodBase64URL:()=>Jm,ZodBigInt:()=>gs,ZodBigIntFormat:()=>Qm,ZodBoolean:()=>ps,ZodCIDRv4:()=>Gm,ZodCIDRv6:()=>Xm,ZodCUID:()=>jm,ZodCUID2:()=>Zm,ZodCatch:()=>bw,ZodCodec:()=>sp,ZodCustom:()=>Ac,ZodCustomStringFormat:()=>fs,ZodDate:()=>_c,ZodDefault:()=>pw,ZodDiscriminatedUnion:()=>ew,ZodE164:()=>Km,ZodEmail:()=>Um,ZodEmoji:()=>Pm,ZodEnum:()=>us,ZodError:()=>dZ,ZodExactOptional:()=>dw,ZodFile:()=>cw,ZodFirstPartyTypeKind:()=>Nw,ZodFunction:()=>Tw,ZodGUID:()=>vc,ZodIPv4:()=>Hm,ZodIPv6:()=>Bm,ZodISODate:()=>km,ZodISODateTime:()=>Im,ZodISODuration:()=>Om,ZodISOTime:()=>Nm,ZodIntersection:()=>tw,ZodIssueCode:()=>mZ,ZodJWT:()=>Wm,ZodKSUID:()=>Fm,ZodLazy:()=>Ew,ZodLiteral:()=>lw,ZodMAC:()=>Z_,ZodMap:()=>aw,ZodNaN:()=>_w,ZodNanoID:()=>Lm,ZodNever:()=>J_,ZodNonOptional:()=>op,ZodNull:()=>B_,ZodNullable:()=>mw,ZodNumber:()=>ms,ZodNumberFormat:()=>To,ZodObject:()=>$c,ZodOptional:()=>rp,ZodPipe:()=>ap,ZodPrefault:()=>hw,ZodPromise:()=>zw,ZodReadonly:()=>ww,ZodRealError:()=>on,ZodRecord:()=>Ec,ZodSet:()=>sw,ZodString:()=>ds,ZodStringFormat:()=>Me,ZodSuccess:()=>Sw,ZodSymbol:()=>F_,ZodTemplateLiteral:()=>Cw,ZodTransform:()=>uw,ZodTuple:()=>iw,ZodType:()=>fe,ZodULID:()=>qm,ZodURL:()=>xc,ZodUUID:()=>Si,ZodUndefined:()=>H_,ZodUnion:()=>Cc,ZodUnknown:()=>Y_,ZodVoid:()=>K_,ZodXID:()=>Vm,ZodXor:()=>Q_,_ZodString:()=>Rm,_default:()=>gw,_function:()=>_O,any:()=>eO,array:()=>wc,base64:()=>UN,base64url:()=>PN,bigint:()=>YN,boolean:()=>V_,catch:()=>xw,check:()=>wO,cidrv4:()=>DN,cidrv6:()=>RN,clone:()=>Vt,codec:()=>SO,coerce:()=>lp,config:()=>We,core:()=>yi,cuid:()=>AN,cuid2:()=>zN,custom:()=>$O,date:()=>nO,decode:()=>M_,decodeAsync:()=>R_,describe:()=>CO,discriminatedUnion:()=>lO,e164:()=>LN,email:()=>vN,emoji:()=>CN,encode:()=>O_,encodeAsync:()=>D_,endsWith:()=>ts,enum:()=>np,exactOptional:()=>fw,file:()=>gO,flattenError:()=>oc,float32:()=>HN,float64:()=>BN,formatError:()=>ac,fromJSONSchema:()=>NO,function:()=>_O,getErrorMap:()=>gZ,globalRegistry:()=>It,gt:()=>hi,gte:()=>Ft,guid:()=>yN,hash:()=>FN,hex:()=>VN,hostname:()=>qN,httpUrl:()=>$N,includes:()=>Qa,instanceof:()=>AO,int:()=>Dm,int32:()=>GN,int64:()=>JN,intersection:()=>nw,ipv4:()=>NN,ipv6:()=>MN,iso:()=>Ao,json:()=>TO,jwt:()=>jN,keyof:()=>iO,ksuid:()=>kN,lazy:()=>Aw,length:()=>Eo,literal:()=>pO,locales:()=>wo,looseObject:()=>aO,looseRecord:()=>uO,lowercase:()=>Ka,lt:()=>gi,lte:()=>xn,mac:()=>ON,map:()=>dO,maxLength:()=>Co,maxSize:()=>jr,meta:()=>EO,mime:()=>ns,minLength:()=>Yi,minSize:()=>vi,multipleOf:()=>Lr,nan:()=>yO,nanoid:()=>EN,nativeEnum:()=>mO,negative:()=>bm,never:()=>ep,nonnegative:()=>_m,nonoptional:()=>yw,nonpositive:()=>xm,normalize:()=>is,null:()=>G_,nullable:()=>Sc,nullish:()=>hO,number:()=>q_,object:()=>rO,optional:()=>yc,overwrite:()=>Kn,parse:()=>T_,parseAsync:()=>I_,partialRecord:()=>cO,pipe:()=>bc,positive:()=>Sm,prefault:()=>vw,preprocess:()=>IO,prettifyError:()=>Gy,promise:()=>xO,property:()=>wm,readonly:()=>$w,record:()=>ow,refine:()=>Iw,regex:()=>Ja,regexes:()=>bn,registry:()=>Wf,safeDecode:()=>P_,safeDecodeAsync:()=>j_,safeEncode:()=>U_,safeEncodeAsync:()=>L_,safeParse:()=>k_,safeParseAsync:()=>N_,set:()=>fO,setErrorMap:()=>pZ,size:()=>$o,slugify:()=>ss,startsWith:()=>es,strictObject:()=>oO,string:()=>Mm,stringFormat:()=>ZN,stringbool:()=>zO,success:()=>vO,superRefine:()=>kw,symbol:()=>WN,templateLiteral:()=>bO,toJSONSchema:()=>Am,toLowerCase:()=>os,toUpperCase:()=>as,transform:()=>ip,treeifyError:()=>By,trim:()=>rs,tuple:()=>rw,uint32:()=>XN,uint64:()=>KN,ulid:()=>TN,undefined:()=>QN,union:()=>tp,unknown:()=>zo,uppercase:()=>Wa,url:()=>wN,util:()=>U,uuid:()=>SN,uuidv4:()=>bN,uuidv6:()=>xN,uuidv7:()=>_N,void:()=>tO,xid:()=>IN,xor:()=>sO});var yi={};ei(yi,{$ZodAny:()=>xb,$ZodArray:()=>Eb,$ZodAsyncError:()=>Jn,$ZodBase64:()=>db,$ZodBase64URL:()=>fb,$ZodBigInt:()=>Hf,$ZodBigIntFormat:()=>vb,$ZodBoolean:()=>uc,$ZodCIDRv4:()=>lb,$ZodCIDRv6:()=>cb,$ZodCUID:()=>JS,$ZodCUID2:()=>KS,$ZodCatch:()=>Fb,$ZodCheck:()=>Re,$ZodCheckBigIntFormat:()=>ES,$ZodCheckEndsWith:()=>PS,$ZodCheckGreaterThan:()=>Pf,$ZodCheckIncludes:()=>RS,$ZodCheckLengthEquals:()=>NS,$ZodCheckLessThan:()=>Uf,$ZodCheckLowerCase:()=>MS,$ZodCheckMaxLength:()=>IS,$ZodCheckMaxSize:()=>AS,$ZodCheckMimeType:()=>jS,$ZodCheckMinLength:()=>kS,$ZodCheckMinSize:()=>zS,$ZodCheckMultipleOf:()=>$S,$ZodCheckNumberFormat:()=>CS,$ZodCheckOverwrite:()=>ZS,$ZodCheckProperty:()=>LS,$ZodCheckRegex:()=>OS,$ZodCheckSizeEquals:()=>TS,$ZodCheckStartsWith:()=>US,$ZodCheckStringFormat:()=>Xa,$ZodCheckUpperCase:()=>DS,$ZodCodec:()=>fc,$ZodCustom:()=>Wb,$ZodCustomStringFormat:()=>gb,$ZodDate:()=>Cb,$ZodDefault:()=>jb,$ZodDiscriminatedUnion:()=>T
Line truncated
|
||||||
|
`)}var Fa=e=>(t,n,r,i)=>{var s;let o=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new Jn;if(a.issues.length){let c=new((s=i==null?void 0:i.Err)!=null?s:e)(a.issues.map(d=>nn(d,o,We())));throw $f(c,i==null?void 0:i.callee),c}return a.value},Cf=Fa(rn),Ha=e=>async(t,n,r,i)=>{var s;let o=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new((s=i==null?void 0:i.Err)!=null?s:e)(a.issues.map(d=>nn(d,o,We())));throw $f(c,i==null?void 0:i.callee),c}return a.value},Ef=Ha(rn),Ba=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new Jn;return o.issues.length?{success:!1,error:new(e!=null?e:rc)(o.issues.map(a=>nn(a,i,We())))}:{success:!0,data:o.value}},Xy=Ba(rn),Ga=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>nn(a,i,We())))}:{success:!0,data:o.value}},Yy=Ga(rn),Af=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Fa(e)(t,n,i)},uj=Af(rn),zf=e=>(t,n,r)=>Fa(e)(t,n,r),dj=zf(rn),Tf=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ha(e)(t,n,i)},fj=Tf(rn),If=e=>async(t,n,r)=>Ha(e)(t,n,r),mj=If(rn),kf=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ba(e)(t,n,i)},pj=kf(rn),Nf=e=>(t,n,r)=>Ba(e)(t,n,r),gj=Nf(rn),Of=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ga(e)(t,n,i)},hj=Of(rn),Mf=e=>async(t,n,r)=>Ga(e)(t,n,r),vj=Mf(rn);var bn={};ei(bn,{base64:()=>dS,base64url:()=>Df,bigint:()=>vS,boolean:()=>SS,browserEmail:()=>Cj,cidrv4:()=>cS,cidrv6:()=>uS,cuid:()=>Jy,cuid2:()=>Ky,date:()=>mS,datetime:()=>gS,domain:()=>zj,duration:()=>nS,e164:()=>fS,email:()=>rS,emoji:()=>oS,extendedDuration:()=>yj,guid:()=>iS,hex:()=>Tj,hostname:()=>Aj,html5Email:()=>_j,idnEmail:()=>$j,integer:()=>yS,ipv4:()=>aS,ipv6:()=>sS,ksuid:()=>eS,lowercase:()=>_S,mac:()=>lS,md5_base64:()=>kj,md5_base64url:()=>Nj,md5_hex:()=>Ij,nanoid:()=>tS,null:()=>bS,number:()=>Rf,rfc5322Email:()=>wj,sha1_base64:()=>Mj,sha1_base64url:()=>Dj,sha1_hex:()=>Oj,sha256_base64:()=>Uj,sha256_base64url:()=>Pj,sha256_hex:()=>Rj,sha384_base64:()=>jj,sha384_base64url:()=>Zj,sha384_hex:()=>Lj,sha512_base64:()=>Vj,sha512_base64url:()=>Fj,sha512_hex:()=>qj,string:()=>hS,time:()=>pS,ulid:()=>Wy,undefined:()=>xS,unicodeEmail:()=>Yk,uppercase:()=>wS,uuid:()=>xo,uuid4:()=>Sj,uuid6:()=>bj,uuid7:()=>xj,xid:()=>Qy});var Jy=/^[cC][^\s-]{8,}$/,Ky=/^[0-9a-z]+$/,Wy=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Qy=/^[0-9a-vA-V]{20}$/,eS=/^[A-Za-z0-9]{27}$/,tS=/^[a-zA-Z0-9_-]{21}$/,nS=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,yj=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,iS=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,xo=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Sj=xo(4),bj=xo(6),xj=xo(7),rS=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_j=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,wj=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Yk=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,$j=Yk,Cj=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Ej="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function oS(){return new RegExp(Ej,"u")}var aS=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,sS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,lS=e=>{let t=Vn(e!=null?e:":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},cS=/^((25[0-5]|2[0-4][0-9]|1Line truncated
|
||||||
|
`).filter(a=>a),i=Math.min(...r.map(a=>a.length-a.trimStart().length)),o=r.map(a=>a.slice(i)).map(a=>" ".repeat(this.indent*2)+a);for(let a of o)this.content.push(a)}compile(){var o;let t=Function,n=this==null?void 0:this.args,i=[...((o=this==null?void 0:this.content)!=null?o:[""]).map(a=>` ${a}`)];return new t(...n,i.join(`
|
||||||
|
`))}};var qS={major:4,minor:3,patch:6};var oe=$("$ZodType",(e,t)=>{var i,o,a;var n;e!=null||(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=qS;let r=[...(i=e._zod.def.checks)!=null?i:[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(let s of r)for(let c of s._zod.onattach)c(e);if(r.length===0)(o=(n=e._zod).deferred)!=null||(n.deferred=[]),(a=e._zod.deferred)==null||a.push(()=>{e._zod.run=e._zod.parse});else{let s=(d,m,l)=>{let f=Pr(d),p;for(let h of m){if(h._zod.def.when){if(!h._zod.def.when(d))continue}else if(f)continue;let y=d.issues.length,x=h._zod.check(d);if(x instanceof Promise&&(l==null?void 0:l.async)===!1)throw new Jn;if(p||x instanceof Promise)p=(p!=null?p:Promise.resolve()).then(async()=>{await x,d.issues.length!==y&&(f||(f=Pr(d,y)))});else{if(d.issues.length===y)continue;f||(f=Pr(d,y))}}return p?p.then(()=>d):d},c=(d,m,l)=>{if(Pr(d))return d.aborted=!0,d;let f=s(m,r,l);if(f instanceof Promise){if(l.async===!1)throw new Jn;return f.then(p=>e._zod.parse(p,l))}return e._zod.parse(f,l)};e._zod.run=(d,m)=>{if(m.skipChecks)return e._zod.parse(d,m);if(m.direction==="backward"){let f=e._zod.parse({value:d.value,issues:[]},{...m,skipChecks:!0});return f instanceof Promise?f.then(p=>c(p,d,m)):c(f,d,m)}let l=e._zod.parse(d,m);if(l instanceof Promise){if(m.async===!1)throw new Jn;return l.then(f=>s(f,r,m))}return s(l,r,m)}}me(e,"~standard",()=>({validate:s=>{var c;try{let d=Xy(e,s);return d.success?{value:d.data}:{issues:(c=d.error)==null?void 0:c.issues}}catch(d){return Yy(e,s).then(m=>{var l;return m.success?{value:m.data}:{issues:(l=m.error)==null?void 0:l.issues}})}},vendor:"zod",version:1}))}),_o=$("$ZodString",(e,t)=>{var n,r,i;oe.init(e,t),e._zod.pattern=(i=[...(r=(n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)!=null?r:[]].pop())!=null?i:hS(e._zod.bag),e._zod.parse=(o,a)=>{if(t.coerce)try{o.value=String(o.value)}catch(s){}return typeof o.value=="string"||o.issues.push({expected:"string",code:"invalid_type",input:o.value,inst:e}),o}}),Oe=$("$ZodStringFormat",(e,t)=>{Xa.init(e,t),_o.init(e,t)}),FS=$("$ZodGUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=iS),Oe.init(e,t)}),HS=$("$ZodUUID",(e,t)=>{var n,r;if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);(n=t.pattern)!=null||(t.pattern=xo(o))}else(r=t.pattern)!=null||(t.pattern=xo());Oe.init(e,t)}),BS=$("$ZodEmail",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=rS),Oe.init(e,t)}),GS=$("$ZodURL",(e,t)=>{Oe.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),XS=$("$ZodEmoji",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=oS()),Oe.init(e,t)}),YS=$("$ZodNanoID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=tS),Oe.init(e,t)}),JS=$("$ZodCUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Jy),Oe.init(e,t)}),KS=$("$ZodCUID2",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ky),Oe.init(e,t)}),WS=$("$ZodULID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Wy),Oe.init(e,t)}),QS=$("$ZodXID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Qy),Oe.init(e,t)}),eb=$("$ZodKSUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=eS),Oe.init(e,t)}),tb=$("$ZodISODateTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=gS(t)),Oe.init(e,t)}),nb=$("$ZodISODate",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=mS),Oe.init(e,t)}),ib=$("$ZodISOTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=pS(t)),Oe.init(e,t)}),rb=$("$ZodISODuration",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=nS),Oe.init(e,t)}),ob=$("$ZodIPv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=aS),Oe.init(e,t),e._zod.bag.format="ipv4"}),ab=$("$ZodIPv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=sS),Oe.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch(i){r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),sb=$("$ZodMAC",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=lS(t.delimiter)),Oe.init(e,t),e._zod.bag.format="mac"}),lb=$("$ZodCIDRv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=cS),Oe.init(e,t)}),cb=$("$ZodCIDRv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=uS),Oe.init(e,t),e._zod.check=r=>{let i=r.value.split("/");try{if(i.length!==2)throw new Error;let[o,a]=i;if(!a)throw new Error;let s=Number(a);if(`${s}`!==a)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch(o){r.issues.push
Line truncated
|
||||||
|
if (${_}.issues.length) {
|
||||||
|
if (${C} in input) {
|
||||||
|
payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
|
||||||
|
...iss,
|
||||||
|
path: iss.path ? [${C}, ...iss.path] : [${C}]
|
||||||
|
})));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (${_}.value === undefined) {
|
||||||
|
if (${C} in input) {
|
||||||
|
newResult[${C}] = undefined;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newResult[${C}] = ${_}.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
`):p.write(`
|
||||||
|
if (${_}.issues.length) {
|
||||||
|
payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
|
||||||
|
...iss,
|
||||||
|
path: iss.path ? [${C}, ...iss.path] : [${C}]
|
||||||
|
})));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (${_}.value === undefined) {
|
||||||
|
if (${C} in input) {
|
||||||
|
newResult[${C}] = undefined;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newResult[${C}] = ${_}.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
`)}p.write("payload.value = newResult;"),p.write("return payload;");let g=p.compile();return(v,_)=>g(f,v,_)},o,a=bo,s=!Kl.jitless,d=s&&jy.value,m=t.catchall,l;e._zod.parse=(f,p)=>{l!=null||(l=r.value);let h=f.value;return a(h)?s&&d&&(p==null?void 0:p.async)===!1&&p.jitless!==!0?(o||(o=i(t.shape)),f=o(f,p),m?g1([],h,f,p,l,e):f):n(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f)}});function n1(e,t,n,r){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let i=e.filter(o=>!Pr(o));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(a=>nn(a,r,We())))}),t)}var dc=$("$ZodUnion",(e,t)=>{oe.init(e,t),me(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),me(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),me(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),me(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){let i=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>ec(o.source)).join("|")})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(n)return r(i,o);let a=!1,s=[];for(let c of t.options){let d=c._zod.run({value:i.value,issues:[]},o);if(d instanceof Promise)s.push(d),a=!0;else{if(d.issues.length===0)return d;s.push(d)}}return a?Promise.all(s).then(c=>n1(c,i,e,o)):n1(s,i,e,o)}});function i1(e,t,n,r){let i=e.filter(o=>o.issues.length===0);return i.length===1?(t.value=i[0].value,t):(i.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(a=>nn(a,r,We())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1}),t)}var zb=$("$ZodXor",(e,t)=>{dc.init(e,t),t.inclusive=!1;let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(n)return r(i,o);let a=!1,s=[];for(let c of t.options){let d=c._zod.run({value:i.value,issues:[]},o);d instanceof Promise?(s.push(d),a=!0):s.push(d)}return a?Promise.all(s).then(c=>i1(c,i,e,o)):i1(s,i,e,o)}}),Tb=$("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,dc.init(e,t);let n=e._zod.parse;me(e._zod,"propValues",()=>{let i={};for(let o of t.options){let a=o._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let[s,c]of Object.entries(a)){i[s]||(i[s]=new Set);for(let d of c)i[s].add(d)}}return i});let r=qa(()=>{var a;let i=t.options,o=new Map;for(let s of i){let c=(a=s._zod.propValues)==null?void 0:a[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let d of c){if(o.has(d))throw new Error(`Duplicate discriminator value "${String(d)}"`);o.set(d,s)}}return o});e._zod.parse=(i,o)=>{let a=i.value;if(!bo(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),i;let s=r.value.get(a==null?void 0:a[t.discriminator]);return s?s._zod.run(i,o):t.unionFallback?n(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),i)}}),Ib=$("$ZodIntersection",(e,t)=>{oe.init(e,t),e._zod.parse=(n,r)=>{let i=n.value,o=t.left._zod.run({value:i,issues:[]},r),a=t.right._zod.run({value:i,issues:[]},r);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([c,d])=>r1(n,c,d)):r1(n,o,a)}});function VS(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ur(e)&&Ur(t)){let n=Object.keys(t),r=Object.keys(e).filter(o=>n.indexOf(o)!==-1),i={...e,...t};for(let o of r){let a=VS(e[o],t[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};i[o]=a.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=t[r],a=VS(i,o);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function r1(e,t,n){let r=new Map,i;for(let s of t.issues)if(s.code==="unrecognized_keys"){i!=null||(i=s);for(let c of s.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(s);for(let s of n.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(s);let o=[...r].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(o.length&&i&&e.issues.push({...i,keys:o}),Pr(e))return e;let a=VS(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var Bf=$("$ZodTuple",(e,t)=>{oe.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];let a=[],
Line truncated
|
||||||
|
|
||||||
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let m of e.seen.entries()){let l=m[1];if(t===m[0]){o(m);continue}if(e.external){let p=(c=e.external.registry.get(m[0]))==null?void 0:c.id;if(t!==m[0]&&p){o(m);continue}}if((d=e.metadataRegistry.get(m[0]))==null?void 0:d.id){o(m);continue}if(l.cycle){o(m);continue}if(l.count>1&&e.reused==="ref"){o(m);continue}}}function Vr(e,t){var a,s,c,d,m;let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=l=>{var S,g,b;let f=e.seen.get(l);if(f.ref===null)return;let p=(S=f.def)!=null?S:f.schema,h={...p},y=f.ref;if(f.ref=null,y){r(y);let v=e.seen.get(y),_=v.schema;if(_.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=(g=p.allOf)!=null?g:[],p.allOf.push(_)):Object.assign(p,_),Object.assign(p,h),l._zod.parent===y)for(let E in p)E==="$ref"||E==="allOf"||E in h||delete p[E];if(_.$ref&&v.def)for(let E in p)E==="$ref"||E==="allOf"||E in v.def&&JSON.stringify(p[E])===JSON.stringify(v.def[E])&&delete p[E]}let x=l._zod.parent;if(x&&x!==y){r(x);let v=e.seen.get(x);if(v!=null&&v.schema.$ref&&(p.$ref=v.schema.$ref,v.def))for(let _ in p)_==="$ref"||_==="allOf"||_ in v.def&&JSON.stringify(p[_])===JSON.stringify(v.def[_])&&delete p[_]}e.override({zodSchema:l,jsonSchema:p,path:(b=f.path)!=null?b:[]})};for(let l of[...e.seen.entries()].reverse())r(l[0]);let i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){let l=(s=e.external.registry.get(t))==null?void 0:s.id;if(!l)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(l)}Object.assign(i,(c=n.def)!=null?c:n.schema);let o=(m=(d=e.external)==null?void 0:d.defs)!=null?m:{};for(let l of e.seen.entries()){let f=l[1];f.def&&f.defId&&(o[f.defId]=f.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{let l=JSON.parse(JSON.stringify(i));return Object.defineProperty(l,"~standard",{value:{...t["~standard"],jsonSchema:{input:cs(t,"input",e.processors),output:cs(t,"output",e.processors)}},enumerable:!1,writable:!1}),l}catch(l){throw new Error("Error converting schema to JSON.")}}function Ht(e,t){let n=t!=null?t:{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Ht(r.element,n);if(r.type==="set")return Ht(r.valueType,n);if(r.type==="lazy")return Ht(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Ht(r.innerType,n);if(r.type==="intersection")return Ht(r.left,n)||Ht(r.right,n);if(r.type==="record"||r.type==="map")return Ht(r.keyType,n)||Ht(r.valueType,n);if(r.type==="pipe")return Ht(r.in,n)||Ht(r.out,n);if(r.type==="object"){for(let i in r.shape)if(Ht(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(let i of r.options)if(Ht(i,n))return!0;return!1}if(r.type==="tuple"){for(let i of r.items)if(Ht(i,n))return!0;return!!(r.rest&&Ht(r.rest,n))}return!1}var jx=(e,t={})=>n=>{let r=Zr({...n,processors:t});return $e(e,r),qr(r,e),Vr(r,e)},cs=(e,t,n={})=>r=>{let{libraryOptions:i,target:o}=r!=null?r:{},a=Zr({...i!=null?i:{},target:o,io:t,processors:n});return $e(e,a),qr(a,e),Vr(a,e)};var cZ={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Zx=(e,t,n,r)=>{var m;let i=n;i.type="string";let{minimum:o,maximum:a,format:s,patterns:c,contentEncoding:d}=e._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof a=="number"&&(i.maxLength=a),s&&(i.format=(m=cZ[s])!=null?m:s,i.format===""&&delete i.format,s==="time"&&delete i.format),d&&(i.contentEncoding=d),c&&c.size>0){let l=[...c];l.length===1?i.pattern=l[0].source:l.length>1&&(i.allOf=[...l.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},qx=(e,t,n,r)=>{let i=n,{minimum:o,maximum:a,format:s,multipleOf:c,exclusiveMaximum:d,exclusiveMinimum:m}=e._zod.bag;typeof s=="string"&&s.includes("int")?i.type="integer":i.type="number",typeof m=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=m,i.exclusiveMinimum=!0):i.exclusiveMinimum=m),typeof o=="number"&&(i.minimum=o,typeof m=="number"&&t.target!=="draft-04"&&(m>=o?delete i.minimum:delete i.exclusiveMinimum)),typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=d,i.exclusiveMaximum=!0):i.exclusiveMaximum=d),typeof a=="number"&&(i.maximum=a,typeof d=="number"&&t.target!=="draft-04"&&(d<=a?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},Vx=(e,t,n,r)=>{n.type="boolean"},Fx=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Hx=(e,t,n,rLine truncated
|
||||||
|
`);s=l.pop()||"";for(let f of l){let p=f.trim();if(p)try{let h=JSON.parse(p);a.enqueue(h)}catch(h){console.error("Failed to parse JSON message:",p,h)}}}}finally{c.releaseLock(),a.close()}}}),o=new WritableStream({async write(a){let s=JSON.stringify(a)+`
|
||||||
|
`,c=e.getWriter();try{await c.write(n.encode(s))}finally{c.releaseLock()}}});return{readable:i,writable:o}}var an,WO=class{constructor(t,n){pt(this,an,void 0);let r=t(this),i=async(a,s)=>{switch(a){case Fe.initialize:{let c=Pw.parse(s);return r.initialize(c)}case Fe.session_new:{let c=Uw.parse(s);return r.newSession(c)}case Fe.session_load:{if(!r.loadSession)throw ze.methodNotFound(a);let c=Fw.parse(s);return r.loadSession(c)}case Fe.session_list:{if(!r.unstable_listSessions)throw ze.methodNotFound(a);let c=Dw.parse(s);return r.unstable_listSessions(c)}case Fe.session_fork:{if(!r.unstable_forkSession)throw ze.methodNotFound(a);let c=qw.parse(s);return r.unstable_forkSession(c)}case Fe.session_resume:{if(!r.unstable_resumeSession)throw ze.methodNotFound(a);let c=Gw.parse(s);return r.unstable_resumeSession(c)}case Fe.session_set_mode:{if(!r.setSessionMode)throw ze.methodNotFound(a);let c=Yw.parse(s),d=await r.setSessionMode(c);return d!=null?d:{}}case Fe.authenticate:{let c=Mw.parse(s),d=await r.authenticate(c);return d!=null?d:{}}case Fe.session_prompt:{let c=Qw.parse(s);return r.prompt(c)}case Fe.session_set_model:{if(!r.unstable_setSessionModel)throw ze.methodNotFound(a);let c=Jw.parse(s),d=await r.unstable_setSessionModel(c);return d!=null?d:{}}case Fe.session_set_config_option:{if(!r.setSessionConfigOption)throw ze.methodNotFound(a);let c=Xw.parse(s);return r.setSessionConfigOption(c)}default:if(r.extMethod)return r.extMethod(a,s);throw ze.methodNotFound(a)}},o=async(a,s)=>{switch(a){case Fe.session_cancel:{let c=jw.parse(s);return r.cancel(c)}default:if(r.extNotification)return r.extNotification(a,s);throw ze.methodNotFound(a)}};Fn(this,an,new pp(i,o,n))}async sessionUpdate(t){return await ie(this,an).sendNotification(yt.session_update,t)}async requestPermission(t){return await ie(this,an).sendRequest(yt.session_request_permission,t)}async readTextFile(t){return await ie(this,an).sendRequest(yt.fs_read_text_file,t)}async writeTextFile(t){var n;return(n=await ie(this,an).sendRequest(yt.fs_write_text_file,t))!=null?n:{}}async createTerminal(t){let n=await ie(this,an).sendRequest(yt.terminal_create,t);return new r$(n.terminalId,t.sessionId,ie(this,an))}async extMethod(t,n){return await ie(this,an).sendRequest(t,n)}async extNotification(t,n){return await ie(this,an).sendNotification(t,n)}get signal(){return ie(this,an).signal}get closed(){return ie(this,an).closed}};an=new WeakMap;var Fr,Hr,r$=class{constructor(t,n,r){qc(this,"id");pt(this,Fr,void 0);pt(this,Hr,void 0);this.id=t,Fn(this,Fr,n),Fn(this,Hr,r)}async currentOutput(){return await ie(this,Hr).sendRequest(yt.terminal_output,{sessionId:ie(this,Fr),terminalId:this.id})}async waitForExit(){return await ie(this,Hr).sendRequest(yt.terminal_wait_for_exit,{sessionId:ie(this,Fr),terminalId:this.id})}async kill(){var t;return(t=await ie(this,Hr).sendRequest(yt.terminal_kill,{sessionId:ie(this,Fr),terminalId:this.id}))!=null?t:{}}async release(){var t;return(t=await ie(this,Hr).sendRequest(yt.terminal_release,{sessionId:ie(this,Fr),terminalId:this.id}))!=null?t:{}}async[Symbol.asyncDispose](){await this.release()}};Fr=new WeakMap,Hr=new WeakMap;var dt,mp=class{constructor(t,n){pt(this,dt,void 0);let r=t(this),i=async(a,s)=>{var c,d,m,l,f,p,h;switch(a){case yt.fs_write_text_file:{let y=i$.parse(s);return(c=r.writeTextFile)==null?void 0:c.call(r,y)}case yt.fs_read_text_file:{let y=Hw.parse(s);return(d=r.readTextFile)==null?void 0:d.call(r,y)}case yt.session_request_permission:{let y=e$.parse(s);return r.requestPermission(y)}case yt.terminal_create:{let y=Zw.parse(s);return(m=r.createTerminal)==null?void 0:m.call(r,y)}case yt.terminal_output:{let y=Kw.parse(s);return(l=r.terminalOutput)==null?void 0:l.call(r,y)}case yt.terminal_release:{let y=Bw.parse(s),x=await((f=r.releaseTerminal)==null?void 0:f.call(r,y));return x!=null?x:{}}case yt.terminal_wait_for_exit:{let y=n$.parse(s);return(p=r.waitForTerminalExit)==null?void 0:p.call(r,y)}case yt.terminal_kill:{let y=Vw.parse(s),x=await((h=r.killTerminal)==null?void 0:h.call(r,y));return x!=null?x:{}}default:if(r.extMethod)return r.extMethod(a,s);throw ze.methodNotFound(a)}},o=async(a,s)=>{switch(a){case yt.session_update:{let c=t$.parse(s);return r.sessionUpdate(c)}default:if(r.extNotification)return r.extNotification(a,s);throw ze.methodNotFound(a)}};Fn(this,dt,new pp(i,o,n))}async initialize(t){return await ie(this,dt).sendRequest(Fe.initialize,t)}async newSession(t){return await ie(this,dt).sendRequest(Fe.session_new,t)}async loadSession(t){var n;return(n=await ie(this,dt).sendRequest(Fe.session_load,t))!=null?n:{}}async unstable_forkSession(t){return await ie(this,dt).sendRequest(Fe.session_fork,t)}async unstable_listSessions(t){return await ie(this,dt).sendRequest(Fe.session_list,t)}async unstable_resumeSession(t){return await ie(this,dt).sendRequest(Fe.session_resume,t)}async setSessionMode(t){var n;return(n=await ie(this,dt).sendRequest(Fe.session_set_mode,t))!=null?n:{}}async unstable_setSessionModel(t){va
Line truncated
|
||||||
|
/*! Bundled license information:
|
||||||
|
|
||||||
|
react/cjs/react.production.js:
|
||||||
|
(**
|
||||||
|
* @license React
|
||||||
|
* react.production.js
|
||||||
|
*
|
||||||
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*)
|
||||||
|
|
||||||
|
scheduler/cjs/scheduler.production.js:
|
||||||
|
(**
|
||||||
|
* @license React
|
||||||
|
* scheduler.production.js
|
||||||
|
*
|
||||||
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*)
|
||||||
|
|
||||||
|
react-dom/cjs/react-dom.production.js:
|
||||||
|
(**
|
||||||
|
* @license React
|
||||||
|
* react-dom.production.js
|
||||||
|
*
|
||||||
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*)
|
||||||
|
|
||||||
|
react-dom/cjs/react-dom-client.production.js:
|
||||||
|
(**
|
||||||
|
* @license React
|
||||||
|
* react-dom-client.production.js
|
||||||
|
*
|
||||||
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*)
|
||||||
|
|
||||||
|
react/cjs/react-jsx-runtime.production.js:
|
||||||
|
(**
|
||||||
|
* @license React
|
||||||
|
* react-jsx-runtime.production.js
|
||||||
|
*
|
||||||
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*)
|
||||||
|
*/
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"id":"agent-client","name":"Agent Client","version":"0.10.2","minAppVersion":"0.15.0","description":"Chat with AI agents via the Agent Client Protocol directly from your vault.","author":"RAIT-09","authorUrl":"https://github.com/RAIT-09","fundingUrl":"https://www.buymeacoffee.com/rait09","isDesktopOnly":true}
|
||||||