jupyterlab-codex-sidebar 0.1.4 → 0.1.6

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.
Files changed (153) hide show
  1. package/.claude/settings.local.json +9 -0
  2. package/.github/workflows/unit-tests.yml +27 -0
  3. package/.jupyterlab-playwright.log +0 -0
  4. package/README.md +83 -9
  5. package/docs/images/codex-sidebar-screenshot.png +0 -0
  6. package/jupyterlab_codex/handlers.py +938 -297
  7. package/jupyterlab_codex/labextension/package.json +13 -3
  8. package/jupyterlab_codex/labextension/static/525.224526d045c727069de6.js +2 -0
  9. package/jupyterlab_codex/labextension/static/737.e7de3ad9dd6ded798340.js +1 -0
  10. package/jupyterlab_codex/labextension/static/remoteEntry.6ef5e7167763a316c000.js +1 -0
  11. package/jupyterlab_codex/protocol.py +297 -0
  12. package/jupyterlab_codex/runner.py +58 -15
  13. package/jupyterlab_codex/sessions.py +582 -97
  14. package/lib/codexChat.d.ts +13 -0
  15. package/lib/codexChat.js +2506 -0
  16. package/lib/codexChat.js.map +1 -0
  17. package/lib/codexChatAttachmentDedup.d.ts +10 -0
  18. package/lib/codexChatAttachmentDedup.js +35 -0
  19. package/lib/codexChatAttachmentDedup.js.map +1 -0
  20. package/lib/codexChatAttachmentLimit.d.ts +18 -0
  21. package/lib/codexChatAttachmentLimit.js +50 -0
  22. package/lib/codexChatAttachmentLimit.js.map +1 -0
  23. package/lib/codexChatAttachmentState.d.ts +15 -0
  24. package/lib/codexChatAttachmentState.js +16 -0
  25. package/lib/codexChatAttachmentState.js.map +1 -0
  26. package/lib/codexChatDocumentUtils.d.ts +70 -0
  27. package/lib/codexChatDocumentUtils.js +506 -0
  28. package/lib/codexChatDocumentUtils.js.map +1 -0
  29. package/lib/codexChatFormatting.d.ts +11 -0
  30. package/lib/codexChatFormatting.js +83 -0
  31. package/lib/codexChatFormatting.js.map +1 -0
  32. package/lib/codexChatNotice.d.ts +3 -0
  33. package/lib/codexChatNotice.js +74 -0
  34. package/lib/codexChatNotice.js.map +1 -0
  35. package/lib/codexChatPersistence.d.ts +35 -0
  36. package/lib/codexChatPersistence.js +158 -0
  37. package/lib/codexChatPersistence.js.map +1 -0
  38. package/lib/codexChatPrimitives.d.ts +44 -0
  39. package/lib/codexChatPrimitives.js +156 -0
  40. package/lib/codexChatPrimitives.js.map +1 -0
  41. package/lib/codexChatRender.d.ts +24 -0
  42. package/lib/codexChatRender.js +293 -0
  43. package/lib/codexChatRender.js.map +1 -0
  44. package/lib/codexChatSessionFactory.d.ts +15 -0
  45. package/lib/codexChatSessionFactory.js +45 -0
  46. package/lib/codexChatSessionFactory.js.map +1 -0
  47. package/lib/codexChatSessionKey.d.ts +3 -0
  48. package/lib/codexChatSessionKey.js +14 -0
  49. package/lib/codexChatSessionKey.js.map +1 -0
  50. package/lib/codexChatStorage.d.ts +4 -0
  51. package/lib/codexChatStorage.js +37 -0
  52. package/lib/codexChatStorage.js.map +1 -0
  53. package/lib/codexSessionResolver.d.ts +12 -0
  54. package/lib/codexSessionResolver.js +38 -0
  55. package/lib/codexSessionResolver.js.map +1 -0
  56. package/lib/handlers/activitySummarizer.d.ts +15 -0
  57. package/lib/handlers/activitySummarizer.js +327 -0
  58. package/lib/handlers/activitySummarizer.js.map +1 -0
  59. package/lib/handlers/codexMessageTypes.d.ts +30 -0
  60. package/lib/handlers/codexMessageTypes.js +2 -0
  61. package/lib/handlers/codexMessageTypes.js.map +1 -0
  62. package/lib/handlers/codexMessageUtils.d.ts +46 -0
  63. package/lib/handlers/codexMessageUtils.js +144 -0
  64. package/lib/handlers/codexMessageUtils.js.map +1 -0
  65. package/lib/handlers/handleCodexSocketMessage.d.ts +107 -0
  66. package/lib/handlers/handleCodexSocketMessage.js +78 -0
  67. package/lib/handlers/handleCodexSocketMessage.js.map +1 -0
  68. package/lib/handlers/sessionSyncHandler.d.ts +34 -0
  69. package/lib/handlers/sessionSyncHandler.js +181 -0
  70. package/lib/handlers/sessionSyncHandler.js.map +1 -0
  71. package/lib/hooks/useCodexSocket.d.ts +15 -0
  72. package/lib/hooks/useCodexSocket.js +84 -0
  73. package/lib/hooks/useCodexSocket.js.map +1 -0
  74. package/lib/index.js +1 -1
  75. package/lib/index.js.map +1 -1
  76. package/lib/panel.d.ts +1 -11
  77. package/lib/panel.js +1 -2815
  78. package/lib/panel.js.map +1 -1
  79. package/lib/protocol.d.ts +235 -0
  80. package/lib/protocol.js +278 -0
  81. package/lib/protocol.js.map +1 -0
  82. package/package.json +13 -3
  83. package/playwright.config.cjs +27 -0
  84. package/playwright.unit.config.cjs +19 -0
  85. package/pyproject.toml +1 -1
  86. package/release.sh +52 -14
  87. package/scripts/run_playwright_e2e.sh +96 -0
  88. package/scripts/run_playwright_freeze_repro.sh +58 -0
  89. package/scripts/run_playwright_queue_repro.sh +60 -0
  90. package/scripts/run_playwright_repro.sh +55 -0
  91. package/src/codexChat.tsx +3914 -0
  92. package/src/codexChatAttachmentDedup.ts +47 -0
  93. package/src/codexChatAttachmentLimit.ts +81 -0
  94. package/src/codexChatAttachmentState.ts +37 -0
  95. package/src/codexChatDocumentUtils.ts +644 -0
  96. package/src/codexChatFormatting.ts +94 -0
  97. package/src/codexChatNotice.ts +95 -0
  98. package/src/codexChatPersistence.ts +191 -0
  99. package/src/codexChatPrimitives.tsx +446 -0
  100. package/src/codexChatRender.tsx +376 -0
  101. package/src/codexChatSessionFactory.ts +79 -0
  102. package/src/codexChatSessionKey.ts +16 -0
  103. package/src/codexChatStorage.ts +36 -0
  104. package/src/codexSessionResolver.ts +56 -0
  105. package/src/handlers/activitySummarizer.ts +369 -0
  106. package/src/handlers/codexMessageTypes.ts +34 -0
  107. package/src/handlers/codexMessageUtils.ts +217 -0
  108. package/src/handlers/handleCodexSocketMessage.ts +204 -0
  109. package/src/handlers/sessionSyncHandler.ts +308 -0
  110. package/src/hooks/useCodexSocket.ts +109 -0
  111. package/src/index.ts +1 -1
  112. package/src/panel.tsx +1 -4184
  113. package/src/protocol.ts +582 -0
  114. package/style/index.css +480 -11
  115. package/test-results/.last-run.json +4 -0
  116. package/test.py +0 -0
  117. package/tests/e2e/cell-output-error-tail.spec.js +156 -0
  118. package/tests/e2e/codex-ui-test-helpers.js +138 -0
  119. package/tests/e2e/fixtures/notebooks/error-output-tail.ipynb +58 -0
  120. package/tests/e2e/fixtures/notebooks/error-output-tail.py +19 -0
  121. package/tests/e2e/fixtures/notebooks/tab1.ipynb +322 -0
  122. package/tests/e2e/fixtures/notebooks/tab1.py +272 -0
  123. package/tests/e2e/fixtures/notebooks/tab2.ipynb +252 -0
  124. package/tests/e2e/fixtures/notebooks/tab2.py +231 -0
  125. package/tests/e2e/fixtures/notebooks/tab3.ipynb +403 -0
  126. package/tests/e2e/fixtures/notebooks/tab3.py +331 -0
  127. package/tests/e2e/fixtures/notebooks/tab4.py +339 -0
  128. package/tests/e2e/freeze-notebook-tabs-repro.spec.js +295 -0
  129. package/tests/e2e/mock-codex-cli-flood.py +127 -0
  130. package/tests/e2e/mock-codex-cli-prompt-echo.py +88 -0
  131. package/tests/e2e/mock-codex-cli.py +95 -0
  132. package/tests/e2e/queue-multitab-repro.spec.js +189 -0
  133. package/tests/test_handlers.py +116 -0
  134. package/tests/test_protocol.py +169 -0
  135. package/tests/test_session_store_limits.py +50 -0
  136. package/tests/unit/codexChatAttachmentDedup.spec.ts +56 -0
  137. package/tests/unit/codexChatAttachmentLimit.spec.ts +57 -0
  138. package/tests/unit/codexChatAttachmentState.spec.ts +71 -0
  139. package/tests/unit/codexChatDocumentUtils.spec.ts +63 -0
  140. package/tests/unit/codexChatLimit.spec.ts +18 -0
  141. package/tests/unit/codexChatNotice.spec.ts +45 -0
  142. package/tests/unit/codexChatPersistence.spec.ts +199 -0
  143. package/tests/unit/codexChatSessionFactory.spec.ts +94 -0
  144. package/tests/unit/codexChatSessionKey.spec.ts +18 -0
  145. package/tests/unit/codexMessageUtils.spec.ts +89 -0
  146. package/tests/unit/codexSessionResolver.spec.ts +92 -0
  147. package/tests/unit/handleCodexSocketMessage.spec.ts +476 -0
  148. package/tsconfig.tsbuildinfo +1 -1
  149. package/webpack.config.js +6 -0
  150. package/jupyterlab_codex/labextension/static/504.335f3447c84ba3d74517.js +0 -2
  151. package/jupyterlab_codex/labextension/static/972.8e856719e40acc1ef4cb.js +0 -1
  152. package/jupyterlab_codex/labextension/static/remoteEntry.a2982f776a1f0f515640.js +0 -1
  153. /package/jupyterlab_codex/labextension/static/{504.335f3447c84ba3d74517.js.LICENSE.txt → 525.224526d045c727069de6.js.LICENSE.txt} +0 -0
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env bash
2
+
3
+ if [ -z "${BASH_VERSION:-}" ]; then
4
+ exec bash "$0" "$@"
5
+ fi
6
+
7
+ set -euo pipefail
8
+
9
+ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
10
+ cd "$ROOT_DIR"
11
+
12
+ HOST="${JUPYTERLAB_HOST:-127.0.0.1}"
13
+ DEFAULT_PORT="${JUPYTERLAB_PORT:-8888}"
14
+ FALLBACK_PORTS_RAW="${JUPYTERLAB_FALLBACK_PORTS:-$DEFAULT_PORT 8889 8890 8891 8892 8893}"
15
+ if [[ "${PLAYWRIGHT_BASE_URL:-}" != "" ]]; then
16
+ BASE_URL_CANDIDATES=("$PLAYWRIGHT_BASE_URL")
17
+ else
18
+ # shellcheck disable=SC2206
19
+ FALLBACK_PORTS=(${FALLBACK_PORTS_RAW})
20
+ BASE_URL_CANDIDATES=()
21
+ for port in "${FALLBACK_PORTS[@]}"; do
22
+ BASE_URL_CANDIDATES+=("http://${HOST}:${port}/lab")
23
+ done
24
+ fi
25
+ BASE_URL=""
26
+ for candidate in "${BASE_URL_CANDIDATES[@]}"; do
27
+ if curl -fsS "$candidate" >/dev/null 2>&1; then
28
+ BASE_URL="$candidate"
29
+ break
30
+ fi
31
+ done
32
+
33
+ if [[ -z "$BASE_URL" ]]; then
34
+ echo "[playwright] JupyterLab is not reachable."
35
+ if [[ "${PLAYWRIGHT_BASE_URL:-}" != "" ]]; then
36
+ echo "[playwright] Tried: $PLAYWRIGHT_BASE_URL"
37
+ else
38
+ echo "[playwright] Tried: ${FALLBACK_PORTS_RAW}"
39
+ fi
40
+ echo "[playwright] Start JupyterLab first and retry, or run:"
41
+ echo "[playwright] npm run test:e2e:repro-local"
42
+ exit 1
43
+ fi
44
+
45
+ echo "[playwright] running queue reproduction e2e against $BASE_URL"
46
+ if [ -x "$ROOT_DIR/node_modules/.bin/playwright" ]; then
47
+ env \
48
+ PLAYWRIGHT_BASE_URL="$BASE_URL" \
49
+ PLAYWRIGHT_CODEX_COMMAND="${PLAYWRIGHT_CODEX_COMMAND:-$ROOT_DIR/tests/e2e/mock-codex-cli.py}" \
50
+ MOCK_CODEX_DELAY_MS="${MOCK_CODEX_DELAY_MS:-2600}" \
51
+ "$ROOT_DIR/node_modules/.bin/playwright" \
52
+ test tests/e2e/queue-multitab-repro.spec.js "$@"
53
+ else
54
+ env \
55
+ PLAYWRIGHT_BASE_URL="$BASE_URL" \
56
+ PLAYWRIGHT_CODEX_COMMAND="${PLAYWRIGHT_CODEX_COMMAND:-$ROOT_DIR/tests/e2e/mock-codex-cli.py}" \
57
+ MOCK_CODEX_DELAY_MS="${MOCK_CODEX_DELAY_MS:-2600}" \
58
+ npx playwright \
59
+ test tests/e2e/queue-multitab-repro.spec.js "$@"
60
+ fi
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env bash
2
+
3
+ if [ -z "${BASH_VERSION:-}" ]; then
4
+ exec bash "$0" "$@"
5
+ fi
6
+
7
+ set -euo pipefail
8
+
9
+ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
10
+ cd "$ROOT_DIR"
11
+
12
+ PORT="${JUPYTERLAB_PORT:-8888}"
13
+ HOST="${JUPYTERLAB_HOST:-127.0.0.1}"
14
+ BASE_URL="${PLAYWRIGHT_BASE_URL:-http://${HOST}:${PORT}/lab}"
15
+ MOCK_CODEX="${PLAYWRIGHT_CODEX_COMMAND:-$ROOT_DIR/tests/e2e/mock-codex-cli.py}"
16
+ LOG_FILE="${PLAYWRIGHT_JUPYTER_LOG:-$ROOT_DIR/.jupyterlab-playwright.log}"
17
+
18
+ cleanup() {
19
+ if [ -n "${JUPYTER_PID:-}" ] && kill -0 "$JUPYTER_PID" >/dev/null 2>&1; then
20
+ kill "$JUPYTER_PID" >/dev/null 2>&1 || true
21
+ wait "$JUPYTER_PID" >/dev/null 2>&1 || true
22
+ fi
23
+ }
24
+ trap cleanup EXIT
25
+
26
+ echo "[playwright] launching JupyterLab on ${BASE_URL}"
27
+ jupyter lab \
28
+ --no-browser \
29
+ --ServerApp.open_browser=False \
30
+ --ServerApp.port="$PORT" \
31
+ --ServerApp.ip="$HOST" \
32
+ --IdentityProvider.token='' \
33
+ --ServerApp.token='' \
34
+ --ServerApp.password='' \
35
+ >"$LOG_FILE" 2>&1 &
36
+ JUPYTER_PID=$!
37
+
38
+ echo "[playwright] waiting for JupyterLab to be ready..."
39
+ for _ in $(seq 1 60); do
40
+ if curl -fsS "$BASE_URL" >/dev/null 2>&1; then
41
+ break
42
+ fi
43
+ sleep 1
44
+ done
45
+
46
+ if ! curl -fsS "$BASE_URL" >/dev/null 2>&1; then
47
+ echo "[playwright] JupyterLab failed to start. Log: $LOG_FILE"
48
+ exit 1
49
+ fi
50
+
51
+ echo "[playwright] running queue reproduction e2e"
52
+ PLAYWRIGHT_BASE_URL="$BASE_URL" \
53
+ PLAYWRIGHT_CODEX_COMMAND="$MOCK_CODEX" \
54
+ MOCK_CODEX_DELAY_MS="${MOCK_CODEX_DELAY_MS:-2600}" \
55
+ jlpm test:e2e:queue-repro "$@"