koishi-plugin-terminal 1.0.4 → 1.0.5

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/lib/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Context } from 'koishi';
2
2
  import * as pty from "node-pty";
3
3
  import { Config } from "./config";
4
+ export * from './config';
4
5
  export declare const name = "terminal";
5
6
  export interface ShellSession {
6
7
  terminal: pty.IPty;
package/lib/index.js CHANGED
@@ -30,11 +30,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
+ Config: () => Config,
33
34
  apply: () => apply,
34
35
  name: () => name
35
36
  });
36
37
  module.exports = __toCommonJS(src_exports);
37
- var import_koishi = require("koishi");
38
+ var import_koishi2 = require("koishi");
38
39
  var pty = __toESM(require("node-pty"));
39
40
  var import_node_timers = require("node:timers");
40
41
 
@@ -110,6 +111,19 @@ function isInteractiveCommand(command) {
110
111
  }
111
112
  __name(isInteractiveCommand, "isInteractiveCommand");
112
113
 
114
+ // src/config.ts
115
+ var import_koishi = require("koishi");
116
+ var Config = import_koishi.Schema.object({
117
+ admin: import_koishi.Schema.array(String).description("超级管理员用户名单").default([]),
118
+ auth: import_koishi.Schema.number().description("使用本插件所需的最低权限,此外,用户也需要在超级管理员名单中。").min(1).max(4).step(1).default(4),
119
+ root: import_koishi.Schema.string().description("初始工作路径").default(process.env.HOME),
120
+ shell: import_koishi.Schema.string().description("Shell路径,留空则自动检测系统默认Shell"),
121
+ timeout: import_koishi.Schema.number().description("超时时长").default(import_koishi.Time.minute),
122
+ cols: import_koishi.Schema.number().description("终端列数").default(80),
123
+ rows: import_koishi.Schema.number().description("终端行数").default(24),
124
+ maxOutputLength: import_koishi.Schema.number().description("单次发送最大输出长度").default(16384)
125
+ });
126
+
113
127
  // src/index.ts
114
128
  var name = "terminal";
115
129
  var map = /* @__PURE__ */ new Map();
@@ -160,7 +174,7 @@ function apply(ctx, config) {
160
174
  shellSession.buffer = "";
161
175
  if (!output) return;
162
176
  const text = output.length > config.maxOutputLength ? output.slice(0, config.maxOutputLength - 1) + "\n ...Truncated output" : output;
163
- await session.send(import_koishi.h.text(text));
177
+ await session.send(import_koishi2.h.text(text));
164
178
  }, "flush");
165
179
  const dataDisposable = terminal.onData((data) => {
166
180
  shellSession.buffer += data;
@@ -235,6 +249,7 @@ function apply(ctx, config) {
235
249
  __name(apply, "apply");
236
250
  // Annotate the CommonJS export names for ESM import in node:
237
251
  0 && (module.exports = {
252
+ Config,
238
253
  apply,
239
254
  name
240
255
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-terminal",
3
3
  "description": "通过 QQ 运行持久的 Shell 终端",
4
- "version": "1.0.4",
4
+ "version": "1.0.5",
5
5
  "main": "lib/index.js",
6
6
  "author": {
7
7
  "email": "ygong68@wisc.edu",