codebind 0.6.4__py3-none-any.whl → 0.6.6__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.
- codebind/execution.py +59 -7
- codebind/extension.py +8 -0
- codebind/terminal.py +99 -0
- {codebind-0.6.4.data → codebind-0.6.6.data}/data/share/jupyter/labextensions/codebind-jupyterlab/package.json +2 -2
- codebind-0.6.4.data/data/share/jupyter/labextensions/codebind-jupyterlab/static/remoteEntry.e6950b0910a94bc0.js → codebind-0.6.6.data/data/share/jupyter/labextensions/codebind-jupyterlab/static/remoteEntry.c10098fb6e87897c.js +1 -1
- codebind-0.6.6.dist-info/METADATA +135 -0
- {codebind-0.6.4.dist-info → codebind-0.6.6.dist-info}/RECORD +14 -13
- codebind-0.6.4.dist-info/METADATA +0 -116
- {codebind-0.6.4.data → codebind-0.6.6.data}/data/share/jupyter/labextensions/codebind-jupyterlab/install.json +0 -0
- {codebind-0.6.4.data → codebind-0.6.6.data}/data/share/jupyter/labextensions/codebind-jupyterlab/static/590.dae4561c5427a855.js +0 -0
- {codebind-0.6.4.data → codebind-0.6.6.data}/data/share/jupyter/labextensions/codebind-jupyterlab/static/style.js +0 -0
- {codebind-0.6.4.data → codebind-0.6.6.data}/data/share/jupyter/labextensions/codebind-jupyterlab/static/third-party-licenses.json +0 -0
- {codebind-0.6.4.dist-info → codebind-0.6.6.dist-info}/WHEEL +0 -0
- {codebind-0.6.4.dist-info → codebind-0.6.6.dist-info}/entry_points.txt +0 -0
- {codebind-0.6.4.dist-info → codebind-0.6.6.dist-info}/licenses/LICENSE +0 -0
codebind/execution.py
CHANGED
|
@@ -10,11 +10,13 @@ from typing import Any, cast
|
|
|
10
10
|
|
|
11
11
|
from IPython.core.displaypub import DisplayPublisher
|
|
12
12
|
from IPython.core.interactiveshell import InteractiveShell
|
|
13
|
+
from IPython.terminal.interactiveshell import TerminalInteractiveShell
|
|
13
14
|
from IPython.utils.capture import capture_output
|
|
14
15
|
|
|
15
16
|
from .display import display_cell
|
|
16
17
|
from .images import PreparedImage, prepare_mime_image
|
|
17
18
|
from .jupyter import JupyterLabBridge
|
|
19
|
+
from .terminal import record_tool_output, show_input
|
|
18
20
|
|
|
19
21
|
|
|
20
22
|
_MAXIMUM_IMAGES_PER_REPORT = 32
|
|
@@ -215,6 +217,12 @@ class IPythonExecutor:
|
|
|
215
217
|
if not isinstance(cell, str) or not cell.strip():
|
|
216
218
|
raise ValueError("cell must be a non-empty string")
|
|
217
219
|
|
|
220
|
+
if self.bridge is None and isinstance(self.shell, TerminalInteractiveShell):
|
|
221
|
+
show_input(self.shell, cell)
|
|
222
|
+
with record_tool_output(self.shell):
|
|
223
|
+
result = self.shell.run_cell(cell, store_history=True)
|
|
224
|
+
return self._native_report(result)
|
|
225
|
+
|
|
218
226
|
bridge = self.bridge
|
|
219
227
|
cell_id = bridge.start_code_cell(cell) if bridge is not None else None
|
|
220
228
|
bridged = cell_id is not None
|
|
@@ -247,6 +255,26 @@ class IPythonExecutor:
|
|
|
247
255
|
if not isinstance(cell, str) or not cell.strip():
|
|
248
256
|
raise ValueError("cell must be a non-empty string")
|
|
249
257
|
|
|
258
|
+
if self.bridge is None and isinstance(self.shell, TerminalInteractiveShell):
|
|
259
|
+
show_input(self.shell, cell)
|
|
260
|
+
transformed = self.shell.transform_cell(cell)
|
|
261
|
+
result = None
|
|
262
|
+
with (
|
|
263
|
+
record_tool_output(self.shell),
|
|
264
|
+
self.shell._tee(channel="stdout"),
|
|
265
|
+
self.shell._tee(channel="stderr"),
|
|
266
|
+
):
|
|
267
|
+
try:
|
|
268
|
+
result = await self.shell.run_cell_async(
|
|
269
|
+
cell,
|
|
270
|
+
store_history=True,
|
|
271
|
+
transformed_cell=transformed,
|
|
272
|
+
)
|
|
273
|
+
finally:
|
|
274
|
+
self.shell.events.trigger("post_execute")
|
|
275
|
+
self.shell.events.trigger("post_run_cell", result)
|
|
276
|
+
return self._native_report(result)
|
|
277
|
+
|
|
250
278
|
bridge = self.bridge
|
|
251
279
|
cell_id = bridge.start_code_cell(cell) if bridge is not None else None
|
|
252
280
|
bridged = cell_id is not None
|
|
@@ -304,17 +332,41 @@ class IPythonExecutor:
|
|
|
304
332
|
captured: Any,
|
|
305
333
|
expression_outputs: list[dict[str, Any]],
|
|
306
334
|
) -> ExecutionReport:
|
|
307
|
-
"""Build
|
|
308
|
-
|
|
309
|
-
displays: list[str] = []
|
|
310
|
-
images: list[PreparedImage] = []
|
|
311
|
-
omissions: list[str] = []
|
|
335
|
+
"""Build a report from a captured notebook or alternate frontend cell."""
|
|
312
336
|
bundles = [getattr(output, "data", None) for output in captured.outputs]
|
|
313
337
|
bundles.extend(output.get("data") for output in expression_outputs)
|
|
314
338
|
if not expression_outputs and result.result is not None:
|
|
315
339
|
data, _ = self.shell.display_formatter.format(result.result)
|
|
316
340
|
if any(key.startswith("image/") for key in data):
|
|
317
341
|
bundles.append(data)
|
|
342
|
+
return self._assemble_report(result, captured.stdout, captured.stderr, bundles)
|
|
343
|
+
|
|
344
|
+
def _native_report(self, result: Any) -> ExecutionReport:
|
|
345
|
+
"""Read the exact output IPython recorded for a terminal execution."""
|
|
346
|
+
records = self.shell.history_manager.outputs.get(result.execution_count, ())
|
|
347
|
+
stdout: list[str] = []
|
|
348
|
+
stderr: list[str] = []
|
|
349
|
+
bundles: list[dict[str, Any]] = []
|
|
350
|
+
for record in records:
|
|
351
|
+
if record.output_type == "out_stream":
|
|
352
|
+
stdout.extend(record.bundle["stream"])
|
|
353
|
+
elif record.output_type == "err_stream":
|
|
354
|
+
stderr.extend(record.bundle["stream"])
|
|
355
|
+
elif record.output_type in {"display_data", "execute_result"}:
|
|
356
|
+
bundles.append(record.bundle)
|
|
357
|
+
return self._assemble_report(result, "".join(stdout), "".join(stderr), bundles)
|
|
358
|
+
|
|
359
|
+
@staticmethod
|
|
360
|
+
def _assemble_report(
|
|
361
|
+
result: Any,
|
|
362
|
+
stdout: str,
|
|
363
|
+
stderr: str,
|
|
364
|
+
bundles: list[Any],
|
|
365
|
+
) -> ExecutionReport:
|
|
366
|
+
"""Build the model-facing text and image projection of an IPython execution."""
|
|
367
|
+
displays: list[str] = []
|
|
368
|
+
images: list[PreparedImage] = []
|
|
369
|
+
omissions: list[str] = []
|
|
318
370
|
for index, data in enumerate(bundles):
|
|
319
371
|
if isinstance(data, dict) and "text/plain" in data:
|
|
320
372
|
displays.append(str(data["text/plain"]))
|
|
@@ -340,8 +392,8 @@ class IPythonExecutor:
|
|
|
340
392
|
)
|
|
341
393
|
return ExecutionReport(
|
|
342
394
|
ok=result.success,
|
|
343
|
-
stdout=
|
|
344
|
-
stderr=
|
|
395
|
+
stdout=stdout,
|
|
396
|
+
stderr=stderr,
|
|
345
397
|
result=repr(result.result) if result.result is not None else None,
|
|
346
398
|
displays=tuple(displays),
|
|
347
399
|
error=error,
|
codebind/extension.py
CHANGED
|
@@ -6,18 +6,23 @@ import asyncio
|
|
|
6
6
|
from typing import Any
|
|
7
7
|
|
|
8
8
|
from IPython.core.interactiveshell import InteractiveShell
|
|
9
|
+
from IPython.terminal.interactiveshell import TerminalInteractiveShell
|
|
9
10
|
from langchain_core.language_models import BaseChatModel
|
|
10
11
|
|
|
11
12
|
from .configuration import load_configuration, load_models
|
|
12
13
|
from .conversation import MemoryConversationStore, NotebookConversationStore
|
|
13
14
|
from .jupyter import JupyterLabBridge, TARGET_NAME
|
|
14
15
|
from .session import Session
|
|
16
|
+
from .terminal import install_markdown_renderer
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
_STATE_ATTRIBUTE = "_codebind_extension_state"
|
|
18
20
|
|
|
19
21
|
|
|
20
22
|
def _close_state(state: dict[str, Any]) -> None:
|
|
23
|
+
restore_terminal_display = state.get("restore_terminal_display")
|
|
24
|
+
if callable(restore_terminal_display):
|
|
25
|
+
restore_terminal_display()
|
|
21
26
|
manager = state.get("comm_manager")
|
|
22
27
|
target = state.get("comm_target")
|
|
23
28
|
if manager is not None and getattr(manager, "targets", {}).get(TARGET_NAME) is target:
|
|
@@ -72,10 +77,13 @@ def load_ipython_extension(ipython: InteractiveShell) -> None:
|
|
|
72
77
|
"discard_model": discard_model,
|
|
73
78
|
"comm_manager": manager,
|
|
74
79
|
"comm_target": None,
|
|
80
|
+
"restore_terminal_display": None,
|
|
75
81
|
}
|
|
76
82
|
|
|
77
83
|
if manager is None:
|
|
78
84
|
state["session"] = Session(shell=ipython, store=MemoryConversationStore())
|
|
85
|
+
if isinstance(ipython, TerminalInteractiveShell):
|
|
86
|
+
state["restore_terminal_display"] = install_markdown_renderer(ipython)
|
|
79
87
|
else:
|
|
80
88
|
|
|
81
89
|
def accept_comm(comm: Any, message: dict[str, Any]) -> None:
|
codebind/terminal.py
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""Terminal presentation using IPython's prompts, history, and MIME renderers."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
from collections.abc import Callable, Iterator
|
|
7
|
+
from contextlib import contextmanager
|
|
8
|
+
from unittest.mock import patch
|
|
9
|
+
|
|
10
|
+
from IPython.terminal.interactiveshell import IPythonPTLexer, TerminalInteractiveShell
|
|
11
|
+
from prompt_toolkit.document import Document
|
|
12
|
+
from prompt_toolkit.formatted_text import FormattedText, PygmentsTokens
|
|
13
|
+
from prompt_toolkit.shortcuts import print_formatted_text
|
|
14
|
+
from rich.console import Console
|
|
15
|
+
from rich.markdown import Markdown
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
_MISSING = object()
|
|
19
|
+
_IMAGE_FORMATS = ("image/png", "image/jpeg", "image/svg+xml")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def show_input(shell: TerminalInteractiveShell, cell: str) -> None:
|
|
23
|
+
"""Show a model cell with the shell's own input and continuation prompts."""
|
|
24
|
+
sys.stdout.write(shell.separate_in)
|
|
25
|
+
lines = cell.splitlines()
|
|
26
|
+
lexer = IPythonPTLexer().lex_document(Document(cell))
|
|
27
|
+
first_prompt = shell.prompts.in_prompt_tokens()
|
|
28
|
+
prompt_width = sum(len(text) for _, text in first_prompt)
|
|
29
|
+
style = shell.pt_app.app.style if shell.pt_app is not None else shell._style
|
|
30
|
+
for index, _ in enumerate(lines):
|
|
31
|
+
prompt = (
|
|
32
|
+
first_prompt
|
|
33
|
+
if index == 0
|
|
34
|
+
else shell.prompts.continuation_prompt_tokens(prompt_width, lineno=index - 1)
|
|
35
|
+
)
|
|
36
|
+
print_formatted_text(
|
|
37
|
+
PygmentsTokens(prompt),
|
|
38
|
+
FormattedText(lexer(index)),
|
|
39
|
+
sep="",
|
|
40
|
+
style=style,
|
|
41
|
+
color_depth=shell.color_depth,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def install_markdown_renderer(shell: TerminalInteractiveShell) -> Callable[[], None]:
|
|
46
|
+
"""Render Codebind's Markdown MIME in the terminal, preserving shell settings."""
|
|
47
|
+
mime = "text/markdown"
|
|
48
|
+
formatter = shell.display_formatter.formatters[mime]
|
|
49
|
+
was_enabled = formatter.enabled
|
|
50
|
+
was_active = mime in shell.display_formatter.active_types
|
|
51
|
+
previous_renderer = shell.mime_renderers.get(mime, _MISSING)
|
|
52
|
+
|
|
53
|
+
def render(text: str, _metadata: object) -> None:
|
|
54
|
+
Console(file=sys.stdout, soft_wrap=True, no_color=shell.colors.lower() == "nocolor").print(
|
|
55
|
+
Markdown(text)
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
formatter.enabled = True
|
|
59
|
+
if not was_active:
|
|
60
|
+
shell.display_formatter.active_types.append(mime)
|
|
61
|
+
shell.mime_renderers[mime] = render
|
|
62
|
+
|
|
63
|
+
def restore() -> None:
|
|
64
|
+
if previous_renderer is _MISSING:
|
|
65
|
+
shell.mime_renderers.pop(mime, None)
|
|
66
|
+
else:
|
|
67
|
+
shell.mime_renderers[mime] = previous_renderer
|
|
68
|
+
if not was_active and mime in shell.display_formatter.active_types:
|
|
69
|
+
shell.display_formatter.active_types.remove(mime)
|
|
70
|
+
formatter.enabled = was_enabled
|
|
71
|
+
|
|
72
|
+
return restore
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@contextmanager
|
|
76
|
+
def record_tool_output(shell: TerminalInteractiveShell) -> Iterator[None]:
|
|
77
|
+
"""Keep image and shell-command output in IPython's native history."""
|
|
78
|
+
active = shell.display_formatter.active_types
|
|
79
|
+
previous_png_renderer = shell.mime_renderers.pop("image/png", _MISSING)
|
|
80
|
+
settings: list[tuple[str, bool, bool]] = []
|
|
81
|
+
for mime in _IMAGE_FORMATS:
|
|
82
|
+
formatter = shell.display_formatter.formatters[mime]
|
|
83
|
+
settings.append((mime, formatter.enabled, mime in active))
|
|
84
|
+
formatter.enabled = True
|
|
85
|
+
if mime not in active:
|
|
86
|
+
active.append(mime)
|
|
87
|
+
try:
|
|
88
|
+
with patch.object(shell, "system", shell.system_piped):
|
|
89
|
+
yield
|
|
90
|
+
finally:
|
|
91
|
+
for mime, was_enabled, was_active in settings:
|
|
92
|
+
if not was_active and mime in active:
|
|
93
|
+
active.remove(mime)
|
|
94
|
+
shell.display_formatter.formatters[mime].enabled = was_enabled
|
|
95
|
+
if previous_png_renderer is not _MISSING:
|
|
96
|
+
shell.mime_renderers["image/png"] = previous_png_renderer
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
__all__ = ["install_markdown_renderer", "record_tool_output", "show_input"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codebind-jupyterlab",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "Native JupyterLab cells and Question cells for Codebind.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"extension": true,
|
|
32
32
|
"outputDir": "../data/share/jupyter/labextensions/codebind-jupyterlab",
|
|
33
33
|
"_build": {
|
|
34
|
-
"load": "static/remoteEntry.
|
|
34
|
+
"load": "static/remoteEntry.c10098fb6e87897c.js",
|
|
35
35
|
"extension": "./extension"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _JUPYTERLAB;(()=>{"use strict";var e,n,r,t,o,i,u,a,l,c,s,f,p,d,h,g,v,y,b,m,S,k,j,w,E,x,T,M,P,V,q,A,C,O,D,_,L,N={457(e,n,r){var t={"./index":()=>r.e(590).then(()=>()=>r(509)),"./extension":()=>r.e(590).then(()=>()=>r(509))},o=function(e,n){return r.R=n,n=r.o(t,e)?t[e]():Promise.resolve().then(()=>{throw Error('Module "'+e+'" does not exist in container.')}),r.R=void 0,n},i=function(e,n){if(r.S){var t="default",o=r.S[t];if(o&&o!==e)throw Error("Container initialization failed as it has already been initialized with a different share scope");return r.S[t]=e,r.I(t,n)}};r.d(n,{get:()=>o,init:()=>i})}},$={};function z(e){var n=$[e];if(void 0!==n)return n.exports;var r=$[e]={exports:{}};return N[e](r,r.exports,z),r.exports}z.m=N,z.c=$,z.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return z.d(n,{a:n}),n},z.d=(e,n,r)=>{var t=(n,r)=>{for(var t in n)z.o(n,t)&&!z.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,[r]:n[t]})};t(n,"get"),t(r,"value")},z.f={},z.e=e=>Promise.all(Object.keys(z.f).reduce((n,r)=>(z.f[r](e,n),n),[])),z.u=e=>""+e+".dae4561c5427a855.js?v=dae4561c5427a855",z.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),z.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),I={},z.l=function(e,n,r,t){if(I[e])return void I[e].push(n);if(void 0!==r)for(var o,i,u=document.getElementsByTagName("script"),a=0;a<u.length;a++){var l=u[a];if(l.getAttribute("src")==e||l.getAttribute("data-rspack")=="codebind-jupyterlab:"+r){o=l;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,z.nc&&o.setAttribute("nonce",z.nc),o.setAttribute("data-rspack","codebind-jupyterlab:"+r),o.src=e),I[e]=[n];var c=function(n,r){o.onerror=o.onload=null,clearTimeout(s);var t=I[e];if(delete I[e],o.parentNode&&o.parentNode.removeChild(o),t&&t.forEach(function(e){return e(r)}),n)return n(r)},s=setTimeout(c.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=c.bind(null,o.onerror),o.onload=c.bind(null,o.onload),i&&document.head.appendChild(o)},z.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},z.S={},z.initializeSharingData={scopeToSharingDataMapping:{default:[{name:"codebind-jupyterlab",version:"0.6.4",factory:()=>z.e(590).then(()=>()=>z(509)),eager:0,treeShakingMode:null}]},uniqueName:"codebind-jupyterlab"},R={},U={},z.I=function(e,n){n||(n=[]);var r=U[e];if(r||(r=U[e]={}),!(n.indexOf(r)>=0)){if(n.push(r),R[e])return R[e];z.o(z.S,e)||(z.S[e]={});var t=z.S[e],o=function(e){"u">typeof console&&console.warn&&console.warn(e)},i=z.initializeSharingData.uniqueName,u=function(e,n,r,o){var u=t[e]=t[e]||{},a=u[n];(!a||!a.loaded&&(!o!=!a.eager?o:i>a.from))&&(u[n]={get:r,from:i,eager:!!o})},a=function(r){var t=function(e){o("Initialization of sharing external failed: "+e)};try{var i=z(r);if(!i)return;var u=function(r){return r&&r.init&&r.init(z.S[e],n)};if(i.then)return l.push(i.then(u,t));var a=u(i);if(a&&a.then)return l.push(a.catch(t))}catch(e){t(e)}},l=[],c=z.initializeSharingData.scopeToSharingDataMapping;return(c[e]&&c[e].forEach(function(e){"object"==typeof e?u(e.name,e.version,e.factory,e.eager):a(e)}),l.length)?R[e]=Promise.all(l).then(function(){return R[e]=1}):R[e]=1}},z.g.importScripts&&(B=z.g.location+"");var I,R,U,B,K=z.g.document;if(!B&&K&&(K.currentScript&&"SCRIPT"===K.currentScript.tagName.toUpperCase()&&(B=K.currentScript.src),!B)){var J=K.getElementsByTagName("script");if(J.length)for(var Y=J.length-1;Y>-1&&(!B||!/^http(s?):/.test(B));)B=J[Y--].src}if(!B)throw Error("Automatic publicPath is not supported in this browser");z.p=B=B.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),z.consumesLoadingData={chunkMapping:{590:["511","343","99","171","241"]},moduleIdToConsumeDataMapping:{171:{shareScope:"default",shareKey:"@jupyterlab/notebook",import:null,requiredVersion:"^4.6.3",strictVersion:!1,singleton:!0,eager:!1,fallback:void 0,treeShakingMode:null},241:{shareScope:"default",shareKey:"@jupyterlab/services",import:null,requiredVersion:"^7.6.3",strictVersion:!1,singleton:!0,eager:!1,fallback:void 0,treeShakingMode:null},343:{shareScope:"default",shareKey:"@jupyterlab/cells",import:null,requiredVersion:"^4.6.3",strictVersion:!1,singleton:!1,eager:!1,fallback:void 0,treeShakingMode:null},511:{shareScope:"default",shareKey:"@jupyterlab/apputils",import:null,requiredVersion:"^4.7.3",strictVersion:!1,singleton:!0,eager:!1,fallback:void 0,treeShakingMode:null},99:{shareScope:"default",shareKey:"@jupyterlab/nbformat",import:null,requiredVersion:"^4.6.3",strictVersion:!1,singleton:!1,eager:!1,fallback:void 0,treeShakingMode:null}},initialConsumes:[]},e=function(e){return e.split(".").map(function(e){return+e==e?+e:e})},n=function(n){var r=function(n){var r=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(n),t=r[1]?[0].concat(e(r[1])):[0];r[2]&&(t.length++,t.push.apply(t,e(r[2])));let o=t[t.length-1];for(;t.length&&(void 0===o||/^[*xX]$/.test(o));)t.pop(),o=t[t.length-1];return t},t=function(e){return 1===e.length?[0]:2===e.length?[1].concat(e.slice(1)):3===e.length?[2].concat(e.slice(1)):[e.length].concat(e.slice(1))},o=function(e){return[-e[0]-1].concat(e.slice(1))},i=function(e){let n=/^(\^|~|<=|<|>=|>|=|v|!)/.exec(e),i=n?n[0]:"",u=r(i.length?e.slice(i.length).trim():e.trim());switch(i){case"^":if(u.length>1&&0===u[1]){if(u.length>2&&0===u[2])return[3].concat(u.slice(1));return[2].concat(u.slice(1))}return[1].concat(u.slice(1));case"~":return[2].concat(u.slice(1));case">=":return u;case"=":case"v":case"":return t(u);case"<":return o(u);case">":return[,t(u),0,u,2];case"<=":return[,t(u),o(u),1];case"!":return[,t(u),0];default:throw Error("Unexpected start value")}},u=function(e,n){if(1===e.length)return e[0];let r=[];for(let n of e.slice().reverse())0 in n?r.push(n):r.push.apply(r,n.slice(1));return[,].concat(r,e.slice(1).map(()=>n))};return u(n.split(/\s*\|\|\s*/).map(function(e){let n=e.split(/\s+-\s+/);if(1===n.length){e=e.trim();let n=[],r=/[-0-9A-Za-z]\s+/g;for(var a,l=0;a=r.exec(e);){let r=a.index+1;n.push(i(e.slice(l,r).trim())),l=r}return n.push(i(e.slice(l).trim())),u(n,2)}let c=r(n[0]),s=r(n[1]);return[,t(s),o(s),1,c,2]}),1)},r=function(n){var r=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(n),t=r[1]?e(r[1]):[];return r[2]&&(t.length++,t.push.apply(t,e(r[2]))),r[3]&&(t.push([]),t.push.apply(t,e(r[3]))),t},t=function(e,n){e=r(e),n=r(n);for(var t=0;;){if(t>=e.length)return t<n.length&&"u"!=(typeof n[t])[0];var o=e[t],i=(typeof o)[0];if(t>=n.length)return"u"==i;var u=n[t],a=(typeof u)[0];if(i==a){if("o"!=i&&"u"!=i&&o!=u)return o<u;t++}else{if("o"==i&&"n"==a)return!0;return"s"==a||"u"==i}}},o=function(e){var n=e[0],r="";if(1===e.length)return"*";if(n+.5){r+=0==n?">=":-1==n?"<":1==n?"^":2==n?"~":n>0?"=":"!=";for(var t=1,i=1;i<e.length;i++){var u=e[i],a=(typeof u)[0];t--,r+="u"==a?"-":(t>0?".":"")+(t=2,u)}return r}for(var l=[],i=1;i<e.length;i++){var u=e[i];l.push(0===u?"not("+c()+")":1===u?"("+c()+" || "+c()+")":2===u?l.pop()+" "+l.pop():o(u))}return c();function c(){return l.pop().replace(/^\((.+)\)$/,"$1")}},i=function(e,n){if(0 in e){n=r(n);var t=e[0],o=t<0;o&&(t=-t-1);for(var u=0,a=1,l=!0;;a++,u++){var c,s,f=a<e.length?(typeof e[a])[0]:"";if(u>=n.length||"o"==(s=(typeof(c=n[u]))[0])){if(!l)return!0;if("u"==f)return a>t&&!o;return""==f!=o}if("u"==s){if(!l||"u"!=f)return!1}else if(l)if(f==s)if(a<=t){if(c!=e[a])return!1}else{if(o?c>e[a]:c<e[a])return!1;c!=e[a]&&(l=!1)}else if("s"!=f&&"n"!=f){if(o||a<=t)return!1;l=!1,a--}else{if(a<=t||s<f!=o)return!1;l=!1}else"s"!=f&&"n"!=f&&(l=!1,a--)}}for(var p=[],d=p.pop.bind(p),u=1;u<e.length;u++){var h=e[u];p.push(1==h?d()|d():2==h?d()&d():h?i(h,n):!d())}return!!d()},u=function(e,n){var r=z.S[e];if(!r||!z.o(r,n))throw Error("Shared module "+n+" doesn't exist in shared scope "+e);return r},a=function(e,n){var r=e[n],n=Object.keys(r).reduce(function(e,n){return!e||t(e,n)?n:e},0);return n&&r[n]},l=function(e,n){var r=e[n];return Object.keys(r).reduce(function(e,n){return!e||!r[e].loaded&&t(e,n)?n:e},0)},c=function(e,n,r,t){return"Unsatisfied version "+r+" from "+(r&&e[n][r].from)+" of shared singleton module "+n+" (required "+o(t)+")"},s=function(e,n,r,t){var o=l(e,r);return b(e[r][o])},f=function(e,n,r,t){var o=l(e,r);return i(t,o)||v(c(e,r,o,t)),b(e[r][o])},p=function(e,n,r,t){var o=l(e,r);if(!i(t,o))throw Error(c(e,r,o,t));return b(e[r][o])},d=function(e,n,r){var o=e[n],n=Object.keys(o).reduce(function(e,n){return i(r,n)&&(!e||t(e,n))?n:e},0);return n&&o[n]},h=function(e,n,r,t){var i=e[r];return"No satisfying version ("+o(t)+") of shared module "+r+" found in shared scope "+n+".\nAvailable versions: "+Object.keys(i).map(function(e){return e+" from "+i[e].from}).join(", ")},g=function(e,n,r,t){var o=d(e,r,t);if(o)return b(o);throw Error(h(e,n,r,t))},v=function(e){"u">typeof console&&console.warn&&console.warn(e)},y=function(e,n,r,t){v(h(e,n,r,t))},b=function(e){return e.loaded=1,e.get()},S=(m=function(e){return function(n,r,t,o){var i=z.I(n);return i&&i.then?i.then(e.bind(e,n,z.S[n],r,t,o)):e(n,z.S[n],r,t,o)}})(function(e,n,r){return u(e,r),b(a(n,r))}),k=m(function(e,n,r,t){return n&&z.o(n,r)?b(a(n,r)):t()}),j=m(function(e,n,r,t){return u(e,r),b(d(n,r,t)||y(n,e,r,t)||a(n,r))}),w=m(function(e,n,r){return u(e,r),s(n,e,r)}),E=m(function(e,n,r,t){return u(e,r),f(n,e,r,t)}),x=m(function(e,n,r,t){return u(e,r),g(n,e,r,t)}),T=m(function(e,n,r,t){return u(e,r),p(n,e,r,t)}),M=m(function(e,n,r,t,o){return n&&z.o(n,r)?b(d(n,r,t)||y(n,e,r,t)||a(n,r)):o()}),P=m(function(e,n,r,t){return n&&z.o(n,r)?s(n,e,r):t()}),V=m(function(e,n,r,t,o){return n&&z.o(n,r)?f(n,e,r,t):o()}),q=m(function(e,n,r,t,o){var i=n&&z.o(n,r)&&d(n,r,t);return i?b(i):o()}),A=m(function(e,n,r,t,o){return n&&z.o(n,r)?p(n,e,r,t):o()}),C=function(e){var r=!1,t=!1,o=!1,i=!1,u=[e.shareScope,e.shareKey];return(e.requiredVersion?(e.strictVersion&&(r=!0),e.singleton&&(t=!0),u.push(n(e.requiredVersion)),o=!0):e.singleton&&(t=!0),e.fallback&&(i=!0,u.push(e.fallback)),r&&t&&o&&i)?function(){return A.apply(null,u)}:r&&o&&i?function(){return q.apply(null,u)}:t&&o&&i?function(){return V.apply(null,u)}:r&&t&&o?function(){return T.apply(null,u)}:t&&i?function(){return P.apply(null,u)}:o&&i?function(){return M.apply(null,u)}:r&&o?function(){return x.apply(null,u)}:t&&o?function(){return E.apply(null,u)}:t?function(){return w.apply(null,u)}:o?function(){return j.apply(null,u)}:i?function(){return k.apply(null,u)}:function(){return S.apply(null,u)}},O={},z.f.consumes=function(e,n){var r=z.consumesLoadingData.moduleIdToConsumeDataMapping,t=z.consumesLoadingData.chunkMapping;z.o(t,e)&&t[e].forEach(function(e){if(z.o(O,e))return n.push(O[e]);var t=function(n){O[e]=0,z.m[e]=function(r){delete z.c[e],r.exports=n()}},o=function(n){delete O[e],z.m[e]=function(r){throw delete z.c[e],n}};try{var i=C(r[e])();i.then?n.push(O[e]=i.then(t).catch(o)):t(i)}catch(e){o(e)}})},D={871:0},z.f.j=function(e,n){var r=z.o(D,e)?D[e]:void 0;if(0!==r)if(r)n.push(r[2]);else{var t=new Promise((n,t)=>r=D[e]=[n,t]);n.push(r[2]=t);var o=z.p+z.u(e),i=Error();z.l(o,function(n){if(z.o(D,e)&&(0!==(r=D[e])&&(D[e]=void 0),r)){var t=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;i.message="Loading chunk "+e+" failed.\n("+t+": "+o+")",i.name="ChunkLoadError",i.type=t,i.request=o,r[1](i)}},"chunk-"+e,e)}},_=(e,n)=>{var r,t,[o,i,u]=n,a=0;if(o.some(e=>0!==D[e])){for(r in i)z.o(i,r)&&(z.m[r]=i[r]);u&&u(z)}for(e&&e(n);a<o.length;a++)t=o[a],z.o(D,t)&&D[t]&&D[t][0](),D[t]=0},(L=self.rspackChunkcodebind_jupyterlab=self.rspackChunkcodebind_jupyterlab||[]).forEach(_.bind(null,0)),L.push=_.bind(null,L.push.bind(L));var F=z(457);(_JUPYTERLAB=void 0===_JUPYTERLAB?{}:_JUPYTERLAB)["codebind-jupyterlab"]=F})();
|
|
1
|
+
var _JUPYTERLAB;(()=>{"use strict";var e,n,r,t,o,i,u,a,l,c,s,f,p,d,h,g,v,y,b,m,S,k,j,w,E,x,T,M,P,V,q,A,C,O,D,_,L,N={457(e,n,r){var t={"./index":()=>r.e(590).then(()=>()=>r(509)),"./extension":()=>r.e(590).then(()=>()=>r(509))},o=function(e,n){return r.R=n,n=r.o(t,e)?t[e]():Promise.resolve().then(()=>{throw Error('Module "'+e+'" does not exist in container.')}),r.R=void 0,n},i=function(e,n){if(r.S){var t="default",o=r.S[t];if(o&&o!==e)throw Error("Container initialization failed as it has already been initialized with a different share scope");return r.S[t]=e,r.I(t,n)}};r.d(n,{get:()=>o,init:()=>i})}},$={};function z(e){var n=$[e];if(void 0!==n)return n.exports;var r=$[e]={exports:{}};return N[e](r,r.exports,z),r.exports}z.m=N,z.c=$,z.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return z.d(n,{a:n}),n},z.d=(e,n,r)=>{var t=(n,r)=>{for(var t in n)z.o(n,t)&&!z.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,[r]:n[t]})};t(n,"get"),t(r,"value")},z.f={},z.e=e=>Promise.all(Object.keys(z.f).reduce((n,r)=>(z.f[r](e,n),n),[])),z.u=e=>""+e+".dae4561c5427a855.js?v=dae4561c5427a855",z.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),z.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),I={},z.l=function(e,n,r,t){if(I[e])return void I[e].push(n);if(void 0!==r)for(var o,i,u=document.getElementsByTagName("script"),a=0;a<u.length;a++){var l=u[a];if(l.getAttribute("src")==e||l.getAttribute("data-rspack")=="codebind-jupyterlab:"+r){o=l;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,z.nc&&o.setAttribute("nonce",z.nc),o.setAttribute("data-rspack","codebind-jupyterlab:"+r),o.src=e),I[e]=[n];var c=function(n,r){o.onerror=o.onload=null,clearTimeout(s);var t=I[e];if(delete I[e],o.parentNode&&o.parentNode.removeChild(o),t&&t.forEach(function(e){return e(r)}),n)return n(r)},s=setTimeout(c.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=c.bind(null,o.onerror),o.onload=c.bind(null,o.onload),i&&document.head.appendChild(o)},z.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},z.S={},z.initializeSharingData={scopeToSharingDataMapping:{default:[{name:"codebind-jupyterlab",version:"0.6.5",factory:()=>z.e(590).then(()=>()=>z(509)),eager:0,treeShakingMode:null}]},uniqueName:"codebind-jupyterlab"},R={},U={},z.I=function(e,n){n||(n=[]);var r=U[e];if(r||(r=U[e]={}),!(n.indexOf(r)>=0)){if(n.push(r),R[e])return R[e];z.o(z.S,e)||(z.S[e]={});var t=z.S[e],o=function(e){"u">typeof console&&console.warn&&console.warn(e)},i=z.initializeSharingData.uniqueName,u=function(e,n,r,o){var u=t[e]=t[e]||{},a=u[n];(!a||!a.loaded&&(!o!=!a.eager?o:i>a.from))&&(u[n]={get:r,from:i,eager:!!o})},a=function(r){var t=function(e){o("Initialization of sharing external failed: "+e)};try{var i=z(r);if(!i)return;var u=function(r){return r&&r.init&&r.init(z.S[e],n)};if(i.then)return l.push(i.then(u,t));var a=u(i);if(a&&a.then)return l.push(a.catch(t))}catch(e){t(e)}},l=[],c=z.initializeSharingData.scopeToSharingDataMapping;return(c[e]&&c[e].forEach(function(e){"object"==typeof e?u(e.name,e.version,e.factory,e.eager):a(e)}),l.length)?R[e]=Promise.all(l).then(function(){return R[e]=1}):R[e]=1}},z.g.importScripts&&(B=z.g.location+"");var I,R,U,B,K=z.g.document;if(!B&&K&&(K.currentScript&&"SCRIPT"===K.currentScript.tagName.toUpperCase()&&(B=K.currentScript.src),!B)){var J=K.getElementsByTagName("script");if(J.length)for(var Y=J.length-1;Y>-1&&(!B||!/^http(s?):/.test(B));)B=J[Y--].src}if(!B)throw Error("Automatic publicPath is not supported in this browser");z.p=B=B.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),z.consumesLoadingData={chunkMapping:{590:["511","343","99","171","241"]},moduleIdToConsumeDataMapping:{171:{shareScope:"default",shareKey:"@jupyterlab/notebook",import:null,requiredVersion:"^4.6.3",strictVersion:!1,singleton:!0,eager:!1,fallback:void 0,treeShakingMode:null},241:{shareScope:"default",shareKey:"@jupyterlab/services",import:null,requiredVersion:"^7.6.3",strictVersion:!1,singleton:!0,eager:!1,fallback:void 0,treeShakingMode:null},343:{shareScope:"default",shareKey:"@jupyterlab/cells",import:null,requiredVersion:"^4.6.3",strictVersion:!1,singleton:!1,eager:!1,fallback:void 0,treeShakingMode:null},511:{shareScope:"default",shareKey:"@jupyterlab/apputils",import:null,requiredVersion:"^4.7.3",strictVersion:!1,singleton:!0,eager:!1,fallback:void 0,treeShakingMode:null},99:{shareScope:"default",shareKey:"@jupyterlab/nbformat",import:null,requiredVersion:"^4.6.3",strictVersion:!1,singleton:!1,eager:!1,fallback:void 0,treeShakingMode:null}},initialConsumes:[]},e=function(e){return e.split(".").map(function(e){return+e==e?+e:e})},n=function(n){var r=function(n){var r=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(n),t=r[1]?[0].concat(e(r[1])):[0];r[2]&&(t.length++,t.push.apply(t,e(r[2])));let o=t[t.length-1];for(;t.length&&(void 0===o||/^[*xX]$/.test(o));)t.pop(),o=t[t.length-1];return t},t=function(e){return 1===e.length?[0]:2===e.length?[1].concat(e.slice(1)):3===e.length?[2].concat(e.slice(1)):[e.length].concat(e.slice(1))},o=function(e){return[-e[0]-1].concat(e.slice(1))},i=function(e){let n=/^(\^|~|<=|<|>=|>|=|v|!)/.exec(e),i=n?n[0]:"",u=r(i.length?e.slice(i.length).trim():e.trim());switch(i){case"^":if(u.length>1&&0===u[1]){if(u.length>2&&0===u[2])return[3].concat(u.slice(1));return[2].concat(u.slice(1))}return[1].concat(u.slice(1));case"~":return[2].concat(u.slice(1));case">=":return u;case"=":case"v":case"":return t(u);case"<":return o(u);case">":return[,t(u),0,u,2];case"<=":return[,t(u),o(u),1];case"!":return[,t(u),0];default:throw Error("Unexpected start value")}},u=function(e,n){if(1===e.length)return e[0];let r=[];for(let n of e.slice().reverse())0 in n?r.push(n):r.push.apply(r,n.slice(1));return[,].concat(r,e.slice(1).map(()=>n))};return u(n.split(/\s*\|\|\s*/).map(function(e){let n=e.split(/\s+-\s+/);if(1===n.length){e=e.trim();let n=[],r=/[-0-9A-Za-z]\s+/g;for(var a,l=0;a=r.exec(e);){let r=a.index+1;n.push(i(e.slice(l,r).trim())),l=r}return n.push(i(e.slice(l).trim())),u(n,2)}let c=r(n[0]),s=r(n[1]);return[,t(s),o(s),1,c,2]}),1)},r=function(n){var r=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(n),t=r[1]?e(r[1]):[];return r[2]&&(t.length++,t.push.apply(t,e(r[2]))),r[3]&&(t.push([]),t.push.apply(t,e(r[3]))),t},t=function(e,n){e=r(e),n=r(n);for(var t=0;;){if(t>=e.length)return t<n.length&&"u"!=(typeof n[t])[0];var o=e[t],i=(typeof o)[0];if(t>=n.length)return"u"==i;var u=n[t],a=(typeof u)[0];if(i==a){if("o"!=i&&"u"!=i&&o!=u)return o<u;t++}else{if("o"==i&&"n"==a)return!0;return"s"==a||"u"==i}}},o=function(e){var n=e[0],r="";if(1===e.length)return"*";if(n+.5){r+=0==n?">=":-1==n?"<":1==n?"^":2==n?"~":n>0?"=":"!=";for(var t=1,i=1;i<e.length;i++){var u=e[i],a=(typeof u)[0];t--,r+="u"==a?"-":(t>0?".":"")+(t=2,u)}return r}for(var l=[],i=1;i<e.length;i++){var u=e[i];l.push(0===u?"not("+c()+")":1===u?"("+c()+" || "+c()+")":2===u?l.pop()+" "+l.pop():o(u))}return c();function c(){return l.pop().replace(/^\((.+)\)$/,"$1")}},i=function(e,n){if(0 in e){n=r(n);var t=e[0],o=t<0;o&&(t=-t-1);for(var u=0,a=1,l=!0;;a++,u++){var c,s,f=a<e.length?(typeof e[a])[0]:"";if(u>=n.length||"o"==(s=(typeof(c=n[u]))[0])){if(!l)return!0;if("u"==f)return a>t&&!o;return""==f!=o}if("u"==s){if(!l||"u"!=f)return!1}else if(l)if(f==s)if(a<=t){if(c!=e[a])return!1}else{if(o?c>e[a]:c<e[a])return!1;c!=e[a]&&(l=!1)}else if("s"!=f&&"n"!=f){if(o||a<=t)return!1;l=!1,a--}else{if(a<=t||s<f!=o)return!1;l=!1}else"s"!=f&&"n"!=f&&(l=!1,a--)}}for(var p=[],d=p.pop.bind(p),u=1;u<e.length;u++){var h=e[u];p.push(1==h?d()|d():2==h?d()&d():h?i(h,n):!d())}return!!d()},u=function(e,n){var r=z.S[e];if(!r||!z.o(r,n))throw Error("Shared module "+n+" doesn't exist in shared scope "+e);return r},a=function(e,n){var r=e[n],n=Object.keys(r).reduce(function(e,n){return!e||t(e,n)?n:e},0);return n&&r[n]},l=function(e,n){var r=e[n];return Object.keys(r).reduce(function(e,n){return!e||!r[e].loaded&&t(e,n)?n:e},0)},c=function(e,n,r,t){return"Unsatisfied version "+r+" from "+(r&&e[n][r].from)+" of shared singleton module "+n+" (required "+o(t)+")"},s=function(e,n,r,t){var o=l(e,r);return b(e[r][o])},f=function(e,n,r,t){var o=l(e,r);return i(t,o)||v(c(e,r,o,t)),b(e[r][o])},p=function(e,n,r,t){var o=l(e,r);if(!i(t,o))throw Error(c(e,r,o,t));return b(e[r][o])},d=function(e,n,r){var o=e[n],n=Object.keys(o).reduce(function(e,n){return i(r,n)&&(!e||t(e,n))?n:e},0);return n&&o[n]},h=function(e,n,r,t){var i=e[r];return"No satisfying version ("+o(t)+") of shared module "+r+" found in shared scope "+n+".\nAvailable versions: "+Object.keys(i).map(function(e){return e+" from "+i[e].from}).join(", ")},g=function(e,n,r,t){var o=d(e,r,t);if(o)return b(o);throw Error(h(e,n,r,t))},v=function(e){"u">typeof console&&console.warn&&console.warn(e)},y=function(e,n,r,t){v(h(e,n,r,t))},b=function(e){return e.loaded=1,e.get()},S=(m=function(e){return function(n,r,t,o){var i=z.I(n);return i&&i.then?i.then(e.bind(e,n,z.S[n],r,t,o)):e(n,z.S[n],r,t,o)}})(function(e,n,r){return u(e,r),b(a(n,r))}),k=m(function(e,n,r,t){return n&&z.o(n,r)?b(a(n,r)):t()}),j=m(function(e,n,r,t){return u(e,r),b(d(n,r,t)||y(n,e,r,t)||a(n,r))}),w=m(function(e,n,r){return u(e,r),s(n,e,r)}),E=m(function(e,n,r,t){return u(e,r),f(n,e,r,t)}),x=m(function(e,n,r,t){return u(e,r),g(n,e,r,t)}),T=m(function(e,n,r,t){return u(e,r),p(n,e,r,t)}),M=m(function(e,n,r,t,o){return n&&z.o(n,r)?b(d(n,r,t)||y(n,e,r,t)||a(n,r)):o()}),P=m(function(e,n,r,t){return n&&z.o(n,r)?s(n,e,r):t()}),V=m(function(e,n,r,t,o){return n&&z.o(n,r)?f(n,e,r,t):o()}),q=m(function(e,n,r,t,o){var i=n&&z.o(n,r)&&d(n,r,t);return i?b(i):o()}),A=m(function(e,n,r,t,o){return n&&z.o(n,r)?p(n,e,r,t):o()}),C=function(e){var r=!1,t=!1,o=!1,i=!1,u=[e.shareScope,e.shareKey];return(e.requiredVersion?(e.strictVersion&&(r=!0),e.singleton&&(t=!0),u.push(n(e.requiredVersion)),o=!0):e.singleton&&(t=!0),e.fallback&&(i=!0,u.push(e.fallback)),r&&t&&o&&i)?function(){return A.apply(null,u)}:r&&o&&i?function(){return q.apply(null,u)}:t&&o&&i?function(){return V.apply(null,u)}:r&&t&&o?function(){return T.apply(null,u)}:t&&i?function(){return P.apply(null,u)}:o&&i?function(){return M.apply(null,u)}:r&&o?function(){return x.apply(null,u)}:t&&o?function(){return E.apply(null,u)}:t?function(){return w.apply(null,u)}:o?function(){return j.apply(null,u)}:i?function(){return k.apply(null,u)}:function(){return S.apply(null,u)}},O={},z.f.consumes=function(e,n){var r=z.consumesLoadingData.moduleIdToConsumeDataMapping,t=z.consumesLoadingData.chunkMapping;z.o(t,e)&&t[e].forEach(function(e){if(z.o(O,e))return n.push(O[e]);var t=function(n){O[e]=0,z.m[e]=function(r){delete z.c[e],r.exports=n()}},o=function(n){delete O[e],z.m[e]=function(r){throw delete z.c[e],n}};try{var i=C(r[e])();i.then?n.push(O[e]=i.then(t).catch(o)):t(i)}catch(e){o(e)}})},D={871:0},z.f.j=function(e,n){var r=z.o(D,e)?D[e]:void 0;if(0!==r)if(r)n.push(r[2]);else{var t=new Promise((n,t)=>r=D[e]=[n,t]);n.push(r[2]=t);var o=z.p+z.u(e),i=Error();z.l(o,function(n){if(z.o(D,e)&&(0!==(r=D[e])&&(D[e]=void 0),r)){var t=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;i.message="Loading chunk "+e+" failed.\n("+t+": "+o+")",i.name="ChunkLoadError",i.type=t,i.request=o,r[1](i)}},"chunk-"+e,e)}},_=(e,n)=>{var r,t,[o,i,u]=n,a=0;if(o.some(e=>0!==D[e])){for(r in i)z.o(i,r)&&(z.m[r]=i[r]);u&&u(z)}for(e&&e(n);a<o.length;a++)t=o[a],z.o(D,t)&&D[t]&&D[t][0](),D[t]=0},(L=self.rspackChunkcodebind_jupyterlab=self.rspackChunkcodebind_jupyterlab||[]).forEach(_.bind(null,0)),L.push=_.bind(null,L.push.bind(L));var F=z(457);(_JUPYTERLAB=void 0===_JUPYTERLAB?{}:_JUPYTERLAB)["codebind-jupyterlab"]=F})();
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codebind
|
|
3
|
+
Version: 0.6.6
|
|
4
|
+
Summary: A frontend-neutral model loop for persistent IPython sessions.
|
|
5
|
+
Keywords: ai,ipython,llm,repl,agents
|
|
6
|
+
Author: Giovanni Gravili
|
|
7
|
+
Author-email: Giovanni Gravili <ghovax@users.noreply.github.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Dist: ipython>=9.17
|
|
19
|
+
Requires-Dist: langchain-core>=1.0
|
|
20
|
+
Requires-Dist: models-provider>=0.1.2
|
|
21
|
+
Requires-Dist: pillow>=11
|
|
22
|
+
Requires-Dist: resvg-py>=0.5
|
|
23
|
+
Requires-Dist: rich>=14.1
|
|
24
|
+
Requires-Python: >=3.13
|
|
25
|
+
Project-URL: Repository, https://github.com/ghovax/codebind
|
|
26
|
+
Project-URL: Issues, https://github.com/ghovax/codebind/issues
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# Codebind
|
|
30
|
+
|
|
31
|
+
Codebind turns an ordinary IPython session into a durable model harness with one tool: an IPython cell executed in the active session. IPython owns execution, namespace, history, magics, tracebacks, and rich display; Codebind owns conversation state and model orchestration.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```console
|
|
36
|
+
uvx codebind
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or install it with any Python package installer:
|
|
40
|
+
|
|
41
|
+
```console
|
|
42
|
+
pip install codebind
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Configuration
|
|
46
|
+
|
|
47
|
+
Codebind reads its private model choice from `$XDG_CONFIG_HOME/codebind/configuration.json`, or `~/.config/codebind/configuration.json` when `XDG_CONFIG_HOME` is unset:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"model": "openai/gpt-5.6-luna",
|
|
52
|
+
"parameters": {
|
|
53
|
+
"reasoning_effort": "medium"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Provider credentials use the same XDG directory in `models.json`. Keep both files readable only by their owner. Loading Codebind does not add `chat`, `model`, `models`, `Models`, or any other variable to the IPython namespace.
|
|
59
|
+
|
|
60
|
+
## Terminal IPython
|
|
61
|
+
|
|
62
|
+
Start a new conversation:
|
|
63
|
+
|
|
64
|
+
```console
|
|
65
|
+
uvx codebind
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Ask through ordinary IPython magic syntax:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
%%question
|
|
72
|
+
Inspect this project and tell me what to implement first.
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Terminal conversations remain live for the current IPython process. Durable automatic resumption belongs to notebooks, where the notebook file provides an unambiguous conversation identity.
|
|
76
|
+
Model-executed cells appear with IPython's native input counter, syntax highlighting, output prompts, streams, and tracebacks. Assistant Markdown is rendered through IPython's terminal MIME renderer. A terminal is a stream rather than a notebook document, so these displays are not editable notebook cells.
|
|
77
|
+
|
|
78
|
+
## JupyterLab
|
|
79
|
+
|
|
80
|
+
```console
|
|
81
|
+
uvx --from jupyterlab --with codebind --with 'nbconvert[webpdf]' jupyter lab
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
When running an unpublished local checkout, expose both its editable Python source and its current prebuilt frontend:
|
|
85
|
+
|
|
86
|
+
```console
|
|
87
|
+
JUPYTER_PATH=/path/to/codebind/data/share/jupyter \
|
|
88
|
+
uvx --refresh --from jupyterlab --with-editable /path/to/codebind \
|
|
89
|
+
--with 'nbconvert[webpdf]' jupyter-lab
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Load Codebind in a notebook:
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
%load_ext codebind
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
That is the complete setup. **Question** is a native toolbar toggle:
|
|
99
|
+
|
|
100
|
+
- Turning it on converts the selected cell into a Question and makes each newly created user cell a Question until the toggle is turned off.
|
|
101
|
+
- Codebind-generated instruction, tool, and answer cells are never converted.
|
|
102
|
+
- Write ordinary Markdown and press `Shift+Enter`.
|
|
103
|
+
|
|
104
|
+
### Instructions and notebook context
|
|
105
|
+
|
|
106
|
+
- Loading the extension adds a locked Markdown cell containing Codebind's packaged instructions. Its exact text becomes the conversation's immutable system message and remains stable when the server or kernel restarts.
|
|
107
|
+
- The whole notebook is model context. Before each Question, Codebind snapshots ordinary Markdown, raw, and code cells—including visible text and image outputs, but never the live Python namespace.
|
|
108
|
+
- Images displayed by the model's IPython tool are included in that tool's result. PNG, JPEG, WebP, GIF, and SVG renditions are prepared as model-visible images; unsupported or oversized images are reported as omissions.
|
|
109
|
+
- The first turn records the snapshot. Later turns append only new, changed, removed, or reordered cells. Existing Questions, tool calls, tool results, and answers in the conversation ledger are not duplicated.
|
|
110
|
+
- Image bytes travel in the relevant message; notebook snapshots contain only stable image descriptors. This append-only representation keeps the prior model prefix unchanged for provider caching.
|
|
111
|
+
|
|
112
|
+
### Persistence and notebook behavior
|
|
113
|
+
|
|
114
|
+
- Codebind stores the complete LangChain message, notebook-context, and turn ledger in notebook metadata. Reopening the notebook, restarting its kernel, and loading the extension restores the accumulated context automatically.
|
|
115
|
+
- Each assistant Markdown segment is buffered and inserted as one complete native cell as soon as it finishes, before a following tool call completes.
|
|
116
|
+
- Tool executions and assistant answers are appended to the notebook end without changing the user's selection or scroll position. Tool outputs are collapsed by default and expandable through JupyterLab's native output control.
|
|
117
|
+
|
|
118
|
+
### Reliability and editing
|
|
119
|
+
|
|
120
|
+
- The conversation ledger validates its structure and each assistant tool call against its single matching result, without a version gate.
|
|
121
|
+
- Interrupted saves finish before a turn is cancelled, preventing a restart from turning a partial write into an orphan tool result. An interrupted tool call is closed with an explicit interrupted result.
|
|
122
|
+
- Temporary model transport failures retry the same Question with a fresh connection; repeated WebSocket failures use HTTP. Invalid requests and authentication failures remain visible errors.
|
|
123
|
+
- If a provider stream is cancelled or fails, Codebind discards that provider session before the next Question while retaining the notebook conversation and stable prompt-cache identity.
|
|
124
|
+
- The instruction cell, sent Question cells, model-authored tool cells, and assistant Markdown cells are non-editable and non-deletable. Draft Questions remain editable until sent. Jupyter's standard interrupt button cancels an active Codebind question.
|
|
125
|
+
|
|
126
|
+
### Markdown and other frontends
|
|
127
|
+
|
|
128
|
+
- Question and assistant Markdown supports `$...$`, `$$...$$`, `\(...\)`, and `\[...\]` through JupyterLab's native MathJax renderer.
|
|
129
|
+
- Other IPython frontends retain standard MIME display, syntax-highlighted code, Markdown, stdout, tracebacks, rich results, and native IPython history.
|
|
130
|
+
|
|
131
|
+
## ChatGPT account access
|
|
132
|
+
|
|
133
|
+
- Models Provider owns OpenAI account authorization and token refresh.
|
|
134
|
+
- Save the resulting provider-values object in Codebind's XDG `models.json`; Codebind loads it privately when the extension starts.
|
|
135
|
+
- ChatGPT subscription access is separate from the public, pay-as-you-go OpenAI API and may require compatibility updates when the account protocol changes.
|
|
@@ -3,21 +3,22 @@ codebind/cli.py,sha256=9LOR1L3P8sPsOOgsnpbOsA1PNUZdAj1Z9ROFKeo3EV8,423
|
|
|
3
3
|
codebind/configuration.py,sha256=b9ux-MiepzAFfRhorZp4w2pdLLs44necescIGg_IKfo,1828
|
|
4
4
|
codebind/conversation.py,sha256=nFMe2QgFkFOA2GYInN-cO_jhA9010LpM6_Ij2g4Q2BA,17500
|
|
5
5
|
codebind/display.py,sha256=IpxcElyNcr5olRIatEduN_d-sRwpsMlaq1UtrOXocQA,494
|
|
6
|
-
codebind/execution.py,sha256=
|
|
7
|
-
codebind/extension.py,sha256
|
|
6
|
+
codebind/execution.py,sha256=gqpZP2BFlSnGkdjLXCsouU6Zim9oETz7dmAiHlIybj8,16261
|
|
7
|
+
codebind/extension.py,sha256=kLlpPZxW5OrQSAA0Oh5tXTHqTsSat7B_HjG8qsG5F_o,6050
|
|
8
8
|
codebind/images.py,sha256=9bJHjXc75_YRBFTAqAWiknRTCjs8ApyGVVSxC_S5lio,4342
|
|
9
9
|
codebind/instructions.md,sha256=WQ42UB5mmGcRqj_hQBzYLpcyUh1EuKDFU5dZ3GpB6JM,3664
|
|
10
10
|
codebind/jupyter.py,sha256=07H_S9G3iyyUtWRzlvFr5-5X6CuLBXVficu5Fz8jpVw,8652
|
|
11
11
|
codebind/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
codebind/session.py,sha256=b8fEFOFdZn4h1wIr9RE2K5SPWmoVyro5pRhGUr4rI6c,23722
|
|
13
|
-
codebind
|
|
14
|
-
codebind-0.6.
|
|
15
|
-
codebind-0.6.
|
|
16
|
-
codebind-0.6.
|
|
17
|
-
codebind-0.6.
|
|
18
|
-
codebind-0.6.
|
|
19
|
-
codebind-0.6.
|
|
20
|
-
codebind-0.6.
|
|
21
|
-
codebind-0.6.
|
|
22
|
-
codebind-0.6.
|
|
23
|
-
codebind-0.6.
|
|
13
|
+
codebind/terminal.py,sha256=zSnVSHSxVqKg6wyjZm6KtxUTmuyCM46PQoXwVIVxmNw,3819
|
|
14
|
+
codebind-0.6.6.dist-info/licenses/LICENSE,sha256=ujX46e0LFBIBTnCDY0u3Q7LV363B7CiI7QJZxIkEXlk,1073
|
|
15
|
+
codebind-0.6.6.data/data/share/jupyter/labextensions/codebind-jupyterlab/install.json,sha256=78rEThkfrk1pXtekX5WrG9_Y0lJYi5XBEm8n9athpFE,164
|
|
16
|
+
codebind-0.6.6.data/data/share/jupyter/labextensions/codebind-jupyterlab/package.json,sha256=hawl8ZytgxN-WbUjgbzdIVemPPczzmSFoc2HwDxtgIc,1192
|
|
17
|
+
codebind-0.6.6.data/data/share/jupyter/labextensions/codebind-jupyterlab/static/590.dae4561c5427a855.js,sha256=lMbXilytbQEc_kzyVkgzhKZxU_zgdNLTz4uLJfC7APY,16141
|
|
18
|
+
codebind-0.6.6.data/data/share/jupyter/labextensions/codebind-jupyterlab/static/remoteEntry.c10098fb6e87897c.js,sha256=U0JBoOwkRkzPct8MzcUO1pc2XeVGvxgztXBMtJMg2b4,11794
|
|
19
|
+
codebind-0.6.6.data/data/share/jupyter/labextensions/codebind-jupyterlab/static/style.js,sha256=Opy15wyuR_ABqsrk-cOcOj2yZtvtq0r36aDkErnloD0,113
|
|
20
|
+
codebind-0.6.6.data/data/share/jupyter/labextensions/codebind-jupyterlab/static/third-party-licenses.json,sha256=MNToQfru1YnHAie-2Virp23yWsc5co3qG0IzrO6SEfw,20
|
|
21
|
+
codebind-0.6.6.dist-info/WHEEL,sha256=7hzKWg-J8I3Buqyw5tBii5z_MmAVsDYXXijd_QAtNZ8,81
|
|
22
|
+
codebind-0.6.6.dist-info/entry_points.txt,sha256=GiPcU63sULDlywJSKigAS4M3vaziYIrubXOb3fAg2_c,48
|
|
23
|
+
codebind-0.6.6.dist-info/METADATA,sha256=2M2ZoO3gCWYhx_BSEFhhECMyXh4prs8mo2V3nF4wMlY,6959
|
|
24
|
+
codebind-0.6.6.dist-info/RECORD,,
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: codebind
|
|
3
|
-
Version: 0.6.4
|
|
4
|
-
Summary: A frontend-neutral model loop for persistent IPython sessions.
|
|
5
|
-
Keywords: ai,ipython,llm,repl,agents
|
|
6
|
-
Author: Giovanni Gravili
|
|
7
|
-
Author-email: Giovanni Gravili <ghovax@users.noreply.github.com>
|
|
8
|
-
License-Expression: MIT
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
Classifier: Development Status :: 3 - Alpha
|
|
11
|
-
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt
|
|
12
|
-
Classifier: Intended Audience :: Developers
|
|
13
|
-
Classifier: Operating System :: OS Independent
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
-
Classifier: Typing :: Typed
|
|
18
|
-
Requires-Dist: ipython>=9.0
|
|
19
|
-
Requires-Dist: langchain-core>=1.0
|
|
20
|
-
Requires-Dist: models-provider>=0.1.2
|
|
21
|
-
Requires-Dist: pillow>=11
|
|
22
|
-
Requires-Dist: resvg-py>=0.5
|
|
23
|
-
Requires-Python: >=3.13
|
|
24
|
-
Project-URL: Repository, https://github.com/ghovax/codebind
|
|
25
|
-
Project-URL: Issues, https://github.com/ghovax/codebind/issues
|
|
26
|
-
Description-Content-Type: text/markdown
|
|
27
|
-
|
|
28
|
-
# Codebind
|
|
29
|
-
|
|
30
|
-
Codebind turns an ordinary IPython session into a durable model harness with one tool: an IPython cell executed in the active session. IPython owns execution, namespace, history, magics, tracebacks, and rich display; Codebind owns conversation state and model orchestration.
|
|
31
|
-
|
|
32
|
-
## Installation
|
|
33
|
-
|
|
34
|
-
```console
|
|
35
|
-
uvx codebind
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Or install it with any Python package installer:
|
|
39
|
-
|
|
40
|
-
```console
|
|
41
|
-
pip install codebind
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Configuration
|
|
45
|
-
|
|
46
|
-
Codebind reads its private model choice from `$XDG_CONFIG_HOME/codebind/configuration.json`, or `~/.config/codebind/configuration.json` when `XDG_CONFIG_HOME` is unset:
|
|
47
|
-
|
|
48
|
-
```json
|
|
49
|
-
{
|
|
50
|
-
"model": "openai/gpt-5.6-luna",
|
|
51
|
-
"parameters": {
|
|
52
|
-
"reasoning_effort": "medium"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Provider credentials use the same XDG directory in `models.json`. Keep both files readable only by their owner. Loading Codebind does not add `chat`, `model`, `models`, `Models`, or any other variable to the IPython namespace.
|
|
58
|
-
|
|
59
|
-
## Terminal IPython
|
|
60
|
-
|
|
61
|
-
Start a new conversation:
|
|
62
|
-
|
|
63
|
-
```console
|
|
64
|
-
uvx codebind
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Ask through ordinary IPython magic syntax:
|
|
68
|
-
|
|
69
|
-
```python
|
|
70
|
-
%%question
|
|
71
|
-
Inspect this project and tell me what to implement first.
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Terminal conversations remain live for the current IPython process. Durable automatic resumption belongs to notebooks, where the notebook file provides an unambiguous conversation identity.
|
|
75
|
-
|
|
76
|
-
## JupyterLab
|
|
77
|
-
|
|
78
|
-
```console
|
|
79
|
-
uvx --from jupyterlab --with codebind --with 'nbconvert[webpdf]' jupyter lab
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
When running an unpublished local checkout, expose both its editable Python source and its current prebuilt frontend:
|
|
83
|
-
|
|
84
|
-
```console
|
|
85
|
-
JUPYTER_PATH=/path/to/codebind/data/share/jupyter \
|
|
86
|
-
uvx --refresh --from jupyterlab --with-editable /path/to/codebind \
|
|
87
|
-
--with 'nbconvert[webpdf]' jupyter-lab
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
Load Codebind in a notebook:
|
|
91
|
-
|
|
92
|
-
```python
|
|
93
|
-
%load_ext codebind
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
That is the complete setup. **Question** is a native toolbar toggle. Turning it on converts the selected cell into a Question and automatically makes each newly created user cell a Question until the toggle is turned off. Codebind-generated instruction, tool, and answer cells are never converted. Write ordinary Markdown and press `Shift+Enter`.
|
|
97
|
-
|
|
98
|
-
Loading the extension adds a locked Markdown cell containing Codebind's packaged instructions. That exact text becomes the conversation's immutable system message and remains stable when the server or kernel restarts.
|
|
99
|
-
|
|
100
|
-
The whole notebook is model context. Before each Question, Codebind takes a canonical snapshot of ordinary Markdown, raw, and code cells, including visible text and image outputs but never the live Python namespace. Images displayed by the model's IPython tool are included in that tool's result as well. PNG, JPEG, WebP, GIF, and SVG renditions are prepared as model-visible images; unsupported or oversized images are reported as omissions rather than silently discarded. The first turn records the snapshot; later turns append only new, changed, removed, or reordered cells. Questions, tool calls, tool results, and answers already present in the conversation ledger are not duplicated. Image bytes are carried in the relevant message, while notebook snapshots contain only stable image descriptors. This append-only representation keeps the prior model prefix unchanged for provider caching.
|
|
101
|
-
|
|
102
|
-
Codebind stores the complete LangChain message, notebook-context, and turn ledger in notebook metadata. Reopening the notebook, restarting its kernel, and loading the extension restores the exact accumulated context automatically. Each assistant Markdown segment is buffered and inserted as one complete native cell as soon as that segment finishes, before a following tool call is complete. Tool executions and assistant answers are always appended to the notebook end without changing the user's current selection or scroll position. Tool outputs are collapsed by default and remain expandable through JupyterLab's native output control.
|
|
103
|
-
|
|
104
|
-
The conversation ledger validates its structure and every assistant tool call against its single matching result, without a version gate. Interrupted saves finish before a turn is cancelled, so a restart cannot turn a partial write into an orphan tool result. Temporary model transport failures retry the same Question with a fresh connection; repeated WebSocket failures use HTTP. Invalid requests and authentication failures remain visible errors.
|
|
105
|
-
|
|
106
|
-
An interrupted tool call is closed with an explicit interrupted result before the turn ends. If a provider stream is cancelled or fails, Codebind discards that provider session before the next Question while retaining the notebook conversation and its stable prompt-cache identity.
|
|
107
|
-
|
|
108
|
-
The instruction cell, sent Question cells, model-authored tool cells, and assistant Markdown cells are non-editable and non-deletable. Draft Question cells remain editable until they are sent. Jupyter's standard interrupt button cancels an active Codebind question.
|
|
109
|
-
|
|
110
|
-
Question and assistant Markdown supports `$...$`, `$$...$$`, `\(...\)`, and `\[...\]` through JupyterLab's native MathJax renderer.
|
|
111
|
-
|
|
112
|
-
Other IPython frontends retain standard MIME display, syntax-highlighted code, Markdown, stdout, tracebacks, rich results, and native IPython history.
|
|
113
|
-
|
|
114
|
-
## ChatGPT account access
|
|
115
|
-
|
|
116
|
-
Models Provider owns OpenAI account authorization and token refresh. Save the resulting provider-values object in Codebind's XDG `models.json`; Codebind loads it privately when the extension starts. ChatGPT subscription access is separate from the public, pay-as-you-go OpenAI API and may require compatibility updates when the account protocol changes.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|