@sourcegraph/cody-web 0.5.1 → 0.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sourcegraph/cody-web",
3
- "version": "0.5.1",
3
+ "version": "0.6.1",
4
4
  "description": "Cody standalone web app",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "main": "dist/index.js",
12
12
  "types": "dist/lib/index.d.ts",
13
- "sideEffects": false,
13
+ "sideEffects": true,
14
14
  "files": ["dist/*"],
15
15
  "scripts": {
16
16
  "dev": "vite --mode development",
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const agent_worker = require("./agent.worker-CHrb4rcq.js");
4
- const timeDate = require("./time-date-C7nUVQ0Y.js");
5
- var define_process_default = { env: {} };
6
- const _exec = agent_worker.util.promisify(agent_worker.exec);
7
- async function getContextFileFromShell(command) {
8
- return timeDate.wrapInActiveSpan("commands.context.command", async (span) => {
9
- var _a, _b, _c;
10
- const rootDir = agent_worker.os.homedir() || define_process_default.env.HOME || define_process_default.env.USERPROFILE || "";
11
- if (!agent_worker.env.shell) {
12
- void agent_worker.window.showErrorMessage("Shell command is not supported your current workspace.");
13
- return [];
14
- }
15
- const filteredCommand = command.replaceAll(/(\s~\/)/g, ` ${rootDir}${agent_worker.path.sep}`);
16
- const cwd = (_c = (_b = (_a = agent_worker.workspace.workspaceFolders) == null ? void 0 : _a[0]) == null ? void 0 : _b.uri) == null ? void 0 : _c.fsPath;
17
- try {
18
- const { stdout, stderr } = await _exec(filteredCommand, { cwd, encoding: "utf8" });
19
- const output = JSON.stringify(stdout ?? stderr).trim();
20
- if (!output) {
21
- throw new Error("Empty output");
22
- }
23
- const content = outputWrapper.replace("{command}", command).replace("{output}", output);
24
- const size = await timeDate.TokenCounterUtils.countTokens(content);
25
- return [
26
- {
27
- type: "file",
28
- content,
29
- title: "Terminal Output",
30
- uri: agent_worker.Uri.file(command),
31
- source: timeDate.ContextItemSource.Terminal,
32
- size
33
- }
34
- ];
35
- } catch (error) {
36
- agent_worker.logError("getContextFileFromShell", "failed", { verbose: error });
37
- void agent_worker.window.showErrorMessage(error.message);
38
- throw new Error("Failed to get shell output for Custom Command.");
39
- }
40
- });
41
- }
42
- const outputWrapper = `
43
- Terminal output from the \`{command}\` command enclosed between <OUTPUT0412> tags:
44
- <OUTPUT0412>
45
- {output}
46
- </OUTPUT0412>`;
47
- exports.getContextFileFromShell = getContextFileFromShell;