Skip to content

Commit 5e5608c

Browse files
committed
Merge remote-tracking branch 'origin/master' into chat-threads-smaller
2 parents 4ae1de8 + 83df56a commit 5e5608c

File tree

14 files changed

+113
-56
lines changed

14 files changed

+113
-56
lines changed

src/packages/frontend/cspell.json

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,58 +7,62 @@
77
"CoCalc",
88
"dplyr",
99
"ggplot",
10+
"ipython",
1011
"ipywidgets",
1112
"katex",
13+
"knitr",
1214
"kucalc",
1315
"mathjax",
1416
"matplotlib",
17+
"Miniterm",
18+
"Miniterm",
1519
"nbconvert",
1620
"nbgrader",
1721
"nbviewer",
1822
"Ollama",
1923
"onprem",
2024
"plotly",
25+
"rclass",
2126
"rereturn",
2227
"respawns",
2328
"Rmarkdown",
29+
"rtypes",
2430
"Sagemath",
31+
"sagetex",
2532
"sagews",
2633
"scikit",
2734
"statsmodels",
2835
"syncdb",
36+
"syncdoc",
37+
"syncdoc",
2938
"syncstring",
39+
"synctables",
3040
"tidyverse",
3141
"timetravel",
32-
"undelete",
33-
"undeleting",
3442
"tolerations",
35-
"rtypes",
36-
"rclass",
37-
"ipython",
38-
"Miniterm",
39-
"syncdoc",
40-
"synctables"
43+
"undelete",
44+
"undeleting"
4145
],
4246
"ignoreWords": [
43-
"LLMs",
44-
"LLM",
4547
"antd",
48+
"immutablejs",
4649
"ipynb",
50+
"isdir",
4751
"kernelspec",
52+
"LLM",
53+
"LLMs",
54+
"MDLG",
4855
"medkit",
4956
"mesg",
57+
"mintime",
5058
"mistralai",
5159
"Popconfirm",
52-
"vertexai",
53-
"vfill",
54-
"xsmall",
55-
"MDLG",
56-
"isdir",
57-
"mintime",
5860
"PoweroffOutlined",
59-
"immutablejs",
6061
"reuseinflight",
61-
"sidechat"
62+
"sidechat",
63+
"vertexai",
64+
"vfill",
65+
"xsmall"
6266
],
6367
"flagWords": [],
6468
"ignorePaths": ["node_modules/**", "dist/**", "dist-ts/**", "build/**"],

src/packages/frontend/frame-editors/code-editor/actions.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,16 @@ import {
3535
redux,
3636
} from "@cocalc/frontend/app-framework";
3737
import type { PageActions } from "@cocalc/frontend/app/actions";
38+
import { VideoChat } from "@cocalc/frontend/chat/video/video-chat";
3839
import { syncAllComputeServers } from "@cocalc/frontend/compute/sync-all";
3940
import { get_buffer, set_buffer } from "@cocalc/frontend/copy-paste-buffer";
4041
import { filenameMode } from "@cocalc/frontend/file-associations";
42+
import {
43+
chat,
44+
getSideChatActions,
45+
} from "@cocalc/frontend/frame-editors/generic/chat";
4146
import { open_new_tab } from "@cocalc/frontend/misc";
47+
import type { FragmentId } from "@cocalc/frontend/misc/fragment-id";
4248
import Fragment from "@cocalc/frontend/misc/fragment-id";
4349
import {
4450
delete_local_storage,
@@ -59,7 +65,7 @@ import {
5965
syntax2tool,
6066
} from "@cocalc/util/code-formatter";
6167
import {
62-
TIMEOUT_CALLING_PROJECT,
68+
IS_TIMEOUT_CALLING_PROJECT,
6369
TIMEOUT_CALLING_PROJECT_MSG,
6470
} from "@cocalc/util/consts/project";
6571
import {
@@ -103,12 +109,6 @@ import * as cm_doc_cache from "./doc";
103109
import { SHELLS } from "./editor";
104110
import { test_line } from "./simulate_typing";
105111
import { misspelled_words } from "./spell-check";
106-
import { VideoChat } from "@cocalc/frontend/chat/video/video-chat";
107-
import type { FragmentId } from "@cocalc/frontend/misc/fragment-id";
108-
import {
109-
chat,
110-
getSideChatActions,
111-
} from "@cocalc/frontend/frame-editors/generic/chat";
112112

113113
interface gutterMarkerParams {
114114
line: number;
@@ -388,7 +388,7 @@ export class Actions<
388388
});
389389

390390
this._syncstring.on("save-to-disk", () => {
391-
// incremenet save_to_disk counter, so that react components can
391+
// increment save_to_disk counter, so that react components can
392392
// react to save_to_disk event happening.
393393
this.set_reload("save_to_disk");
394394
});
@@ -1765,7 +1765,7 @@ export class Actions<
17651765
return;
17661766
}
17671767

1768-
// This implentation of goto_line only supports integer line numbers.
1768+
// This implementation of goto_line only supports integer line numbers.
17691769
// However, derived classes may support id's or other types of more general "lines".
17701770
try {
17711771
if (typeof line == "string") {
@@ -1912,7 +1912,7 @@ export class Actions<
19121912
if (typeof e != "string") throw Error("bug"); // make typescript happy
19131913
error = e;
19141914
}
1915-
if (error === TIMEOUT_CALLING_PROJECT) {
1915+
if (IS_TIMEOUT_CALLING_PROJECT(error)) {
19161916
error = TIMEOUT_CALLING_PROJECT_MSG;
19171917
}
19181918
this.setState({ error });
@@ -2100,7 +2100,7 @@ export class Actions<
21002100
const before = gutter_markers;
21012101
gutter_markers.map((info, id) => {
21022102
if (info !== undefined && info.get("gutter_id") === gutter_id && id) {
2103-
/* && id is to satify typescript */
2103+
/* && id is to satisfy typescript */
21042104
gutter_markers = gutter_markers.delete(id);
21052105
}
21062106
});
@@ -2622,7 +2622,7 @@ export class Actions<
26222622
if (type == "terminal") {
26232623
this.clear_terminal_command(id);
26242624
if (node.get("command") == "jupyter") {
2625-
// not reseting jupyter
2625+
// not resetting jupyter
26262626
return;
26272627
}
26282628
// we also wait until it is "back again with a prompt"

src/packages/frontend/frame-editors/latex-editor/actions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export class Actions extends BaseActions<LatexEditorState> {
197197

198198
private init_ext_path(): void {
199199
if (this.knitr) {
200-
// changing the path to the (to be generated) tex file makes everyting else
200+
// changing the path to the (to be generated) tex file makes everything else
201201
// here compatible with the latex commands
202202
this.path = change_filename_extension(this.path, "tex");
203203
this.setState({ knitr: this.knitr, knitr_error: false });
@@ -225,7 +225,7 @@ export class Actions extends BaseActions<LatexEditorState> {
225225
) {
226226
this._last_syncstring_hash = hash;
227227
// there are two cases: the parent "master" file triggers the build (usual case)
228-
// or an included depdenency – i.e. where parent_file is set
228+
// or an included dependency – i.e. where parent_file is set
229229
if (this.parent_file != null && this.parent_file != this.path) {
230230
const parent_actions = this.redux.getEditorActions(
231231
this.project_id,
@@ -672,7 +672,7 @@ export class Actions extends BaseActions<LatexEditorState> {
672672
// kicks off a save of all relevant files
673673
// Obviously, do not make this save_all(true), because
674674
// that would end up calling this very function again
675-
// crashing the browser in an INFINITE RECURSSION
675+
// crashing the browser in an INFINITE RECURSION
676676
// (this was a bug for a while!).
677677
// Also, the save of the related files is NOT
678678
// explicit -- the user is only explicitly saving this

src/packages/frontend/frame-editors/latex-editor/knitr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export async function knitr(
4242
project_id,
4343
command: R_CMD,
4444
args: [...R_ARGS, expr],
45-
rundir: directory,
45+
runDir: directory,
4646
aggregate: time ? { value: time } : undefined,
4747
set_job_info,
4848
path,

src/packages/frontend/frame-editors/latex-editor/latexmk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export async function latexmk(
4040
project_id,
4141
command,
4242
args,
43-
rundir: head,
43+
runDir: head,
4444
aggregate: time,
4545
set_job_info,
4646
path,

src/packages/frontend/frame-editors/latex-editor/pythontex.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export async function pythontex(
4646
project_id,
4747
aggregate,
4848
command,
49-
rundir: output_directory || directory,
49+
runDir: output_directory || directory,
5050
set_job_info,
5151
// for python plots -- https://github.com/sagemathinc/cocalc/issues/4203
5252
env: { MPLBACKEND: "Agg" },

src/packages/frontend/frame-editors/latex-editor/sagetex.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export async function sagetex(
6565
command: "sage",
6666
args: [s],
6767
set_job_info,
68-
rundir: output_directory || directory,
68+
runDir: output_directory || directory,
6969
aggregate: hash ? { value: hash } : undefined,
7070
path,
7171
});

src/packages/frontend/frame-editors/latex-editor/util.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import {
1010
ExecOpts,
1111
ExecOutput,
1212
} from "@cocalc/frontend/frame-editors/generic/client";
13+
import { IS_TIMEOUT_CALLING_PROJECT } from "@cocalc/util/consts/project";
14+
import { ExecOptsBlocking } from "@cocalc/util/db-schema/projects";
1315
import { separate_file_extension } from "@cocalc/util/misc";
1416
import { ExecuteCodeOutputAsync } from "@cocalc/util/types/execute-code";
15-
// import { TIMEOUT_CALLING_PROJECT } from "@cocalc/util/consts/project";
16-
import { TIMEOUT_CALLING_PROJECT } from "@cocalc/util/consts/project";
17-
import { ExecOptsBlocking } from "@cocalc/util/db-schema/projects";
1817
import { TIMEOUT_LATEX_JOB_S } from "./constants";
1918

2019
export function pdf_path(path: string): string {
@@ -112,7 +111,7 @@ interface RunJobOpts {
112111
command: string;
113112
env?: { [key: string]: string };
114113
project_id: string;
115-
rundir: string; // a directory! (output_directory if in /tmp, or the directory of the file's path)
114+
runDir: string; // a directory! (output_directory if in /tmp, or the directory of the file's path)
116115
set_job_info: (info: ExecuteCodeOutputAsync) => void;
117116
timeout?: number;
118117
path: string;
@@ -125,7 +124,7 @@ export async function runJob(opts: RunJobOpts): Promise<ExecOutput> {
125124
command,
126125
env,
127126
project_id,
128-
rundir,
127+
runDir,
129128
set_job_info,
130129
path,
131130
} = opts;
@@ -140,7 +139,7 @@ export async function runJob(opts: RunJobOpts): Promise<ExecOutput> {
140139
command,
141140
env,
142141
err_on_exit: false,
143-
path: rundir,
142+
path: runDir,
144143
project_id,
145144
timeout: TIMEOUT_LATEX_JOB_S,
146145
};
@@ -177,12 +176,12 @@ export async function runJob(opts: RunJobOpts): Promise<ExecOutput> {
177176
set_job_info(output);
178177
return output;
179178
} catch (err) {
180-
if (err === TIMEOUT_CALLING_PROJECT) {
179+
if (IS_TIMEOUT_CALLING_PROJECT(err)) {
181180
// This will eventually be fine, hopefully. We continue trying to get a reply.
182181
await new Promise((done) => setTimeout(done, 100));
183182
} else {
184183
throw new Error(
185-
"Unable to complete compilation. Check the project and try again...",
184+
"Unable to run the compilation. Please check up on the project.",
186185
);
187186
}
188187
}

src/packages/frontend/frame-editors/terminal-editor/connected-terminal.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ const MAX_HISTORY_LENGTH = 100 * SCROLLBACK;
4848

4949
const MAX_DELAY = 10000;
5050

51-
const ENABLE_WEBGL = true;
51+
// See https://github.com/sagemathinc/cocalc/issues/8330
52+
const ENABLE_WEBGL = false;
5253

5354
interface Path {
5455
file?: string;

src/packages/frontend/frame-editors/terminal-editor/nats-terminal-connection.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,19 @@ export class NatsTerminalConnection extends EventEmitter {
154154
}
155155
};
156156

157-
close = () => {
157+
close = async () => {
158158
webapp_client.nats_client.removeListener("connected", this.clearWriteQueue);
159159
this.stream?.close();
160160
delete this.stream;
161161
this.service?.close();
162162
delete this.service;
163-
this.api.close(webapp_client.browser_id);
164163
this.setState("closed");
164+
try {
165+
await this.api.close(webapp_client.browser_id);
166+
} catch {
167+
// we did our best to quickly tell that we're closed, but if it times out or fails,
168+
// it is the responsibility of the project to stop worrying about this browser.
169+
}
165170
};
166171

167172
end = () => {

0 commit comments

Comments
 (0)