better-dsh 0.3.0 → 0.3.1-a
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 +49 -177
- package/cordis.patch.yml +5 -36
- package/docs/20_specs/kernel-provisioning/spec.md +2 -0
- package/docs/adr/0015-independent-bundles-agent-remote.md +40 -0
- package/docs/remote-tools.md +56 -0
- package/docs/specs/kernel-provisioning/spec.md +12 -40
- package/docs/specs/omp-python-repl-port/runtime-guide.md +35 -0
- package/docs/specs/omp-python-repl-port/spec.md +68 -0
- package/docs/specs/remote-tool-enhancement/spec.md +203 -0
- package/dsh-docs/baseline.md +13 -0
- package/dsh-docs/subsystems/invariants.md +3 -0
- package/dsh-docs/subsystems/invariants.zh.md +3 -0
- package/eval-description.md +7 -3
- package/lib/LaunchOptions-0Mr6meJc.js +4 -0
- package/lib/{LaunchOptions-kGXcZOe0.js → LaunchOptions-iE9M-STS.js} +1 -1
- package/lib/{bidi-BalpKaJc.js → bidi-CaQeBZHY.js} +1 -1
- package/lib/client/index.js +30 -6
- package/lib/failover/index.js +1 -1
- package/lib/fs-aware/sandbox-plugin.js +3 -3
- package/lib/{index-browser-CysrjMyM.js → index-browser-CJzxT9Vi.js} +4 -4
- package/lib/index.d.ts +16 -50
- package/lib/index.js +482 -1720
- package/lib/kernel-env-x_WkG6Fr.js +76 -0
- package/lib/kernel-env.d.ts +5 -69
- package/lib/kernel-env.js +2 -2
- package/lib/{lsp-server-registry-BXvUTBY7.js → lsp-server-registry-BcdkHROD.js} +1 -1
- package/lib/{lsp-server-registry-CH9WNFFt.js → lsp-server-registry-D4VLs1Sm.js} +1 -1
- package/lib/{main-BQeFrBM1.js → main-taSMz1KX.js} +1 -1
- package/lib/{main-CupOhMp5.js → main-uqGqYYnA.js} +7 -5
- package/lib/mobile/plugin.d.ts +1 -1
- package/lib/omp-python/DILL-LICENSE +35 -0
- package/lib/omp-python/OMP-LICENSE +23 -0
- package/lib/omp-python/better_snapshot.py +391 -0
- package/lib/omp-python/better_support.py +425 -0
- package/lib/omp-python/dill-provenance.json +55 -0
- package/lib/omp-python/provenance.json +13 -0
- package/lib/omp-python/runner.py +2499 -0
- package/lib/omp-python/vendor/dill/__diff.py +234 -0
- package/lib/omp-python/vendor/dill/__info__.py +291 -0
- package/lib/omp-python/vendor/dill/__init__.py +119 -0
- package/lib/omp-python/vendor/dill/_dill.py +2265 -0
- package/lib/omp-python/vendor/dill/_objects.py +545 -0
- package/lib/omp-python/vendor/dill/_shims.py +193 -0
- package/lib/omp-python/vendor/dill/detect.py +287 -0
- package/lib/omp-python/vendor/dill/logger.py +285 -0
- package/lib/omp-python/vendor/dill/objtypes.py +24 -0
- package/lib/omp-python/vendor/dill/pointers.py +122 -0
- package/lib/omp-python/vendor/dill/session.py +612 -0
- package/lib/omp-python/vendor/dill/settings.py +25 -0
- package/lib/omp-python/vendor/dill/source.py +1025 -0
- package/lib/omp-python/vendor/dill/temp.py +252 -0
- package/lib/{puppeteer-core-CSk2PtSm.js → puppeteer-core-C-4NyOpY.js} +8 -8
- package/lib/remote/plugin.d.ts +459 -5
- package/lib/remote/plugin.js +2389 -210
- package/lib/url-schemes/index.d.ts +11 -11
- package/lib/url-schemes/index.js +11 -11
- package/lib/web-password.d.ts +8 -8
- package/lib/web-password.js +5 -1
- package/lib/{web-trust-Dej_RI2B.d.ts → web-trust-C_Y6o8Z2.d.ts} +11 -11
- package/lib/web-trust.d.ts +1 -2
- package/lib/welcome-notice.d.ts +5 -7
- package/lib/welcome-notice.js +9 -48
- package/lib/{wrap-T4I0nfPM.js → wrap-0VA0uFx8.js} +1 -1
- package/package.json +7 -24
- package/scripts/kernel-check.mjs +5 -0
- package/lib/LaunchOptions-B874eBu2.js +0 -4
- package/lib/bundle-delivery.d.ts +0 -20
- package/lib/bundle-delivery.js +0 -209
- package/lib/hmr.d.ts +0 -32
- package/lib/hmr.js +0 -49
- package/lib/kernel-bridge.py +0 -172
- package/lib/kernel-env-D8UOWeji.js +0 -195
- package/lib/webserver.d.ts +0 -10
- package/lib/webserver.js +0 -19
- package/scripts/kernel-provision.mjs +0 -35
- package/scripts/register-bundle.mjs +0 -80
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
|
-
/**
|
|
382
|
+
/** Existing interpreter path/name; absent discovers active/project environments then PATH. */
|
|
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
|
|
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,16 +398,10 @@ 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
|
-
/**
|
|
401
|
+
/** Per-session immutable checkpoints. Defaults to the official profile home; empty string disables, standalone callers opt in. */
|
|
403
402
|
snapshotDir?: string;
|
|
404
|
-
/** Serialized
|
|
403
|
+
/** Serialized graph cap in bytes; each over-cap attempt reports the last successful checkpoint. */
|
|
405
404
|
snapshotSizeCapBytes?: number;
|
|
406
|
-
/** Managed venv directory (used when `python` is absent/`python3`); defaults to `<package>/.venv-kernel`. */
|
|
407
|
-
kernelEnvDir?: string;
|
|
408
|
-
/** Preferred CPython version for a managed venv. */
|
|
409
|
-
kernelPythonVersion?: string;
|
|
410
|
-
/** Provision the managed venv (ipykernel + dill) on first use; default true. */
|
|
411
|
-
kernelAutoInstall?: boolean;
|
|
412
405
|
username?: string;
|
|
413
406
|
}
|
|
414
407
|
/**
|
|
@@ -428,8 +421,7 @@ declare class DashrRuntime extends ReplRuntime {
|
|
|
428
421
|
/** One entry per session principal that has run code (lazy — never pre-seeded). */
|
|
429
422
|
private readonly kernels;
|
|
430
423
|
private disposed;
|
|
431
|
-
|
|
432
|
-
private kernelEnvPromise;
|
|
424
|
+
private readonly transactions;
|
|
433
425
|
constructor(ctx: Context, config: Config$1);
|
|
434
426
|
/**
|
|
435
427
|
* The agentless-default kernel's pid, for lifecycle diagnostics; absent
|
|
@@ -446,7 +438,9 @@ declare class DashrRuntime extends ReplRuntime {
|
|
|
446
438
|
* @param request - the program, its bindings, and the abort signal.
|
|
447
439
|
* @returns the run's outcome per the seam contract.
|
|
448
440
|
*/
|
|
441
|
+
private transaction;
|
|
449
442
|
run(request: CodeRunRequest): Promise<CodeRunResult>;
|
|
443
|
+
private runTransaction;
|
|
450
444
|
/**
|
|
451
445
|
* Read one user-namespace variable by name on the session's kernel. A
|
|
452
446
|
* bare/empty name lists the namespace's user-variable names; a
|
|
@@ -459,6 +453,7 @@ declare class DashrRuntime extends ReplRuntime {
|
|
|
459
453
|
* @param principal - the session key (absent → the shared default).
|
|
460
454
|
*/
|
|
461
455
|
queryVar(name: string, principal?: string): Promise<ReplVarQuery>;
|
|
456
|
+
private queryTransaction;
|
|
462
457
|
/**
|
|
463
458
|
* Assign one lossless-JSON value into the user namespace under `name` on
|
|
464
459
|
* the session's kernel. `name` must be a usable identifier (and not a
|
|
@@ -470,14 +465,13 @@ declare class DashrRuntime extends ReplRuntime {
|
|
|
470
465
|
* @param principal - the session key (absent → the shared default).
|
|
471
466
|
*/
|
|
472
467
|
setVar(name: string, value: unknown, principal?: string): Promise<void>;
|
|
468
|
+
private setTransaction;
|
|
473
469
|
/** Map one cell outcome onto the seam's result shape under the output ledger. */
|
|
474
470
|
private assembleResult;
|
|
475
471
|
/** Reject malformed binding globals or typed-error declarations as contract misuse. */
|
|
476
472
|
private validateBindings;
|
|
477
473
|
/** Dispatch one kernel-side host request; unknown types and bad payloads become error replies. */
|
|
478
474
|
private dispatchHostRequest;
|
|
479
|
-
/** Resolve (and provision, when managed) the kernel interpreter once per runtime. */
|
|
480
|
-
private resolveKernelPython;
|
|
481
475
|
/**
|
|
482
476
|
* Spawn-or-reuse the kernel for one key. The lazy map guarantees one
|
|
483
477
|
* entry is created here and nowhere else, so a key that never runs never
|
|
@@ -486,40 +480,14 @@ declare class DashrRuntime extends ReplRuntime {
|
|
|
486
480
|
* @param key - the run principal (or the agentless default).
|
|
487
481
|
*/
|
|
488
482
|
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
|
-
*/
|
|
483
|
+
/** Restore once before user admission; any degraded load retires that child. */
|
|
497
484
|
private restoreEntry;
|
|
498
|
-
|
|
499
|
-
|
|
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
|
-
*/
|
|
485
|
+
private omissionNotice;
|
|
486
|
+
/** Restore a fresh child and report whether the observing call had started. */
|
|
510
487
|
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
|
-
*/
|
|
488
|
+
/** Save completed mutations and expose partial/failed coverage within output limits. */
|
|
516
489
|
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
|
-
*/
|
|
490
|
+
/** Cancel active work, drain admitted transactions, and reap every owned child. */
|
|
523
491
|
private teardown;
|
|
524
492
|
/**
|
|
525
493
|
* Tear one session's kernel down (session end via the `agent/disposed`
|
|
@@ -530,11 +498,9 @@ declare class DashrRuntime extends ReplRuntime {
|
|
|
530
498
|
/**
|
|
531
499
|
* Reset one session's kernel to a fresh, empty namespace: dispose the live
|
|
532
500
|
* subprocess WITHOUT a turn-end snapshot and clear its on-disk snapshot, so
|
|
533
|
-
* the next ensureKernel spawns empty (restore finds
|
|
501
|
+
* the next ensureKernel spawns empty (restore finds no checkpoint).
|
|
534
502
|
*/
|
|
535
503
|
private resetKey;
|
|
536
|
-
/** Snapshot (when configured) then dispose one key's kernel; failures log, never throw into a listener. */
|
|
537
|
-
private teardownKernel;
|
|
538
504
|
}
|
|
539
505
|
//#endregion
|
|
540
506
|
//#region src/tool-call-id.d.ts
|
|
@@ -619,7 +585,7 @@ declare function resolveMaxParallelSubCalls(value: number | undefined): number;
|
|
|
619
585
|
* `dashr/repl-dispatch-log` waterfall — dashr's OWN dispatch-log event,
|
|
620
586
|
* self-registered via the cordis Events merge below. Decoupled from
|
|
621
587
|
* upstream's `tools/ptc-dispatch-log` (PTC `run_code` sub-dispatches): `eval`
|
|
622
|
-
* is a broader session-persistent REPL (
|
|
588
|
+
* is a broader session-persistent REPL (OMP Python child) than upstream's
|
|
623
589
|
* `run_code` TS-worker tool, so its durable-log reshape extension point is
|
|
624
590
|
* dashr-owned and version-independent — no coupling to upstream's
|
|
625
591
|
* `CodeDispatchLog`/`PtcDispatchLog` rename or the PTC tool's event name.
|