better-dsh 0.3.0 → 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.
- package/README.md +49 -178
- package/cordis.patch.yml +4 -35
- package/docs/adr/0015-independent-bundles-agent-remote.md +40 -0
- package/docs/remote-tools.md +56 -0
- package/docs/specs/omp-python-repl-port/runtime-guide.md +33 -0
- package/docs/specs/omp-python-repl-port/spec.md +61 -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-kGXcZOe0.js → LaunchOptions-5eg7E0ye.js} +1 -1
- package/lib/LaunchOptions-DxQQ0s-A.js +4 -0
- package/lib/{bidi-BalpKaJc.js → bidi-CwabFH07.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-B-9jm12n.js} +4 -4
- package/lib/index.d.ts +17 -41
- package/lib/index.js +473 -1678
- package/lib/kernel-env-BOF0fNHn.js +91 -0
- package/lib/kernel-env.d.ts +4 -58
- 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-CupOhMp5.js → main-BeCgUd20.js} +8 -6
- package/lib/{main-BQeFrBM1.js → main-Dv_UQqG2.js} +1 -1
- 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-Dnd7eqel.js} +9 -9
- 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 +12 -12
- 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-CwZrTBcl.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 +6 -23
- package/scripts/kernel-provision.mjs +4 -34
- 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/register-bundle.mjs +0 -80
package/lib/webserver.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Service } from "@deepseek-ai/cordis";
|
|
2
|
-
import { WebServer } from "@deepseek-ai/dsh-host-webserver";
|
|
3
|
-
|
|
4
|
-
//#region src/webserver.ts
|
|
5
|
-
var BetterWebServer = class extends WebServer {
|
|
6
|
-
static inject = ["loader"];
|
|
7
|
-
async [Service.init]() {
|
|
8
|
-
const welcome = [...this.ctx.loader.entries()].find((entry) => entry.options.id === "dashr-welcome-notice");
|
|
9
|
-
if (welcome !== void 0 && !welcome.disabled) {
|
|
10
|
-
if (welcome.fiber === void 0) await welcome.init();
|
|
11
|
-
await welcome.fiber?.await();
|
|
12
|
-
}
|
|
13
|
-
this.ctx.fiber.assertActive();
|
|
14
|
-
await super[Service.init]();
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { BetterWebServer as default };
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
// Separate-process entry for the SAME native package operations used by dsh plugin.
|
|
2
|
-
// No shell interpolation, package scripts, upstream edits, or companion registry lookup.
|
|
3
|
-
import { createRequire } from 'node:module'
|
|
4
|
-
import { createHash } from 'node:crypto'
|
|
5
|
-
import { readFile, realpath } from 'node:fs/promises'
|
|
6
|
-
import { dirname, join, relative, resolve, isAbsolute, sep } from 'node:path'
|
|
7
|
-
import { pathToFileURL } from 'node:url'
|
|
8
|
-
let input = ''
|
|
9
|
-
for await (const bytes of process.stdin) input += bytes
|
|
10
|
-
const {profile,archive,expected} = JSON.parse(input)
|
|
11
|
-
const require = createRequire(profile.installAnchor)
|
|
12
|
-
const {runProfilePnpm} = await import(pathToFileURL(require.resolve('@deepseek-ai/dsh-plugin-manager/operations')).href)
|
|
13
|
-
const {withFileLock} = await import(pathToFileURL(require.resolve('@deepseek-ai/dsh-atomic-write')).href)
|
|
14
|
-
const abort = new AbortController()
|
|
15
|
-
process.once('SIGTERM', () => abort.abort())
|
|
16
|
-
const json = async path => JSON.parse(await readFile(path, 'utf8'))
|
|
17
|
-
const hash = bytes => createHash('sha256').update(bytes).digest('hex')
|
|
18
|
-
async function contained(root, path) {
|
|
19
|
-
if (typeof path !== 'string' || isAbsolute(path)) throw new Error('Pack delivery path must be relative')
|
|
20
|
-
const base = await realpath(root), file = await realpath(resolve(base, path)), rel = relative(base, file)
|
|
21
|
-
if (rel === '..' || rel.startsWith('..' + sep) || isAbsolute(rel)) throw new Error('Pack delivery path escapes its owner')
|
|
22
|
-
return file
|
|
23
|
-
}
|
|
24
|
-
const skipped = disposition => ({ exitCode: 0, disposition })
|
|
25
|
-
// Complete each native acquisition/release before observing cancellation;
|
|
26
|
-
// exiting during its async lock-file write can strand incomplete lock metadata.
|
|
27
|
-
async function withCancellableProfileLock(operation) {
|
|
28
|
-
const path = join(profile.dir, 'package.json'), deadline = Date.now() + 120000
|
|
29
|
-
for (;;) {
|
|
30
|
-
abort.signal.throwIfAborted()
|
|
31
|
-
let acquired = false
|
|
32
|
-
try {
|
|
33
|
-
return await withFileLock(path, async () => {
|
|
34
|
-
acquired = true
|
|
35
|
-
abort.signal.throwIfAborted()
|
|
36
|
-
return operation()
|
|
37
|
-
}, { waitMs: Math.min(250, Math.max(0, deadline - Date.now())) })
|
|
38
|
-
} catch (error) {
|
|
39
|
-
abort.signal.throwIfAborted()
|
|
40
|
-
if (acquired || Date.now() >= deadline
|
|
41
|
-
|| error.message !== `atomic-write: timed out waiting for the writer lock at ${path}.lock`) throw error
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const result = await withCancellableProfileLock(async () => {
|
|
46
|
-
abort.signal.throwIfAborted()
|
|
47
|
-
const current = await json(join(profile.dir, 'package.json'))
|
|
48
|
-
if (typeof expected.ownerSpec !== 'string' || current.dependencies?.[expected.owner] !== expected.ownerSpec) return skipped('owner-changed')
|
|
49
|
-
const ownerDir = join(profile.dir, 'node_modules', expected.owner)
|
|
50
|
-
let owner, descriptorPath, descriptor
|
|
51
|
-
try {
|
|
52
|
-
owner = await json(join(ownerDir, 'package.json'))
|
|
53
|
-
if (owner.dependencies?.[expected.companion.name] !== expected.companion.version || owner.superd?.delivery === undefined) return skipped('owner-changed')
|
|
54
|
-
descriptorPath = await contained(ownerDir, owner.superd.delivery)
|
|
55
|
-
descriptor = await json(descriptorPath)
|
|
56
|
-
} catch (error) {
|
|
57
|
-
if (error.code === 'ENOENT') return skipped('owner-changed')
|
|
58
|
-
throw error
|
|
59
|
-
}
|
|
60
|
-
const item = descriptor.companions?.find(item => item.name === expected.companion.name)
|
|
61
|
-
if (item?.version !== expected.companion.version || item.sha256 !== expected.companion.sha256
|
|
62
|
-
|| hash(await readFile(await contained(dirname(descriptorPath), item.tarball))) !== expected.companion.sha256) return skipped('owner-changed')
|
|
63
|
-
const prior = current.dependencies?.[item.name]
|
|
64
|
-
if (prior !== expected.priorSpec) return skipped(prior === undefined && expected.priorSpec !== undefined ? 'companion-removed' : 'companion-changed')
|
|
65
|
-
if (hash(await readFile(archive)) !== item.sha256) throw new Error('Cached companion SHA256 mismatch')
|
|
66
|
-
abort.signal.throwIfAborted()
|
|
67
|
-
// Same public operation and writer lock used by the native Plugin Manager;
|
|
68
|
-
// intent is checked after acquisition, before a queued install can undo removal.
|
|
69
|
-
const operation = await runProfilePnpm({profile:profile.name,dir:profile.dir,installAnchor:profile.installAnchor,cwd:profile.dir,home:profile.home}, ['add','file:'+archive,'--ignore-scripts'], {
|
|
70
|
-
...profile.packageManager, execution:'service', signal:abort.signal, outputBytes:16384,
|
|
71
|
-
lookupTimeoutMs:120000, idleTimeoutMs:120000,
|
|
72
|
-
})
|
|
73
|
-
if (operation.exitCode === 0) {
|
|
74
|
-
const installed = await json(join(profile.dir, 'node_modules', item.name, 'package.json'))
|
|
75
|
-
const after = await json(join(profile.dir, 'package.json'))
|
|
76
|
-
if (installed.name !== item.name || installed.version !== item.version || after.dependencies?.[item.name] !== 'file:' + archive) throw new Error('Native companion registration did not install the exact local artifact')
|
|
77
|
-
}
|
|
78
|
-
return { exitCode: operation.exitCode, logPath: operation.logPath, disposition: 'installed' }
|
|
79
|
-
})
|
|
80
|
-
process.stdout.write(JSON.stringify(result)+'\n')
|