@ricsam/r5d-worker 0.0.119 → 0.0.120

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/dist/cjs/main.cjs CHANGED
@@ -5913,7 +5913,15 @@ async function startWorker(options, projectRuntime = {
5913
5913
  }
5914
5914
  if (message.type === "workspace_config") {
5915
5915
  const receiptGeneration = ++workspaceConfigurationReceiptGeneration;
5916
- const refreshesDeferredConfiguration = deferredWorkspaceConfiguration !== null && activeWorkspaceIncidentId === null && message.deferWorkspaceSyncForIncidentId === void 0;
5916
+ const refreshesDeferredConfiguration = (0, import_workspace_incident_state.workspaceConfigurationRefreshesDeferredConfiguration)({
5917
+ deferredIncidentId: deferredWorkspaceConfiguration?.incidentId ?? null,
5918
+ activeIncidentId: activeWorkspaceIncidentId,
5919
+ requestedDeferredIncidentId: message.deferWorkspaceSyncForIncidentId
5920
+ });
5921
+ if (refreshesDeferredConfiguration && deferredWorkspaceConfigurationRefreshTimer) {
5922
+ clearTimeout(deferredWorkspaceConfigurationRefreshTimer);
5923
+ deferredWorkspaceConfigurationRefreshTimer = void 0;
5924
+ }
5917
5925
  const digest = (0, import_recovery_store.workerOperationDigest)(message);
5918
5926
  const cached = projectRuntime.configuration;
5919
5927
  const canReuseConfiguration = cached?.digest === digest && cached.workspaceSync?.remoteUrl === message.workspaceRemoteUrl && Boolean(cached.workspaceSync.credentialHelper) && cached.workspaceSync.credentialUsername === workerCredentialUsername && cached.workspaceSync.gitIdentity?.name === message.gitIdentity.name && cached.workspaceSync.gitIdentity?.email === message.gitIdentity.email && !unsafeWorkspaceSyncBouncePending && credentialGenerationFingerprint({ ...message, workerBaseUrl: baseUrl, workerAuthHeader: bearerAuthHeader }) === configuredCredentialGenerationFingerprint;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.119",
3
+ "version": "0.0.120",
4
4
  "type": "commonjs"
5
5
  }
@@ -18,7 +18,8 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var workspace_incident_state_exports = {};
20
20
  __export(workspace_incident_state_exports, {
21
- applyWorkspaceIncidentUpdate: () => applyWorkspaceIncidentUpdate
21
+ applyWorkspaceIncidentUpdate: () => applyWorkspaceIncidentUpdate,
22
+ workspaceConfigurationRefreshesDeferredConfiguration: () => workspaceConfigurationRefreshesDeferredConfiguration
22
23
  });
23
24
  module.exports = __toCommonJS(workspace_incident_state_exports);
24
25
  function applyWorkspaceIncidentUpdate(currentIncidentId, update) {
@@ -26,7 +27,11 @@ function applyWorkspaceIncidentUpdate(currentIncidentId, update) {
26
27
  if (currentIncidentId && update.incidentId && update.incidentId !== currentIncidentId) return currentIncidentId;
27
28
  return null;
28
29
  }
30
+ function workspaceConfigurationRefreshesDeferredConfiguration(input) {
31
+ return input.deferredIncidentId !== null && input.activeIncidentId === null && input.requestedDeferredIncidentId === void 0;
32
+ }
29
33
  // Annotate the CommonJS export names for ESM import in node:
30
34
  0 && (module.exports = {
31
- applyWorkspaceIncidentUpdate
35
+ applyWorkspaceIncidentUpdate,
36
+ workspaceConfigurationRefreshesDeferredConfiguration
32
37
  });
package/dist/mjs/main.mjs CHANGED
@@ -34,7 +34,7 @@ import {
34
34
  registryAuthHasAppManagedGitHubCredential,
35
35
  RegistryAuthConfigurationError
36
36
  } from "./registry-auth.mjs";
37
- import { applyWorkspaceIncidentUpdate } from "./workspace-incident-state.mjs";
37
+ import { applyWorkspaceIncidentUpdate, workspaceConfigurationRefreshesDeferredConfiguration } from "./workspace-incident-state.mjs";
38
38
  import {
39
39
  hasActiveVisibleProjectsWorkspaceTarget,
40
40
  PENDING_CREATED_BRANCH_AUTOMATIC_SYNC_GRACE_MS,
@@ -5932,7 +5932,15 @@ async function startWorker(options, projectRuntime = {
5932
5932
  }
5933
5933
  if (message.type === "workspace_config") {
5934
5934
  const receiptGeneration = ++workspaceConfigurationReceiptGeneration;
5935
- const refreshesDeferredConfiguration = deferredWorkspaceConfiguration !== null && activeWorkspaceIncidentId === null && message.deferWorkspaceSyncForIncidentId === void 0;
5935
+ const refreshesDeferredConfiguration = workspaceConfigurationRefreshesDeferredConfiguration({
5936
+ deferredIncidentId: deferredWorkspaceConfiguration?.incidentId ?? null,
5937
+ activeIncidentId: activeWorkspaceIncidentId,
5938
+ requestedDeferredIncidentId: message.deferWorkspaceSyncForIncidentId
5939
+ });
5940
+ if (refreshesDeferredConfiguration && deferredWorkspaceConfigurationRefreshTimer) {
5941
+ clearTimeout(deferredWorkspaceConfigurationRefreshTimer);
5942
+ deferredWorkspaceConfigurationRefreshTimer = void 0;
5943
+ }
5936
5944
  const digest = workerOperationDigest(message);
5937
5945
  const cached = projectRuntime.configuration;
5938
5946
  const canReuseConfiguration = cached?.digest === digest && cached.workspaceSync?.remoteUrl === message.workspaceRemoteUrl && Boolean(cached.workspaceSync.credentialHelper) && cached.workspaceSync.credentialUsername === workerCredentialUsername && cached.workspaceSync.gitIdentity?.name === message.gitIdentity.name && cached.workspaceSync.gitIdentity?.email === message.gitIdentity.email && !unsafeWorkspaceSyncBouncePending && credentialGenerationFingerprint({ ...message, workerBaseUrl: baseUrl, workerAuthHeader: bearerAuthHeader }) === configuredCredentialGenerationFingerprint;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.119",
3
+ "version": "0.0.120",
4
4
  "type": "module"
5
5
  }
@@ -3,6 +3,10 @@ function applyWorkspaceIncidentUpdate(currentIncidentId, update) {
3
3
  if (currentIncidentId && update.incidentId && update.incidentId !== currentIncidentId) return currentIncidentId;
4
4
  return null;
5
5
  }
6
+ function workspaceConfigurationRefreshesDeferredConfiguration(input) {
7
+ return input.deferredIncidentId !== null && input.activeIncidentId === null && input.requestedDeferredIncidentId === void 0;
8
+ }
6
9
  export {
7
- applyWorkspaceIncidentUpdate
10
+ applyWorkspaceIncidentUpdate,
11
+ workspaceConfigurationRefreshesDeferredConfiguration
8
12
  };
@@ -3,3 +3,17 @@ export type WorkspaceIncidentUpdate = {
3
3
  status: "remediating" | "waiting_for_worker" | "resolved" | "confirmed" | "reset" | null;
4
4
  };
5
5
  export declare function applyWorkspaceIncidentUpdate(currentIncidentId: string | null, update: WorkspaceIncidentUpdate): string | null;
6
+ /**
7
+ * Whether an incoming `workspace_config` is the full configuration a terminal
8
+ * incident update promised: the worker still holds an incident-deferred
9
+ * configuration, no incident is active any more, and the server did not ask
10
+ * for another deferral. Arrival of that configuration disarms the refresh
11
+ * watchdog; from then on the configuration's own generation checks and its
12
+ * failure close govern, so a legitimately long full configuration is never
13
+ * cut off mid-flight by the arrival timer.
14
+ */
15
+ export declare function workspaceConfigurationRefreshesDeferredConfiguration(input: {
16
+ deferredIncidentId: string | null;
17
+ activeIncidentId: string | null;
18
+ requestedDeferredIncidentId: string | undefined;
19
+ }): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.119",
3
+ "version": "0.0.120",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/main.cjs",
6
6
  "module": "./dist/mjs/main.mjs",