pinokiod 8.0.51 → 8.0.54

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/kernel/index.js CHANGED
@@ -148,6 +148,32 @@ class Kernel {
148
148
  this.launchRequirements.hasRuntimeForLaunchPath(launchPath)
149
149
  )
150
150
  }
151
+ notifyVaultAppLifecycle(method, launchPath) {
152
+ const automaticScans = this.vault && this.vault.automaticScans
153
+ if (!automaticScans || typeof automaticScans[method] !== "function") {
154
+ return
155
+ }
156
+ try {
157
+ const pending = automaticScans[method](launchPath)
158
+ if (pending && typeof pending.catch === "function") {
159
+ pending.catch((error) => {
160
+ console.warn("[Vault Automatic Scan] " + JSON.stringify({
161
+ time: new Date().toISOString(),
162
+ event: "lifecycle-error",
163
+ method,
164
+ message: error && error.message ? error.message : String(error)
165
+ }))
166
+ })
167
+ }
168
+ } catch (error) {
169
+ console.warn("[Vault Automatic Scan] " + JSON.stringify({
170
+ time: new Date().toISOString(),
171
+ event: "lifecycle-error",
172
+ method,
173
+ message: error && error.message ? error.message : String(error)
174
+ }))
175
+ }
176
+ }
151
177
  markAppLaunchStarted(launchPath) {
152
178
  const status = this.readyState.markStarted(launchPath)
153
179
  const appId = this.readyState.getAppIdForLaunchPath(launchPath)
@@ -157,6 +183,8 @@ class Kernel {
157
183
  }
158
184
  this.launchRequirements.markStarted(launchPath)
159
185
  }
186
+ Kernel.prototype.notifyVaultAppLifecycle.call(
187
+ this, "handleStarted", launchPath)
160
188
  return status
161
189
  }
162
190
  markAppLaunchProgress(launchPath, current, total) {
@@ -182,6 +210,8 @@ class Kernel {
182
210
  }
183
211
  markAppLaunchStopped(launchPath, options = {}) {
184
212
  const status = this.readyState.markStopped(launchPath)
213
+ Kernel.prototype.notifyVaultAppLifecycle.call(
214
+ this, "handleStopped", launchPath)
185
215
  if (options && options.internal_completion) {
186
216
  return status
187
217
  }
@@ -1217,21 +1247,12 @@ class Kernel {
1217
1247
  await this.git.loadCheckpoints()
1218
1248
  console.timeEnd("git.loadCheckpoints")
1219
1249
 
1220
- // Shared model store: registry verification only at startup never a
1221
- // discovery walk (spec/requirements/shared-model-store.md, trigger 5).
1250
+ // Shared model store: startup reads only the enable flag. Registry and
1251
+ // filesystem initialization are deferred until a Vault page or action
1252
+ // calls ensureInitialized().
1222
1253
  this.vault = new Vault(this)
1223
1254
  if (this.homedir) {
1224
- this.vault.ready = this.vault.init({ existingOnly: true }).then(async (result) => {
1225
- if (result && result.enabled && this.vault.initialized) {
1226
- this.vault.verificationPending = true
1227
- await this.vault.runExclusive(async () => {
1228
- await this.vault.verify()
1229
- await this.vault.registry.flush()
1230
- })
1231
- this.vault.verificationPending = false
1232
- }
1233
- return result
1234
- }).catch((err) => {
1255
+ this.vault.ready = this.vault.init({ deferStorage: true }).catch((err) => {
1235
1256
  // Keep an enabled Vault retryable after transient registry or
1236
1257
  // filesystem errors. A genuinely disabled Vault already has
1237
1258
  // enabled=false from its environment check.