@highstate/backend 0.5.4 → 0.6.0

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 (2) hide show
  1. package/dist/index.mjs +11 -5
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -1048,7 +1048,7 @@ class TerminalManager {
1048
1048
  };
1049
1049
  await this.stateBackend.putTerminalSession(projectId, instanceId, terminalSession);
1050
1050
  this.logger.info({ msg: "terminal session created", id: terminalSession.id });
1051
- await this.createManagedTerminal(projectId, instanceId, terminalSession);
1051
+ await this.createManagedTerminal(projectId, instanceId, terminalSession, true);
1052
1052
  return terminalSession;
1053
1053
  }
1054
1054
  async ensureSessionCreated(projectId, instanceId, terminalName) {
@@ -1062,7 +1062,7 @@ class TerminalManager {
1062
1062
  }
1063
1063
  if (!this.managedTerminals.has(session.id)) {
1064
1064
  this.logger.info({ msg: "no managed terminal found, creating new one", id: session.id });
1065
- await this.createManagedTerminal(projectId, instanceId, session);
1065
+ await this.createManagedTerminal(projectId, instanceId, session, false);
1066
1066
  }
1067
1067
  return session;
1068
1068
  }
@@ -1082,7 +1082,7 @@ class TerminalManager {
1082
1082
  if (!session) {
1083
1083
  throw new Error(`Terminal session "${sessionId}" not found`);
1084
1084
  }
1085
- terminal = await this.createManagedTerminal(projectId, instanceId, session);
1085
+ terminal = await this.createManagedTerminal(projectId, instanceId, session, false);
1086
1086
  terminal.history = await this.stateBackend.getTerminalSessionHistory(sessionId);
1087
1087
  }
1088
1088
  if (terminal.attached) {
@@ -1101,7 +1101,7 @@ class TerminalManager {
1101
1101
  this.logger.info({ msg: "terminal detached", id: sessionId });
1102
1102
  });
1103
1103
  }
1104
- async createManagedTerminal(projectId, instanceId, terminalSession) {
1104
+ async createManagedTerminal(projectId, instanceId, terminalSession, firstLaunch) {
1105
1105
  const [instanceType, instanceName] = parseInstanceId(instanceId);
1106
1106
  const factory = await this.runnerBackend.getTerminalFactory(
1107
1107
  { projectId, instanceType, instanceName },
@@ -1127,7 +1127,13 @@ class TerminalManager {
1127
1127
  });
1128
1128
  this.managedTerminals.set(managedTerminal.sessionId, managedTerminal);
1129
1129
  void this.terminalBackend.run({
1130
- factory,
1130
+ factory: {
1131
+ ...factory,
1132
+ env: {
1133
+ ...factory.env,
1134
+ HIGHSTATE_TERMINAL_FIRST_LAUNCH: firstLaunch ? "1" : "0"
1135
+ }
1136
+ },
1131
1137
  stdin: managedTerminal.stdin,
1132
1138
  stdout: managedTerminal.stdout,
1133
1139
  signal: managedTerminal.abortController.signal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highstate/backend",
3
- "version": "0.5.4",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -27,7 +27,7 @@
27
27
  "build": "pkgroll --tsconfig=tsconfig.build.json"
28
28
  },
29
29
  "dependencies": {
30
- "@highstate/contract": "^0.5.4",
30
+ "@highstate/contract": "^0.6.0",
31
31
  "@types/node": "^22.10.1",
32
32
  "ajv": "^8.17.1",
33
33
  "better-lock": "^3.2.0",
@@ -65,5 +65,5 @@
65
65
  "rollup": "^4.28.1",
66
66
  "typescript": "^5.7.2"
67
67
  },
68
- "gitHead": "d185cf2269127b4a82156121fc493dea9b7108c3"
68
+ "gitHead": "cf9b81699d833f7d795d1936f97f045709fc058b"
69
69
  }