@runweave/server-linux-x64 0.1.9 → 0.1.11

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.
Files changed (89) hide show
  1. package/manifest.json +165 -163
  2. package/native.tar.gz +0 -0
  3. package/package.json +1 -1
  4. package/payload/app-server/build-info.json +4 -4
  5. package/payload/app-server/index.cjs +6 -2
  6. package/payload/app-server/index.cjs.map +1 -1
  7. package/payload/backend/activity-sqlite-worker.cjs +2 -0
  8. package/payload/backend/build-info.json +4 -4
  9. package/payload/backend/dev-resources/control.cjs +5 -1
  10. package/payload/backend/index.cjs +449 -308
  11. package/payload/backend/scheduled-tasks-sqlite-worker.cjs +2 -0
  12. package/payload/frontend/dist/assets/{_baseUniq-qHFga5V8.js → _baseUniq-VUz3u9LC.js} +1 -1
  13. package/payload/frontend/dist/assets/{access-DgHvmn15.js → access-DYX0dB6C.js} +1 -1
  14. package/payload/frontend/dist/assets/{advanced-C1Fh14vw.js → advanced-CweRHp2W.js} +1 -1
  15. package/payload/frontend/dist/assets/{appearance-Bs7cSXqO.js → appearance-494KUegR.js} +1 -1
  16. package/payload/frontend/dist/assets/{arc-E3iYHQG_.js → arc-Z2kK66lq.js} +1 -1
  17. package/payload/frontend/dist/assets/{architectureDiagram-Q4EWVU46-DgpYpTb9.js → architectureDiagram-Q4EWVU46-qCVxxH3R.js} +1 -1
  18. package/payload/frontend/dist/assets/{blockDiagram-DXYQGD6D-CfFOEKZ7.js → blockDiagram-DXYQGD6D-BlIbAFEf.js} +1 -1
  19. package/payload/frontend/dist/assets/{c4Diagram-AHTNJAMY-BxlHBUj3.js → c4Diagram-AHTNJAMY-E3iDtEa4.js} +1 -1
  20. package/payload/frontend/dist/assets/channel-CoPKff4t.js +1 -0
  21. package/payload/frontend/dist/assets/{chunk-4BX2VUAB-xWocgDo8.js → chunk-4BX2VUAB-BMmYQfLj.js} +1 -1
  22. package/payload/frontend/dist/assets/{chunk-4TB4RGXK-Bl1cNICf.js → chunk-4TB4RGXK-CWBrRDbS.js} +1 -1
  23. package/payload/frontend/dist/assets/{chunk-55IACEB6-DVtE836u.js → chunk-55IACEB6-B-RyyBnf.js} +1 -1
  24. package/payload/frontend/dist/assets/{chunk-EDXVE4YY-Dbd3tDCr.js → chunk-EDXVE4YY-BKzU4TXS.js} +1 -1
  25. package/payload/frontend/dist/assets/{chunk-FMBD7UC4-MPJaTsyN.js → chunk-FMBD7UC4-n132OCI6.js} +1 -1
  26. package/payload/frontend/dist/assets/{chunk-OYMX7WX6-D3LuudlW.js → chunk-OYMX7WX6-4b-D8G11.js} +1 -1
  27. package/payload/frontend/dist/assets/{chunk-QZHKN3VN-Dn1aF6iQ.js → chunk-QZHKN3VN-C3zjki3z.js} +1 -1
  28. package/payload/frontend/dist/assets/{chunk-YZCP3GAM-jZYbHnCw.js → chunk-YZCP3GAM-Bi7S_JyD.js} +1 -1
  29. package/payload/frontend/dist/assets/classDiagram-6PBFFD2Q-FUK_Ald7.js +1 -0
  30. package/payload/frontend/dist/assets/classDiagram-v2-HSJHXN6E-FUK_Ald7.js +1 -0
  31. package/payload/frontend/dist/assets/clone-ByE4QDPq.js +1 -0
  32. package/payload/frontend/dist/assets/{connection-V2iI-6rM.js → connection-DtjjR8IP.js} +1 -1
  33. package/payload/frontend/dist/assets/{connections-G_Q7342g.js → connections-BytUAh1Z.js} +1 -1
  34. package/payload/frontend/dist/assets/{cose-bilkent-S5V4N54A-75FLD3RS.js → cose-bilkent-S5V4N54A-CDCFpAOm.js} +1 -1
  35. package/payload/frontend/dist/assets/{dagre-KV5264BT-DEm-DpJL.js → dagre-KV5264BT-DTQVpeTz.js} +1 -1
  36. package/payload/frontend/dist/assets/{desktop-g5JC-CQd.js → desktop-BuftJPyE.js} +1 -1
  37. package/payload/frontend/dist/assets/{diagram-5BDNPKRD-BV6P2UTy.js → diagram-5BDNPKRD-ShI36c2G.js} +1 -1
  38. package/payload/frontend/dist/assets/{diagram-G4DWMVQ6-DuCK-MM2.js → diagram-G4DWMVQ6-BPxdrMgU.js} +1 -1
  39. package/payload/frontend/dist/assets/{diagram-MMDJMWI5-D5_GlPgO.js → diagram-MMDJMWI5-iwh0ZT7T.js} +1 -1
  40. package/payload/frontend/dist/assets/{diagram-TYMM5635-QRbOYR1P.js → diagram-TYMM5635-CX2F4XD4.js} +1 -1
  41. package/payload/frontend/dist/assets/{erDiagram-SMLLAGMA-DefCheAw.js → erDiagram-SMLLAGMA-DwXz5Tds.js} +1 -1
  42. package/payload/frontend/dist/assets/{flowDiagram-DWJPFMVM-DVzyWIso.js → flowDiagram-DWJPFMVM-CVDi2XWl.js} +1 -1
  43. package/payload/frontend/dist/assets/{ganttDiagram-T4ZO3ILL-BJaClUEF.js → ganttDiagram-T4ZO3ILL-DLuDUXuQ.js} +1 -1
  44. package/payload/frontend/dist/assets/{gitGraphDiagram-UUTBAWPF-BLfbApNz.js → gitGraphDiagram-UUTBAWPF-DsqOAHKo.js} +1 -1
  45. package/payload/frontend/dist/assets/{graph-C-YqFh68.js → graph-6BysLM8d.js} +1 -1
  46. package/payload/frontend/dist/assets/{image-CZo_2Awc.js → image-dI1rk_wX.js} +1 -1
  47. package/payload/frontend/dist/assets/{index-6q2aeqkt.js → index-CNnzZKYi.js} +5 -5
  48. package/payload/frontend/dist/assets/{infoDiagram-42DDH7IO-BakVOutT.js → infoDiagram-42DDH7IO-ByaP-F4m.js} +1 -1
  49. package/payload/frontend/dist/assets/{ishikawaDiagram-UXIWVN3A-D_1Oa5Dc.js → ishikawaDiagram-UXIWVN3A-BbNJbxvT.js} +1 -1
  50. package/payload/frontend/dist/assets/{journeyDiagram-VCZTEJTY-Y8TVFv6B.js → journeyDiagram-VCZTEJTY-CrOVnF8b.js} +1 -1
  51. package/payload/frontend/dist/assets/{kanban-definition-6JOO6SKY-DxeNhTIB.js → kanban-definition-6JOO6SKY-B0uutGkA.js} +1 -1
  52. package/payload/frontend/dist/assets/{layout-5cMeOTAp.js → layout-BNJKrH1C.js} +1 -1
  53. package/payload/frontend/dist/assets/{linear-Bnc3ev5g.js → linear-CzieEpVo.js} +1 -1
  54. package/payload/frontend/dist/assets/{main-3TPtEl66.js → main-DPDWozNB.js} +143 -143
  55. package/payload/frontend/dist/assets/{min-BRXKkrS8.js → min-COzbZh0B.js} +1 -1
  56. package/payload/frontend/dist/assets/{mindmap-definition-QFDTVHPH-RYZO_BEr.js → mindmap-definition-QFDTVHPH-COtW2jp5.js} +1 -1
  57. package/payload/frontend/dist/assets/{monitoring-Fv7kZ4s6.js → monitoring-VTNGzAyv.js} +1 -1
  58. package/payload/frontend/dist/assets/{notifications-BzrYqyMH.js → notifications-D-GW-TTF.js} +1 -1
  59. package/payload/frontend/dist/assets/{pieDiagram-DEJITSTG-Bzw0dhjz.js → pieDiagram-DEJITSTG-EKQe1mDG.js} +1 -1
  60. package/payload/frontend/dist/assets/{quadrantDiagram-34T5L4WZ-CQJY_msa.js → quadrantDiagram-34T5L4WZ-UdkJN2GP.js} +1 -1
  61. package/payload/frontend/dist/assets/{record-content-B7-6olQt.js → record-content-BMMqgX4o.js} +1 -1
  62. package/payload/frontend/dist/assets/{requirementDiagram-MS252O5E-DuP8hAV8.js → requirementDiagram-MS252O5E-DUp6aMLi.js} +1 -1
  63. package/payload/frontend/dist/assets/{sankeyDiagram-XADWPNL6-D-fQnCZZ.js → sankeyDiagram-XADWPNL6-BEHbyQqG.js} +1 -1
  64. package/payload/frontend/dist/assets/{sequenceDiagram-FGHM5R23-DaZNEccV.js → sequenceDiagram-FGHM5R23-DOidQGue.js} +1 -1
  65. package/payload/frontend/dist/assets/{stateDiagram-FHFEXIEX-CkOLt5R1.js → stateDiagram-FHFEXIEX-D19ZNvzk.js} +1 -1
  66. package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-BHG_Lyc2.js +1 -0
  67. package/payload/frontend/dist/assets/{status-CIIPajZp.js → status-DgyGUiXv.js} +1 -1
  68. package/payload/frontend/dist/assets/suiji-C9TumXnC.js +1 -0
  69. package/payload/frontend/dist/assets/{svg-BUqAWGtg.js → svg-DaiBcNRS.js} +1 -1
  70. package/payload/frontend/dist/assets/{tabs-Cwlp1Meu.js → tabs-DPvaaQlw.js} +1 -1
  71. package/payload/frontend/dist/assets/{timeline-definition-GMOUNBTQ-BOKDMwHS.js → timeline-definition-GMOUNBTQ-DyZYnin1.js} +1 -1
  72. package/payload/frontend/dist/assets/{vennDiagram-DHZGUBPP-fSZjDS41.js → vennDiagram-DHZGUBPP-CvLT97Cb.js} +1 -1
  73. package/payload/frontend/dist/assets/{wardley-RL74JXVD-D1KIsvoD.js → wardley-RL74JXVD-Bi_yW1_U.js} +1 -1
  74. package/payload/frontend/dist/assets/{wardleyDiagram-NUSXRM2D-FMe67dwE.js → wardleyDiagram-NUSXRM2D-Bg55_fJ7.js} +1 -1
  75. package/payload/frontend/dist/assets/{xychartDiagram-5P7HB3ND-B9AM9_9w.js → xychartDiagram-5P7HB3ND-CgI-KDMY.js} +1 -1
  76. package/payload/frontend/dist/build-info.json +4 -4
  77. package/payload/frontend/dist/companion.html +1 -1
  78. package/payload/frontend/dist/index.html +2 -2
  79. package/payload/plugins/toolkit/.codex-plugin/plugin.json +1 -1
  80. package/payload/plugins/toolkit/skills/publish-runweave-server/SKILL.md +11 -4
  81. package/payload/plugins/toolkit-release.json +1 -1
  82. package/payload/pty-host/index.cjs +123 -43
  83. package/payload/server/index.cjs +5 -1
  84. package/payload/frontend/dist/assets/channel-amxyNKnk.js +0 -1
  85. package/payload/frontend/dist/assets/classDiagram-6PBFFD2Q-B8cTijjT.js +0 -1
  86. package/payload/frontend/dist/assets/classDiagram-v2-HSJHXN6E-B8cTijjT.js +0 -1
  87. package/payload/frontend/dist/assets/clone-xzI2eGRI.js +0 -1
  88. package/payload/frontend/dist/assets/stateDiagram-v2-QKLJ7IA2-atg1K4nB.js +0 -1
  89. package/payload/frontend/dist/assets/suiji-C453W-Sg.js +0 -1
@@ -14763,6 +14763,8 @@ var CONFIGURATION_FIELDS = [
14763
14763
  { "path": "agents.companion.binary", "type": "string", "domain": "agents.companion", "sensitive": false, "remote": false, "apply": "restart", "description": "\u4F34\u968F\u7A97\u53E3 Agent \u53EF\u6267\u884C\u6587\u4EF6", "environmentKeys": ["RUNWEAVE_COMPANION_AGENT_EXECUTABLE"], "owner": "electron/companion", "scope": "instance", "storage": "settings.yaml", "default": { "rule": "\u4F7F\u7528\u5DF2\u5B89\u88C5 Codex App \u81EA\u5E26\u6267\u884C\u5165\u53E3\uFF1B\u663E\u5F0F\u503C\u5FC5\u987B\u53EF\u6267\u884C\u3002" }, "migrationSources": ["RUNWEAVE_COMPANION_AGENT_EXECUTABLE"] },
14764
14764
  { "path": "agents.codex.sessionsDirectory", "type": "string", "domain": "agents.codex", "sensitive": false, "remote": false, "apply": "restart", "description": "\u5916\u90E8 Codex \u4F1A\u8BDD\u76EE\u5F55\u5F15\u7528", "environmentKeys": ["RUNWEAVE_CODEX_SESSIONS_DIR"], "owner": "backend+app-server", "scope": "instance", "storage": "settings.yaml", "default": { "rule": "\u5916\u90E8\u5DE5\u5177\u62E5\u6709\u7684 CODEX_HOME/sessions \u6216\u64CD\u4F5C\u7CFB\u7EDF\u7528\u6237\u76EE\u5F55\u4E0B .codex/sessions\uFF0C\u4EC5\u5F15\u7528\u3002" }, "migrationSources": ["RUNWEAVE_CODEX_SESSIONS_DIR"] },
14765
14765
  { "path": "agents.traex.sessionsDirectory", "type": "string", "domain": "agents.traex", "sensitive": false, "remote": false, "apply": "restart", "description": "\u5916\u90E8 Trae \u4F1A\u8BDD\u76EE\u5F55\u5F15\u7528", "environmentKeys": ["RUNWEAVE_TRAE_SESSIONS_DIR"], "owner": "backend+app-server", "scope": "instance", "storage": "settings.yaml", "default": { "rule": "\u64CD\u4F5C\u7CFB\u7EDF\u7528\u6237\u76EE\u5F55\u4E0B .trae/cli/sessions\uFF0C\u4EC5\u5F15\u7528\u3002" }, "migrationSources": ["RUNWEAVE_TRAE_SESSIONS_DIR"] },
14766
+ { "path": "terminal.defaultShell.command", "type": "string", "domain": "terminal.defaultShell", "sensitive": false, "remote": false, "apply": "reload", "description": "\u5F53\u524D\u7535\u8111\u65B0\u7EC8\u7AEF\u7684\u9ED8\u8BA4\u53EF\u6267\u884C\u6587\u4EF6\uFF1B\u7F3A\u7701\u4F7F\u7528\u7CFB\u7EDF Shell\uFF0C\u542F\u52A8\u4E0D\u53EF\u7528\u65F6\u56DE\u9000\u7CFB\u7EDF\u9ED8\u8BA4", "environmentKeys": [], "owner": "backend/terminal", "scope": "instance", "storage": "settings.yaml", "default": { "rule": "\u7CFB\u7EDF\u8D26\u6237\u767B\u5F55 Shell\uFF1BWindows \u4F7F\u7528 ComSpec\uFF1B\u4E0D\u53EF\u7528\u65F6\u91C7\u7528\u5E73\u53F0\u515C\u5E95" }, "migrationSources": ["new-field:no-legacy-source"] },
14767
+ { "path": "terminal.defaultShell.args", "type": "array<string>", "domain": "terminal.defaultShell", "sensitive": false, "remote": false, "apply": "reload", "description": "\u9ED8\u8BA4 Shell \u7684\u542F\u52A8\u53C2\u6570\uFF1B\u7A7A\u6570\u7EC4\u660E\u786E\u4E0D\u52A0\u53C2\u6570\uFF0C\u7F3A\u7701\u4FDD\u7559 bash/zsh \u7684 -l \u884C\u4E3A", "environmentKeys": [], "owner": "backend/terminal", "scope": "instance", "storage": "settings.yaml", "default": { "rule": "\u6839\u636E\u6240\u9009\u7A0B\u5E8F\u89E3\u6790\uFF1Bbash/zsh \u4E3A [-l]\uFF0C\u5176\u4ED6\u4E3A\u7A7A\u6570\u7EC4" }, "migrationSources": ["new-field:no-legacy-source"] },
14766
14768
  { "path": "terminal.tmux.enabled", "type": "boolean", "domain": "terminal", "sensitive": false, "remote": false, "apply": "restart", "description": "tmux \u6301\u4E45\u7EC8\u7AEF\u5F00\u5173", "environmentKeys": ["TERMINAL_TMUX_ENABLED"], "owner": "backend/terminal", "scope": "instance", "storage": "settings.yaml", "default": { "value": true }, "migrationSources": ["TERMINAL_TMUX_ENABLED"] },
14767
14769
  { "path": "terminal.tmux.binary", "type": "string", "domain": "terminal", "sensitive": false, "remote": false, "apply": "restart", "description": "tmux \u53EF\u6267\u884C\u6587\u4EF6", "environmentKeys": ["TMUX_BINARY"], "owner": "backend/terminal", "scope": "instance", "storage": "settings.yaml", "default": { "value": "tmux" }, "migrationSources": ["TMUX_BINARY"] },
14768
14770
  { "path": "terminal.tmux.shutdownPolicy", "type": "string", "domain": "terminal", "sensitive": false, "remote": false, "apply": "restart", "description": "\u9000\u51FA\u65F6 tmux \u4FDD\u7559\u7B56\u7565", "environmentKeys": ["TERMINAL_TMUX_SHUTDOWN_POLICY"], "owner": "backend/terminal", "scope": "instance", "storage": "settings.yaml", "default": { "rule": "Stable \u4E3A preserve\uFF0CDev \u4E3A cleanup\u3002" }, "migrationSources": ["TERMINAL_TMUX_SHUTDOWN_POLICY"] },
@@ -19237,12 +19239,28 @@ var import_node_crypto6 = require("node:crypto");
19237
19239
  var import_node_module = require("node:module");
19238
19240
  var import_node_url = require("node:url");
19239
19241
 
19242
+ // packages/shared/src/terminal/shell.ts
19243
+ function terminalShellName(command) {
19244
+ return (command.split(/[\\/]/).at(-1) ?? command).toLowerCase().replace(/\.exe$/, "");
19245
+ }
19246
+ function isInteractiveShellLaunch(launch2) {
19247
+ const name = terminalShellName(launch2.command);
19248
+ if (!["sh", "bash", "zsh", "dash", "ksh", "fish", "powershell", "pwsh", "cmd"].includes(name)) return false;
19249
+ return !(launch2.args ?? []).some((arg) => {
19250
+ const value = arg.toLowerCase();
19251
+ if (name === "cmd") return !/^\/(?:d|q|a|u|e:(?:on|off)|f:(?:on|off)|v:(?:on|off))$/.test(value);
19252
+ if (name === "powershell" || name === "pwsh") return !["-nologo", "-noprofile", "-noexit", "-login", "-l"].includes(value);
19253
+ return ["--help", "--version"].includes(value) || !value.startsWith("-") || value === "--" || /^-[^-]*[cs]/.test(value) || /^--(?:command|init-command)(?:=|$)/.test(value);
19254
+ });
19255
+ }
19256
+
19240
19257
  // packages/pty-host/src/input-operations.ts
19241
19258
  var import_node_crypto4 = require("node:crypto");
19242
19259
  var InputOperations = class {
19243
- constructor(write, isRunning) {
19260
+ constructor(write, isRunning, generation = () => 0) {
19244
19261
  this.write = write;
19245
19262
  this.isRunning = isRunning;
19263
+ this.generation = generation;
19246
19264
  }
19247
19265
  operations = /* @__PURE__ */ new Map();
19248
19266
  sequences = /* @__PURE__ */ new Map();
@@ -19297,13 +19315,16 @@ var InputOperations = class {
19297
19315
  };
19298
19316
  this.operations.set(input.operationId, operation);
19299
19317
  this.sequences.set(input.sequence, input.operationId);
19318
+ const acceptedGeneration = this.generation();
19300
19319
  operation.done = this.tail.then(async () => {
19301
19320
  try {
19302
19321
  for (const step of input.steps) {
19322
+ if (acceptedGeneration !== this.generation()) throw new Error("HOST_PROCESS_CHANGED");
19303
19323
  if (!this.isRunning()) throw new Error("HOST_SESSION_GONE");
19304
19324
  if (step.type === "text") this.write(step.data);
19305
19325
  else await new Promise((resolve) => setTimeout(resolve, step.ms));
19306
19326
  }
19327
+ if (acceptedGeneration !== this.generation()) throw new Error("HOST_PROCESS_CHANGED");
19307
19328
  operation.result.state = "written";
19308
19329
  } catch (error) {
19309
19330
  operation.result.state = "failed";
@@ -19523,10 +19544,10 @@ function serializeHyperlinks(terminal, buffer, state) {
19523
19544
  }
19524
19545
  return result ? "\x1B7\x1B[?7l" + result + "\x1B[?7h\x1B8" : "";
19525
19546
  }
19526
- function serializeOutputScreen(terminal, addon) {
19547
+ function serializeOutputScreen(terminal, addon, scrollback = 0) {
19527
19548
  const state = core(terminal);
19528
19549
  const buffer = state._bufferService.buffer;
19529
- let result = addon.serialize({ scrollback: 0, excludeModes: true });
19550
+ let result = addon.serialize({ scrollback, excludeModes: true });
19530
19551
  const normalLinks = serializeHyperlinks(
19531
19552
  terminal,
19532
19553
  terminal.buffer.normal,
@@ -19534,7 +19555,7 @@ function serializeOutputScreen(terminal, addon) {
19534
19555
  );
19535
19556
  if (terminal.buffer.active.type === "alternate") {
19536
19557
  const normal = addon.serialize({
19537
- scrollback: 0,
19558
+ scrollback,
19538
19559
  excludeModes: true,
19539
19560
  excludeAltBuffer: true
19540
19561
  });
@@ -19599,20 +19620,21 @@ function serializeOutputScreen(terminal, addon) {
19599
19620
 
19600
19621
  // packages/pty-host/src/output-screen.ts
19601
19622
  var TerminalOutputScreen = class _TerminalOutputScreen {
19602
- constructor(cursor, onFailure) {
19623
+ constructor(cursor, onFailure, scrollback = 0) {
19603
19624
  this.onFailure = onFailure;
19604
19625
  this.cursor = cursor;
19626
+ this.terminal = new import_headless.default.Terminal({
19627
+ cols: 80,
19628
+ rows: 24,
19629
+ scrollback,
19630
+ allowProposedApi: true
19631
+ });
19605
19632
  this.terminal.loadAddon(this.serializer);
19606
19633
  this.terminal.loadAddon(new import_addon_unicode11.default.Unicode11Addon());
19607
19634
  this.terminal.unicode.activeVersion = "11";
19608
19635
  }
19609
19636
  static pendingSnapshots = 0;
19610
- terminal = new import_headless.default.Terminal({
19611
- cols: 80,
19612
- rows: 24,
19613
- scrollback: 0,
19614
- allowProposedApi: true
19615
- });
19637
+ terminal;
19616
19638
  serializer = new import_addon_serialize.default.SerializeAddon();
19617
19639
  queue = [];
19618
19640
  pendingBytes = 0;
@@ -19667,7 +19689,12 @@ var TerminalOutputScreen = class _TerminalOutputScreen {
19667
19689
  return;
19668
19690
  }
19669
19691
  try {
19670
- const data = serializeOutputScreen(this.terminal, this.serializer);
19692
+ let scrollback = this.terminal.buffer.normal.baseY;
19693
+ let data = serializeOutputScreen(this.terminal, this.serializer, scrollback);
19694
+ while (Buffer.byteLength(data, "utf8") > RESUME_MAX_BYTES && scrollback > 0) {
19695
+ scrollback = Math.floor(scrollback / 2);
19696
+ data = serializeOutputScreen(this.terminal, this.serializer, scrollback);
19697
+ }
19671
19698
  if (Buffer.byteLength(data, "utf8") > RESUME_MAX_BYTES)
19672
19699
  throw new Error("Terminal snapshot exceeds 512 KiB");
19673
19700
  resolve({
@@ -19741,20 +19768,18 @@ var TerminalOutputScreen = class _TerminalOutputScreen {
19741
19768
  }
19742
19769
  };
19743
19770
 
19771
+ // packages/shared/src/terminal/limits.ts
19772
+ var TERMINAL_CLIENT_SCROLLBACK_LINES = 5e3;
19773
+ var TERMINAL_LIVE_SCROLLBACK_BYTES = 512 * 1024;
19774
+ var TERMINAL_COMPACTED_SCROLLBACK_BYTES = 8 * 1024 * 1024;
19775
+ var TERMINAL_PERSISTED_SCROLLBACK_BYTES = 10 * 1024 * 1024;
19776
+
19744
19777
  // packages/pty-host/src/sessions.ts
19745
19778
  var requireNative = (0, import_node_module.createRequire)((0, import_node_url.fileURLToPath)(__IMPORT_META_URL__));
19746
19779
  var HostSession = class {
19747
- info;
19748
- buffer = new TerminalOutputRecoveryBuffer();
19749
- screen;
19750
- inputs;
19751
- createDigest;
19752
- outputListeners = /* @__PURE__ */ new Set();
19753
- exitListeners = /* @__PURE__ */ new Set();
19754
- resizeListeners = /* @__PURE__ */ new Set();
19755
- degraded = false;
19756
- terminal;
19757
19780
  constructor(hostInstanceId, options, prepareEnv) {
19781
+ this.options = options;
19782
+ this.prepareEnv = prepareEnv;
19758
19783
  this.createDigest = (0, import_node_crypto6.createHash)("sha256").update(JSON.stringify(options)).digest("hex");
19759
19784
  this.info = {
19760
19785
  hostInstanceId,
@@ -19770,30 +19795,77 @@ var HostSession = class {
19770
19795
  };
19771
19796
  this.screen = new TerminalOutputScreen(this.buffer.cursor, () => {
19772
19797
  this.degraded = true;
19773
- });
19798
+ }, TERMINAL_CLIENT_SCROLLBACK_LINES);
19774
19799
  this.screen.resize(options.cols, options.rows);
19775
- const pty = requireNative("node-pty");
19800
+ this.inputs = new InputOperations((data) => this.terminal.write(data), () => this.info.status === "running", () => this.processGeneration);
19776
19801
  try {
19777
- this.terminal = pty.spawn(options.command, options.args, {
19778
- name: "xterm-256color",
19779
- cols: options.cols,
19780
- rows: options.rows,
19781
- cwd: options.cwd,
19782
- env: { ...options.env, ...prepareEnv(this.info.gatewayToken, this.info.terminalSessionId) }
19783
- });
19802
+ this.spawn(options);
19784
19803
  } catch (error) {
19785
- this.screen.dispose();
19786
- throw error;
19787
- }
19788
- this.inputs = new InputOperations((data) => this.terminal.write(data), () => this.info.status === "running");
19789
- this.terminal.onData((data) => {
19790
- this.info.pid = this.terminal.pid;
19791
- for (const frame of this.buffer.append(data)) {
19792
- if (!this.degraded) this.screen.append(frame);
19793
- for (const listener of this.outputListeners) listener(frame);
19804
+ try {
19805
+ if (!this.activateFallback(String(error))) throw error;
19806
+ } catch (fallbackError) {
19807
+ this.screen.dispose();
19808
+ throw fallbackError;
19794
19809
  }
19810
+ }
19811
+ }
19812
+ info;
19813
+ buffer = new TerminalOutputRecoveryBuffer();
19814
+ screen;
19815
+ inputs;
19816
+ createDigest;
19817
+ outputListeners = /* @__PURE__ */ new Set();
19818
+ exitListeners = /* @__PURE__ */ new Set();
19819
+ resizeListeners = /* @__PURE__ */ new Set();
19820
+ launchListeners = /* @__PURE__ */ new Set();
19821
+ degraded = false;
19822
+ terminal;
19823
+ fallbackActivated = false;
19824
+ closing = false;
19825
+ processGeneration = 0;
19826
+ startupDeadline = 0;
19827
+ emitOutput(data) {
19828
+ for (const frame of this.buffer.append(data)) {
19829
+ if (!this.degraded) this.screen.append(frame);
19830
+ for (const listener of this.outputListeners) listener(frame);
19831
+ }
19832
+ }
19833
+ activateFallback(reason) {
19834
+ if (!this.options.fallback || this.fallbackActivated || this.closing || !isInteractiveShellLaunch(this.options)) return false;
19835
+ this.fallbackActivated = true;
19836
+ this.emitOutput("[Runweave: shell failed to start; using system default: " + this.options.fallback.command + "]\r\n");
19837
+ this.spawn(this.options.fallback, reason);
19838
+ return true;
19839
+ }
19840
+ spawn(launch2, fallbackReason) {
19841
+ const pty = requireNative("node-pty");
19842
+ const started = Date.now();
19843
+ const terminal = pty.spawn(launch2.command, launch2.args, {
19844
+ name: "xterm-256color",
19845
+ cols: this.info.cols,
19846
+ rows: this.info.rows,
19847
+ cwd: this.options.cwd,
19848
+ env: { ...launch2.env, ...this.prepareEnv(this.info.gatewayToken, this.info.terminalSessionId) }
19795
19849
  });
19796
- this.terminal.onExit((event) => {
19850
+ this.startupDeadline = this.options.fallback && isInteractiveShellLaunch(this.options) ? Date.now() + 1e3 : 0;
19851
+ this.processGeneration++;
19852
+ this.terminal = terminal;
19853
+ this.info.pid = terminal.pid;
19854
+ this.info.launch = { command: launch2.command, args: [...launch2.args], ...fallbackReason ? { fallbackReason } : {} };
19855
+ for (const listener of this.launchListeners) listener(this.info.launch);
19856
+ terminal.onData((data) => {
19857
+ if (this.terminal === terminal) this.emitOutput(data);
19858
+ });
19859
+ terminal.onExit((event) => {
19860
+ if (this.terminal !== terminal) return;
19861
+ if (event.exitCode > 0 && Date.now() - started < 1e3) {
19862
+ try {
19863
+ if (this.activateFallback(`Shell exited with code ${event.exitCode}`)) return;
19864
+ } catch (error) {
19865
+ this.emitOutput(`[Runweave: system shell failed to start: ${String(error)}]\r
19866
+ `);
19867
+ }
19868
+ }
19797
19869
  this.info.status = "exited";
19798
19870
  this.info.exitCode = event.exitCode;
19799
19871
  for (const listener of this.exitListeners) listener(event.exitCode);
@@ -19801,7 +19873,7 @@ var HostSession = class {
19801
19873
  }
19802
19874
  async ready() {
19803
19875
  const deadline = Date.now() + 1e4;
19804
- while (this.terminal.pid < 1 && this.info.status === "running" && Date.now() < deadline)
19876
+ while ((this.terminal.pid < 1 || Date.now() < this.startupDeadline) && this.info.status === "running" && Date.now() < deadline)
19805
19877
  await new Promise((resolve) => setTimeout(resolve, 20));
19806
19878
  this.info.pid = this.terminal.pid;
19807
19879
  if (this.info.pid < 1) {
@@ -19828,6 +19900,7 @@ var HostSession = class {
19828
19900
  }
19829
19901
  signal(signal) {
19830
19902
  if (!["SIGINT", "SIGTERM", "SIGKILL"].includes(signal)) throw new Error("HOST_SIGNAL_INVALID");
19903
+ this.closing = true;
19831
19904
  if (process.platform === "win32") {
19832
19905
  if (signal === "SIGINT") this.terminal.write("");
19833
19906
  else this.close();
@@ -19835,6 +19908,7 @@ var HostSession = class {
19835
19908
  }
19836
19909
  close() {
19837
19910
  if (this.info.status !== "running") return;
19911
+ this.closing = true;
19838
19912
  this.terminal.kill();
19839
19913
  }
19840
19914
  snapshot() {
@@ -19891,7 +19965,8 @@ var createSchema = external_exports.object({
19891
19965
  cwd: external_exports.string().min(1),
19892
19966
  cols: external_exports.number().int().min(2).max(500),
19893
19967
  rows: external_exports.number().int().min(1).max(200),
19894
- env: external_exports.record(external_exports.string().optional())
19968
+ env: external_exports.record(external_exports.string().optional()),
19969
+ fallback: external_exports.object({ command: external_exports.string().min(1).max(32768), args: external_exports.array(external_exports.string()).max(256), env: external_exports.record(external_exports.string().optional()) }).optional()
19895
19970
  });
19896
19971
  var wireSchema = external_exports.object({ requestId: external_exports.string().uuid(), token: external_exports.string(), hostInstanceId: external_exports.string().uuid(), action: external_exports.string(), body: external_exports.unknown() });
19897
19972
  async function startHost(scope, release) {
@@ -20061,10 +20136,15 @@ async function startHost(scope, release) {
20061
20136
  const resized = (cols, rows) => {
20062
20137
  if (ready) sendJson(socket, { type: "resize", terminalSessionId: session.info.terminalSessionId, cols, rows, cursor: session.buffer.cursor });
20063
20138
  };
20139
+ const launched = (launch2) => {
20140
+ if (ready) sendJson(socket, { type: "launch", terminalSessionId: session.info.terminalSessionId, launch: launch2 });
20141
+ };
20142
+ session.launchListeners.add(launched);
20064
20143
  session.outputListeners.add(output);
20065
20144
  session.exitListeners.add(exited);
20066
20145
  session.resizeListeners.add(resized);
20067
20146
  subscriptions.set(session.info.terminalSessionId, () => {
20147
+ session.launchListeners.delete(launched);
20068
20148
  session.outputListeners.delete(output);
20069
20149
  session.exitListeners.delete(exited);
20070
20150
  session.resizeListeners.delete(resized);
@@ -7636,6 +7636,8 @@ var CONFIGURATION_FIELDS = [
7636
7636
  { "path": "agents.companion.binary", "type": "string", "domain": "agents.companion", "sensitive": false, "remote": false, "apply": "restart", "description": "\u4F34\u968F\u7A97\u53E3 Agent \u53EF\u6267\u884C\u6587\u4EF6", "environmentKeys": ["RUNWEAVE_COMPANION_AGENT_EXECUTABLE"], "owner": "electron/companion", "scope": "instance", "storage": "settings.yaml", "default": { "rule": "\u4F7F\u7528\u5DF2\u5B89\u88C5 Codex App \u81EA\u5E26\u6267\u884C\u5165\u53E3\uFF1B\u663E\u5F0F\u503C\u5FC5\u987B\u53EF\u6267\u884C\u3002" }, "migrationSources": ["RUNWEAVE_COMPANION_AGENT_EXECUTABLE"] },
7637
7637
  { "path": "agents.codex.sessionsDirectory", "type": "string", "domain": "agents.codex", "sensitive": false, "remote": false, "apply": "restart", "description": "\u5916\u90E8 Codex \u4F1A\u8BDD\u76EE\u5F55\u5F15\u7528", "environmentKeys": ["RUNWEAVE_CODEX_SESSIONS_DIR"], "owner": "backend+app-server", "scope": "instance", "storage": "settings.yaml", "default": { "rule": "\u5916\u90E8\u5DE5\u5177\u62E5\u6709\u7684 CODEX_HOME/sessions \u6216\u64CD\u4F5C\u7CFB\u7EDF\u7528\u6237\u76EE\u5F55\u4E0B .codex/sessions\uFF0C\u4EC5\u5F15\u7528\u3002" }, "migrationSources": ["RUNWEAVE_CODEX_SESSIONS_DIR"] },
7638
7638
  { "path": "agents.traex.sessionsDirectory", "type": "string", "domain": "agents.traex", "sensitive": false, "remote": false, "apply": "restart", "description": "\u5916\u90E8 Trae \u4F1A\u8BDD\u76EE\u5F55\u5F15\u7528", "environmentKeys": ["RUNWEAVE_TRAE_SESSIONS_DIR"], "owner": "backend+app-server", "scope": "instance", "storage": "settings.yaml", "default": { "rule": "\u64CD\u4F5C\u7CFB\u7EDF\u7528\u6237\u76EE\u5F55\u4E0B .trae/cli/sessions\uFF0C\u4EC5\u5F15\u7528\u3002" }, "migrationSources": ["RUNWEAVE_TRAE_SESSIONS_DIR"] },
7639
+ { "path": "terminal.defaultShell.command", "type": "string", "domain": "terminal.defaultShell", "sensitive": false, "remote": false, "apply": "reload", "description": "\u5F53\u524D\u7535\u8111\u65B0\u7EC8\u7AEF\u7684\u9ED8\u8BA4\u53EF\u6267\u884C\u6587\u4EF6\uFF1B\u7F3A\u7701\u4F7F\u7528\u7CFB\u7EDF Shell\uFF0C\u542F\u52A8\u4E0D\u53EF\u7528\u65F6\u56DE\u9000\u7CFB\u7EDF\u9ED8\u8BA4", "environmentKeys": [], "owner": "backend/terminal", "scope": "instance", "storage": "settings.yaml", "default": { "rule": "\u7CFB\u7EDF\u8D26\u6237\u767B\u5F55 Shell\uFF1BWindows \u4F7F\u7528 ComSpec\uFF1B\u4E0D\u53EF\u7528\u65F6\u91C7\u7528\u5E73\u53F0\u515C\u5E95" }, "migrationSources": ["new-field:no-legacy-source"] },
7640
+ { "path": "terminal.defaultShell.args", "type": "array<string>", "domain": "terminal.defaultShell", "sensitive": false, "remote": false, "apply": "reload", "description": "\u9ED8\u8BA4 Shell \u7684\u542F\u52A8\u53C2\u6570\uFF1B\u7A7A\u6570\u7EC4\u660E\u786E\u4E0D\u52A0\u53C2\u6570\uFF0C\u7F3A\u7701\u4FDD\u7559 bash/zsh \u7684 -l \u884C\u4E3A", "environmentKeys": [], "owner": "backend/terminal", "scope": "instance", "storage": "settings.yaml", "default": { "rule": "\u6839\u636E\u6240\u9009\u7A0B\u5E8F\u89E3\u6790\uFF1Bbash/zsh \u4E3A [-l]\uFF0C\u5176\u4ED6\u4E3A\u7A7A\u6570\u7EC4" }, "migrationSources": ["new-field:no-legacy-source"] },
7639
7641
  { "path": "terminal.tmux.enabled", "type": "boolean", "domain": "terminal", "sensitive": false, "remote": false, "apply": "restart", "description": "tmux \u6301\u4E45\u7EC8\u7AEF\u5F00\u5173", "environmentKeys": ["TERMINAL_TMUX_ENABLED"], "owner": "backend/terminal", "scope": "instance", "storage": "settings.yaml", "default": { "value": true }, "migrationSources": ["TERMINAL_TMUX_ENABLED"] },
7640
7642
  { "path": "terminal.tmux.binary", "type": "string", "domain": "terminal", "sensitive": false, "remote": false, "apply": "restart", "description": "tmux \u53EF\u6267\u884C\u6587\u4EF6", "environmentKeys": ["TMUX_BINARY"], "owner": "backend/terminal", "scope": "instance", "storage": "settings.yaml", "default": { "value": "tmux" }, "migrationSources": ["TMUX_BINARY"] },
7641
7643
  { "path": "terminal.tmux.shutdownPolicy", "type": "string", "domain": "terminal", "sensitive": false, "remote": false, "apply": "restart", "description": "\u9000\u51FA\u65F6 tmux \u4FDD\u7559\u7B56\u7565", "environmentKeys": ["TERMINAL_TMUX_SHUTDOWN_POLICY"], "owner": "backend/terminal", "scope": "instance", "storage": "settings.yaml", "default": { "rule": "Stable \u4E3A preserve\uFF0CDev \u4E3A cleanup\u3002" }, "migrationSources": ["TERMINAL_TMUX_SHUTDOWN_POLICY"] },
@@ -7958,7 +7960,9 @@ function validateDomains(value, context) {
7958
7960
  issue(key, "CONFIG_FIELD_TYPE_INVALID");
7959
7961
  continue;
7960
7962
  }
7961
- if (key === "backend.taskSupervision.model" && typeof entry === "string" && !entry.trim()) issue(key, "CONFIG_FIELD_VALUE_INVALID");
7963
+ if (["backend.taskSupervision.model", "terminal.defaultShell.command"].includes(key) && typeof entry === "string" && !entry.trim()) issue(key, "CONFIG_FIELD_VALUE_INVALID");
7964
+ if (key === "terminal.defaultShell.command" && typeof entry === "string" && /[\\/]/.test(entry) && !import_node_path3.default.isAbsolute(entry.trim())) issue(key, "CONFIG_FIELD_VALUE_INVALID");
7965
+ if (key.startsWith("terminal.defaultShell.") && (typeof entry === "string" ? entry.includes("\0") : Array.isArray(entry) && entry.some((item) => typeof item === "string" && item.includes("\0")))) issue(key, "CONFIG_FIELD_VALUE_INVALID");
7962
7966
  if (CONFIGURATION_ENUMS[key] && !CONFIGURATION_ENUMS[key].includes(String(entry))) issue(key, "CONFIG_FIELD_ENUM_INVALID");
7963
7967
  if (configurationServiceOrigin(key) && typeof entry === "string") {
7964
7968
  try {
@@ -1 +0,0 @@
1
- import{U as a,M as n}from"./index-6q2aeqkt.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
@@ -1 +0,0 @@
1
- import{s as a,c as s,a as e,C as t}from"./chunk-4TB4RGXK-Bl1cNICf.js";import{_ as i}from"./index-6q2aeqkt.js";import"./chunk-FMBD7UC4-MPJaTsyN.js";import"./chunk-YZCP3GAM-jZYbHnCw.js";import"./chunk-55IACEB6-DVtE836u.js";import"./chunk-EDXVE4YY-Dbd3tDCr.js";import"./main-3TPtEl66.js";import"./index-D9-cSGu-.js";import"./record-content-B7-6olQt.js";var b={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{b as diagram};
@@ -1 +0,0 @@
1
- import{s as a,c as s,a as e,C as t}from"./chunk-4TB4RGXK-Bl1cNICf.js";import{_ as i}from"./index-6q2aeqkt.js";import"./chunk-FMBD7UC4-MPJaTsyN.js";import"./chunk-YZCP3GAM-jZYbHnCw.js";import"./chunk-55IACEB6-DVtE836u.js";import"./chunk-EDXVE4YY-Dbd3tDCr.js";import"./main-3TPtEl66.js";import"./index-D9-cSGu-.js";import"./record-content-B7-6olQt.js";var b={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{b as diagram};
@@ -1 +0,0 @@
1
- import{b as r}from"./graph-C-YqFh68.js";var e=4;function a(o){return r(o,e)}export{a as c};
@@ -1 +0,0 @@
1
- import{s as r,b as e,a,S as s}from"./chunk-OYMX7WX6-D3LuudlW.js";import{_ as i}from"./index-6q2aeqkt.js";import"./chunk-55IACEB6-DVtE836u.js";import"./chunk-EDXVE4YY-Dbd3tDCr.js";import"./index-D9-cSGu-.js";import"./main-3TPtEl66.js";import"./record-content-B7-6olQt.js";var n={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{n as diagram};
@@ -1 +0,0 @@
1
- import{j as t}from"./index-D9-cSGu-.js";import o from"./connection-V2iI-6rM.js";import"./main-3TPtEl66.js";import"./record-content-B7-6olQt.js";function n(){return t.jsx(o,{accountOnly:!0})}export{n as default};