newmark-agent 0.4.5 → 0.4.6
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/dist/cli-commands.d.ts +1 -1
- package/dist/cli-commands.js +89 -7
- package/dist/cli-discovery.js +8 -0
- package/dist/conversation-utility-host.bundle.cjs +3 -0
- package/dist/core/config.js +3 -0
- package/dist/core/dshCompatibility.d.ts +23 -6
- package/dist/core/dshCompatibility.js +99 -1
- package/dist/core/installUpdate.d.ts +67 -0
- package/dist/core/installUpdate.js +265 -0
- package/dist/core/mobilePairing.d.ts +46 -0
- package/dist/core/mobilePairing.js +207 -0
- package/dist/main.js +49 -0
- package/dist/preload.js +5 -0
- package/dist/server.js +195 -3
- package/dist/tui/src/adapters/core-runtime-adapter.js +17 -1
- package/dist/tui/src/app.js +41 -0
- package/dist/tui/src/data.js +1 -0
- package/dist/tui/src/render.js +11 -0
- package/dist/tui/src/settings-schema.js +3 -1
- package/dist/tui/src/state.js +21 -1
- package/dist/ui/index.html +455 -13
- package/dist/ui/lucide-sprite.svg +10 -0
- package/dist/wsl-agent-host.bundle.cjs +3 -0
- package/package.json +12 -8
package/dist/cli-commands.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const CLI_COMMANDS: readonly ["state", "tool", "send", "validate-models", "fuzzy-inject", "skills-market", "memory-lab", "install-update", "compat", "compat-tool"];
|
|
1
|
+
export declare const CLI_COMMANDS: readonly ["state", "tool", "send", "validate-models", "fuzzy-inject", "skills-market", "memory-lab", "install-update", "compat", "compat-tool", "pair", "remote"];
|
|
2
2
|
export declare function cliHelpRequested(args: string[]): boolean;
|
|
3
3
|
/**
|
|
4
4
|
* Compatibility discovery reads third-party metadata outside the selected
|
package/dist/cli-commands.js
CHANGED
|
@@ -49,7 +49,8 @@ const compat_1 = require("./core/compat");
|
|
|
49
49
|
const dshCompatibility_1 = require("./core/dshCompatibility");
|
|
50
50
|
const memoryLab_1 = require("./core/memoryLab");
|
|
51
51
|
const installUpdate_1 = require("./core/installUpdate");
|
|
52
|
-
|
|
52
|
+
const mobilePairing_1 = require("./core/mobilePairing");
|
|
53
|
+
exports.CLI_COMMANDS = ['state', 'tool', 'send', 'validate-models', 'fuzzy-inject', 'skills-market', 'memory-lab', 'install-update', 'compat', 'compat-tool', 'pair', 'remote'];
|
|
53
54
|
const CLI_COMMAND_HELP = {
|
|
54
55
|
state: [
|
|
55
56
|
'Usage: Newmark.exe state [--root <dir>]',
|
|
@@ -80,9 +81,17 @@ const CLI_COMMAND_HELP = {
|
|
|
80
81
|
'Usage: Newmark.exe memory-lab [--read|--component <name>|--update ...|--reindex] [--root <dir>]',
|
|
81
82
|
'Read or update the local Memory Lab index and components.',
|
|
82
83
|
],
|
|
84
|
+
pair: [
|
|
85
|
+
'Usage: Newmark.exe pair [--root <dir>]',
|
|
86
|
+
'Print a Tailscale pairing QR code and URL for the Newmark mobile app.',
|
|
87
|
+
],
|
|
88
|
+
remote: [
|
|
89
|
+
'Usage: Newmark.exe remote --on|--off [--root <dir>]',
|
|
90
|
+
'Enable or disable mobile remote-touch over Tailscale.',
|
|
91
|
+
],
|
|
83
92
|
'install-update': [
|
|
84
|
-
'Usage: Newmark.exe install-update (--source <path>|--check-github|--from-github) [options] [--root <dir>]',
|
|
85
|
-
'Inspect or apply a local/GitHub update
|
|
93
|
+
'Usage: Newmark.exe install-update (--source <path>|--check-github|--from-github|--msi <path>) [options] [--root <dir>]',
|
|
94
|
+
'Inspect or apply a local/GitHub update, or run a managed MSI install with process confirmation, previous-version uninstall, and legacy cleanup.',
|
|
86
95
|
],
|
|
87
96
|
compat: [
|
|
88
97
|
'Usage: Newmark.exe compat [--target all|tools|plugins|dsh|marketplaces|skills|agents|subagents] [--root <dir>]',
|
|
@@ -104,12 +113,12 @@ const CLI_VALUE_FLAGS = new Set([
|
|
|
104
113
|
'--candidate-models', '--protocol', '--query', '--type', '--path', '--component', '--source-id',
|
|
105
114
|
'--remove-source', '--enable-source', '--disable-source', '--source', '--target', '--target-file',
|
|
106
115
|
'--expected-version', '--preserve', '--repo', '--tag', '--asset', '--version', '--content-file',
|
|
107
|
-
'--content', '--description', '--tags',
|
|
116
|
+
'--content', '--description', '--tags', '--msi', '--log-dir',
|
|
108
117
|
]);
|
|
109
118
|
const CLI_BOOLEAN_FLAGS = new Set([
|
|
110
119
|
'--persist', '--agent-only', '--list', '--preview-only', '--sources', '--add-source', '--check-github',
|
|
111
120
|
'--from-github', '--dry-run', '--read', '--index', '--reindex', '--update', '--version', '--folder', '--help', '-h',
|
|
112
|
-
'--branch-communication',
|
|
121
|
+
'--branch-communication', '--yes', '--confirm-stop', '--confirm-remove-legacy', '--no-uninstall-previous', '--no-elevate',
|
|
113
122
|
]);
|
|
114
123
|
function invalidCliCommandArgument(args) {
|
|
115
124
|
let skipNext = false;
|
|
@@ -712,6 +721,41 @@ async function runCliCommand(root, args) {
|
|
|
712
721
|
}
|
|
713
722
|
agent.setMode(requestedMode);
|
|
714
723
|
}
|
|
724
|
+
if (command === 'pair') {
|
|
725
|
+
const qr = await (0, mobilePairing_1.pairingQrAscii)(root);
|
|
726
|
+
safeStdout(qr.ascii + '\n');
|
|
727
|
+
safeStdout(`\nPairing URL: ${qr.session.url}\n`);
|
|
728
|
+
safeStdout(`Token file: ${(0, mobilePairing_1.pairingTokenPath)(root)}\n`);
|
|
729
|
+
const expiresIn = Math.max(0, Math.round((qr.session.expiresAt - Date.now()) / 1000));
|
|
730
|
+
safeStdout(`Window: ${expiresIn}s — scan with the Newmark mobile app. Waiting for confirmation...\n`);
|
|
731
|
+
const deadline = qr.session.expiresAt + 1000;
|
|
732
|
+
while (Date.now() < deadline) {
|
|
733
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
734
|
+
const status = (0, mobilePairing_1.pairingStatus)(root);
|
|
735
|
+
if (status.confirmed) {
|
|
736
|
+
safeStdout('\n✓ Paired successfully. QR window closed.\n');
|
|
737
|
+
return true;
|
|
738
|
+
}
|
|
739
|
+
if (status.expired || !status.active) {
|
|
740
|
+
safeStdout("\n✗ Pairing window expired. Run 'pair' again for a new QR.\n");
|
|
741
|
+
return false;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return false;
|
|
745
|
+
}
|
|
746
|
+
if (command === 'remote') {
|
|
747
|
+
const on = args.includes('--on');
|
|
748
|
+
const off = args.includes('--off');
|
|
749
|
+
if (on === off) {
|
|
750
|
+
safeStderr('Usage: Newmark.exe remote --on|--off\n');
|
|
751
|
+
process.exitCode = 2;
|
|
752
|
+
return true;
|
|
753
|
+
}
|
|
754
|
+
agent.config.set('remote', 'touch_enabled', on);
|
|
755
|
+
agent.config.save();
|
|
756
|
+
safeStdout(`Remote touch ${on ? 'enabled' : 'disabled'}\n`);
|
|
757
|
+
return true;
|
|
758
|
+
}
|
|
715
759
|
if (command === 'state') {
|
|
716
760
|
printJson(safeState(agent, root));
|
|
717
761
|
return true;
|
|
@@ -963,10 +1007,47 @@ async function runCliCommand(root, args) {
|
|
|
963
1007
|
process.exitCode = 1;
|
|
964
1008
|
return true;
|
|
965
1009
|
}
|
|
1010
|
+
if (args.includes('--msi')) {
|
|
1011
|
+
const msiPath = argValue(args, '--msi') || positionalAfter(args, 'install-update')[0] || '';
|
|
1012
|
+
const confirmAll = args.includes('--yes');
|
|
1013
|
+
const stopConfirmed = confirmAll || args.includes('--confirm-stop');
|
|
1014
|
+
const removeLegacyConfirmed = confirmAll || args.includes('--confirm-remove-legacy');
|
|
1015
|
+
const options = {
|
|
1016
|
+
stopConfirmed,
|
|
1017
|
+
removeLegacyConfirmed,
|
|
1018
|
+
uninstallPrevious: !args.includes('--no-uninstall-previous'),
|
|
1019
|
+
allowElevate: !args.includes('--no-elevate'),
|
|
1020
|
+
logDir: argValue(args, '--log-dir') || root,
|
|
1021
|
+
};
|
|
1022
|
+
const plan = (0, installUpdate_1.planManagedMsiInstall)(msiPath, options);
|
|
1023
|
+
if (!plan.ok) {
|
|
1024
|
+
printJson(plan);
|
|
1025
|
+
safeStderr(`Managed MSI install cannot start: ${plan.error || 'unknown error'}\n`);
|
|
1026
|
+
process.exitCode = 1;
|
|
1027
|
+
return true;
|
|
1028
|
+
}
|
|
1029
|
+
if (plan.needsStopConfirmation) {
|
|
1030
|
+
printJson(plan);
|
|
1031
|
+
safeStderr('Running Newmark processes were found. Re-run with --confirm-stop (or --yes) to stop them before installing.\n');
|
|
1032
|
+
process.exitCode = 2;
|
|
1033
|
+
return true;
|
|
1034
|
+
}
|
|
1035
|
+
if (plan.needsLegacyRemovalConfirmation) {
|
|
1036
|
+
printJson(plan);
|
|
1037
|
+
safeStderr('Legacy Newmark executables were found outside the install target. Re-run with --confirm-remove-legacy (or --yes) to remove them.\n');
|
|
1038
|
+
process.exitCode = 2;
|
|
1039
|
+
return true;
|
|
1040
|
+
}
|
|
1041
|
+
const result = (0, installUpdate_1.executeManagedMsiInstall)(msiPath, options);
|
|
1042
|
+
printJson(result);
|
|
1043
|
+
if (!result.ok)
|
|
1044
|
+
process.exitCode = 1;
|
|
1045
|
+
return true;
|
|
1046
|
+
}
|
|
966
1047
|
const source = pathArgValue(args, '--source') || positionalAfter(args, 'install-update')[0] || '';
|
|
967
1048
|
const target = pathArgValue(args, '--target') || root;
|
|
968
1049
|
if (!source) {
|
|
969
|
-
safeStderr('Usage: Newmark.exe install-update (--source <portable-exe-or-unpacked-dir>|--check-github|--from-github) [--repo owner/name] [--tag vX.Y.Z] [--asset name] [--target <dir>] [--target-file <path>] [--expected-version <version>] [--preserve csv] [--dry-run] [--root <dir>]\n');
|
|
1050
|
+
safeStderr('Usage: Newmark.exe install-update (--source <portable-exe-or-unpacked-dir>|--check-github|--from-github|--msi <path>) [--repo owner/name] [--tag vX.Y.Z] [--asset name] [--target <dir>] [--target-file <path>] [--expected-version <version>] [--preserve csv] [--dry-run] [--root <dir>]\n');
|
|
970
1051
|
process.exitCode = 1;
|
|
971
1052
|
return true;
|
|
972
1053
|
}
|
|
@@ -1082,7 +1163,8 @@ function cliCommandUsage() {
|
|
|
1082
1163
|
' Newmark.exe fuzzy-inject [--name <provider>] [--env-file <PowerShell-or-dotenv-file>|--env-file-env <ENV_WITH_FILE_PATH>] [--endpoint-env <ENV_WITH_BASE_URL>] [--key-env <ENV_WITH_API_KEY>] [--protocol openai|anthropic] [--preview-only] [--root <dir>]',
|
|
1083
1164
|
' Newmark.exe skills-market [--query <text>|--sources|--add-source --name <name> (--url <url>|--path <path>) [--type json|skill-url|local-dir]|--remove-source <id>|--enable-source <id>|--disable-source <id>] [--root <dir>]',
|
|
1084
1165
|
' Newmark.exe memory-lab [--read|--component <name>|--update --name <name> --description <text> --tags <csv> --content-file <path> [--folder]|--reindex] [--root <dir>]',
|
|
1085
|
-
' Newmark.exe
|
|
1166
|
+
' Newmark.exe pair [--root <dir>]',
|
|
1167
|
+
' Newmark.exe install-update (--source <portable-exe-or-unpacked-dir>|--check-github|--from-github|--msi <path>) [--repo owner/name] [--tag vX.Y.Z] [--asset name] [--target <dir>] [--target-file <path>] [--expected-version <version>] [--preserve csv] [--dry-run] [--confirm-stop|--confirm-remove-legacy|--yes] [--no-uninstall-previous] [--no-elevate] [--log-dir <dir>] [--root <dir>]',
|
|
1086
1168
|
' Newmark.exe compat [--target all|tools|plugins|marketplaces|skills|agents|subagents] [--root <dir>]',
|
|
1087
1169
|
' Newmark.exe compat-tool --list | --name <opencode-tool> [json-args | --args-file path] [--root <dir>]',
|
|
1088
1170
|
`Working directory fallback: ${path.resolve('.')}`,
|
package/dist/cli-discovery.js
CHANGED
|
@@ -64,6 +64,8 @@ const VALUE_FLAGS = new Set([
|
|
|
64
64
|
'--inspect-port',
|
|
65
65
|
'--js-flags',
|
|
66
66
|
'--viewer-request',
|
|
67
|
+
'--msi',
|
|
68
|
+
'--log-dir',
|
|
67
69
|
]);
|
|
68
70
|
const BOOLEAN_FLAGS = new Set([
|
|
69
71
|
'--tui',
|
|
@@ -76,6 +78,7 @@ const BOOLEAN_FLAGS = new Set([
|
|
|
76
78
|
'-v',
|
|
77
79
|
'-version',
|
|
78
80
|
'--automation-wake',
|
|
81
|
+
'--no-browser',
|
|
79
82
|
'--newmark-viewer',
|
|
80
83
|
'--allow-multiple-instances',
|
|
81
84
|
'--disable-gpu',
|
|
@@ -101,6 +104,11 @@ const BOOLEAN_FLAGS = new Set([
|
|
|
101
104
|
'--limit',
|
|
102
105
|
'--scopes',
|
|
103
106
|
'--web',
|
|
107
|
+
'--yes',
|
|
108
|
+
'--confirm-stop',
|
|
109
|
+
'--confirm-remove-legacy',
|
|
110
|
+
'--no-uninstall-previous',
|
|
111
|
+
'--no-elevate',
|
|
104
112
|
]);
|
|
105
113
|
/** Public version spellings accepted by every Newmark entrypoint. */
|
|
106
114
|
function isVersionArgument(args) {
|
|
@@ -328314,6 +328314,9 @@ function defaultConfig() {
|
|
|
328314
328314
|
default_input: { _description: "Default input mode", _type: "choice", _values: ["guide", "next"], value: "guide" },
|
|
328315
328315
|
auto_archive_on_close: { _description: "Auto archive on close", _type: "boolean", value: true }
|
|
328316
328316
|
},
|
|
328317
|
+
remote: {
|
|
328318
|
+
touch_enabled: { _description: "Allow mobile devices to reach this Newmark instance over Tailscale", _type: "boolean", value: true }
|
|
328319
|
+
},
|
|
328317
328320
|
models: {
|
|
328318
328321
|
providers: { _description: "LLM providers", _type: "array", value: [] },
|
|
328319
328322
|
default_model: { _description: "Default model", _type: "string", value: "" },
|
package/dist/core/config.js
CHANGED
|
@@ -849,6 +849,9 @@ function defaultConfig() {
|
|
|
849
849
|
default_input: { _description: "Default input mode", _type: "choice", _values: ["guide", "next"], value: "guide" },
|
|
850
850
|
auto_archive_on_close: { _description: "Auto archive on close", _type: "boolean", value: true },
|
|
851
851
|
},
|
|
852
|
+
remote: {
|
|
853
|
+
touch_enabled: { _description: "Allow mobile devices to reach this Newmark instance over Tailscale", _type: "boolean", value: true },
|
|
854
|
+
},
|
|
852
855
|
models: {
|
|
853
856
|
providers: { _description: "LLM providers", _type: "array", value: [] },
|
|
854
857
|
default_model: { _description: "Default model", _type: "string", value: "" },
|
|
@@ -38,6 +38,9 @@ export interface DshBundleSnapshot {
|
|
|
38
38
|
patchExists: boolean;
|
|
39
39
|
unknownKeys: string[];
|
|
40
40
|
resolved: boolean;
|
|
41
|
+
installed?: boolean;
|
|
42
|
+
installPath?: string;
|
|
43
|
+
enabled?: boolean;
|
|
41
44
|
}
|
|
42
45
|
export interface DshProfileSnapshot {
|
|
43
46
|
name: string;
|
|
@@ -188,11 +191,25 @@ export declare function discoverDshCompatibility(root: string, options?: DshComp
|
|
|
188
191
|
* 既不 import 也不 execute 任何 DSH 插件代码。
|
|
189
192
|
*/
|
|
190
193
|
export declare function dshCompactionRuntimeSemantics(): DshCompactionRuntimeSemantics;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
export declare function dshInstalledBundles(root: string): Array<{
|
|
195
|
+
name: string;
|
|
196
|
+
installPath: string;
|
|
197
|
+
enabled: boolean;
|
|
198
|
+
}>;
|
|
199
|
+
export declare function installDshBundle(root: string, manifestPath: string): {
|
|
200
|
+
ok: boolean;
|
|
201
|
+
error?: string;
|
|
202
|
+
installPath?: string;
|
|
203
|
+
name?: string;
|
|
204
|
+
};
|
|
205
|
+
export declare function uninstallDshBundle(root: string, name: string): {
|
|
206
|
+
ok: boolean;
|
|
207
|
+
error?: string;
|
|
208
|
+
};
|
|
209
|
+
export declare function setDshBundleEnabled(root: string, name: string, enabled: boolean): {
|
|
210
|
+
ok: boolean;
|
|
211
|
+
error?: string;
|
|
212
|
+
enabled?: boolean;
|
|
213
|
+
};
|
|
197
214
|
export declare function dshToolLayerRuntimeSemantics(): DshToolLayerRuntimeSemantics;
|
|
198
215
|
//# sourceMappingURL=dshCompatibility.d.ts.map
|
|
@@ -35,6 +35,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.discoverDshCompatibility = discoverDshCompatibility;
|
|
37
37
|
exports.dshCompactionRuntimeSemantics = dshCompactionRuntimeSemantics;
|
|
38
|
+
exports.dshInstalledBundles = dshInstalledBundles;
|
|
39
|
+
exports.installDshBundle = installDshBundle;
|
|
40
|
+
exports.uninstallDshBundle = uninstallDshBundle;
|
|
41
|
+
exports.setDshBundleEnabled = setDshBundleEnabled;
|
|
38
42
|
exports.dshToolLayerRuntimeSemantics = dshToolLayerRuntimeSemantics;
|
|
39
43
|
const fs = __importStar(require("fs"));
|
|
40
44
|
const os = __importStar(require("os"));
|
|
@@ -467,6 +471,13 @@ function discoverDshCompatibility(root, options = {}) {
|
|
|
467
471
|
if (!profiles.length)
|
|
468
472
|
warnings.push(`No DSH profiles were found under ${profileRoot}.`);
|
|
469
473
|
const dedupedBundles = bundles.filter((bundle, index) => bundles.findIndex(other => path.resolve(other.manifestPath) === path.resolve(bundle.manifestPath)) === index);
|
|
474
|
+
const installed = dshInstalledBundles(root);
|
|
475
|
+
const bundlesWithInstall = dedupedBundles.map(bundle => {
|
|
476
|
+
const found = installed.find(item => item.name === sanitizePluginName(bundle.name));
|
|
477
|
+
return found
|
|
478
|
+
? { ...bundle, installed: true, installPath: found.installPath, enabled: found.enabled }
|
|
479
|
+
: { ...bundle, installed: false, enabled: false };
|
|
480
|
+
});
|
|
470
481
|
const dedupedMcp = mcpCandidates.filter((candidate, index) => mcpCandidates.findIndex(other => other.name === candidate.name && other.source === candidate.source) === index);
|
|
471
482
|
const configFiles = unique(profiles.flatMap(profile => profile.configFiles).concat(dedupedBundles.flatMap(bundle => bundle.patchPath && bundle.patchExists ? [bundle.patchPath] : []), homeConfigFiles));
|
|
472
483
|
return {
|
|
@@ -492,7 +503,7 @@ function discoverDshCompatibility(root, options = {}) {
|
|
|
492
503
|
},
|
|
493
504
|
recognizedManifestKeys: ['dsh.bundle.patch', 'dsh.profile.bundles'],
|
|
494
505
|
profiles,
|
|
495
|
-
bundles:
|
|
506
|
+
bundles: bundlesWithInstall,
|
|
496
507
|
mcpCandidates: dedupedMcp,
|
|
497
508
|
configFiles,
|
|
498
509
|
homeConfigFiles,
|
|
@@ -559,6 +570,93 @@ function dshCompactionRuntimeSemantics() {
|
|
|
559
570
|
* developer-preview schema 更新的 fail-soft 兼容策略。既不 import 也不 execute
|
|
560
571
|
* 任何 DSH 插件代码。
|
|
561
572
|
*/
|
|
573
|
+
const DSH_INSTALL_DIR = 'plugins/dsh';
|
|
574
|
+
function sanitizePluginName(name) {
|
|
575
|
+
return String(name || '')
|
|
576
|
+
.replace(/^@/, '')
|
|
577
|
+
.replace(/[/\\:*?"<>|]/g, '_')
|
|
578
|
+
.trim() || 'dsh-plugin';
|
|
579
|
+
}
|
|
580
|
+
function dshInstallRoot(root) {
|
|
581
|
+
return path.join(path.resolve(root), DSH_INSTALL_DIR);
|
|
582
|
+
}
|
|
583
|
+
function installedStatePath(installRoot, name) {
|
|
584
|
+
return path.join(installRoot, name, '.newmark-dsh-installed.json');
|
|
585
|
+
}
|
|
586
|
+
function readInstalledState(filePath) {
|
|
587
|
+
try {
|
|
588
|
+
const value = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
|
589
|
+
return value && typeof value === 'object' ? { enabled: value.enabled !== false } : { enabled: true };
|
|
590
|
+
}
|
|
591
|
+
catch {
|
|
592
|
+
return null;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
function dshInstalledBundles(root) {
|
|
596
|
+
const installRoot = dshInstallRoot(root);
|
|
597
|
+
const output = [];
|
|
598
|
+
let entries = [];
|
|
599
|
+
try {
|
|
600
|
+
entries = fs.readdirSync(installRoot, { withFileTypes: true });
|
|
601
|
+
}
|
|
602
|
+
catch {
|
|
603
|
+
return output;
|
|
604
|
+
}
|
|
605
|
+
for (const entry of entries) {
|
|
606
|
+
if (!entry.isDirectory() || entry.name.startsWith('.'))
|
|
607
|
+
continue;
|
|
608
|
+
const state = readInstalledState(installedStatePath(installRoot, entry.name));
|
|
609
|
+
output.push({ name: entry.name, installPath: path.join(installRoot, entry.name), enabled: state ? state.enabled : true });
|
|
610
|
+
}
|
|
611
|
+
return output.sort((a, b) => a.name.localeCompare(b.name));
|
|
612
|
+
}
|
|
613
|
+
function installDshBundle(root, manifestPath) {
|
|
614
|
+
const resolved = path.resolve(manifestPath);
|
|
615
|
+
if (!fileExists(resolved))
|
|
616
|
+
return { ok: false, error: `DSH bundle manifest not found: ${resolved}` };
|
|
617
|
+
const manifest = readJson(resolved);
|
|
618
|
+
const rawName = typeof manifest?.name === 'string' ? manifest.name : path.basename(path.dirname(resolved));
|
|
619
|
+
const name = sanitizePluginName(rawName);
|
|
620
|
+
const sourceDir = path.dirname(resolved);
|
|
621
|
+
const installRoot = dshInstallRoot(root);
|
|
622
|
+
const targetDir = path.join(installRoot, name);
|
|
623
|
+
try {
|
|
624
|
+
fs.rmSync(targetDir, { recursive: true, force: true });
|
|
625
|
+
fs.mkdirSync(installRoot, { recursive: true });
|
|
626
|
+
fs.cpSync(sourceDir, targetDir, { recursive: true, force: true });
|
|
627
|
+
fs.writeFileSync(installedStatePath(installRoot, name), JSON.stringify({ enabled: true, installedAt: new Date().toISOString(), source: sourceDir }, null, 2), 'utf-8');
|
|
628
|
+
return { ok: true, installPath: targetDir, name };
|
|
629
|
+
}
|
|
630
|
+
catch (e) {
|
|
631
|
+
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
function uninstallDshBundle(root, name) {
|
|
635
|
+
const clean = sanitizePluginName(name);
|
|
636
|
+
const targetDir = path.join(dshInstallRoot(root), clean);
|
|
637
|
+
try {
|
|
638
|
+
fs.rmSync(targetDir, { recursive: true, force: true });
|
|
639
|
+
return { ok: true };
|
|
640
|
+
}
|
|
641
|
+
catch (e) {
|
|
642
|
+
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
function setDshBundleEnabled(root, name, enabled) {
|
|
646
|
+
const clean = sanitizePluginName(name);
|
|
647
|
+
const targetDir = path.join(dshInstallRoot(root), clean);
|
|
648
|
+
const statePath = installedStatePath(dshInstallRoot(root), clean);
|
|
649
|
+
if (!fs.existsSync(targetDir))
|
|
650
|
+
return { ok: false, error: 'DSH plugin is not installed.' };
|
|
651
|
+
try {
|
|
652
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
653
|
+
fs.writeFileSync(statePath, JSON.stringify({ enabled: !!enabled, updatedAt: new Date().toISOString() }, null, 2), 'utf-8');
|
|
654
|
+
return { ok: true, enabled: !!enabled };
|
|
655
|
+
}
|
|
656
|
+
catch (e) {
|
|
657
|
+
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
658
|
+
}
|
|
659
|
+
}
|
|
562
660
|
function dshToolLayerRuntimeSemantics() {
|
|
563
661
|
return {
|
|
564
662
|
plugin: '@deepseek-ai/dsh-tools',
|
|
@@ -64,4 +64,71 @@ export declare function normalizeReleaseVersion(input: string): string;
|
|
|
64
64
|
export declare function compareSemver(a: string, b: string): number;
|
|
65
65
|
export declare function checkGitHubUpdate(repoInput?: string, tagInput?: string, assetName?: string, token?: string, runtime?: GitHubUpdateCheckRuntimeOptions): Promise<GitHubUpdateCheckResult>;
|
|
66
66
|
export declare function applyGitHubUpdate(options: GitHubUpdateApplyOptions): Promise<GitHubUpdateApplyResult>;
|
|
67
|
+
export interface RunningNewmarkProcess {
|
|
68
|
+
pid: number;
|
|
69
|
+
name: string;
|
|
70
|
+
executablePath: string;
|
|
71
|
+
}
|
|
72
|
+
export interface InstalledNewmarkProduct {
|
|
73
|
+
productCode: string;
|
|
74
|
+
displayName: string;
|
|
75
|
+
installLocation: string;
|
|
76
|
+
uninstallString: string;
|
|
77
|
+
}
|
|
78
|
+
export interface ManagedMsiInstallOptions {
|
|
79
|
+
stopConfirmed?: boolean;
|
|
80
|
+
removeLegacyConfirmed?: boolean;
|
|
81
|
+
uninstallPrevious?: boolean;
|
|
82
|
+
allowElevate?: boolean;
|
|
83
|
+
excludeRoots?: string[];
|
|
84
|
+
logDir?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface ManagedMsiInstallPlan {
|
|
87
|
+
ok: boolean;
|
|
88
|
+
msiPath: string;
|
|
89
|
+
runningProcesses: RunningNewmarkProcess[];
|
|
90
|
+
installedProducts: InstalledNewmarkProduct[];
|
|
91
|
+
legacyExecutables: string[];
|
|
92
|
+
needsStopConfirmation: boolean;
|
|
93
|
+
needsLegacyRemovalConfirmation: boolean;
|
|
94
|
+
error?: string;
|
|
95
|
+
}
|
|
96
|
+
export interface ManagedMsiInstallResult {
|
|
97
|
+
ok: boolean;
|
|
98
|
+
plan: ManagedMsiInstallPlan;
|
|
99
|
+
stopped: number[];
|
|
100
|
+
uninstalled: string[];
|
|
101
|
+
removedLegacy: string[];
|
|
102
|
+
exitCode?: number;
|
|
103
|
+
logPath?: string;
|
|
104
|
+
error?: string;
|
|
105
|
+
}
|
|
106
|
+
export declare function listRunningNewmarkProcesses(): RunningNewmarkProcess[];
|
|
107
|
+
export declare function stopNewmarkProcesses(pids: number[]): {
|
|
108
|
+
stopped: number[];
|
|
109
|
+
errors: string[];
|
|
110
|
+
};
|
|
111
|
+
export declare function listInstalledNewmarkProducts(): InstalledNewmarkProduct[];
|
|
112
|
+
export declare function uninstallNewmarkProduct(productCode: string, logPath: string): {
|
|
113
|
+
ok: boolean;
|
|
114
|
+
exitCode: number;
|
|
115
|
+
logPath: string;
|
|
116
|
+
error?: string;
|
|
117
|
+
};
|
|
118
|
+
export declare function installMsiPackage(msiPath: string, options?: {
|
|
119
|
+
logDir?: string;
|
|
120
|
+
allowElevate?: boolean;
|
|
121
|
+
}): {
|
|
122
|
+
ok: boolean;
|
|
123
|
+
exitCode: number;
|
|
124
|
+
logPath: string;
|
|
125
|
+
error?: string;
|
|
126
|
+
};
|
|
127
|
+
export declare function findLegacyNewmarkExecutables(excludeRoots?: string[]): string[];
|
|
128
|
+
export declare function removeLegacyNewmarkExecutables(paths: string[]): {
|
|
129
|
+
removed: string[];
|
|
130
|
+
errors: string[];
|
|
131
|
+
};
|
|
132
|
+
export declare function planManagedMsiInstall(msiPath: string, options?: ManagedMsiInstallOptions): ManagedMsiInstallPlan;
|
|
133
|
+
export declare function executeManagedMsiInstall(msiPath: string, options?: ManagedMsiInstallOptions): ManagedMsiInstallResult;
|
|
67
134
|
//# sourceMappingURL=installUpdate.d.ts.map
|