better-dsh 0.3.0-r → 0.3.1

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 (49) hide show
  1. package/README.md +46 -176
  2. package/cordis.patch.yml +3 -2
  3. package/docs/specs/omp-python-repl-port/runtime-guide.md +33 -0
  4. package/docs/specs/omp-python-repl-port/spec.md +61 -0
  5. package/eval-description.md +7 -3
  6. package/lib/{LaunchOptions-CLEBmZeM.js → LaunchOptions-5eg7E0ye.js} +1 -1
  7. package/lib/LaunchOptions-DxQQ0s-A.js +4 -0
  8. package/lib/{bidi-Bs8owg1e.js → bidi-CwabFH07.js} +1 -1
  9. package/lib/client/index.js +2 -2
  10. package/lib/fs-aware/sandbox-plugin.js +1 -1
  11. package/lib/{index-browser-pHtsz007.js → index-browser-B-9jm12n.js} +4 -4
  12. package/lib/index.d.ts +17 -41
  13. package/lib/index.js +470 -1675
  14. package/lib/kernel-env-BOF0fNHn.js +91 -0
  15. package/lib/kernel-env.d.ts +4 -58
  16. package/lib/kernel-env.js +2 -2
  17. package/lib/{main-CBC7_uE-.js → main-BeCgUd20.js} +2 -2
  18. package/lib/{main-RqgDOjH9.js → main-Dv_UQqG2.js} +1 -1
  19. package/lib/omp-python/DILL-LICENSE +35 -0
  20. package/lib/omp-python/OMP-LICENSE +23 -0
  21. package/lib/omp-python/better_snapshot.py +391 -0
  22. package/lib/omp-python/better_support.py +425 -0
  23. package/lib/omp-python/dill-provenance.json +55 -0
  24. package/lib/omp-python/provenance.json +13 -0
  25. package/lib/omp-python/runner.py +2499 -0
  26. package/lib/omp-python/vendor/dill/__diff.py +234 -0
  27. package/lib/omp-python/vendor/dill/__info__.py +291 -0
  28. package/lib/omp-python/vendor/dill/__init__.py +119 -0
  29. package/lib/omp-python/vendor/dill/_dill.py +2265 -0
  30. package/lib/omp-python/vendor/dill/_objects.py +545 -0
  31. package/lib/omp-python/vendor/dill/_shims.py +193 -0
  32. package/lib/omp-python/vendor/dill/detect.py +287 -0
  33. package/lib/omp-python/vendor/dill/logger.py +285 -0
  34. package/lib/omp-python/vendor/dill/objtypes.py +24 -0
  35. package/lib/omp-python/vendor/dill/pointers.py +122 -0
  36. package/lib/omp-python/vendor/dill/session.py +612 -0
  37. package/lib/omp-python/vendor/dill/settings.py +25 -0
  38. package/lib/omp-python/vendor/dill/source.py +1025 -0
  39. package/lib/omp-python/vendor/dill/temp.py +252 -0
  40. package/lib/{puppeteer-core-DnI7gBFU.js → puppeteer-core-Dnd7eqel.js} +6 -6
  41. package/lib/remote/plugin.js +1 -1
  42. package/lib/url-schemes/index.d.ts +11 -11
  43. package/lib/url-schemes/index.js +3 -3
  44. package/lib/web-password.d.ts +8 -8
  45. package/package.json +3 -3
  46. package/scripts/kernel-provision.mjs +4 -34
  47. package/lib/LaunchOptions-CjYFNZFS.js +0 -4
  48. package/lib/kernel-bridge.py +0 -172
  49. package/lib/kernel-env-BLPZE-I3.js +0 -195
package/lib/index.d.ts CHANGED
@@ -379,7 +379,7 @@ interface ReplRuntimeSurface {
379
379
  //#region src/runtime.d.ts
380
380
  /** Plugin config: every tunable, changeable from `cordis.yml` (no hardcoded tunables). */
381
381
  interface Config$1 {
382
- /** Python interpreter with `ipykernel` installed. The bare sentinel `python3` (or absent) selects a managed venv under {@link Config.kernelEnvDir}. */
382
+ /** Python >=3.9 interpreter. The bare sentinel `python3` (or absent) selects a managed venv under {@link Config.kernelEnvDir}. */
383
383
  python?: string;
384
384
  /** Budget for kernel spawn → ready, in milliseconds. */
385
385
  startupTimeoutMs?: number;
@@ -388,8 +388,7 @@ interface Config$1 {
388
388
  /** Grace between a timeout/abort interrupt and the force-settle, in milliseconds. */
389
389
  interruptGraceMs?: number;
390
390
  /**
391
- * Confirm window between the control-channel interrupt and the SIGALRM
392
- * escalation, in milliseconds; must stay below {@link Config.interruptGraceMs}.
391
+ * Confirm window before repeating SIGINT, in milliseconds; must stay below {@link Config.interruptGraceMs}.
393
392
  * See the bridge's two-phase interrupt for why the escalation is deferred.
394
393
  */
395
394
  interruptConfirmMs?: number;
@@ -399,15 +398,15 @@ interface Config$1 {
399
398
  snapshotTimeoutMs?: number;
400
399
  /** Hard cap for serialized log-array, completion-value, and failure-message payloads. */
401
400
  maxOutputBytes?: number;
402
- /** Directory for per-session namespace snapshots (`state.dill` + `manifest.json`); none when absent. */
401
+ /** Per-session immutable checkpoints. Defaults to the official profile home; empty string disables, standalone callers opt in. */
403
402
  snapshotDir?: string;
404
- /** Serialized-size cap for a turn-end snapshot, in bytes; over-cap snapshots are skipped with a one-time model warning. */
403
+ /** Serialized graph cap in bytes; each over-cap attempt reports the last successful checkpoint. */
405
404
  snapshotSizeCapBytes?: number;
406
405
  /** Managed venv directory (used when `python` is absent/`python3`); defaults to `<package>/.venv-kernel`. */
407
406
  kernelEnvDir?: string;
408
407
  /** Preferred CPython version for a managed venv. */
409
408
  kernelPythonVersion?: string;
410
- /** Provision the managed venv (ipykernel + dill) on first use; default true. */
409
+ /** Provision a stdlib-only managed venv on first use; default true. */
411
410
  kernelAutoInstall?: boolean;
412
411
  username?: string;
413
412
  }
@@ -428,6 +427,7 @@ declare class DashrRuntime extends ReplRuntime {
428
427
  /** One entry per session principal that has run code (lazy — never pre-seeded). */
429
428
  private readonly kernels;
430
429
  private disposed;
430
+ private readonly transactions;
431
431
  /** Lazily-resolved (and, when managed, provisioned) kernel interpreter. */
432
432
  private kernelEnvPromise;
433
433
  constructor(ctx: Context, config: Config$1);
@@ -446,7 +446,9 @@ declare class DashrRuntime extends ReplRuntime {
446
446
  * @param request - the program, its bindings, and the abort signal.
447
447
  * @returns the run's outcome per the seam contract.
448
448
  */
449
+ private transaction;
449
450
  run(request: CodeRunRequest): Promise<CodeRunResult>;
451
+ private runTransaction;
450
452
  /**
451
453
  * Read one user-namespace variable by name on the session's kernel. A
452
454
  * bare/empty name lists the namespace's user-variable names; a
@@ -459,6 +461,7 @@ declare class DashrRuntime extends ReplRuntime {
459
461
  * @param principal - the session key (absent → the shared default).
460
462
  */
461
463
  queryVar(name: string, principal?: string): Promise<ReplVarQuery>;
464
+ private queryTransaction;
462
465
  /**
463
466
  * Assign one lossless-JSON value into the user namespace under `name` on
464
467
  * the session's kernel. `name` must be a usable identifier (and not a
@@ -470,6 +473,7 @@ declare class DashrRuntime extends ReplRuntime {
470
473
  * @param principal - the session key (absent → the shared default).
471
474
  */
472
475
  setVar(name: string, value: unknown, principal?: string): Promise<void>;
476
+ private setTransaction;
473
477
  /** Map one cell outcome onto the seam's result shape under the output ledger. */
474
478
  private assembleResult;
475
479
  /** Reject malformed binding globals or typed-error declarations as contract misuse. */
@@ -486,40 +490,14 @@ declare class DashrRuntime extends ReplRuntime {
486
490
  * @param key - the run principal (or the agentless default).
487
491
  */
488
492
  private ensureKernel;
489
- /**
490
- * Restore a key's on-disk snapshot into a freshly booted kernel, when one
491
- * exists and its manifest is plausible. Called once per entry boot. The
492
- * kernel-side restore cell performs the authoritative environment checks
493
- * (python version, interpreter identity, skills); this method only gates on
494
- * the manifest the host can read cheaply, then records the turn so the
495
- * first-run notice and the revive chain can name it.
496
- */
493
+ /** Restore once before user admission; any degraded load retires that child. */
497
494
  private restoreEntry;
498
- /** Read the per-key manifest's host-relevant fields; absent when unreadable/missing. */
499
- private readSnapshotManifest;
500
- /**
501
- * Revive one session's kernel after death: respawn a fresh kernel, restore
502
- * the nearest replayable snapshot onto it (the normal restore path), and
503
- * return the death-observing run's explicit error naming the turn. When no
504
- * replayable snapshot exists the message falls back to M3-A's fresh-empty
505
- * contract. The run itself does NOT execute — an error that lies about a
506
- * NameError costs the model more than one dropped cell (blueprint §8.3).
507
- * @param key - the run principal.
508
- * @param dead - the entry that died (its `turn` is the last completed turn).
509
- */
495
+ private omissionNotice;
496
+ /** Restore a fresh child and report whether the observing call had started. */
510
497
  private reviveAfterDeath;
511
- /**
512
- * Write one key's turn-end snapshot, when a snapshot directory is
513
- * configured. A size-cap skip is reported (so the run can warn the model
514
- * once); other failures log without disturbing the run.
515
- */
498
+ /** Save completed mutations and expose partial/failed coverage within output limits. */
516
499
  private snapshotTurnEnd;
517
- /**
518
- * Dispose to quiescence: snapshot every live key's namespace when a
519
- * snapshot directory is configured (each under its own per-key
520
- * subdirectory), then shut the subprocesses down. Registered as the
521
- * plugin's `ctx.effect` disposer.
522
- */
500
+ /** Cancel active work, drain admitted transactions, and reap every owned child. */
523
501
  private teardown;
524
502
  /**
525
503
  * Tear one session's kernel down (session end via the `agent/disposed`
@@ -530,11 +508,9 @@ declare class DashrRuntime extends ReplRuntime {
530
508
  /**
531
509
  * Reset one session's kernel to a fresh, empty namespace: dispose the live
532
510
  * subprocess WITHOUT a turn-end snapshot and clear its on-disk snapshot, so
533
- * the next ensureKernel spawns empty (restore finds nothing to replay).
511
+ * the next ensureKernel spawns empty (restore finds no checkpoint).
534
512
  */
535
513
  private resetKey;
536
- /** Snapshot (when configured) then dispose one key's kernel; failures log, never throw into a listener. */
537
- private teardownKernel;
538
514
  }
539
515
  //#endregion
540
516
  //#region src/tool-call-id.d.ts
@@ -619,7 +595,7 @@ declare function resolveMaxParallelSubCalls(value: number | undefined): number;
619
595
  * `dashr/repl-dispatch-log` waterfall — dashr's OWN dispatch-log event,
620
596
  * self-registered via the cordis Events merge below. Decoupled from
621
597
  * upstream's `tools/ptc-dispatch-log` (PTC `run_code` sub-dispatches): `eval`
622
- * is a broader session-persistent REPL (IPython kernel) than upstream's
598
+ * is a broader session-persistent REPL (OMP Python child) than upstream's
623
599
  * `run_code` TS-worker tool, so its durable-log reshape extension point is
624
600
  * dashr-owned and version-independent — no coupling to upstream's
625
601
  * `CodeDispatchLog`/`PtcDispatchLog` rename or the PTC tool's event name.