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.
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/eval-description.md +33 -0
- package/lib/client/index.js +1 -1
- package/lib/fs-aware/sandbox-plugin.d.ts +71 -0
- package/lib/fs-aware/sandbox-plugin.js +249 -0
- package/lib/index.d.ts +11 -18
- package/lib/index.js +555 -757
- package/lib/py-sdk-Chvy92MB.js +178 -0
- package/lib/py-sdk.d.ts +19 -2
- package/lib/py-sdk.js +2 -2
- package/lib/wrap-DC8O3SYz.js +721 -0
- package/package.json +7 -2
- package/url-schemes-instruction.md +22 -0
- package/control-prompt.md +0 -37
- package/lib/py-sdk-BCaOGYz7.d.ts +0 -125
- package/lib/py-sdk-CbgYiX8O.js +0 -691
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { Context, Service } from "@deepseek-ai/cordis";
|
|
2
|
+
|
|
3
|
+
//#region src/vendored/repl-runtime.ts
|
|
4
|
+
/**
|
|
5
|
+
* Binding globals EVERY backend refuses because SOME backend owns the slot in
|
|
6
|
+
* the program's namespace: `console` (the worker's log capture), and
|
|
7
|
+
* `__dsh_main__`/`__builtins__`/`__name__` (the Python backend's bootstrap
|
|
8
|
+
* wrapper and seeded module globals; see upstream's Agent Note
|
|
9
|
+
* `2026-07-31-code-runtime-portable-identifier-seam.md` in the dsh monorepo),
|
|
10
|
+
* and `__debug__`. One shared set — rather than each backend refusing only its
|
|
11
|
+
* own slots — keeps the portability promise real: a namespace list valid on
|
|
12
|
+
* one backend is valid on all, so a caller cannot pick a name that works on
|
|
13
|
+
* the worker and collides on Python (or vice versa). `__name__` et al. ARE
|
|
14
|
+
* valid portable identifiers, so the identifier rule on
|
|
15
|
+
* `CodeBindingNamespace.global` never rejects them — hence this explicit set.
|
|
16
|
+
* (Error members differ: {@link DUNDER_MEMBER} refuses every dunder form
|
|
17
|
+
* wholesale; binding globals refuse only the names listed here.) `__debug__`
|
|
18
|
+
* is listed for a different reason than a collision: CPython compiles a bare
|
|
19
|
+
* `__debug__` reference to the constant `True` and rejects any assignment to
|
|
20
|
+
* the name at COMPILE time, so an injected global under that name is
|
|
21
|
+
* unreachable from the program — accepted by validation, unusable on the
|
|
22
|
+
* Python backend, which is exactly the split the shared set exists to prevent.
|
|
23
|
+
*/
|
|
24
|
+
const RESERVED_BINDING_GLOBALS = new Set([
|
|
25
|
+
"console",
|
|
26
|
+
"__dsh_main__",
|
|
27
|
+
"__builtins__",
|
|
28
|
+
"__name__",
|
|
29
|
+
"__debug__"
|
|
30
|
+
]);
|
|
31
|
+
/**
|
|
32
|
+
* `CodeBindingErrorClass.memberNameProperty` names EVERY backend refuses, as
|
|
33
|
+
* one shared contract so a request valid on one backend is valid on all. The
|
|
34
|
+
* JS `Error` exclusions (`name`, `message`, `stack`) and Python's
|
|
35
|
+
* exception-protocol members (`args`, `with_traceback`, `add_note`) are
|
|
36
|
+
* listed by name; dunder-form names (`__x__`, non-empty middle) are refused
|
|
37
|
+
* wholesale — several are constrained CPython descriptors whose `setattr`
|
|
38
|
+
* raises while constructing the rejection, and the exact set is an interpreter
|
|
39
|
+
* version detail. Any other non-empty own property name is accepted everywhere.
|
|
40
|
+
*/
|
|
41
|
+
const RESERVED_ERROR_MEMBERS = new Set([
|
|
42
|
+
"name",
|
|
43
|
+
"message",
|
|
44
|
+
"stack",
|
|
45
|
+
"args",
|
|
46
|
+
"with_traceback",
|
|
47
|
+
"add_note"
|
|
48
|
+
]);
|
|
49
|
+
/**
|
|
50
|
+
* Dunder form (`__x__`, non-empty middle): object-protocol slots in Python,
|
|
51
|
+
* refused as {@link RESERVED_ERROR_MEMBERS | error members} on every backend.
|
|
52
|
+
*/
|
|
53
|
+
const DUNDER_MEMBER = /^__.+__$/;
|
|
54
|
+
/**
|
|
55
|
+
* Reserved words of every portable target language (ECMAScript ∪ Python),
|
|
56
|
+
* refused as {@link CodeBindingNamespace.global} / error-class names by all
|
|
57
|
+
* backends. Python is a portability target here even though only the
|
|
58
|
+
* TypeScript worker has a published backend. The portable-identifier contract
|
|
59
|
+
* promises a namespace list valid on one backend is valid on every backend; a
|
|
60
|
+
* per-language check would let `lambda` pass the TypeScript backend and fail
|
|
61
|
+
* the Python one. Extending the seam with a new language means widening this
|
|
62
|
+
* union (a breaking review of existing binding names, by design).
|
|
63
|
+
*/
|
|
64
|
+
const PORTABLE_RESERVED_WORDS = new Set([
|
|
65
|
+
"await",
|
|
66
|
+
"break",
|
|
67
|
+
"case",
|
|
68
|
+
"catch",
|
|
69
|
+
"class",
|
|
70
|
+
"const",
|
|
71
|
+
"continue",
|
|
72
|
+
"debugger",
|
|
73
|
+
"default",
|
|
74
|
+
"delete",
|
|
75
|
+
"do",
|
|
76
|
+
"else",
|
|
77
|
+
"enum",
|
|
78
|
+
"export",
|
|
79
|
+
"extends",
|
|
80
|
+
"false",
|
|
81
|
+
"finally",
|
|
82
|
+
"for",
|
|
83
|
+
"function",
|
|
84
|
+
"if",
|
|
85
|
+
"import",
|
|
86
|
+
"in",
|
|
87
|
+
"instanceof",
|
|
88
|
+
"new",
|
|
89
|
+
"null",
|
|
90
|
+
"return",
|
|
91
|
+
"super",
|
|
92
|
+
"switch",
|
|
93
|
+
"this",
|
|
94
|
+
"throw",
|
|
95
|
+
"true",
|
|
96
|
+
"try",
|
|
97
|
+
"typeof",
|
|
98
|
+
"var",
|
|
99
|
+
"void",
|
|
100
|
+
"while",
|
|
101
|
+
"with",
|
|
102
|
+
"yield",
|
|
103
|
+
"let",
|
|
104
|
+
"static",
|
|
105
|
+
"implements",
|
|
106
|
+
"interface",
|
|
107
|
+
"package",
|
|
108
|
+
"private",
|
|
109
|
+
"protected",
|
|
110
|
+
"public",
|
|
111
|
+
"arguments",
|
|
112
|
+
"eval",
|
|
113
|
+
"False",
|
|
114
|
+
"None",
|
|
115
|
+
"True",
|
|
116
|
+
"and",
|
|
117
|
+
"as",
|
|
118
|
+
"assert",
|
|
119
|
+
"async",
|
|
120
|
+
"def",
|
|
121
|
+
"del",
|
|
122
|
+
"elif",
|
|
123
|
+
"except",
|
|
124
|
+
"from",
|
|
125
|
+
"global",
|
|
126
|
+
"is",
|
|
127
|
+
"lambda",
|
|
128
|
+
"nonlocal",
|
|
129
|
+
"not",
|
|
130
|
+
"or",
|
|
131
|
+
"pass",
|
|
132
|
+
"raise",
|
|
133
|
+
"match",
|
|
134
|
+
"type",
|
|
135
|
+
"_"
|
|
136
|
+
]);
|
|
137
|
+
/**
|
|
138
|
+
* Registers one `ctx.replRuntime` implementation. Program, budget, abort, and substrate
|
|
139
|
+
* failures resolve in {@link CodeRunResult}; only Service Definition contract misuse rejects. Implementations bridge
|
|
140
|
+
* structured-cloneable bindings, materialize each declared namespace rejection
|
|
141
|
+
* class, treat programs as hostile peers — budget, interrupt, and substrate
|
|
142
|
+
* semantics apply per program and are unchanged by this seam's statefulness —
|
|
143
|
+
* share one persistent per-session user namespace across runs (state
|
|
144
|
+
* codification across runs IS the product; this replaces upstream's
|
|
145
|
+
* isolate-runs-from-one-another clause), and terminate and await in-flight
|
|
146
|
+
* runs during disposal.
|
|
147
|
+
*/
|
|
148
|
+
var ReplRuntime = class extends Service {
|
|
149
|
+
constructor(ctx) {
|
|
150
|
+
super(ctx, "replRuntime");
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/py-sdk.ts
|
|
156
|
+
/** The language-portable identifier subset the seam accepts as a binding global (mirrors the runtime's private rule). */
|
|
157
|
+
const PORTABLE_IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
158
|
+
/**
|
|
159
|
+
* Whether a tool name can be bound as a `tool` member — the ONE
|
|
160
|
+
* policy the bridge's binding loop (src/index.ts) applies, so the
|
|
161
|
+
* bindings never promise a name the kernel does
|
|
162
|
+
* not bind. Strictly narrower than the runtime's validation: the
|
|
163
|
+
* language-portable identifier subset (`[A-Za-z_][A-Za-z0-9_]*`, ASCII — a
|
|
164
|
+
* non-ASCII XID name is legal CPython but not portable, so the runtime
|
|
165
|
+
* refuses it as a binding global), minus
|
|
166
|
+
* every portable reserved word (ECMAScript ∪ Python — `type` and `match`
|
|
167
|
+
* are legal Python but reserved on the seam), minus the seam's reserved
|
|
168
|
+
* binding globals (`console`, dunders), minus underscore-leading names
|
|
169
|
+
* (kernel-shim prefix plus the call-site hazards; not callable as taught
|
|
170
|
+
* flat globals). The runtime's `validateBindings` remains the authoritative
|
|
171
|
+
* backstop: everything this accepts, it accepts.
|
|
172
|
+
*/
|
|
173
|
+
function isFlatBindableName(name) {
|
|
174
|
+
return PORTABLE_IDENTIFIER.test(name) && !name.startsWith("_") && !PORTABLE_RESERVED_WORDS.has(name) && !RESERVED_BINDING_GLOBALS.has(name);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
//#endregion
|
|
178
|
+
export { RESERVED_ERROR_MEMBERS as a, RESERVED_BINDING_GLOBALS as i, DUNDER_MEMBER as n, ReplRuntime as o, PORTABLE_RESERVED_WORDS as r, isFlatBindableName as t };
|
package/lib/py-sdk.d.ts
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/py-sdk.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Whether a tool name can be bound as a `tool` member — the ONE
|
|
4
|
+
* policy the bridge's binding loop (src/index.ts) applies, so the
|
|
5
|
+
* bindings never promise a name the kernel does
|
|
6
|
+
* not bind. Strictly narrower than the runtime's validation: the
|
|
7
|
+
* language-portable identifier subset (`[A-Za-z_][A-Za-z0-9_]*`, ASCII — a
|
|
8
|
+
* non-ASCII XID name is legal CPython but not portable, so the runtime
|
|
9
|
+
* refuses it as a binding global), minus
|
|
10
|
+
* every portable reserved word (ECMAScript ∪ Python — `type` and `match`
|
|
11
|
+
* are legal Python but reserved on the seam), minus the seam's reserved
|
|
12
|
+
* binding globals (`console`, dunders), minus underscore-leading names
|
|
13
|
+
* (kernel-shim prefix plus the call-site hazards; not callable as taught
|
|
14
|
+
* flat globals). The runtime's `validateBindings` remains the authoritative
|
|
15
|
+
* backstop: everything this accepts, it accepts.
|
|
16
|
+
*/
|
|
17
|
+
declare function isFlatBindableName(name: string): boolean;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { isFlatBindableName };
|
package/lib/py-sdk.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as isFlatBindableName } from "./py-sdk-Chvy92MB.js";
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { isFlatBindableName };
|