better-dsh 0.2.3-c → 0.2.3-e

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 (25) hide show
  1. package/docs/50_test-reports/2026-09-11-control-prompt-into-eval-description/345/256/236/346/265/213/346/212/245/345/221/212.md +222 -0
  2. package/docs/50_test-reports/2026-09-12-fs-scheme-resolution-/345/256/236/346/265/213/346/212/245/345/221/212.md +81 -0
  3. package/docs/50_test-reports/2026-09-12-url-schemes-grammar-matrix/344/270/216catalog-centralize-/345/256/236/346/265/213/346/212/245/345/221/212.md +234 -0
  4. package/docs/50_test-reports/2026-09-12-url-schemes-recallable-context-design/351/252/214/350/257/201/346/212/245/345/221/212.md +160 -0
  5. package/docs/50_test-reports/2026-09-12-url-schemes-recallable-context-/345/256/236/346/265/213/345/211/247/346/234/254.md +44 -0
  6. package/docs/50_test-reports/2026-09-12-url-schemes-recallable-context-/345/256/236/346/265/213/346/212/245/345/221/212.md +89 -0
  7. package/docs/50_test-reports/2026-09-12-url-schemes-/345/205/255scheme/345/206/222/347/203/237/344/270/216/350/276/271/347/225/214/345/256/236/346/265/213/346/212/245/345/221/212.md +198 -0
  8. package/docs/50_test-reports/2026-09-13-hashline-off/344/270/213scheme/345/217/257/350/276/276/346/200/247/345/267/245/345/205/267/351/235/242/344/270/215/345/257/271/347/247/260-/345/256/236/346/265/213/346/212/245/345/221/212.md +246 -0
  9. package/docs/50_test-reports/2026-09-13-preact-ui-shell/345/256/236/346/265/213/346/212/245/345/221/212.md +50 -0
  10. package/docs/50_test-reports/v0.2.3c-mobile-wave/345/256/236/346/265/213/346/212/245/345/221/212.md +47 -0
  11. package/eval-description.md +33 -0
  12. package/lib/client/index.js +1 -1
  13. package/lib/fs-aware/sandbox-plugin.d.ts +71 -0
  14. package/lib/fs-aware/sandbox-plugin.js +249 -0
  15. package/lib/index.d.ts +11 -18
  16. package/lib/index.js +555 -757
  17. package/lib/py-sdk-Chvy92MB.js +178 -0
  18. package/lib/py-sdk.d.ts +19 -2
  19. package/lib/py-sdk.js +2 -2
  20. package/lib/wrap-DC8O3SYz.js +721 -0
  21. package/package.json +7 -2
  22. package/url-schemes-instruction.md +22 -0
  23. package/control-prompt.md +0 -37
  24. package/lib/py-sdk-BCaOGYz7.d.ts +0 -125
  25. package/lib/py-sdk-CbgYiX8O.js +0 -691
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-dsh",
3
- "version": "0.2.3-c",
3
+ "version": "0.2.3-e",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -13,6 +13,10 @@
13
13
  "types": "./lib/py-sdk.d.ts",
14
14
  "default": "./lib/py-sdk.js"
15
15
  },
16
+ "./fs-aware-sandbox": {
17
+ "types": "./lib/fs-aware/sandbox-plugin.d.ts",
18
+ "default": "./lib/fs-aware/sandbox-plugin.js"
19
+ },
16
20
  "./cordis.patch.yml": "./cordis.patch.yml",
17
21
  "./package.json": "./package.json",
18
22
  "./client": {
@@ -24,7 +28,8 @@
24
28
  "lib",
25
29
  "docs",
26
30
  "cordis.patch.yml",
27
- "control-prompt.md",
31
+ "eval-description.md",
32
+ "url-schemes-instruction.md",
28
33
  "scripts/kernel-provision.mjs"
29
34
  ],
30
35
  "scripts": {
@@ -0,0 +1,22 @@
1
+ # Internal URL Schemes
2
+
3
+ - Format: `scheme://<path>[:selector]`.
4
+ - Compatibility: Supported anywhere a filesystem path is accepted across `read`, `write`, `grep`, and `glob`.
5
+ - `skill://`, `agent://`, `ctx://`, `dsh://`, `dvc://`, `http(s)://`.
6
+ - Reading scheme:// lists available surfaces/help for that scheme.
7
+
8
+ **Selectors:**
9
+ - `:raw` — Accesses the full underlying content bypasses prepared faces/summaries.
10
+ - `:N-M[,N2-M2]` — Line range selection (1-based, inclusive; `N-` reads to end). Indexes canonical full content (so `:raw:N-M` ≡ `:N-M`).
11
+ - `:path/<a.b>` — Traverses JSON using dot-path notation.
12
+ - `?q=<q>` — Dot-path search or plain line filter.
13
+
14
+ **Schemes:**
15
+ - `skill://<name>[/<file>]` — a registered skill's files; first level = skill names.
16
+ - `agent://[<id>[/transcript]]` — agent roster / a LIVE agent's transcript.
17
+ - `dsh://docs[/<doc>]` and `dsh://config` — harness docs / live resolved config.
18
+ - `ctx://session/<face>` — THIS session's own log; faces: `transcript`, `compactions`, `compactions[<label|n>]`, `thinking`, `system`, `user_prompts[n]`, `tool_calls[n]`, `agent_responses[n]`.
19
+ - `dvc://<device>` — device registry; devices: `ast_edit`, `ast_grep`, `browser`, `lsp`; `write` executes.
20
+ - `http(s)://<host>/<path>` — plain fetch.
21
+
22
+ Bulk: prefer grep or `:N-M` line windows over full reads.
package/control-prompt.md DELETED
@@ -1,37 +0,0 @@
1
- ## The DASHR REPL interface
2
-
3
- This agent has TWO ways to act:
4
-
5
- 1. **Direct tool calls** — call native tools (`read`/`write`/`edit`/`bash`/…) as ordinary function calls. Use these for payload-shaped work: one long read, one edit, one command.
6
- 2. **`eval` cells** — one `eval` call runs one Python program on a session-persistent scripting pad. Use it when you need logic: loops, conditions, fan-out, or composing many tool results into one step.
7
-
8
- `eval` takes two required arguments: `cell` (one Python program; top-level `await` works; top-level `return` is a SyntaxError — the cell runs in module scope; variables/imports/definitions from earlier cells are still alive) and `description` (a short summary).
9
-
10
- ## Tools inside a cell
11
-
12
- Inside a cell, every native tool is a member of the `tool` object, called as `await tool.name({...})` with ONE positional arguments object — `await tool.read({"file_path": "x"})`, never `tool.read(file_path="x")`. A failed call raises `ToolCallError`. Tool names that are not plain identifiers (non-identifier characters, e.g. hyphens) have no `tool.<name>` member — call those as direct tool calls. Delegation: `agent` is the unified agent-spawn entry; `subagent` is its native alias — both delegate through the same runtime, so call either.
13
-
14
- ```python
15
- # One step cell
16
- print(await tool.read({"file_path": "docs/README.md"}))
17
-
18
- # shell is another tool
19
- r = await tool.bash({"command": "ls -la src/", "description": "List source directory"})
20
- print(r["stdout"]["text"])
21
-
22
- # fan-out with gather
23
- import asyncio
24
- matches, files = await asyncio.gather(
25
- tool.grep({"pattern": "TODO", "path": "src"}),
26
- tool.glob({"pattern": "**/*.ts", "path": "src"}),
27
- )
28
-
29
- # variables persist across cells and turns
30
- cfg = await tool.read({"file_path": "config.yaml"}) # cfg stays alive in later cells
31
- ```
32
-
33
- ## Rules
34
-
35
- - Payload-shaped work (a long read, a big write, a single command) → direct tool call. Logic-shaped work (loops, conditions, composition) → an `eval` cell.
36
- - Only print or return what you need next; everything else stays in the scripting pad.
37
- - Variables persist across cells and turns, but they live in the pad's process: keep durable state in files.
@@ -1,125 +0,0 @@
1
- //#region src/py-sdk.d.ts
2
- /**
3
- * DASHR kernel SDK codegen — Python flavor, cell edition.
4
- *
5
- * The pure projection from one calling scope's visible tool schemas to the
6
- * Python SDK text the model programs against inside `eval` cells. The
7
- * type-rendering machinery is ported from `@deepseek-ai/dsh-tools`
8
- * `py-types.ts` (0.1.0-rc.6) per blueprint §7.4, deliberately slimmed to
9
- * DASHR's single-language, stateful surface:
10
- *
11
- * - The usage instructions are OURS, not upstream's: upstream promises a
12
- * one-shot program ("runs as the body of an async function", value-less
13
- * between calls), while a DASHR cell runs on a PERSISTENT kernel whose
14
- * variables, imports, and definitions survive across `eval` calls.
15
- * The prose here must never state the throwaway contract.
16
- * - No language table and no context-free renderer: DASHR renders Python
17
- * only, and object shapes always render through the named-`TypedDict`
18
- * path this module owns. (Upstream's exported `jsonSchemaToPy` degrades
19
- * every object to `dict[str, Any]`; reusing it would lose the shape.)
20
- * - The bare-identifier rule, `camelCase` derivation, class-name capping
21
- * and collision suffixing, `typing` import emission, and the
22
- * deterministic lexicographic member order are ported near-verbatim: the
23
- * parseability invariants (NFKC stability, reserved words, unprintable
24
- * escapes, bracket-nesting cap) exist because the emitted block is the
25
- * model's ONLY declaration of the tools, and a syntax error in it poisons
26
- * the whole mode.
27
- * - renders one `tool.<name>(args) -> Output` member per tool — no `Tools`
28
- * protocol and no `tools` singleton — matching the kernel's `tool`
29
- * object holder. Which names may render as members is decided by
30
- * {@link isFlatBindableName}, the one policy the renderer and the bridge
31
- * share.
32
- * @module dashr-repl/py-sdk
33
- */
34
- /**
35
- * One tool as the SDK renderer sees it: the model-facing schema
36
- * (name/description/parameters) plus the tool's canonical output schema.
37
- * The caller (the presentation plugin) excludes `eval` itself and reads
38
- * both through the tool registry's public projection APIs.
39
- */
40
- interface DASHRSdkSchema {
41
- /** Tool name as registered (may be exotic; the renderer routes non-bindable names to not-callable comments). */
42
- readonly name: string;
43
- /** Tool description, rendered as the method docstring. */
44
- readonly description: string;
45
- /** Validated JSON-Schema node for the arguments object. */
46
- readonly parameters: unknown;
47
- /** Validated JSON-Schema node for the canonical output value. */
48
- readonly output: unknown;
49
- }
50
- /**
51
- * Whether a tool name can be emitted AND bound as a `tool` member — the ONE
52
- * policy shared by this renderer and the bridge's binding
53
- * loop (src/index.ts), so the catalog never promises a name the kernel does
54
- * not bind. Strictly narrower than the runtime's validation: the
55
- * language-portable identifier subset (`[A-Za-z_][A-Za-z0-9_]*`, ASCII — a
56
- * non-ASCII XID name is legal CPython but not portable, so the runtime
57
- * refuses it as a binding global and the catalog must not teach it), minus
58
- * every portable reserved word (ECMAScript ∪ Python — `type` and `match`
59
- * are legal Python but reserved on the seam), minus the seam's reserved
60
- * binding globals (`console`, dunders), minus underscore-leading names
61
- * (kernel-shim prefix plus the call-site hazards; not callable as taught
62
- * flat globals). The runtime's `validateBindings` remains the authoritative
63
- * backstop: everything this accepts, it accepts.
64
- */
65
- declare function isFlatBindableName(name: string): boolean;
66
- /**
67
- * Render the `dashr:tool-catalog` prompt section body from the registry
68
- * schemas: the cell-flavored usage instructions above, the
69
- * `ToolCallError` declaration, one named `TypedDict` per tool argument or
70
- * output object (and per nested object), and one
71
- * `tool.<name>(args: XArgs) -> XOutput` member per visible tool — no `Tools`
72
- * protocol, no `tools` singleton, every tool is a member of the `tool`
73
- * object exactly as the kernel binds it — inside one fenced
74
- * ```python block. The `typing` import line lists exactly the symbols the
75
- * render used (and is omitted entirely when none are).
76
- *
77
- * Deterministic — tools are emitted in lexicographic name order and class
78
- * declarations precede the function that references them in that same
79
- * order (nested classes before the parent that references them), so an
80
- * unchanged tool set produces byte-identical text across assemblies.
81
- *
82
- * Non-bindable names (reserved, exotic, or underscore-leading) render as
83
- * comment lines: they are registered upstream but NOT callable from cells,
84
- * and the comment keeps the signature and description visible instead of
85
- * silently dropping the tool.
86
- * @param schemas - the calling scope's visible tools (caller excludes
87
- * `eval` and the masked delegation names).
88
- * @returns the complete section body.
89
- */
90
- declare function renderToolsSdkPy(schemas: readonly DASHRSdkSchema[]): string;
91
- /**
92
- * The `dashr:tool-catalog` section's presentation mode (design D4):
93
- * `'signatures'` renders one compact declaration line per visible tool
94
- * (the omp code-mode shape: `name(args: {…})` per line, argument and output
95
- * sketches abbreviated to depth 2 — the default, chosen for low-tier model
96
- * robustness); `'convention'` renders the one-sentence calling convention
97
- * alone (zero repetition, the A/B deployment experiment's other arm).
98
- * Both modes keep the output contract (each tool's canonical JSON output
99
- * shape) and the non-flat-name exception; neither presents a REPL binding
100
- * listing — the declaration lines themselves are the authoritative surface.
101
- */
102
- type ReplBridgeCatalogMode = 'signatures' | 'convention';
103
- /** The deployed presentation mode; flip to `'convention'` to ship arm A. */
104
- declare const REPL_BRIDGE_CATALOG_MODE: ReplBridgeCatalogMode;
105
- /**
106
- * Render the `dashr:tool-catalog` prompt section body as the REPL bridge
107
- * instructions (design D4/D5): the scripting-pad positioning and the
108
- * calling convention above, then — in the default `'signatures'` mode —
109
- * one compact declaration line per visible tool
110
- * (`tool.<name>(args: {…}) -> <output shape>`, omp code-mode shape with
111
- * the output contract kept), inside one fenced ```python block.
112
- * Non-bindable names (reserved, exotic, underscore-leading) are omitted
113
- * from the lines; the convention sentence above states that limit once.
114
- *
115
- * Deterministic — lines are emitted in lexicographic name order, so an
116
- * unchanged tool set produces byte-identical text across assemblies.
117
- * @param schemas - the calling scope's visible tools (the caller already
118
- * excluded the transport and the wire-masked names).
119
- * @param mode - override the deployed {@link REPL_BRIDGE_CATALOG_MODE}
120
- * (the two render states; tests exercise both).
121
- * @returns the complete section body.
122
- */
123
- declare function renderReplBridgeInstructions(schemas: readonly DASHRSdkSchema[], mode?: ReplBridgeCatalogMode): string;
124
- //#endregion
125
- export { renderReplBridgeInstructions as a, isFlatBindableName as i, REPL_BRIDGE_CATALOG_MODE as n, renderToolsSdkPy as o, ReplBridgeCatalogMode as r, DASHRSdkSchema as t };