@deepblend/dsh-blender-provider-local 0.2.12 → 0.2.13

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/lib/index.js +41 -6
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -591,6 +591,14 @@ export default class LocalBlenderRuntime extends Service {
591
591
  /** The kept Blender for `sessionActions`, and the timer that closes it when it goes quiet. */
592
592
  _session = null
593
593
  _sessionTimer = null
594
+ /**
595
+ * Which transport the kept session came from: `configured`, `discovered` or `spawned`.
596
+ *
597
+ * Recorded rather than inferred, because "is this deployment driving the user's Blender or one of
598
+ * its own" is the first question anybody asks of a Live Bridge that behaves unexpectedly — and the
599
+ * only place that knows is the branch that chose.
600
+ */
601
+ _sessionOrigin = null
594
602
 
595
603
  /**
596
604
  * @param {import('@deepseek-ai/cordis').Context} ctx
@@ -1021,12 +1029,39 @@ export default class LocalBlenderRuntime extends Service {
1021
1029
  */
1022
1030
  async _keptSession() {
1023
1031
  if (this._session !== null && !this._session.closed) return this._session
1024
- const socket = this.config.sessionSocket
1025
- // THE USER'S BLENDER, when they have named one. `attachSession` owns the refusal and its message;
1026
- // this only decides which of the two transports the configured actions travel over.
1027
- this._session = typeof socket === 'string' && socket.length > 0
1028
- ? await this.attachSession(socket)
1029
- : await this.openSession()
1032
+
1033
+ const configured = this.config.sessionSocket
1034
+ if (typeof configured === 'string' && configured.length > 0) {
1035
+ // NAMED BY THE OPERATOR, so it is used and a failure is theirs to see. `attachSession` owns the
1036
+ // refusal and its message; this only decides which transport the configured actions travel over.
1037
+ this._session = await this.attachSession(configured)
1038
+ this._sessionOrigin = 'configured'
1039
+ return this._session
1040
+ }
1041
+
1042
+ // DISCOVERY, WHICH IS NOT A GUESS. The convention says a bridge listens at
1043
+ // `<workspace>/.deepblend/bridge.sock`, and a deployment that opted into sessions should not have
1044
+ // to write that path down as well. A GUESS asserts and fails when it is wrong; this CHECKS and
1045
+ // falls back — something answering at the conventional path is used, and nothing answering means
1046
+ // exactly what happened before this existed. The wrong-blender check still applies to whatever is
1047
+ // found, so discovery cannot attach to another workspace's Blender.
1048
+ const conventional = join(this.workspaceRoot, '.deepblend', 'bridge.sock')
1049
+ if (existsSync(conventional)) {
1050
+ const found = await this.attachSession(conventional).then(
1051
+ session => session,
1052
+ () => null,
1053
+ )
1054
+ if (found !== null) {
1055
+ this._session = found
1056
+ this._sessionOrigin = 'discovered'
1057
+ return this._session
1058
+ }
1059
+ // A file that exists and does not answer is the state a crash leaves; the bridge replaces it
1060
+ // when it starts again, and until then this deployment spawns its own Blender as before.
1061
+ }
1062
+
1063
+ this._session = await this.openSession()
1064
+ this._sessionOrigin = 'spawned'
1030
1065
  return this._session
1031
1066
  }
1032
1067
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepblend/dsh-blender-provider-local",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "type": "module",
5
5
  "description": "Local Blender Provider: the BlenderRuntime Service over ctx.subprocess (batch execution).",
6
6
  "main": "lib/index.js",
@@ -11,7 +11,7 @@
11
11
  "./package.json": "./package.json"
12
12
  },
13
13
  "dependencies": {
14
- "@deepblend/dsh-blender-contracts": "0.2.12"
14
+ "@deepblend/dsh-blender-contracts": "0.2.13"
15
15
  },
16
16
  "license": "MIT",
17
17
  "repository": {