@pasko70/pibo 1.9.2 → 1.9.4
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.
- package/README.md +183 -183
- package/context/codex-base-prompt.md +148 -148
- package/context/compute-worker.md +23 -23
- package/context/pibo-compaction-prompt.md +100 -100
- package/context/pibo-native-tooling.md +18 -18
- package/context/pibo-system-prompt.md +77 -77
- package/dist/apps/chat/agent-store.js +248 -248
- package/dist/apps/chat/data/project-service.js +168 -168
- package/dist/apps/chat/data/read-state-service.js +18 -18
- package/dist/apps/chat/data/session-query-service.js +25 -25
- package/dist/apps/chat/data/timeline-query-service.js +14 -14
- package/dist/apps/chat/static-assets.js +854 -854
- package/dist/apps/chat/workflow-persistence.js +255 -255
- package/dist/apps/chat-ui/assets/{dist-CjYtD7ZT.js → dist-9a5adSX0.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-9lsp1UpA.js → dist-BJftG-mN.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-2KdPXbMT.js → dist-BmIDFlGO.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-BWbWIOcD.js → dist-CCNYUBAQ.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-Cge8JklW.js → dist-Cmr0ZAV7.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-DFhhiR8M.js → dist-Crc-B1sZ.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-5GM30SQK.js → dist-DHPwmWcR.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-C-5u2QIS.js → dist-U3lqQ0aI.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-Idz5kzy8.js → dist-_poCjCWK.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-Etxmpyxg.js → dist-ffW7mw39.js} +1 -1
- package/dist/apps/chat-ui/assets/{dist-BYKMZlI0.js → dist-w2d_3LSu.js} +1 -1
- package/dist/apps/chat-ui/assets/{index-BqD_bm7z.js → index-rXMhSu4U.js} +9 -9
- package/dist/apps/chat-ui/index.html +17 -17
- package/dist/apps/chat-ui/manifest.webmanifest +25 -25
- package/dist/apps/chat-ui/sw.js +47 -47
- package/dist/apps/chat-vscode-web/assets/index-BAMxIaI_.js +41 -0
- package/dist/apps/chat-vscode-web/index.html +13 -13
- package/dist/apps/cli-ui/cliSessionsCommand.js +23 -23
- package/dist/apps/context-files-ui/index.html +11 -11
- package/dist/cli.js +39 -39
- package/dist/compute/cli.js +54 -54
- package/dist/core/session-router.js +5 -2
- package/dist/cron/cli.js +15 -15
- package/dist/cron/store.js +49 -49
- package/dist/data/cli.js +23 -23
- package/dist/data/event-log.js +23 -23
- package/dist/data/message-store.js +20 -20
- package/dist/data/navigation-store.js +9 -9
- package/dist/data/observation-store.js +4 -4
- package/dist/data/payload-store.js +17 -17
- package/dist/data/schema.js +431 -431
- package/dist/data/session-store.js +4 -4
- package/dist/data/telemetry-queries.js +54 -54
- package/dist/data/telemetry.js +197 -197
- package/dist/debug/events.js +12 -12
- package/dist/debug/failures.js +6 -6
- package/dist/debug/index.js +227 -227
- package/dist/debug/messages.js +6 -6
- package/dist/debug/pty.js +124 -124
- package/dist/debug/session.js +29 -29
- package/dist/debug/tools.js +5 -5
- package/dist/debug/web-snapshot-browser-scripts.js +294 -294
- package/dist/debug/web-streaming-browser-library.js +925 -925
- package/dist/debug/web-streaming-browser-scripts.js +232 -232
- package/dist/debug/web-streaming-provider-telemetry.js +4 -4
- package/dist/debug/web.js +93 -93
- package/dist/gateway/cli.js +19 -19
- package/dist/mcp/config-command.js +53 -53
- package/dist/mcp/index.js +21 -21
- package/dist/mcp/registry.js +11 -11
- package/dist/pi-packages/cli.js +11 -11
- package/dist/plugins/context-files-store.js +110 -110
- package/dist/plugins/context-files.js +4 -4
- package/dist/ralph/cli.js +18 -18
- package/dist/ralph/templates.js +140 -140
- package/dist/reliability/store.js +226 -226
- package/dist/session-ui/sessionActivity.js +30 -0
- package/dist/sessions/pibo-data-store.js +16 -16
- package/dist/sessions/sqlite-store.js +53 -53
- package/dist/setup/cli.js +58 -58
- package/dist/signals/projector.js +26 -11
- package/dist/signals/registry.js +41 -0
- package/dist/tools/agent-browser-wrapper.js +80 -80
- package/dist/tools/browser-use-cdp.js +12 -12
- package/dist/tools/browser-use-wrapper.js +762 -762
- package/dist/tools/guides.js +538 -538
- package/dist/tools/index.js +99 -99
- package/dist/tools/runtime/node-worker-source.js +205 -205
- package/dist/tools/runtime/python-worker-source.js +177 -177
- package/dist/vscode/cli.js +9 -9
- package/dist/web-annotations/cdp.js +900 -900
- package/dist/web-annotations/store.js +96 -96
- package/docs/README.md +23 -23
- package/docs/ops/install-developer-host.md +112 -112
- package/docs/ops/install-user-host.md +96 -96
- package/docs/ops/upgrade-user-to-developer-host.md +69 -69
- package/docs/ops/vscode-extension-release.md +160 -160
- package/package.json +95 -95
- package/skills/builtin/graphify/SKILL.md +52 -52
- package/skills/builtin/pi-agent-harness/SKILL.md +319 -319
- package/skills/builtin/pi-agent-harness/agents/openai.yaml +4 -4
- package/skills/builtin/pibo-docker-system/SKILL.md +170 -170
- package/skills/builtin/pibo-spec-writing/SKILL.md +330 -330
- package/skills/builtin/prd/SKILL.md +143 -143
- package/skills/builtin/ralph-loop/SKILL.md +359 -359
- package/skills/builtin/ralph-prd-json/SKILL.md +123 -123
- package/skills/builtin/skill-creator/LICENSE.txt +201 -201
- package/skills/builtin/skill-creator/SKILL.md +513 -513
- package/skills/builtin/skill-creator/agents/analyzer.md +274 -274
- package/skills/builtin/skill-creator/agents/comparator.md +202 -202
- package/skills/builtin/skill-creator/agents/grader.md +223 -223
- package/skills/builtin/skill-creator/assets/eval_review.html +146 -146
- package/skills/builtin/skill-creator/eval-viewer/generate_review.py +471 -471
- package/skills/builtin/skill-creator/eval-viewer/viewer.html +1325 -1325
- package/skills/builtin/skill-creator/references/schemas.md +430 -430
- package/skills/builtin/skill-creator/scripts/aggregate_benchmark.py +401 -401
- package/skills/builtin/skill-creator/scripts/generate_report.py +326 -326
- package/skills/builtin/skill-creator/scripts/improve_description.py +247 -247
- package/skills/builtin/skill-creator/scripts/package_skill.py +136 -136
- package/skills/builtin/skill-creator/scripts/quick_validate.py +102 -102
- package/skills/builtin/skill-creator/scripts/run_eval.py +310 -310
- package/skills/builtin/skill-creator/scripts/run_loop.py +328 -328
- package/skills/builtin/skill-creator/scripts/utils.py +47 -47
- package/skills/builtin/web-annotations/SKILL.md +93 -93
- package/src/mcp/LICENSE.mcp-cli +21 -21
- package/dist/apps/chat-vscode-web/assets/index-Cst9OUkC.js +0 -41
- package/dist/session-ui/activeTurn.js +0 -126
|
@@ -1,178 +1,178 @@
|
|
|
1
|
-
export const PYTHON_RUNTIME_WORKER_SOURCE = String.raw `
|
|
2
|
-
import contextlib
|
|
3
|
-
import inspect
|
|
4
|
-
import io
|
|
5
|
-
import json
|
|
6
|
-
import signal
|
|
7
|
-
import sys
|
|
8
|
-
import traceback
|
|
9
|
-
|
|
10
|
-
user_globals = {"__name__": "__pibo_runtime__"}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def bounded(value, max_bytes=8192):
|
|
14
|
-
text = str(value)
|
|
15
|
-
encoded = text.encode("utf-8", "replace")
|
|
16
|
-
if len(encoded) <= max_bytes:
|
|
17
|
-
return text
|
|
18
|
-
return encoded[:max_bytes].decode("utf-8", "replace") + "\n...<truncated>"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def safe_repr(value, max_bytes=4096):
|
|
22
|
-
try:
|
|
23
|
-
return bounded(repr(value), max_bytes)
|
|
24
|
-
except Exception as exc:
|
|
25
|
-
return f"<repr failed: {type(exc).__name__}: {exc}>"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def summarize(value, max_bytes=4096):
|
|
29
|
-
result = {"type": type(value).__name__, "repr": safe_repr(value, max_bytes)}
|
|
30
|
-
try:
|
|
31
|
-
if hasattr(value, "shape"):
|
|
32
|
-
shape = getattr(value, "shape")
|
|
33
|
-
try:
|
|
34
|
-
result["shape"] = list(shape)
|
|
35
|
-
except Exception:
|
|
36
|
-
pass
|
|
37
|
-
if hasattr(value, "columns"):
|
|
38
|
-
try:
|
|
39
|
-
result["columns"] = [str(c) for c in list(getattr(value, "columns"))[:50]]
|
|
40
|
-
except Exception:
|
|
41
|
-
pass
|
|
42
|
-
if isinstance(value, dict):
|
|
43
|
-
result["length"] = len(value)
|
|
44
|
-
result["keys"] = [safe_repr(k, 128) for k in list(value.keys())[:50]]
|
|
45
|
-
elif isinstance(value, (list, tuple, set, frozenset, str, bytes, bytearray)):
|
|
46
|
-
result["length"] = len(value)
|
|
47
|
-
if hasattr(value, "head"):
|
|
48
|
-
try:
|
|
49
|
-
result["preview"] = bounded(value.head().to_string(), max_bytes)
|
|
50
|
-
except Exception:
|
|
51
|
-
pass
|
|
52
|
-
except Exception:
|
|
53
|
-
pass
|
|
54
|
-
return result
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def error_summary(exc):
|
|
58
|
-
tb = traceback.format_exc()
|
|
59
|
-
line = None
|
|
60
|
-
try:
|
|
61
|
-
extracted = traceback.extract_tb(exc.__traceback__)
|
|
62
|
-
runtime_frames = [frame for frame in extracted if frame.filename == "<pibo-runtime>"]
|
|
63
|
-
if runtime_frames:
|
|
64
|
-
line = runtime_frames[-1].lineno
|
|
65
|
-
except Exception:
|
|
66
|
-
pass
|
|
67
|
-
out = {"name": type(exc).__name__, "message": str(exc), "traceback": tb}
|
|
68
|
-
if line is not None:
|
|
69
|
-
out["line"] = line
|
|
70
|
-
return out
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def execute(req):
|
|
74
|
-
mode = req.get("mode") or "exec"
|
|
75
|
-
code = req.get("code") or ""
|
|
76
|
-
if mode == "auto":
|
|
77
|
-
mode = "exec"
|
|
78
|
-
stdout = io.StringIO()
|
|
79
|
-
stderr = io.StringIO()
|
|
80
|
-
try:
|
|
81
|
-
with contextlib.redirect_stdout(stdout), contextlib.redirect_stderr(stderr):
|
|
82
|
-
if mode == "eval":
|
|
83
|
-
value = eval(compile(code, "<pibo-runtime>", "eval"), user_globals, user_globals)
|
|
84
|
-
else:
|
|
85
|
-
exec(compile(code, "<pibo-runtime>", "exec"), user_globals, user_globals)
|
|
86
|
-
value = None
|
|
87
|
-
return {
|
|
88
|
-
"id": req.get("id"),
|
|
89
|
-
"status": "ok",
|
|
90
|
-
"stdout": stdout.getvalue(),
|
|
91
|
-
"stderr": stderr.getvalue(),
|
|
92
|
-
"result": summarize(value) if value is not None else None,
|
|
93
|
-
}
|
|
94
|
-
except KeyboardInterrupt as exc:
|
|
95
|
-
return {"id": req.get("id"), "status": "interrupted", "stdout": stdout.getvalue(), "stderr": stderr.getvalue(), "error": error_summary(exc)}
|
|
96
|
-
except Exception as exc:
|
|
97
|
-
return {"id": req.get("id"), "status": "error", "stdout": stdout.getvalue(), "stderr": stderr.getvalue(), "error": error_summary(exc)}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
def inspect_value(req):
|
|
101
|
-
expression = req.get("expression") or ""
|
|
102
|
-
what = req.get("what") or "summary"
|
|
103
|
-
max_bytes = int(req.get("maxBytes") or 8192)
|
|
104
|
-
try:
|
|
105
|
-
value = eval(compile(expression, "<pibo-runtime>", "eval"), user_globals, user_globals)
|
|
106
|
-
result = {"id": req.get("id"), "status": "ok"}
|
|
107
|
-
if what in ("summary", "all"):
|
|
108
|
-
result["summary"] = summarize(value, max_bytes)
|
|
109
|
-
if what in ("signature", "all"):
|
|
110
|
-
try:
|
|
111
|
-
result["signature"] = bounded(str(inspect.signature(value)), max_bytes)
|
|
112
|
-
except Exception as exc:
|
|
113
|
-
result["signature"] = f"<signature unavailable: {type(exc).__name__}: {exc}>"
|
|
114
|
-
if what in ("members", "all"):
|
|
115
|
-
try:
|
|
116
|
-
result["members"] = [name for name, _ in inspect.getmembers(value)[:200]]
|
|
117
|
-
except Exception:
|
|
118
|
-
result["members"] = dir(value)[:200]
|
|
119
|
-
if what in ("source", "all"):
|
|
120
|
-
try:
|
|
121
|
-
result["source"] = bounded(inspect.getsource(value), max_bytes)
|
|
122
|
-
except Exception as exc:
|
|
123
|
-
result["source"] = f"<source unavailable: {type(exc).__name__}: {exc}>"
|
|
124
|
-
if what in ("doc", "all"):
|
|
125
|
-
result["doc"] = bounded(inspect.getdoc(value) or "", max_bytes)
|
|
126
|
-
return result
|
|
127
|
-
except Exception as exc:
|
|
128
|
-
return {"id": req.get("id"), "status": "error", "error": error_summary(exc)}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
def list_vars(req):
|
|
132
|
-
include_private = bool(req.get("includePrivate"))
|
|
133
|
-
max_items = int(req.get("maxItems") or 100)
|
|
134
|
-
max_bytes = int(req.get("maxBytes") or 4096)
|
|
135
|
-
variables = []
|
|
136
|
-
for name, value in sorted(user_globals.items()):
|
|
137
|
-
if name == "__builtins__":
|
|
138
|
-
continue
|
|
139
|
-
if not include_private and name.startswith("_"):
|
|
140
|
-
continue
|
|
141
|
-
if inspect.ismodule(value):
|
|
142
|
-
continue
|
|
143
|
-
variables.append({"name": name, "summary": summarize(value, max_bytes)})
|
|
144
|
-
if len(variables) >= max_items:
|
|
145
|
-
break
|
|
146
|
-
return {"id": req.get("id"), "status": "ok", "variables": variables, "truncated": len(variables) >= max_items}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
def write_response(resp):
|
|
150
|
-
sys.stdout.write(json.dumps(resp, ensure_ascii=False) + "\n")
|
|
151
|
-
sys.stdout.flush()
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
def main():
|
|
155
|
-
write_response({"id": "ready", "status": "ready"})
|
|
156
|
-
for line in sys.stdin:
|
|
157
|
-
try:
|
|
158
|
-
req = json.loads(line)
|
|
159
|
-
typ = req.get("type")
|
|
160
|
-
if typ == "exec":
|
|
161
|
-
resp = execute(req)
|
|
162
|
-
elif typ == "inspect":
|
|
163
|
-
resp = inspect_value(req)
|
|
164
|
-
elif typ == "vars":
|
|
165
|
-
resp = list_vars(req)
|
|
166
|
-
elif typ == "shutdown":
|
|
167
|
-
write_response({"id": req.get("id"), "status": "ok"})
|
|
168
|
-
return
|
|
169
|
-
else:
|
|
170
|
-
resp = {"id": req.get("id"), "status": "error", "error": {"name": "RuntimeProtocolError", "message": f"unknown request type {typ}"}}
|
|
171
|
-
except Exception as exc:
|
|
172
|
-
resp = {"id": None, "status": "error", "error": error_summary(exc)}
|
|
173
|
-
write_response(resp)
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if __name__ == "__main__":
|
|
177
|
-
main()
|
|
1
|
+
export const PYTHON_RUNTIME_WORKER_SOURCE = String.raw `
|
|
2
|
+
import contextlib
|
|
3
|
+
import inspect
|
|
4
|
+
import io
|
|
5
|
+
import json
|
|
6
|
+
import signal
|
|
7
|
+
import sys
|
|
8
|
+
import traceback
|
|
9
|
+
|
|
10
|
+
user_globals = {"__name__": "__pibo_runtime__"}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def bounded(value, max_bytes=8192):
|
|
14
|
+
text = str(value)
|
|
15
|
+
encoded = text.encode("utf-8", "replace")
|
|
16
|
+
if len(encoded) <= max_bytes:
|
|
17
|
+
return text
|
|
18
|
+
return encoded[:max_bytes].decode("utf-8", "replace") + "\n...<truncated>"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def safe_repr(value, max_bytes=4096):
|
|
22
|
+
try:
|
|
23
|
+
return bounded(repr(value), max_bytes)
|
|
24
|
+
except Exception as exc:
|
|
25
|
+
return f"<repr failed: {type(exc).__name__}: {exc}>"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def summarize(value, max_bytes=4096):
|
|
29
|
+
result = {"type": type(value).__name__, "repr": safe_repr(value, max_bytes)}
|
|
30
|
+
try:
|
|
31
|
+
if hasattr(value, "shape"):
|
|
32
|
+
shape = getattr(value, "shape")
|
|
33
|
+
try:
|
|
34
|
+
result["shape"] = list(shape)
|
|
35
|
+
except Exception:
|
|
36
|
+
pass
|
|
37
|
+
if hasattr(value, "columns"):
|
|
38
|
+
try:
|
|
39
|
+
result["columns"] = [str(c) for c in list(getattr(value, "columns"))[:50]]
|
|
40
|
+
except Exception:
|
|
41
|
+
pass
|
|
42
|
+
if isinstance(value, dict):
|
|
43
|
+
result["length"] = len(value)
|
|
44
|
+
result["keys"] = [safe_repr(k, 128) for k in list(value.keys())[:50]]
|
|
45
|
+
elif isinstance(value, (list, tuple, set, frozenset, str, bytes, bytearray)):
|
|
46
|
+
result["length"] = len(value)
|
|
47
|
+
if hasattr(value, "head"):
|
|
48
|
+
try:
|
|
49
|
+
result["preview"] = bounded(value.head().to_string(), max_bytes)
|
|
50
|
+
except Exception:
|
|
51
|
+
pass
|
|
52
|
+
except Exception:
|
|
53
|
+
pass
|
|
54
|
+
return result
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def error_summary(exc):
|
|
58
|
+
tb = traceback.format_exc()
|
|
59
|
+
line = None
|
|
60
|
+
try:
|
|
61
|
+
extracted = traceback.extract_tb(exc.__traceback__)
|
|
62
|
+
runtime_frames = [frame for frame in extracted if frame.filename == "<pibo-runtime>"]
|
|
63
|
+
if runtime_frames:
|
|
64
|
+
line = runtime_frames[-1].lineno
|
|
65
|
+
except Exception:
|
|
66
|
+
pass
|
|
67
|
+
out = {"name": type(exc).__name__, "message": str(exc), "traceback": tb}
|
|
68
|
+
if line is not None:
|
|
69
|
+
out["line"] = line
|
|
70
|
+
return out
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def execute(req):
|
|
74
|
+
mode = req.get("mode") or "exec"
|
|
75
|
+
code = req.get("code") or ""
|
|
76
|
+
if mode == "auto":
|
|
77
|
+
mode = "exec"
|
|
78
|
+
stdout = io.StringIO()
|
|
79
|
+
stderr = io.StringIO()
|
|
80
|
+
try:
|
|
81
|
+
with contextlib.redirect_stdout(stdout), contextlib.redirect_stderr(stderr):
|
|
82
|
+
if mode == "eval":
|
|
83
|
+
value = eval(compile(code, "<pibo-runtime>", "eval"), user_globals, user_globals)
|
|
84
|
+
else:
|
|
85
|
+
exec(compile(code, "<pibo-runtime>", "exec"), user_globals, user_globals)
|
|
86
|
+
value = None
|
|
87
|
+
return {
|
|
88
|
+
"id": req.get("id"),
|
|
89
|
+
"status": "ok",
|
|
90
|
+
"stdout": stdout.getvalue(),
|
|
91
|
+
"stderr": stderr.getvalue(),
|
|
92
|
+
"result": summarize(value) if value is not None else None,
|
|
93
|
+
}
|
|
94
|
+
except KeyboardInterrupt as exc:
|
|
95
|
+
return {"id": req.get("id"), "status": "interrupted", "stdout": stdout.getvalue(), "stderr": stderr.getvalue(), "error": error_summary(exc)}
|
|
96
|
+
except Exception as exc:
|
|
97
|
+
return {"id": req.get("id"), "status": "error", "stdout": stdout.getvalue(), "stderr": stderr.getvalue(), "error": error_summary(exc)}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def inspect_value(req):
|
|
101
|
+
expression = req.get("expression") or ""
|
|
102
|
+
what = req.get("what") or "summary"
|
|
103
|
+
max_bytes = int(req.get("maxBytes") or 8192)
|
|
104
|
+
try:
|
|
105
|
+
value = eval(compile(expression, "<pibo-runtime>", "eval"), user_globals, user_globals)
|
|
106
|
+
result = {"id": req.get("id"), "status": "ok"}
|
|
107
|
+
if what in ("summary", "all"):
|
|
108
|
+
result["summary"] = summarize(value, max_bytes)
|
|
109
|
+
if what in ("signature", "all"):
|
|
110
|
+
try:
|
|
111
|
+
result["signature"] = bounded(str(inspect.signature(value)), max_bytes)
|
|
112
|
+
except Exception as exc:
|
|
113
|
+
result["signature"] = f"<signature unavailable: {type(exc).__name__}: {exc}>"
|
|
114
|
+
if what in ("members", "all"):
|
|
115
|
+
try:
|
|
116
|
+
result["members"] = [name for name, _ in inspect.getmembers(value)[:200]]
|
|
117
|
+
except Exception:
|
|
118
|
+
result["members"] = dir(value)[:200]
|
|
119
|
+
if what in ("source", "all"):
|
|
120
|
+
try:
|
|
121
|
+
result["source"] = bounded(inspect.getsource(value), max_bytes)
|
|
122
|
+
except Exception as exc:
|
|
123
|
+
result["source"] = f"<source unavailable: {type(exc).__name__}: {exc}>"
|
|
124
|
+
if what in ("doc", "all"):
|
|
125
|
+
result["doc"] = bounded(inspect.getdoc(value) or "", max_bytes)
|
|
126
|
+
return result
|
|
127
|
+
except Exception as exc:
|
|
128
|
+
return {"id": req.get("id"), "status": "error", "error": error_summary(exc)}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def list_vars(req):
|
|
132
|
+
include_private = bool(req.get("includePrivate"))
|
|
133
|
+
max_items = int(req.get("maxItems") or 100)
|
|
134
|
+
max_bytes = int(req.get("maxBytes") or 4096)
|
|
135
|
+
variables = []
|
|
136
|
+
for name, value in sorted(user_globals.items()):
|
|
137
|
+
if name == "__builtins__":
|
|
138
|
+
continue
|
|
139
|
+
if not include_private and name.startswith("_"):
|
|
140
|
+
continue
|
|
141
|
+
if inspect.ismodule(value):
|
|
142
|
+
continue
|
|
143
|
+
variables.append({"name": name, "summary": summarize(value, max_bytes)})
|
|
144
|
+
if len(variables) >= max_items:
|
|
145
|
+
break
|
|
146
|
+
return {"id": req.get("id"), "status": "ok", "variables": variables, "truncated": len(variables) >= max_items}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def write_response(resp):
|
|
150
|
+
sys.stdout.write(json.dumps(resp, ensure_ascii=False) + "\n")
|
|
151
|
+
sys.stdout.flush()
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def main():
|
|
155
|
+
write_response({"id": "ready", "status": "ready"})
|
|
156
|
+
for line in sys.stdin:
|
|
157
|
+
try:
|
|
158
|
+
req = json.loads(line)
|
|
159
|
+
typ = req.get("type")
|
|
160
|
+
if typ == "exec":
|
|
161
|
+
resp = execute(req)
|
|
162
|
+
elif typ == "inspect":
|
|
163
|
+
resp = inspect_value(req)
|
|
164
|
+
elif typ == "vars":
|
|
165
|
+
resp = list_vars(req)
|
|
166
|
+
elif typ == "shutdown":
|
|
167
|
+
write_response({"id": req.get("id"), "status": "ok"})
|
|
168
|
+
return
|
|
169
|
+
else:
|
|
170
|
+
resp = {"id": req.get("id"), "status": "error", "error": {"name": "RuntimeProtocolError", "message": f"unknown request type {typ}"}}
|
|
171
|
+
except Exception as exc:
|
|
172
|
+
resp = {"id": None, "status": "error", "error": error_summary(exc)}
|
|
173
|
+
write_response(resp)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
if __name__ == "__main__":
|
|
177
|
+
main()
|
|
178
178
|
`;
|
package/dist/vscode/cli.js
CHANGED
|
@@ -11,15 +11,15 @@ import { runInstall } from "./install.js";
|
|
|
11
11
|
import { runStatus, formatStatusText } from "./status.js";
|
|
12
12
|
import { runUninstall } from "./uninstall.js";
|
|
13
13
|
function printDiscovery() {
|
|
14
|
-
console.log(`pibo vscode
|
|
15
|
-
|
|
16
|
-
Manage the Pibo VS Code extension.
|
|
17
|
-
|
|
18
|
-
Commands:
|
|
19
|
-
install Download and install the latest Pibo VS Code extension
|
|
20
|
-
uninstall Remove the installed Pibo VS Code extension
|
|
21
|
-
status Show whether the extension is installed
|
|
22
|
-
|
|
14
|
+
console.log(`pibo vscode
|
|
15
|
+
|
|
16
|
+
Manage the Pibo VS Code extension.
|
|
17
|
+
|
|
18
|
+
Commands:
|
|
19
|
+
install Download and install the latest Pibo VS Code extension
|
|
20
|
+
uninstall Remove the installed Pibo VS Code extension
|
|
21
|
+
status Show whether the extension is installed
|
|
22
|
+
|
|
23
23
|
Next: pibo vscode install --help`);
|
|
24
24
|
}
|
|
25
25
|
export async function runVscodeCli(argv = process.argv) {
|