dialoghelper 0.0.44__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ __version__ = "0.0.44"
2
+ from .core import *
@@ -0,0 +1,51 @@
1
+ # Autogenerated by nbdev
2
+
3
+ d = { 'settings': { 'branch': 'main',
4
+ 'doc_baseurl': '/dialoghelper',
5
+ 'doc_host': 'https://AnswerDotAI.github.io',
6
+ 'git_url': 'https://github.com/AnswerDotAI/dialoghelper',
7
+ 'lib_path': 'dialoghelper'},
8
+ 'syms': { 'dialoghelper.capture': { 'dialoghelper.capture._capture_screen': ('capture.html#_capture_screen', 'dialoghelper/capture.py'),
9
+ 'dialoghelper.capture.capture_screen': ('capture.html#capture_screen', 'dialoghelper/capture.py'),
10
+ 'dialoghelper.capture.capture_tool': ('capture.html#capture_tool', 'dialoghelper/capture.py'),
11
+ 'dialoghelper.capture.setup_share': ('capture.html#setup_share', 'dialoghelper/capture.py'),
12
+ 'dialoghelper.capture.start_share': ('capture.html#start_share', 'dialoghelper/capture.py')},
13
+ 'dialoghelper.core': { 'dialoghelper.core._add_msg_unsafe': ('core.html#_add_msg_unsafe', 'dialoghelper/core.py'),
14
+ 'dialoghelper.core._find_frame_dict': ('core.html#_find_frame_dict', 'dialoghelper/core.py'),
15
+ 'dialoghelper.core._umsg': ('core.html#_umsg', 'dialoghelper/core.py'),
16
+ 'dialoghelper.core.add_html': ('core.html#add_html', 'dialoghelper/core.py'),
17
+ 'dialoghelper.core.add_msg': ('core.html#add_msg', 'dialoghelper/core.py'),
18
+ 'dialoghelper.core.add_scr': ('core.html#add_scr', 'dialoghelper/core.py'),
19
+ 'dialoghelper.core.add_styles': ('core.html#add_styles', 'dialoghelper/core.py'),
20
+ 'dialoghelper.core.ast_grep': ('core.html#ast_grep', 'dialoghelper/core.py'),
21
+ 'dialoghelper.core.ast_py': ('core.html#ast_py', 'dialoghelper/core.py'),
22
+ 'dialoghelper.core.call_endp': ('core.html#call_endp', 'dialoghelper/core.py'),
23
+ 'dialoghelper.core.curr_dialog': ('core.html#curr_dialog', 'dialoghelper/core.py'),
24
+ 'dialoghelper.core.del_msg': ('core.html#del_msg', 'dialoghelper/core.py'),
25
+ 'dialoghelper.core.event_get': ('core.html#event_get', 'dialoghelper/core.py'),
26
+ 'dialoghelper.core.fc_tool_info': ('core.html#fc_tool_info', 'dialoghelper/core.py'),
27
+ 'dialoghelper.core.find_dname': ('core.html#find_dname', 'dialoghelper/core.py'),
28
+ 'dialoghelper.core.find_msg_id': ('core.html#find_msg_id', 'dialoghelper/core.py'),
29
+ 'dialoghelper.core.find_msgs': ('core.html#find_msgs', 'dialoghelper/core.py'),
30
+ 'dialoghelper.core.find_var': ('core.html#find_var', 'dialoghelper/core.py'),
31
+ 'dialoghelper.core.fire_event': ('core.html#fire_event', 'dialoghelper/core.py'),
32
+ 'dialoghelper.core.gist_file': ('core.html#gist_file', 'dialoghelper/core.py'),
33
+ 'dialoghelper.core.iife': ('core.html#iife', 'dialoghelper/core.py'),
34
+ 'dialoghelper.core.import_gist': ('core.html#import_gist', 'dialoghelper/core.py'),
35
+ 'dialoghelper.core.import_string': ('core.html#import_string', 'dialoghelper/core.py'),
36
+ 'dialoghelper.core.is_usable_tool': ('core.html#is_usable_tool', 'dialoghelper/core.py'),
37
+ 'dialoghelper.core.load_gist': ('core.html#load_gist', 'dialoghelper/core.py'),
38
+ 'dialoghelper.core.mk_toollist': ('core.html#mk_toollist', 'dialoghelper/core.py'),
39
+ 'dialoghelper.core.msg_idx': ('core.html#msg_idx', 'dialoghelper/core.py'),
40
+ 'dialoghelper.core.msg_insert_line': ('core.html#msg_insert_line', 'dialoghelper/core.py'),
41
+ 'dialoghelper.core.msg_replace_lines': ('core.html#msg_replace_lines', 'dialoghelper/core.py'),
42
+ 'dialoghelper.core.msg_str_replace': ('core.html#msg_str_replace', 'dialoghelper/core.py'),
43
+ 'dialoghelper.core.msg_strs_replace': ('core.html#msg_strs_replace', 'dialoghelper/core.py'),
44
+ 'dialoghelper.core.pop_data': ('core.html#pop_data', 'dialoghelper/core.py'),
45
+ 'dialoghelper.core.read_msg': ('core.html#read_msg', 'dialoghelper/core.py'),
46
+ 'dialoghelper.core.run_msg': ('core.html#run_msg', 'dialoghelper/core.py'),
47
+ 'dialoghelper.core.set_var': ('core.html#set_var', 'dialoghelper/core.py'),
48
+ 'dialoghelper.core.tool_info': ('core.html#tool_info', 'dialoghelper/core.py'),
49
+ 'dialoghelper.core.update_msg': ('core.html#update_msg', 'dialoghelper/core.py'),
50
+ 'dialoghelper.core.url2note': ('core.html#url2note', 'dialoghelper/core.py')},
51
+ 'dialoghelper.db_dc': {}}}
@@ -0,0 +1,45 @@
1
+ """Screen Capture."""
2
+
3
+ # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/01_capture.ipynb.
4
+
5
+ # %% auto 0
6
+ __all__ = ['setup_share', 'start_share', 'capture_screen', 'capture_tool']
7
+
8
+ # %% ../nbs/01_capture.ipynb
9
+ from .core import *
10
+ from fastcore.all import *
11
+ from fasthtml.common import Div,Script
12
+ from httpx import post as xpost
13
+ from importlib import resources
14
+ from lisette.core import *
15
+ import PIL.Image
16
+
17
+ import base64,json,time
18
+
19
+ # %% ../nbs/01_capture.ipynb
20
+ def setup_share():
21
+ "Setup screen sharing"
22
+ iife((resources.files('dialoghelper')/'screenshot.js').read_text())
23
+
24
+ # %% ../nbs/01_capture.ipynb
25
+ def start_share(): fire_event('shareScreen')
26
+
27
+ # %% ../nbs/01_capture.ipynb
28
+ def _capture_screen(timeout=15):
29
+ d = event_get('captureScreen', timeout)
30
+ if 'img_data' in d: return d.img_data
31
+ else: raise Exception(f'Capture failed: {d.error}')
32
+
33
+ # %% ../nbs/01_capture.ipynb
34
+ def capture_screen(timeout=15):
35
+ "Capture the screen as a PIL image."
36
+ res = _capture_screen()
37
+ data = base64.b64decode(res.split(',')[1])
38
+ return PIL.Image.open(BytesIO(data))
39
+
40
+ # %% ../nbs/01_capture.ipynb
41
+ def capture_tool(timeout:int=15):
42
+ "Capture the screen. Re-call this function to get the most recent screenshot, as needed. Use default timeout where possible"
43
+ try: d = _capture_screen(timeout)
44
+ except Exception as e: return f'Capture failed: {e}'
45
+ return ToolResponse([{'type': 'image_url', 'image_url': d}])
dialoghelper/core.py ADDED
@@ -0,0 +1,445 @@
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['md_cls_d', 'dh_settings', 'Placements', 'empty', 'add_styles', 'find_var', 'set_var', 'call_endp', 'find_dname',
5
+ 'find_msg_id', 'curr_dialog', 'msg_idx', 'add_scr', 'iife', 'pop_data', 'fire_event', 'event_get',
6
+ 'find_msgs', 'add_html', 'read_msg', 'add_msg', 'del_msg', 'update_msg', 'run_msg', 'url2note', 'ast_py',
7
+ 'ast_grep', 'msg_insert_line', 'msg_str_replace', 'msg_strs_replace', 'msg_replace_lines', 'load_gist',
8
+ 'gist_file', 'import_string', 'is_usable_tool', 'mk_toollist', 'import_gist', 'tool_info', 'fc_tool_info']
9
+
10
+ # %% ../nbs/00_core.ipynb
11
+ import json,importlib,linecache,re,inspect,uuid
12
+ from typing import Dict
13
+ from tempfile import TemporaryDirectory
14
+ from ipykernel_helper import *
15
+ from dataclasses import dataclass
16
+ from fastcore.xml import to_xml
17
+
18
+ from fastcore.utils import *
19
+ from fastcore.meta import delegates
20
+ from ghapi.all import *
21
+ from fastlite import *
22
+ from fastcore.xtras import asdict
23
+ from inspect import currentframe,Parameter,signature
24
+ from httpx import get as xget, post as xpost
25
+ from IPython.display import display,Markdown
26
+ from monsterui.all import franken_class_map,apply_classes
27
+ from fasthtml.common import Safe,Script,Div
28
+
29
+ # %% ../nbs/00_core.ipynb
30
+ md_cls_d = {
31
+ **{f'h{i}': f'uk-h{i}' for i in range(1,5)},
32
+ 'a': "uk-link",
33
+ 'blockquote': "uk-blockquote",
34
+ 'hr':'uk-divider-icon',
35
+ 'table':'uk-table uk-table-sm uk-table-middle uk-table-divider border [&_tr]:divide-x w-[80%] mx-auto',
36
+ 'ol': 'uk-list uk-list-decimal space-y-0',
37
+ 'ul': 'uk-list uk-list-bullet space-y-0',
38
+ 'p': 'leading-tight',
39
+ 'li': 'leading-tight',
40
+ 'pre': '', 'pre code': '',
41
+ 'code': 'tracking-tight'
42
+ }
43
+
44
+ def add_styles(s:str, cls_map:dict=None):
45
+ "Add solveit styles to `s`"
46
+ return Safe(apply_classes(s, class_map=cls_map or md_cls_d))
47
+
48
+ # %% ../nbs/00_core.ipynb
49
+ def _find_frame_dict(var:str):
50
+ "Find the dict (globals or locals) containing var"
51
+ frame = currentframe().f_back.f_back
52
+ while frame:
53
+ if var in frame.f_globals: return frame.f_globals
54
+ frame = frame.f_back
55
+ raise ValueError(f"Could not find {var} in any scope")
56
+
57
+ def find_var(var:str):
58
+ "Search for var in all frames of the call stack"
59
+ return _find_frame_dict(var)[var]
60
+
61
+ def set_var(var:str, val):
62
+ "Set var to val after finding it in all frames of the call stack"
63
+ _find_frame_dict(var)[var] = val
64
+
65
+ # %% ../nbs/00_core.ipynb
66
+ dh_settings = {'port':5001}
67
+
68
+ def call_endp(path, dname='', json=False, raiseex=False, **data):
69
+ if not dname: dname = find_dname()
70
+ data['dlg_name'] = dname
71
+ res = xpost(f'http://localhost:{dh_settings["port"]}/{path}', data=data)
72
+ if raiseex: res.raise_for_status()
73
+ try: return res.json() if json else res.text
74
+ except Exception as e: return str(e)
75
+
76
+ # %% ../nbs/00_core.ipynb
77
+ def find_dname():
78
+ "Get the message id by searching the call stack for __dialog_id."
79
+ return find_var('__dialog_name')
80
+
81
+ # %% ../nbs/00_core.ipynb
82
+ def find_msg_id():
83
+ "Get the message id by searching the call stack for __msg_id."
84
+ return find_var('__msg_id')
85
+
86
+ # %% ../nbs/00_core.ipynb
87
+ def curr_dialog(
88
+ with_messages:bool=False, # Include messages as well?
89
+ dname:str='' # Running dialog to get info for; defaults to current dialog
90
+ ):
91
+ "Get the current dialog info."
92
+ res = call_endp('curr_dialog_', dname, json=True, with_messages=with_messages)
93
+ if res: return {'name': res['name'], 'mode': res['mode']}
94
+
95
+ # %% ../nbs/00_core.ipynb
96
+ def msg_idx(
97
+ msgid=None, # Message id to find (defaults to current message)
98
+ dname:str='' # Running dialog to get info for; defaults to current dialog
99
+ ):
100
+ "Get absolute index of message in dialog."
101
+ if not msgid: msgid = find_msg_id()
102
+ return call_endp('msg_idx_', dname, json=True, msgid=msgid)['msgid']
103
+
104
+ # %% ../nbs/00_core.ipynb
105
+ def add_scr(scr, oob='beforeend:#js-script'):
106
+ "Swap a script element to the end of the js-script element"
107
+ if isinstance(scr,str): scr = Script(scr)
108
+ add_html(Div(scr, hx_swap_oob=oob))
109
+
110
+ # %% ../nbs/00_core.ipynb
111
+ def iife(code: str) -> str:
112
+ "Wrap javascript code string in an IIFE and execute it via `add_html`"
113
+ add_scr(f'''
114
+ (async () => {{
115
+ {code}
116
+ }})();
117
+ ''')
118
+
119
+ # %% ../nbs/00_core.ipynb
120
+ def pop_data(idx, timeout=15):
121
+ url = 'http://localhost:5001/pop_data_blocking_'
122
+ return dict2obj(xpost(url, data={'data_id': idx, 'timeout': timeout}).json())
123
+
124
+ # %% ../nbs/00_core.ipynb
125
+ def fire_event(evt:str, data=None):
126
+ params = f"'{evt}'"
127
+ if data is not None: params += f", {json.dumps(data)}"
128
+ add_html(Script(f"htmx.trigger(document.body, {params});", id='js-event', hx_swap_oob='true'))
129
+
130
+ # %% ../nbs/00_core.ipynb
131
+ def event_get(evt:str, timeout=15, data=None):
132
+ "Call `fire_event` and then `pop_data` to get a response"
133
+ idx = uuid.uuid4()
134
+ if not data: data = {}
135
+ data['idx'] = str(idx)
136
+ fire_event(evt, data=data)
137
+ return pop_data(idx, timeout)
138
+
139
+ # %% ../nbs/00_core.ipynb
140
+ def find_msgs(
141
+ re_pattern:str='', # Optional regex to search for (re.DOTALL+re.MULTILINE is used)
142
+ msg_type:str=None, # optional limit by message type ('code', 'note', or 'prompt')
143
+ limit:int=None, # Optionally limit number of returned items
144
+ include_output:bool=True, # Include output in returned dict?
145
+ dname:str='' # Running dialog to get info for; defaults to current dialog
146
+ ):
147
+ "Find `list[dict]` of messages in current specific dialog that contain the given information. To refer to a message found later, use its `id` field."
148
+ res = call_endp('find_msgs_', dname, json=True, re_pattern=re_pattern, msg_type=msg_type, limit=limit)['msgs']
149
+ if not include_output:
150
+ for o in res: o.pop('output', None)
151
+ return res
152
+
153
+ # %% ../nbs/00_core.ipynb
154
+ def add_html(
155
+ content:str, # The HTML to send to the client (generally should include hx-swap-oob)
156
+ dname:str='' # Running dialog to get info for; defaults to current dialog
157
+ ):
158
+ "Send HTML to the browser to be swapped into the DOM"
159
+ call_endp('add_html_', dname, content=to_xml(content))
160
+
161
+ # %% ../nbs/00_core.ipynb
162
+ Placements = str_enum('Placements', 'add_after', 'add_before', 'at_start', 'at_end')
163
+
164
+ # %% ../nbs/00_core.ipynb
165
+ def read_msg(
166
+ n:int=-1, # Message index (if relative, +ve is downwards)
167
+ relative:bool=True, # Is `n` relative to current message (True) or absolute (False)?
168
+ msgid:str=None, # Message id to find (defaults to current message)
169
+ view_range:list[int,int]=None, # Optional 1-indexed (start, end) line range for files, end=-1 for EOF
170
+ nums:bool=False, # Whether to show line numbers
171
+ dname:str='' # Running dialog to get info for; defaults to current dialog
172
+ ):
173
+ """Get the message indexed in the current dialog.
174
+ - To get the exact message use `n=0` and `relative=True` together with `msgid`.
175
+ - To get a relative message use `n` (relative position index).
176
+ - To get the nth message use `n` with `relative=False`, e.g `n=0` first message, `n=-1` last message."""
177
+ if relative and not msgid: msgid = find_msg_id()
178
+ data = dict(n=n, relative=relative, msgid=msgid)
179
+ if view_range: data['view_range'] = view_range # None gets converted to '' so we avoid passing it to use the p.default
180
+ if nums: data['nums'] = nums
181
+ return call_endp('read_msg_', dname, json=True, **data)
182
+
183
+ # %% ../nbs/00_core.ipynb
184
+ def add_msg(
185
+ content:str, # Content of the message (i.e the message prompt, code, or note text)
186
+ placement:str='add_after', # Can be 'add_after', 'add_before', 'at_start', 'at_end'
187
+ msgid:str=None, # id of message that placement is relative to (if None, uses current message)
188
+ msg_type: str='note', # Message type, can be 'code', 'note', or 'prompt'
189
+ output:str='', # Prompt/code output; Code outputs must be .ipynb-compatible JSON array
190
+ time_run: str | None = '', # When was message executed
191
+ is_exported: int | None = 0, # Export message to a module?
192
+ skipped: int | None = 0, # Hide message from prompt?
193
+ i_collapsed: int | None = 0, # Collapse input?
194
+ o_collapsed: int | None = 0, # Collapse output?
195
+ heading_collapsed: int | None = 0, # Collapse heading section?
196
+ pinned: int | None = 0, # Pin to context?
197
+ dname:str='' # Running dialog to get info for; defaults to current dialog
198
+ ):
199
+ "Add/update a message to the queue to show after code execution completes."
200
+ if placement not in ('at_start','at_end') and not msgid: msgid = find_msg_id()
201
+ res = call_endp(
202
+ 'add_relative_', dname, content=content, placement=placement, msgid=msgid, msg_type=msg_type, output=output,
203
+ time_run=time_run, is_exported=is_exported, skipped=skipped, pinned=pinned,
204
+ i_collapsed=i_collapsed, o_collapsed=o_collapsed, heading_collapsed=heading_collapsed)
205
+ set_var('__msg_id', res)
206
+ return res
207
+
208
+ # %% ../nbs/00_core.ipynb
209
+ def del_msg(
210
+ msgid:str=None, # id of message to delete
211
+ dname:str='' # Running dialog to get info for; defaults to current dialog
212
+ ):
213
+ "Delete a message from the dialog."
214
+ call_endp('rm_msg_', dname, raiseex=True, msid=msgid)
215
+
216
+ # %% ../nbs/00_core.ipynb
217
+ @delegates(add_msg)
218
+ def _add_msg_unsafe(
219
+ content:str, # Content of the message (i.e the message prompt, code, or note text)
220
+ placement:str='add_after', # Can be 'add_after', 'add_before', 'at_start', 'at_end'
221
+ msgid:str=None, # id of message that placement is relative to (if None, uses current message)
222
+ run:bool=False, # For prompts, send it to the AI; for code, execute it (*DANGEROUS -- be careful of what you run!)
223
+ dname:str='', # Running dialog to get info for; defaults to current dialog
224
+ **kwargs
225
+ ):
226
+ """Add/update a message to the queue to show after code execution completes, and optionally run it. Be sure to pass a `sid` (stable id) not a `mid` (which is used only for sorting, and can change).
227
+ *WARNING*--This can execute arbitrary code, so check carefully what you run!--*WARNING"""
228
+ if placement not in ('at_start','at_end') and not msgid: msgid = find_msg_id()
229
+ res = call_endp(
230
+ 'add_relative_', dname, content=content, placement=placement, msgid=msgid, run=run, **kwargs)
231
+ set_var('__msg_id', res)
232
+ return res
233
+
234
+ # %% ../nbs/00_core.ipynb
235
+ def _umsg(
236
+ content:str|None=None, # Content of the message (i.e the message prompt, code, or note text)
237
+ msg_type: str|None = None, # Message type, can be 'code', 'note', or 'prompt'
238
+ output:str|None = None, # Prompt/code output; Code outputs must be .ipynb-compatible JSON array
239
+ time_run: str | None = None, # When was message executed
240
+ is_exported: int | None = None, # Export message to a module?
241
+ skipped: int | None = None, # Hide message from prompt?
242
+ i_collapsed: int | None = None, # Collapse input?
243
+ o_collapsed: int | None = None, # Collapse output?
244
+ heading_collapsed: int | None = None, # Collapse heading section?
245
+ pinned: int | None = None # Pin to context?
246
+ ): ...
247
+
248
+ # %% ../nbs/00_core.ipynb
249
+ @delegates(_umsg)
250
+ def update_msg(
251
+ msgid:str=None, # id of message to update (if None, uses current message)
252
+ msg:Optional[Dict]=None, # Dictionary of field keys/values to update
253
+ dname:str='', # Running dialog to get info for; defaults to current dialog
254
+ **kwargs):
255
+ """Update an existing message. Provide either `msg` OR field key/values to update.
256
+ - Use `content` param to update contents.
257
+ - Only include parameters to update--missing ones will be left unchanged."""
258
+ if not msgid and not msg: raise TypeError("update_msg needs either a dict message or `msgid=`")
259
+ res = call_endp('update_msg_', dname, msgid=msgid, **kwargs)
260
+ set_var('__msg_id', res)
261
+ return res
262
+
263
+ # %% ../nbs/00_core.ipynb
264
+ def run_msg(
265
+ msgid:str=None, # id of message to execute
266
+ dname:str='' # Running dialog to get info for; defaults to current dialog
267
+ ):
268
+ "Adds a message to the run queue. Use read_msg to see the output once it runs."
269
+ return call_endp('add_runq_', dname, msgid=msgid, api=True)
270
+
271
+ # %% ../nbs/00_core.ipynb
272
+ def url2note(
273
+ url:str, # URL to read
274
+ extract_section:bool=True, # If url has an anchor, return only that section
275
+ selector:str=None # Select section(s) using BeautifulSoup.select (overrides extract_section)
276
+ ):
277
+ "Read URL as markdown, and add a note below current message with the result"
278
+ res = read_url(url, as_md=True, extract_section=extract_section, selector=selector)
279
+ return add_msg(res)
280
+
281
+ # %% ../nbs/00_core.ipynb
282
+ def ast_py(code:str):
283
+ "Get an SgRoot root node for python `code`"
284
+ from ast_grep_py import SgRoot
285
+ return SgRoot(code, "python").root()
286
+
287
+ # %% ../nbs/00_core.ipynb
288
+ def ast_grep(
289
+ pattern:str, # ast-grep pattern to search
290
+ path=".", # path to recursively search for files
291
+ lang="python" # language to search/scan
292
+ ):
293
+ "Use the `ast-grep` command to find `pattern` in `path`"
294
+ import json, subprocess
295
+ cmd = f"ast-grep --pattern '{pattern}' --lang {lang} --json=compact"
296
+ if path != ".": cmd = f"cd {path} && {cmd}"
297
+ res = subprocess.run(cmd, shell=True, capture_output=True, text=True)
298
+ return json.loads(res.stdout) if res.stdout else res.stderr
299
+
300
+ # %% ../nbs/00_core.ipynb
301
+ def msg_insert_line(
302
+ msgid:str, # Message id to edit
303
+ insert_line: int, # The line number after which to insert the text (0 for beginning of file)
304
+ new_str: str, # The text to insert
305
+ dname:str='' # Running dialog to get info for; defaults to current dialog
306
+ ):
307
+ "Insert text at a specific line number in a message"
308
+ return call_endp('msg_insert_line_', dname, json=True, msgid=msgid, insert_line=insert_line, new_str=new_str)
309
+
310
+ # %% ../nbs/00_core.ipynb
311
+ def msg_str_replace(
312
+ msgid:str, # Message id to edit
313
+ old_str: str, # Text to find and replace
314
+ new_str: str, # Text to replace with
315
+ dname:str='' # Running dialog to get info for; defaults to current dialog
316
+ ):
317
+ "Replace first occurrence of old_str with new_str in a message"
318
+ return call_endp('msg_str_replace_', dname, json=True, msgid=msgid, old_str=old_str, new_str=new_str)
319
+
320
+ # %% ../nbs/00_core.ipynb
321
+ def msg_strs_replace(
322
+ msgid:str, # Message id to edit
323
+ old_strs:list[str], # List of strings to find and replace
324
+ new_strs:list[str], # List of replacement strings (must match length of old_strs)
325
+ dname:str='' # Running dialog to get info for; defaults to current dialog
326
+ ):
327
+ "Replace multiple strings simultaneously in a message"
328
+ return call_endp('msg_strs_replace_', dname, json=True, msgid=msgid, old_strs=old_strs, new_strs=new_strs)
329
+
330
+ # %% ../nbs/00_core.ipynb
331
+ def msg_replace_lines(
332
+ msgid:str, # Message id to edit
333
+ start_line:int, # Starting line number to replace (1-based indexing)
334
+ end_line:int, # Ending line number to replace (1-based indexing, inclusive)
335
+ new_content:str, # New content to replace the specified lines
336
+ dname:str='' # Running dialog to get info for; defaults to current dialog
337
+ ):
338
+ "Replace a range of lines with new content in a message"
339
+ return call_endp('msg_replace_lines_', dname, json=True, msgid=msgid, start_line=start_line, end_line=end_line, new_content=new_content)
340
+
341
+ # %% ../nbs/00_core.ipynb
342
+ def load_gist(gist_id:str):
343
+ "Retrieve a gist"
344
+ api = GhApi()
345
+ if '/' in gist_id: *_,user,gist_id = gist_id.split('/')
346
+ else: user = None
347
+ return api.gists.get(gist_id, user=user)
348
+
349
+ # %% ../nbs/00_core.ipynb
350
+ def gist_file(gist_id:str):
351
+ "Get the first file from a gist"
352
+ gist = load_gist(gist_id)
353
+ return first(gist.files.values())
354
+
355
+ # %% ../nbs/00_core.ipynb
356
+ def import_string(
357
+ code:str, # Code to import as a module
358
+ name:str # Name of module to create
359
+ ):
360
+ with TemporaryDirectory() as tmpdir:
361
+ path = Path(tmpdir) / f"{name}.py"
362
+ path.write_text(code)
363
+ # linecache.cache storage allows inspect.getsource() after tmpdir lifetime ends
364
+ linecache.cache[str(path)] = (len(code), None, code.splitlines(keepends=True), str(path))
365
+ spec = importlib.util.spec_from_file_location(name, path)
366
+ module = importlib.util.module_from_spec(spec)
367
+ sys.modules[name] = module
368
+ spec.loader.exec_module(module)
369
+ return module
370
+
371
+ # %% ../nbs/00_core.ipynb
372
+ empty = Parameter.empty
373
+
374
+ def is_usable_tool(func:callable):
375
+ "True if the function has a docstring and all parameters have types, meaning that it can be used as an LLM tool."
376
+ if not func.__doc__ or not callable(func): return False
377
+ return all(p.annotation != empty for p in signature(func).parameters.values())
378
+
379
+ # %% ../nbs/00_core.ipynb
380
+ def mk_toollist(syms):
381
+ return "\n".join(f"- &`{sym.__name__}`: {sym.__doc__}" for sym in syms if is_usable_tool(sym))
382
+
383
+ # %% ../nbs/00_core.ipynb
384
+ def import_gist(
385
+ gist_id:str, # user/id or just id of gist to import as a module
386
+ mod_name:str=None, # module name to create (taken from gist filename if not passed)
387
+ add_global:bool=True, # add module to caller's globals?
388
+ import_wildcard:bool=False, # import all exported symbols to caller's globals
389
+ create_msg:bool=False # Add a message that lists usable tools
390
+ ):
391
+ "Import gist directly from string without saving to disk"
392
+ fil = gist_file(gist_id)
393
+ mod_name = mod_name or Path(fil['filename']).stem
394
+ module = import_string(fil['content'], mod_name)
395
+ glbs = currentframe().f_back.f_globals
396
+ if add_global: glbs[mod_name] = module
397
+ syms = getattr(module, '__all__', None)
398
+ if syms is None: syms = [o for o in dir(module) if not o.startswith('_')]
399
+ syms = [getattr(module, nm) for nm in syms]
400
+ if import_wildcard:
401
+ for sym in syms: glbs[sym.__name__] = sym
402
+ if create_msg:
403
+ pref = getattr(module, '__doc__', "Tools added to dialog:")
404
+ add_msg(f"{pref}\n\n{mk_toollist(syms)}")
405
+ return module
406
+
407
+ # %% ../nbs/00_core.ipynb
408
+ def tool_info():
409
+ cts='''Tools available from `dialoghelper`:
410
+
411
+ - &`curr_dialog`: Get the current dialog info.
412
+ - &`msg_idx`: Get absolute index of message in dialog.
413
+ - &`add_html`: Send HTML to the browser to be swapped into the DOM using hx-swap-oob.
414
+ - &`find_msg_id`: Get the current message id.
415
+ - &`find_msgs`: Find messages in current specific dialog that contain the given information.
416
+ - (solveit can often get this id directly from its context, and will not need to use this if the required information is already available to it.)
417
+ - &`read_msg`: Get the message indexed in the current dialog.
418
+ - To get the exact message use `n=0` and `relative=True` together with `msgid`.
419
+ - To get a relative message use `n` (relative position index).
420
+ - To get the nth message use `n` with `relative=False`, e.g `n=0` first message, `n=-1` last message.
421
+ - &`del_msg`: Delete a message from the dialog.
422
+ - &`add_msg`: Add/update a message to the queue to show after code execution completes.
423
+ - &`update_msg`: Update an existing message.
424
+ - &`url2note`: Read URL as markdown, and add a note below current message with the result
425
+ - &`msg_insert_line`: Insert text at a specific location in a message.
426
+ - &`msg_str_replace`: Find and replace text in a message.
427
+ - &`msg_strs_replace`: Find and replace multiple strings in a message.
428
+ - &`msg_replace_lines`: Replace a range of lines in a message with new content.
429
+ - Always first use `read_msg( msgid=msgid, n=0, relative=True, nums=True)` to view the content with line numbers.'''
430
+ add_msg(cts)
431
+
432
+ # %% ../nbs/00_core.ipynb
433
+ def fc_tool_info():
434
+ cts='''Tools available from `fastcore.tools`:
435
+
436
+ - &`rg`: Run the `rg` command with the args in `argstr` (no need to backslash escape)
437
+ - &`sed`: Run the `sed` command with the args in `argstr` (e.g for reading a section of a file)
438
+ - &`view`: View directory or file contents with optional line range and numbers
439
+ - &`create`: Creates a new file with the given content at the specified path
440
+ - &`insert`: Insert new_str at specified line number
441
+ - &`str_replace`: Replace first occurrence of old_str with new_str in file
442
+ - &`strs_replace`: Replace for each str pair in old_strs,new_strs
443
+ - &`replace_lines`: Replace lines in file using start and end line-numbers'''
444
+ add_msg(cts)
445
+ add_msg('from fastcore.tools import *', msg_type='code')
dialoghelper/db_dc.py ADDED
@@ -0,0 +1,92 @@
1
+ __all__ = ["_Meta", "Attachment", "Completion", "Completion_Mode", "Context", "Dialog", "Message", "Secret", "User"]
2
+ from dataclasses import dataclass
3
+ @dataclass
4
+ class _Meta:
5
+ id: int | None = None
6
+ version: int | None = 0
7
+
8
+ @dataclass
9
+ class Attachment:
10
+ id: str | None = None
11
+ data: bytes | None = None
12
+ content_type: str | None = None
13
+ sid: int | None = None
14
+
15
+ @dataclass
16
+ class Completion:
17
+ req_id: str | None = None
18
+ did: int | None = None
19
+ mid: int | None = None
20
+ mtype: str | None = None
21
+ pfx: str | None = None
22
+ sfx: str | None = None
23
+ ctx: str | None = ''
24
+ mode: str | None = None
25
+ comp: str | None = None
26
+ logprobs: str | None = None
27
+ status: str | None = None
28
+
29
+ @dataclass
30
+ class Completion_Mode:
31
+ id: int | None = None
32
+ name: str | None = None
33
+ c_acceptichars: int | None = None
34
+ c_scon: int | None = None
35
+ c_triggerc: str | None = None
36
+ c_triggeronaccept: int | None = None
37
+ c_mftp: float | None = None
38
+ c_model: str | None = None
39
+ c_nlines: str | None = None
40
+ c_temp: float | None = None
41
+ p_acceptichars: int | None = None
42
+ p_scon: int | None = None
43
+ p_triggerc: str | None = None
44
+ p_triggeronaccept: int | None = None
45
+ p_mftp: float | None = None
46
+ p_model: str | None = None
47
+ p_nlines: str | None = None
48
+ p_temp: float | None = None
49
+
50
+ @dataclass
51
+ class Context:
52
+ name: str | None = None
53
+ context: str | None = None
54
+ token_count: int | None = 0
55
+ did: int | None = None
56
+
57
+ @dataclass
58
+ class Dialog:
59
+ id: int | None = None
60
+ name: str | None = None
61
+ mode: int | None = 2
62
+
63
+ @dataclass
64
+ class Message:
65
+ sid: str | None = None
66
+ mid: str | None = None
67
+ content: str | None = None
68
+ output: str | None = ''
69
+ input_tokens: int | None = '0'
70
+ output_tokens: int | None = '0'
71
+ msg_type: str | None = 'code'
72
+ time_run: str | None = ''
73
+ is_exported: int | None = '0'
74
+ skipped: int | None = '0'
75
+ did: int | None = None
76
+ i_collapsed: int | None = '0'
77
+ o_collapsed: int | None = '0'
78
+ header_collapsed: int | None = '0'
79
+ pinned: int | None = '0'
80
+ use_thinking: int | None = 0
81
+
82
+ @dataclass
83
+ class Secret:
84
+ name: str | None = None
85
+ secret: str | None = None
86
+
87
+ @dataclass
88
+ class User:
89
+ id: int | None = None
90
+ version: int | None = None
91
+ settings: str | None = None
92
+
@@ -0,0 +1,26 @@
1
+ window.getScreenshot = async (maxWidth = 1280, maxHeight = 1024) => {
2
+ if (window?.vtrack) {
3
+ const cap = new ImageCapture(window.vtrack);
4
+ const img = await cap.grabFrame();
5
+ // rescale and convert to b64
6
+ const scaleX = maxWidth / img.width;
7
+ const scaleY = maxHeight / img.height;
8
+ const scale = Math.min(scaleX, scaleY, 1); // don't upscale
9
+ const newWidth = Math.floor(img.width * scale);
10
+ const newHeight = Math.floor(img.height * scale);
11
+ const c = document.createElement('canvas');
12
+ c.width = newWidth; c.height = newHeight;
13
+ c.getContext('2d').drawImage(img, 0, 0, newWidth, newHeight);
14
+ return c.toDataURL();
15
+ }
16
+ }
17
+
18
+ document.body.addEventListener('shareScreen', async (e) => {
19
+ vstream = await navigator.mediaDevices.getDisplayMedia();
20
+ window.vtrack = vstream.getVideoTracks()[0];
21
+ });
22
+
23
+ document.body.addEventListener('captureScreen', async (e) => {
24
+ pushData(e.detail.idx, {img_data: await getScreenshot()});
25
+ });
26
+
@@ -0,0 +1,113 @@
1
+ Metadata-Version: 2.4
2
+ Name: dialoghelper
3
+ Version: 0.0.44
4
+ Summary: Helper functions for solveit dialogs
5
+ Home-page: https://github.com/AnswerDotAI/dialoghelper
6
+ Author: Jeremy Howard
7
+ Author-email: github@jhoward.fastmail.fm
8
+ License: Apache Software License 2.0
9
+ Keywords: nbdev jupyter notebook python
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Natural Language :: English
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: License :: OSI Approved :: Apache Software License
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: fastcore>=1.8.10
22
+ Requires-Dist: fastlite
23
+ Requires-Dist: ghapi
24
+ Requires-Dist: ipykernel-helper
25
+ Requires-Dist: claudette
26
+ Requires-Dist: ast-grep-cli
27
+ Requires-Dist: ast-grep-py
28
+ Requires-Dist: MonsterUI
29
+ Requires-Dist: lisette>=0.0.13
30
+ Requires-Dist: pillow
31
+ Provides-Extra: dev
32
+ Requires-Dist: python-fasthtml; extra == "dev"
33
+ Dynamic: author
34
+ Dynamic: author-email
35
+ Dynamic: classifier
36
+ Dynamic: description
37
+ Dynamic: description-content-type
38
+ Dynamic: home-page
39
+ Dynamic: keywords
40
+ Dynamic: license
41
+ Dynamic: license-file
42
+ Dynamic: provides-extra
43
+ Dynamic: requires-dist
44
+ Dynamic: requires-python
45
+ Dynamic: summary
46
+
47
+ # dialoghelper
48
+
49
+
50
+ <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
51
+
52
+ This file will become your README and also the index of your
53
+ documentation.
54
+
55
+ ## Developer Guide
56
+
57
+ If you are new to using `nbdev` here are some useful pointers to get you
58
+ started.
59
+
60
+ ### Install dialoghelper in Development mode
61
+
62
+ ``` sh
63
+ # make sure dialoghelper package is installed in development mode
64
+ $ pip install -e .
65
+
66
+ # make changes under nbs/ directory
67
+ # ...
68
+
69
+ # compile to have changes apply to dialoghelper
70
+ $ nbdev_prepare
71
+ ```
72
+
73
+ ## Usage
74
+
75
+ ### Installation
76
+
77
+ Install latest from the GitHub
78
+ [repository](https://github.com/AnswerDotAI/dialoghelper):
79
+
80
+ ``` sh
81
+ $ pip install git+https://github.com/AnswerDotAI/dialoghelper.git
82
+ ```
83
+
84
+ or from [conda](https://anaconda.org/AnswerDotAI/dialoghelper)
85
+
86
+ ``` sh
87
+ $ conda install -c AnswerDotAI dialoghelper
88
+ ```
89
+
90
+ or from [pypi](https://pypi.org/project/dialoghelper/)
91
+
92
+ ``` sh
93
+ $ pip install dialoghelper
94
+ ```
95
+
96
+ ### Documentation
97
+
98
+ Documentation can be found hosted on this GitHub
99
+ [repository](https://github.com/AnswerDotAI/dialoghelper)’s
100
+ [pages](https://AnswerDotAI.github.io/dialoghelper/). Additionally you
101
+ can find package manager specific guidelines on
102
+ [conda](https://anaconda.org/AnswerDotAI/dialoghelper) and
103
+ [pypi](https://pypi.org/project/dialoghelper/) respectively.
104
+
105
+ ## How to use
106
+
107
+ Fill me in please! Don’t forget code examples:
108
+
109
+ ``` python
110
+ 1+1
111
+ ```
112
+
113
+ 2
@@ -0,0 +1,12 @@
1
+ dialoghelper/__init__.py,sha256=W3xZgCB22_feYaRCGZM4hqkrdBSs6VCfwsSqWGpO6bE,43
2
+ dialoghelper/_modidx.py,sha256=2KIy8BtZ-ks0CGzg8xH6ptn-gPdFn7qZjB5ccB4evog,5442
3
+ dialoghelper/capture.py,sha256=VxkO52HA33jcBm4W4lZS41d1Girg-ov_Mi5wTeBFV48,1429
4
+ dialoghelper/core.py,sha256=O6tuHTyiVHmJVlNm0ghtqvFXgP1ElhnY5fEUhn0QXT4,20128
5
+ dialoghelper/db_dc.py,sha256=mi2Q2am_SoAPGpNQg7KPFS5pR9WEapRXT8ypkNmMfw0,2330
6
+ dialoghelper/screenshot.js,sha256=5x28oyCGdhcNGzb6EPoKpWzMCpCZOrgoePCN5SKkrwo,1023
7
+ dialoghelper-0.0.44.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
8
+ dialoghelper-0.0.44.dist-info/METADATA,sha256=_vr-B0ICukOtdDlWqpDmmhyX4eWvNLlvaobB_CWIrD8,2771
9
+ dialoghelper-0.0.44.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
+ dialoghelper-0.0.44.dist-info/entry_points.txt,sha256=wvDeX-XTS_XVjWiiPQe6yVfmyNwy9eCr36ewp9baFIg,46
11
+ dialoghelper-0.0.44.dist-info/top_level.txt,sha256=VXLlkgltFs_q-XB9imt2G64I_-MPm1RnxlpvUWPuLKM,13
12
+ dialoghelper-0.0.44.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [nbdev]
2
+ dialoghelper = dialoghelper._modidx:d
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1 @@
1
+ dialoghelper