metheus-governance-mcp-cli 0.2.227 → 0.2.228

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/cli.mjs CHANGED
@@ -1885,51 +1885,70 @@ function prefersRunnerStateRecord(candidate, current) {
1885
1885
  function mergeRunnerStateRecords(preferred, fallback) {
1886
1886
  const primary = safeObject(preferred);
1887
1887
  const secondary = safeObject(fallback);
1888
- const pickString = (...values) => firstNonEmptyString(values);
1889
- const pickNumber = (...values) => {
1890
- for (const value of values) {
1891
- if (value === 0 || value === "0") return 0;
1892
- const parsed = intFromRawAllowZero(value, Number.NaN);
1888
+ const hasOwn = (record, key) => Object.prototype.hasOwnProperty.call(record, key);
1889
+ const pickStringField = (key, { allowBlank = false } = {}) => {
1890
+ if (hasOwn(primary, key)) {
1891
+ const value = String(primary[key] ?? "").trim();
1892
+ if (value || allowBlank) {
1893
+ return value;
1894
+ }
1895
+ }
1896
+ return String(secondary[key] ?? "").trim();
1897
+ };
1898
+ const pickNumberField = (key, { allowUndefined = false } = {}) => {
1899
+ if (hasOwn(primary, key)) {
1900
+ const raw = primary[key];
1901
+ if ((raw === undefined || raw === null || String(raw).trim() === "") && allowUndefined) {
1902
+ return undefined;
1903
+ }
1904
+ if (raw === 0 || raw === "0") return 0;
1905
+ const parsed = intFromRawAllowZero(raw, Number.NaN);
1893
1906
  if (Number.isFinite(parsed) && !Number.isNaN(parsed) && parsed > 0) {
1894
1907
  return parsed;
1895
1908
  }
1896
1909
  }
1897
- return 0;
1910
+ const fallbackRaw = secondary[key];
1911
+ if (fallbackRaw === 0 || fallbackRaw === "0") return 0;
1912
+ const fallbackParsed = intFromRawAllowZero(fallbackRaw, Number.NaN);
1913
+ if (Number.isFinite(fallbackParsed) && !Number.isNaN(fallbackParsed) && fallbackParsed > 0) {
1914
+ return fallbackParsed;
1915
+ }
1916
+ return allowUndefined ? undefined : 0;
1898
1917
  };
1899
1918
  return {
1900
- last_processed_comment_id: pickString(primary.last_processed_comment_id, secondary.last_processed_comment_id),
1901
- last_processed_created_at: pickString(primary.last_processed_created_at, secondary.last_processed_created_at),
1902
- last_source_message_id: pickNumber(primary.last_source_message_id, secondary.last_source_message_id) || undefined,
1903
- last_source_kind: pickString(primary.last_source_kind, secondary.last_source_kind),
1904
- last_error: pickString(primary.last_error, secondary.last_error),
1905
- updated_at: pickString(primary.updated_at, secondary.updated_at, new Date().toISOString()),
1906
- last_action: pickString(primary.last_action, secondary.last_action),
1907
- last_reason: pickString(primary.last_reason, secondary.last_reason),
1908
- last_trigger: pickString(primary.last_trigger, secondary.last_trigger),
1909
- last_reply_message_id: pickNumber(primary.last_reply_message_id, secondary.last_reply_message_id) || undefined,
1910
- last_conversation_id: pickString(primary.last_conversation_id, secondary.last_conversation_id),
1911
- last_conversation_stage: pickString(primary.last_conversation_stage, secondary.last_conversation_stage),
1912
- last_speaker_bot_username: pickString(primary.last_speaker_bot_username, secondary.last_speaker_bot_username),
1913
- local_receive_mode: pickString(primary.local_receive_mode, secondary.local_receive_mode),
1919
+ last_processed_comment_id: pickStringField("last_processed_comment_id"),
1920
+ last_processed_created_at: pickStringField("last_processed_created_at"),
1921
+ last_source_message_id: pickNumberField("last_source_message_id", { allowUndefined: true }),
1922
+ last_source_kind: pickStringField("last_source_kind"),
1923
+ last_error: pickStringField("last_error", { allowBlank: true }),
1924
+ updated_at: firstNonEmptyString([primary.updated_at, secondary.updated_at, new Date().toISOString()]),
1925
+ last_action: pickStringField("last_action"),
1926
+ last_reason: pickStringField("last_reason"),
1927
+ last_trigger: pickStringField("last_trigger"),
1928
+ last_reply_message_id: pickNumberField("last_reply_message_id", { allowUndefined: true }),
1929
+ last_conversation_id: pickStringField("last_conversation_id"),
1930
+ last_conversation_stage: pickStringField("last_conversation_stage"),
1931
+ last_speaker_bot_username: pickStringField("last_speaker_bot_username"),
1932
+ local_receive_mode: pickStringField("local_receive_mode"),
1914
1933
  local_telegram_polling_ready: Boolean(primary.local_telegram_polling_ready || secondary.local_telegram_polling_ready),
1915
- local_telegram_webhook_cleared_url: pickString(primary.local_telegram_webhook_cleared_url, secondary.local_telegram_webhook_cleared_url),
1916
- local_telegram_webhook_cleared_at: pickString(primary.local_telegram_webhook_cleared_at, secondary.local_telegram_webhook_cleared_at),
1917
- last_provider_update_id: pickNumber(primary.last_provider_update_id, secondary.last_provider_update_id) || undefined,
1918
- last_local_poll_at: pickString(primary.last_local_poll_at, secondary.last_local_poll_at),
1919
- active_comment_id: pickString(primary.active_comment_id, secondary.active_comment_id),
1920
- active_comment_created_at: pickString(primary.active_comment_created_at, secondary.active_comment_created_at),
1921
- active_source_message_id: pickNumber(primary.active_source_message_id, secondary.active_source_message_id) || undefined,
1922
- active_request_key: pickString(primary.active_request_key, secondary.active_request_key),
1923
- active_started_at: pickString(primary.active_started_at, secondary.active_started_at),
1924
- active_root_work_item_id: pickString(primary.active_root_work_item_id, secondary.active_root_work_item_id),
1925
- active_root_work_item_title: pickString(primary.active_root_work_item_title, secondary.active_root_work_item_title),
1926
- active_root_work_item_status: pickString(primary.active_root_work_item_status, secondary.active_root_work_item_status),
1927
- active_runner_pid: pickNumber(primary.active_runner_pid, secondary.active_runner_pid) || undefined,
1928
- active_execution_token: pickString(primary.active_execution_token, secondary.active_execution_token),
1929
- last_request_key: pickString(primary.last_request_key, secondary.last_request_key),
1930
- last_root_work_item_id: pickString(primary.last_root_work_item_id, secondary.last_root_work_item_id),
1931
- last_root_work_item_title: pickString(primary.last_root_work_item_title, secondary.last_root_work_item_title),
1932
- last_root_work_item_status: pickString(primary.last_root_work_item_status, secondary.last_root_work_item_status),
1934
+ local_telegram_webhook_cleared_url: pickStringField("local_telegram_webhook_cleared_url", { allowBlank: true }),
1935
+ local_telegram_webhook_cleared_at: pickStringField("local_telegram_webhook_cleared_at", { allowBlank: true }),
1936
+ last_provider_update_id: pickNumberField("last_provider_update_id", { allowUndefined: true }),
1937
+ last_local_poll_at: pickStringField("last_local_poll_at"),
1938
+ active_comment_id: pickStringField("active_comment_id", { allowBlank: true }),
1939
+ active_comment_created_at: pickStringField("active_comment_created_at", { allowBlank: true }),
1940
+ active_source_message_id: pickNumberField("active_source_message_id", { allowUndefined: true }),
1941
+ active_request_key: pickStringField("active_request_key", { allowBlank: true }),
1942
+ active_started_at: pickStringField("active_started_at", { allowBlank: true }),
1943
+ active_root_work_item_id: pickStringField("active_root_work_item_id", { allowBlank: true }),
1944
+ active_root_work_item_title: pickStringField("active_root_work_item_title", { allowBlank: true }),
1945
+ active_root_work_item_status: pickStringField("active_root_work_item_status", { allowBlank: true }),
1946
+ active_runner_pid: pickNumberField("active_runner_pid", { allowUndefined: true }),
1947
+ active_execution_token: pickStringField("active_execution_token", { allowBlank: true }),
1948
+ last_request_key: pickStringField("last_request_key"),
1949
+ last_root_work_item_id: pickStringField("last_root_work_item_id"),
1950
+ last_root_work_item_title: pickStringField("last_root_work_item_title"),
1951
+ last_root_work_item_status: pickStringField("last_root_work_item_status"),
1933
1952
  conversation_sessions: {
1934
1953
  ...safeObject(secondary.conversation_sessions),
1935
1954
  ...safeObject(primary.conversation_sessions),
@@ -38,6 +38,9 @@ function isTransientTransportError(err) {
38
38
  || text.includes("econnreset")
39
39
  || text.includes("etimedout")
40
40
  || text.includes("timeout")
41
+ || text.includes("bad record mac")
42
+ || text.includes("decryption failed")
43
+ || text.includes("tls_get_more_records")
41
44
  );
42
45
  }
43
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metheus-governance-mcp-cli",
3
- "version": "0.2.227",
3
+ "version": "0.2.228",
4
4
  "description": "Metheus Governance MCP CLI (setup + stdio proxy)",
5
5
  "type": "module",
6
6
  "files": [