@f5xc-salesdemos/xcsh 15.3.0 → 15.3.2
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/package.json +7 -7
- package/src/ipy/kernel.ts +10 -10
- package/src/ipy/prelude.py +7 -7
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@f5xc-salesdemos/xcsh",
|
|
4
|
-
"version": "15.3.
|
|
4
|
+
"version": "15.3.2",
|
|
5
5
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
6
6
|
"homepage": "https://github.com/f5xc-salesdemos/xcsh",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@agentclientprotocol/sdk": "0.16.1",
|
|
48
48
|
"@mozilla/readability": "^0.6",
|
|
49
|
-
"@f5xc-salesdemos/xcsh-stats": "15.3.
|
|
50
|
-
"@f5xc-salesdemos/pi-agent-core": "15.3.
|
|
51
|
-
"@f5xc-salesdemos/pi-ai": "15.3.
|
|
52
|
-
"@f5xc-salesdemos/pi-natives": "15.3.
|
|
53
|
-
"@f5xc-salesdemos/pi-tui": "15.3.
|
|
54
|
-
"@f5xc-salesdemos/pi-utils": "15.3.
|
|
49
|
+
"@f5xc-salesdemos/xcsh-stats": "15.3.2",
|
|
50
|
+
"@f5xc-salesdemos/pi-agent-core": "15.3.2",
|
|
51
|
+
"@f5xc-salesdemos/pi-ai": "15.3.2",
|
|
52
|
+
"@f5xc-salesdemos/pi-natives": "15.3.2",
|
|
53
|
+
"@f5xc-salesdemos/pi-tui": "15.3.2",
|
|
54
|
+
"@f5xc-salesdemos/pi-utils": "15.3.2",
|
|
55
55
|
"@sinclair/typebox": "^0.34",
|
|
56
56
|
"@xterm/headless": "^6.0",
|
|
57
57
|
"ajv": "^8.18",
|
package/src/ipy/kernel.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { filterEnv, resolvePythonRuntime } from "./runtime";
|
|
|
11
11
|
const TEXT_ENCODER = new TextEncoder();
|
|
12
12
|
const TEXT_DECODER = new TextDecoder();
|
|
13
13
|
const TRACE_IPC = $flag("PI_PYTHON_IPC_TRACE");
|
|
14
|
-
const PRELUDE_INTROSPECTION_SNIPPET = "import json\nprint(json.dumps(
|
|
14
|
+
const PRELUDE_INTROSPECTION_SNIPPET = "import json\nprint(json.dumps(__xcsh_prelude_docs__()))";
|
|
15
15
|
|
|
16
16
|
class SharedGatewayCreateError extends Error {
|
|
17
17
|
constructor(
|
|
@@ -285,8 +285,8 @@ export function renderKernelDisplay(content: Record<string, unknown>): {
|
|
|
285
285
|
const outputs: KernelDisplayOutput[] = [];
|
|
286
286
|
|
|
287
287
|
// Handle status events (custom MIME type from prelude helpers)
|
|
288
|
-
if (data["application/x-
|
|
289
|
-
const statusData = data["application/x-
|
|
288
|
+
if (data["application/x-xcsh-status"] !== undefined) {
|
|
289
|
+
const statusData = data["application/x-xcsh-status"];
|
|
290
290
|
if (statusData && typeof statusData === "object" && "op" in statusData) {
|
|
291
291
|
outputs.push({ type: "status", event: statusData as PythonStatusEvent });
|
|
292
292
|
}
|
|
@@ -512,7 +512,7 @@ export class PythonKernel {
|
|
|
512
512
|
kernelId,
|
|
513
513
|
config.url,
|
|
514
514
|
Snowflake.next(),
|
|
515
|
-
"
|
|
515
|
+
"xcsh",
|
|
516
516
|
false,
|
|
517
517
|
config.token,
|
|
518
518
|
);
|
|
@@ -575,7 +575,7 @@ export class PythonKernel {
|
|
|
575
575
|
)) as { id: string };
|
|
576
576
|
const kernelId = kernelInfo.id;
|
|
577
577
|
|
|
578
|
-
const kernel = new PythonKernel(Snowflake.next(), kernelId, gatewayUrl, Snowflake.next(), "
|
|
578
|
+
const kernel = new PythonKernel(Snowflake.next(), kernelId, gatewayUrl, Snowflake.next(), "xcsh", true);
|
|
579
579
|
|
|
580
580
|
try {
|
|
581
581
|
await logger.time("startWithSharedGateway:connectWS", kernel.#connectWebSocket.bind(kernel), startup);
|
|
@@ -723,11 +723,11 @@ export class PythonKernel {
|
|
|
723
723
|
const envPayload = Object.fromEntries(envEntries);
|
|
724
724
|
const initScript = [
|
|
725
725
|
"import os, sys",
|
|
726
|
-
`
|
|
727
|
-
"os.chdir(
|
|
728
|
-
`
|
|
729
|
-
"for
|
|
730
|
-
"if
|
|
726
|
+
`__xcsh_cwd = ${JSON.stringify(cwd)}`,
|
|
727
|
+
"os.chdir(__xcsh_cwd)",
|
|
728
|
+
`__xcsh_env = ${JSON.stringify(envPayload)}`,
|
|
729
|
+
"for __xcsh_key, __xcsh_val in __xcsh_env.items():\n os.environ[__xcsh_key] = __xcsh_val",
|
|
730
|
+
"if __xcsh_cwd not in sys.path:\n sys.path.insert(0, __xcsh_cwd)",
|
|
731
731
|
].join("\n");
|
|
732
732
|
const executeOptions = getStartupExecuteOptions(options);
|
|
733
733
|
const result = await this.execute(initScript, {
|
package/src/ipy/prelude.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
# OMP IPython prelude helpers
|
|
3
|
-
if "
|
|
4
|
-
|
|
3
|
+
if "__xcsh_prelude_loaded__" not in globals():
|
|
4
|
+
__xcsh_prelude_loaded__ = True
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
import os, re, json, shutil, subprocess, inspect
|
|
7
7
|
from datetime import datetime
|
|
@@ -14,7 +14,7 @@ if "__omp_prelude_loaded__" not in globals():
|
|
|
14
14
|
def _category(cat: str):
|
|
15
15
|
"""Decorator to tag a prelude function with its category."""
|
|
16
16
|
def decorator(fn):
|
|
17
|
-
fn.
|
|
17
|
+
fn._xcsh_category = cat
|
|
18
18
|
return fn
|
|
19
19
|
return decorator
|
|
20
20
|
|
|
@@ -831,11 +831,11 @@ if "__omp_prelude_loaded__" not in globals():
|
|
|
831
831
|
|
|
832
832
|
return current
|
|
833
833
|
|
|
834
|
-
def
|
|
835
|
-
"""Return prelude helper docs for templating. Discovers functions by
|
|
834
|
+
def __xcsh_prelude_docs__() -> list[dict[str, str]]:
|
|
835
|
+
"""Return prelude helper docs for templating. Discovers functions by _xcsh_category attribute."""
|
|
836
836
|
helpers: list[dict[str, str]] = []
|
|
837
837
|
for name, obj in globals().items():
|
|
838
|
-
if not callable(obj) or not hasattr(obj, "
|
|
838
|
+
if not callable(obj) or not hasattr(obj, "_xcsh_category"):
|
|
839
839
|
continue
|
|
840
840
|
signature = str(inspect.signature(obj))
|
|
841
841
|
doc = inspect.getdoc(obj) or ""
|
|
@@ -844,6 +844,6 @@ if "__omp_prelude_loaded__" not in globals():
|
|
|
844
844
|
"name": name,
|
|
845
845
|
"signature": signature,
|
|
846
846
|
"docstring": docline,
|
|
847
|
-
"category": obj.
|
|
847
|
+
"category": obj._xcsh_category,
|
|
848
848
|
})
|
|
849
849
|
return sorted(helpers, key=lambda h: (h["category"], h["name"]))
|