@pellux/goodvibes-sdk 0.34.0 → 0.34.1

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 (189) hide show
  1. package/dist/contracts/artifacts/operator-contract.json +1 -1
  2. package/dist/events/workflows.d.ts +4 -0
  3. package/dist/events/workflows.d.ts.map +1 -1
  4. package/dist/platform/agents/message-bus-core.d.ts +11 -0
  5. package/dist/platform/agents/message-bus-core.d.ts.map +1 -1
  6. package/dist/platform/agents/message-bus-core.js +28 -21
  7. package/dist/platform/agents/orchestrator-runner.d.ts.map +1 -1
  8. package/dist/platform/agents/orchestrator-runner.js +6 -4
  9. package/dist/platform/agents/wrfc-config.d.ts.map +1 -1
  10. package/dist/platform/agents/wrfc-config.js +16 -10
  11. package/dist/platform/agents/wrfc-controller.d.ts +26 -0
  12. package/dist/platform/agents/wrfc-controller.d.ts.map +1 -1
  13. package/dist/platform/agents/wrfc-controller.js +134 -138
  14. package/dist/platform/agents/wrfc-runtime-events.d.ts +1 -0
  15. package/dist/platform/agents/wrfc-runtime-events.d.ts.map +1 -1
  16. package/dist/platform/agents/wrfc-runtime-events.js +4 -1
  17. package/dist/platform/automation/delivery-manager.d.ts.map +1 -1
  18. package/dist/platform/automation/delivery-manager.js +1 -6
  19. package/dist/platform/batch/manager.d.ts.map +1 -1
  20. package/dist/platform/batch/manager.js +1 -3
  21. package/dist/platform/channels/policy-manager.d.ts.map +1 -1
  22. package/dist/platform/channels/policy-manager.js +1 -3
  23. package/dist/platform/channels/reply-pipeline.d.ts.map +1 -1
  24. package/dist/platform/channels/reply-pipeline.js +4 -0
  25. package/dist/platform/config/schema-domain-core.d.ts +1 -1
  26. package/dist/platform/config/schema-domain-core.d.ts.map +1 -1
  27. package/dist/platform/config/schema-domain-core.js +12 -12
  28. package/dist/platform/config/schema-domain-runtime.d.ts +1 -1
  29. package/dist/platform/config/schema-domain-runtime.d.ts.map +1 -1
  30. package/dist/platform/config/schema-domain-runtime.js +19 -18
  31. package/dist/platform/config/schema-domain-surfaces.d.ts +1 -1
  32. package/dist/platform/config/schema-domain-surfaces.d.ts.map +1 -1
  33. package/dist/platform/config/schema-domain-surfaces.js +4 -3
  34. package/dist/platform/config/schema-shared.d.ts +6 -0
  35. package/dist/platform/config/schema-shared.d.ts.map +1 -1
  36. package/dist/platform/config/schema-shared.js +21 -1
  37. package/dist/platform/control-plane/approval-broker.d.ts.map +1 -1
  38. package/dist/platform/control-plane/approval-broker.js +1 -3
  39. package/dist/platform/control-plane/session-broker-state.d.ts.map +1 -1
  40. package/dist/platform/control-plane/session-broker-state.js +1 -3
  41. package/dist/platform/core/compaction-sections.d.ts +5 -1
  42. package/dist/platform/core/compaction-sections.d.ts.map +1 -1
  43. package/dist/platform/core/compaction-sections.js +73 -66
  44. package/dist/platform/core/context-compaction.d.ts.map +1 -1
  45. package/dist/platform/core/context-compaction.js +9 -16
  46. package/dist/platform/core/orchestrator-context-runtime.d.ts +2 -2
  47. package/dist/platform/core/orchestrator-context-runtime.d.ts.map +1 -1
  48. package/dist/platform/core/orchestrator-context-runtime.js +24 -21
  49. package/dist/platform/core/orchestrator-tool-runtime.d.ts.map +1 -1
  50. package/dist/platform/core/orchestrator-tool-runtime.js +2 -1
  51. package/dist/platform/core/session-lineage.d.ts +2 -5
  52. package/dist/platform/core/session-lineage.d.ts.map +1 -1
  53. package/dist/platform/core/session-lineage.js +4 -16
  54. package/dist/platform/core/wrfc-routing.d.ts.map +1 -1
  55. package/dist/platform/core/wrfc-routing.js +1 -3
  56. package/dist/platform/daemon/http/mcp-routes.d.ts.map +1 -1
  57. package/dist/platform/daemon/http/mcp-routes.js +1 -3
  58. package/dist/platform/daemon/http/openai-compatible-routes.d.ts.map +1 -1
  59. package/dist/platform/daemon/http/openai-compatible-routes.js +1 -3
  60. package/dist/platform/daemon/http/runtime-routes.d.ts.map +1 -1
  61. package/dist/platform/daemon/http/runtime-routes.js +1 -3
  62. package/dist/platform/hooks/runners/http.d.ts.map +1 -1
  63. package/dist/platform/hooks/runners/http.js +9 -19
  64. package/dist/platform/integrations/webhooks.js +2 -11
  65. package/dist/platform/knowledge/semantic/self-improvement.d.ts.map +1 -1
  66. package/dist/platform/knowledge/semantic/self-improvement.js +2 -21
  67. package/dist/platform/mcp/client.d.ts.map +1 -1
  68. package/dist/platform/mcp/client.js +1 -3
  69. package/dist/platform/mcp/config.d.ts.map +1 -1
  70. package/dist/platform/mcp/config.js +1 -3
  71. package/dist/platform/media/builtin-generation-providers.d.ts.map +1 -1
  72. package/dist/platform/media/builtin-generation-providers.js +1 -6
  73. package/dist/platform/providers/anthropic-compat.d.ts.map +1 -1
  74. package/dist/platform/providers/anthropic-compat.js +11 -131
  75. package/dist/platform/providers/anthropic-sdk-provider.d.ts.map +1 -1
  76. package/dist/platform/providers/anthropic-sdk-provider.js +8 -42
  77. package/dist/platform/providers/anthropic-sse-assembler.d.ts +80 -0
  78. package/dist/platform/providers/anthropic-sse-assembler.d.ts.map +1 -0
  79. package/dist/platform/providers/anthropic-sse-assembler.js +146 -0
  80. package/dist/platform/providers/anthropic-stream.d.ts +30 -0
  81. package/dist/platform/providers/anthropic-stream.d.ts.map +1 -0
  82. package/dist/platform/providers/anthropic-stream.js +44 -0
  83. package/dist/platform/providers/anthropic-vertex.d.ts.map +1 -1
  84. package/dist/platform/providers/anthropic-vertex.js +1 -3
  85. package/dist/platform/providers/anthropic.d.ts.map +1 -1
  86. package/dist/platform/providers/anthropic.js +15 -151
  87. package/dist/platform/providers/capabilities.d.ts.map +1 -1
  88. package/dist/platform/providers/capabilities.js +11 -7
  89. package/dist/platform/providers/context-discovery.d.ts.map +1 -1
  90. package/dist/platform/providers/context-discovery.js +9 -16
  91. package/dist/platform/providers/context-window-fallback.d.ts +24 -0
  92. package/dist/platform/providers/context-window-fallback.d.ts.map +1 -0
  93. package/dist/platform/providers/context-window-fallback.js +48 -0
  94. package/dist/platform/providers/gemini.d.ts.map +1 -1
  95. package/dist/platform/providers/gemini.js +3 -6
  96. package/dist/platform/providers/json-ttl-cache.d.ts +35 -0
  97. package/dist/platform/providers/json-ttl-cache.d.ts.map +1 -0
  98. package/dist/platform/providers/json-ttl-cache.js +52 -0
  99. package/dist/platform/providers/llama-cpp.d.ts.map +1 -1
  100. package/dist/platform/providers/llama-cpp.js +2 -23
  101. package/dist/platform/providers/lm-studio-helpers.d.ts +1 -1
  102. package/dist/platform/providers/lm-studio-helpers.d.ts.map +1 -1
  103. package/dist/platform/providers/lm-studio-helpers.js +5 -25
  104. package/dist/platform/providers/model-benchmarks.d.ts.map +1 -1
  105. package/dist/platform/providers/model-benchmarks.js +11 -34
  106. package/dist/platform/providers/model-catalog-cache.d.ts.map +1 -1
  107. package/dist/platform/providers/model-catalog-cache.js +15 -38
  108. package/dist/platform/providers/model-catalog-synthetic.d.ts.map +1 -1
  109. package/dist/platform/providers/model-catalog-synthetic.js +3 -2
  110. package/dist/platform/providers/model-catalog.d.ts.map +1 -1
  111. package/dist/platform/providers/model-catalog.js +3 -2
  112. package/dist/platform/providers/model-limits.d.ts.map +1 -1
  113. package/dist/platform/providers/model-limits.js +18 -42
  114. package/dist/platform/providers/ollama.d.ts.map +1 -1
  115. package/dist/platform/providers/ollama.js +3 -24
  116. package/dist/platform/providers/openai-codex.d.ts.map +1 -1
  117. package/dist/platform/providers/openai-codex.js +8 -9
  118. package/dist/platform/providers/openai-compat.d.ts.map +1 -1
  119. package/dist/platform/providers/openai-compat.js +13 -40
  120. package/dist/platform/providers/openai-stream-helpers.d.ts +62 -0
  121. package/dist/platform/providers/openai-stream-helpers.d.ts.map +1 -0
  122. package/dist/platform/providers/openai-stream-helpers.js +73 -0
  123. package/dist/platform/providers/openai.d.ts.map +1 -1
  124. package/dist/platform/providers/openai.js +13 -41
  125. package/dist/platform/providers/provider-error.d.ts +17 -0
  126. package/dist/platform/providers/provider-error.d.ts.map +1 -0
  127. package/dist/platform/providers/provider-error.js +33 -0
  128. package/dist/platform/providers/provider-stop-reason.d.ts +15 -0
  129. package/dist/platform/providers/provider-stop-reason.d.ts.map +1 -0
  130. package/dist/platform/providers/provider-stop-reason.js +15 -0
  131. package/dist/platform/providers/sse-line-buffer.d.ts +13 -0
  132. package/dist/platform/providers/sse-line-buffer.d.ts.map +1 -0
  133. package/dist/platform/providers/sse-line-buffer.js +23 -0
  134. package/dist/platform/providers/tool-formats.d.ts +5 -0
  135. package/dist/platform/providers/tool-formats.d.ts.map +1 -1
  136. package/dist/platform/providers/tool-formats.js +14 -0
  137. package/dist/platform/runtime/bootstrap-runtime-events.d.ts.map +1 -1
  138. package/dist/platform/runtime/bootstrap-runtime-events.js +6 -0
  139. package/dist/platform/runtime/bootstrap-services.d.ts.map +1 -1
  140. package/dist/platform/runtime/bootstrap-services.js +4 -5
  141. package/dist/platform/runtime/emitters/workflows.d.ts +4 -0
  142. package/dist/platform/runtime/emitters/workflows.d.ts.map +1 -1
  143. package/dist/platform/runtime/emitters/workflows.js +3 -0
  144. package/dist/platform/runtime/remote/distributed-runtime-store.d.ts.map +1 -1
  145. package/dist/platform/runtime/remote/distributed-runtime-store.js +1 -3
  146. package/dist/platform/runtime/retention/pruner.js +2 -5
  147. package/dist/platform/runtime/store/helpers/reducers/lifecycle.d.ts.map +1 -1
  148. package/dist/platform/runtime/store/helpers/reducers/lifecycle.js +15 -14
  149. package/dist/platform/runtime/store/helpers/reducers/shared.d.ts +6 -0
  150. package/dist/platform/runtime/store/helpers/reducers/shared.d.ts.map +1 -1
  151. package/dist/platform/runtime/store/helpers/reducers/shared.js +8 -1
  152. package/dist/platform/runtime/telemetry/exporters/queue.d.ts.map +1 -1
  153. package/dist/platform/runtime/telemetry/exporters/queue.js +1 -7
  154. package/dist/platform/runtime/transports/http-helpers.d.ts +0 -1
  155. package/dist/platform/runtime/transports/http-helpers.d.ts.map +1 -1
  156. package/dist/platform/runtime/transports/http-helpers.js +1 -3
  157. package/dist/platform/runtime/ui-read-model-helpers.d.ts +2 -0
  158. package/dist/platform/runtime/ui-read-model-helpers.d.ts.map +1 -1
  159. package/dist/platform/runtime/ui-read-model-helpers.js +8 -0
  160. package/dist/platform/runtime/ui-read-models-core.d.ts.map +1 -1
  161. package/dist/platform/runtime/ui-read-models-core.js +3 -5
  162. package/dist/platform/runtime/ui-read-models-observability-remote.d.ts.map +1 -1
  163. package/dist/platform/runtime/ui-read-models-observability-remote.js +2 -4
  164. package/dist/platform/runtime/ui-read-models-operations.d.ts.map +1 -1
  165. package/dist/platform/runtime/ui-read-models-operations.js +8 -26
  166. package/dist/platform/scheduler/scheduler.d.ts.map +1 -1
  167. package/dist/platform/scheduler/scheduler.js +1 -3
  168. package/dist/platform/tools/exec/runtime.d.ts.map +1 -1
  169. package/dist/platform/tools/exec/runtime.js +1 -7
  170. package/dist/platform/tools/fetch/runtime.d.ts.map +1 -1
  171. package/dist/platform/tools/fetch/runtime.js +9 -20
  172. package/dist/platform/tools/shared/process-manager.d.ts.map +1 -1
  173. package/dist/platform/tools/shared/process-manager.js +1 -6
  174. package/dist/platform/utils/concurrency.d.ts +1 -0
  175. package/dist/platform/utils/concurrency.d.ts.map +1 -1
  176. package/dist/platform/utils/concurrency.js +1 -0
  177. package/dist/platform/utils/error-display.d.ts +9 -0
  178. package/dist/platform/utils/error-display.d.ts.map +1 -1
  179. package/dist/platform/utils/error-display.js +11 -0
  180. package/dist/platform/utils/fetch-with-timeout.d.ts +22 -2
  181. package/dist/platform/utils/fetch-with-timeout.d.ts.map +1 -1
  182. package/dist/platform/utils/fetch-with-timeout.js +33 -15
  183. package/dist/platform/utils/record-coerce.d.ts +5 -0
  184. package/dist/platform/utils/record-coerce.d.ts.map +1 -1
  185. package/dist/platform/utils/record-coerce.js +7 -0
  186. package/dist/platform/utils/retry.d.ts.map +1 -1
  187. package/dist/platform/utils/retry.js +2 -4
  188. package/dist/platform/version.js +1 -1
  189. package/package.json +9 -9
@@ -1,17 +1,11 @@
1
- import { combineSubscriptions, createStoreBackedReadModel } from './ui-read-model-helpers.js';
1
+ import { combineSubscriptions, createStoreBackedReadModel, projectRecords, projectValues } from './ui-read-model-helpers.js';
2
2
  export function createOperationsReadModels(runtimeServices, options = {}) {
3
3
  const { runtimeStore } = runtimeServices;
4
4
  return {
5
5
  automation: createStoreBackedReadModel(runtimeServices, () => {
6
6
  const state = runtimeStore.getState();
7
- const jobs = state.automation.jobIds
8
- .map((id) => state.automation.jobs.get(id))
9
- .filter((job) => job !== undefined)
10
- .sort((a, b) => (b.nextRunAt ?? 0) - (a.nextRunAt ?? 0) || a.name.localeCompare(b.name));
11
- const runs = state.automation.runIds
12
- .map((id) => state.automation.runs.get(id))
13
- .filter((run) => run !== undefined)
14
- .sort((a, b) => b.queuedAt - a.queuedAt || a.id.localeCompare(b.id));
7
+ const jobs = projectRecords(state.automation.jobIds, state.automation.jobs, (a, b) => (b.nextRunAt ?? 0) - (a.nextRunAt ?? 0) || a.name.localeCompare(b.name));
8
+ const runs = projectRecords(state.automation.runIds, state.automation.runs, (a, b) => b.queuedAt - a.queuedAt || a.id.localeCompare(b.id));
15
9
  return {
16
10
  jobs,
17
11
  runs,
@@ -29,10 +23,7 @@ export function createOperationsReadModels(runtimeServices, options = {}) {
29
23
  }),
30
24
  routes: createStoreBackedReadModel(runtimeServices, () => {
31
25
  const state = runtimeStore.getState().routes;
32
- const bindings = state.bindingIds
33
- .map((id) => state.bindings.get(id))
34
- .filter((binding) => binding !== undefined)
35
- .sort((a, b) => b.lastSeenAt - a.lastSeenAt || a.id.localeCompare(b.id));
26
+ const bindings = projectRecords(state.bindingIds, state.bindings, (a, b) => b.lastSeenAt - a.lastSeenAt || a.id.localeCompare(b.id));
36
27
  return {
37
28
  bindings,
38
29
  bindingIdsBySurface: state.bindingIdsBySurface,
@@ -44,10 +35,7 @@ export function createOperationsReadModels(runtimeServices, options = {}) {
44
35
  }),
45
36
  watchers: createStoreBackedReadModel(runtimeServices, () => {
46
37
  const state = runtimeStore.getState().watchers;
47
- const watchers = state.watcherIds
48
- .map((id) => state.watchers.get(id))
49
- .filter((watcher) => watcher !== undefined)
50
- .sort((a, b) => (b.lastHeartbeatAt ?? 0) - (a.lastHeartbeatAt ?? 0) || a.id.localeCompare(b.id));
38
+ const watchers = projectRecords(state.watcherIds, state.watchers, (a, b) => (b.lastHeartbeatAt ?? 0) - (a.lastHeartbeatAt ?? 0) || a.id.localeCompare(b.id));
51
39
  return {
52
40
  watchers,
53
41
  totalWatchers: state.watcherIds.length,
@@ -58,7 +46,7 @@ export function createOperationsReadModels(runtimeServices, options = {}) {
58
46
  }),
59
47
  orchestration: createStoreBackedReadModel(runtimeServices, () => {
60
48
  const state = runtimeStore.getState().orchestration;
61
- const graphs = [...state.graphs.values()].sort((a, b) => b.createdAt - a.createdAt);
49
+ const graphs = projectValues(state.graphs, (a, b) => b.createdAt - a.createdAt);
62
50
  return {
63
51
  graphs,
64
52
  totalGraphs: state.totalGraphs,
@@ -70,10 +58,7 @@ export function createOperationsReadModels(runtimeServices, options = {}) {
70
58
  }),
71
59
  communication: createStoreBackedReadModel(runtimeServices, () => {
72
60
  const state = runtimeStore.getState().communication;
73
- const records = state.recentRecordIds
74
- .map((id) => state.records.get(id))
75
- .filter((record) => record !== undefined)
76
- .sort((a, b) => b.timestamp - a.timestamp);
61
+ const records = projectRecords(state.recentRecordIds, state.records, (a, b) => b.timestamp - a.timestamp);
77
62
  return {
78
63
  records,
79
64
  totalSent: state.totalSent,
@@ -84,10 +69,7 @@ export function createOperationsReadModels(runtimeServices, options = {}) {
84
69
  controlPlane: {
85
70
  getSnapshot() {
86
71
  const state = runtimeStore.getState().controlPlane;
87
- const clients = state.clientIds
88
- .map((id) => state.clients.get(id))
89
- .filter((client) => client !== undefined)
90
- .sort((a, b) => (b.lastSeenAt ?? 0) - (a.lastSeenAt ?? 0) || a.id.localeCompare(b.id));
72
+ const clients = projectRecords(state.clientIds, state.clients, (a, b) => (b.lastSeenAt ?? 0) - (a.lastSeenAt ?? 0) || a.id.localeCompare(b.id));
91
73
  return {
92
74
  connectionState: state.connectionState,
93
75
  activeClientIds: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YAAY;IAoCpB,OAAO,CAAC,WAAW;IAQnB;;;;OAIG;YACW,WAAW;IA+CzB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAcnB,uEAAuE;IACvE,OAAO,CAAC,WAAW;YAUL,IAAI;IAOlB;;;OAGG;IACH,OAAO,CAAC,YAAY;YASN,IAAI;CAgEnB"}
@@ -1,10 +1,8 @@
1
1
  import { PersistentStore } from '../state/persistent-store.js';
2
2
  import { logger } from '../utils/logger.js';
3
3
  import { summarizeError } from '../utils/error-display.js';
4
+ import { isRecord } from '../utils/record-coerce.js';
4
5
  const TASK_RUN_STATUSES = new Set(['running', 'completed', 'failed']);
5
- function isRecord(value) {
6
- return typeof value === 'object' && value !== null && !Array.isArray(value);
7
- }
8
6
  function isFiniteNumber(value) {
9
7
  return typeof value === 'number' && Number.isFinite(value);
10
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/platform/tools/exec/runtime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAqB,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAA+B,iBAAiB,EAAiB,MAAM,aAAa,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AA2e/E;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,iBAAiB,EACzB,OAAO,CAAC,EAAE,aAAa,CAAC,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,GAC3D,OAAO,CA2CT;AA8ID,wBAAgB,cAAc,CAC5B,cAAc,EAAE,cAAc,EAC9B,OAAO,GAAE;IACP,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;IACjF,QAAQ,CAAC,eAAe,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;CACnD,GACL,IAAI,CAmFN"}
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/platform/tools/exec/runtime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAqB,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAA+B,iBAAiB,EAAiB,MAAM,aAAa,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAse/E;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,iBAAiB,EACzB,OAAO,CAAC,EAAE,aAAa,CAAC,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,GAC3D,OAAO,CA2CT;AA8ID,wBAAgB,cAAc,CAC5B,cAAc,EAAE,cAAc,EAC9B,OAAO,GAAE;IACP,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;IACjF,QAAQ,CAAC,eAAe,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;CACnD,GACL,IAAI,CAmFN"}
@@ -7,7 +7,7 @@ import { ProcessManager } from '../shared/process-manager.js';
7
7
  import { guardExecCommand, formatDenialResponse } from './ast-guard.js';
8
8
  import { executeFileOperations } from './file-ops.js';
9
9
  import { DEFAULT_ALLOWED_CLASSES } from '../../runtime/permissions/normalization/verdict.js';
10
- import { mapWithConcurrency } from '../../utils/concurrency.js';
10
+ import { mapWithConcurrency, sleep } from '../../utils/concurrency.js';
11
11
  import { compileSafeRegExp, safeRegExpTest } from '../../utils/safe-regex.js';
12
12
  const DEFAULT_TIMEOUT_MS = 120_000;
13
13
  const PROGRESS_AUTO_THRESHOLD_MS = 30_000;
@@ -78,12 +78,6 @@ function resolveCwd(cwd, workingDirectory) {
78
78
  return effective;
79
79
  return resolve(workingDirectory, effective);
80
80
  }
81
- function sleep(ms) {
82
- return new Promise((resolve) => {
83
- const timer = setTimeout(resolve, ms);
84
- timer.unref?.();
85
- });
86
- }
87
81
  function computeRetryDelay(attempt, delayMs, backoff, maxDelayMs = 30_000) {
88
82
  if (backoff === 'fixed')
89
83
  return delayMs;
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/platform/tools/fetch/runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,sBAAsB,CAAC;AAEjE,OAAO,KAAK,EAAE,UAAU,EAAsF,MAAM,aAAa,CAAC;AAClI,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAUxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAM/E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,eAAe,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;IACnF,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;CAClF;AAED,UAAU,UAAU;IAClB,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb;AASD,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiC;IAC/D,OAAO,CAAC,eAAe,CAAK;IAE5B,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,MAA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AAe,CAAK;IAE5B,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAOtE,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI;IAiBxC,OAAO,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,GAAE,gBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;CAkFpF;AAED,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,GAAE,gBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC,CAE5G;AAseD,wBAAgB,eAAe,CAC7B,IAAI,GAAE,gBAAqB,EAC3B,OAAO,sBAA4B,GAClC,IAAI,CAiCN"}
@@ -4,9 +4,9 @@ import { applySanitizer, resolveSanitizeMode } from './sanitizer.js';
4
4
  import { classifyHostTrustTier, emitSsrfDeny, emitHostTrustTier, extractHostname, } from './trust-tiers.js';
5
5
  import { applyExtract, sniffContentType } from './extract.js';
6
6
  import { summarizeError } from '../../utils/error-display.js';
7
- import { instrumentedFetch } from '../../utils/fetch-with-timeout.js';
7
+ import { instrumentedFetch, createTimeoutController } from '../../utils/fetch-with-timeout.js';
8
8
  import { toRecord } from '../../utils/record-coerce.js';
9
- import { mapWithConcurrency } from '../../utils/concurrency.js';
9
+ import { mapWithConcurrency, sleep } from '../../utils/concurrency.js';
10
10
  const MAX_CACHE_SIZE = 500;
11
11
  const MAX_FETCH_URLS = 20;
12
12
  const MAX_PARALLEL_FETCHES = 5;
@@ -88,7 +88,7 @@ export class FetchRuntimeService {
88
88
  results = [];
89
89
  for (let i = 0; i < input.urls.length; i++) {
90
90
  if (i > 0 && rateLimitMs > 0) {
91
- await delay(rateLimitMs);
91
+ await sleep(rateLimitMs);
92
92
  }
93
93
  results.push(await fetchOne(input.urls[i], fetchOpts, this));
94
94
  }
@@ -135,12 +135,6 @@ function cacheKey(url, params, extract, verbosity) {
135
135
  : url;
136
136
  return `${base}|${extract}|${verbosity}`;
137
137
  }
138
- function delay(ms) {
139
- return new Promise((r) => {
140
- const timer = setTimeout(r, ms);
141
- timer.unref?.();
142
- });
143
- }
144
138
  function applyAuthHeaders(headers, auth) {
145
139
  switch (auth.type) {
146
140
  case 'bearer':
@@ -172,31 +166,26 @@ function encodeFormBodyData(bodyData) {
172
166
  return params.toString();
173
167
  }
174
168
  async function fetchOneRaw(urlInput, headers, method, body, effectiveUrl, trustTierConfig, sanitizationEnabled) {
175
- const controller = new AbortController();
176
- const timer = setTimeout(() => controller.abort(), urlInput.timeout_ms ?? DEFAULT_TIMEOUT_MS);
177
- timer.unref?.();
169
+ const { signal, dispose } = createTimeoutController(urlInput.timeout_ms ?? DEFAULT_TIMEOUT_MS);
178
170
  try {
179
- const response = sanitizationEnabled
171
+ return sanitizationEnabled
180
172
  ? await fetchWithValidatedRedirects({
181
173
  url: effectiveUrl,
182
174
  method,
183
175
  headers,
184
176
  body,
185
- signal: controller.signal,
177
+ signal,
186
178
  trustTierConfig,
187
179
  })
188
180
  : await instrumentedFetch(effectiveUrl, {
189
181
  method,
190
182
  ...(Object.keys(headers).length > 0 ? { headers: headers } : {}),
191
183
  ...(body !== undefined ? { body } : {}),
192
- signal: controller.signal,
184
+ signal,
193
185
  });
194
- clearTimeout(timer);
195
- return response;
196
186
  }
197
- catch (err) {
198
- clearTimeout(timer);
199
- throw err;
187
+ finally {
188
+ dispose();
200
189
  }
201
190
  }
202
191
  async function fetchWithValidatedRedirects(input) {
@@ -1 +1 @@
1
- {"version":3,"file":"process-manager.d.ts","sourceRoot":"","sources":["../../../../src/platform/tools/shared/process-manager.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAKrF;;;;;GAKG;AAIH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,E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AE,GAAG,SAAS;IAUrE;;;OAGG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAczB,yEAAyE;IACzE,IAAI,IAAI,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAUvE;;;OAGG;IACH,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI;IAqDlD,OAAO,CAAC,uBAAuB;CAWhC"}
1
+ {"version":3,"file":"process-manager.d.ts","sourceRoot":"","sources":["../../../../src/platform/tools/shared/process-manager.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAMrF;;;;;GAKG;AAIH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC;IACd;;;OAGG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;AAQD,MAAM,WAAW,YAAY;IAC3B,oFAAoF;IACpF,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAID,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAID,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,UAAU,CAAwC;IAC1D,OAAO,CAAC,MAAM,CAAmD;IAIjE,OAAO,CAAC,KAAK;IAMb;;;;;;;;;;OAUG;IACG,KAAK,CACT,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EACvC,IAAI,CAAC,EAAE,YAAY,GAClB,OAAO,CAAC,eAAe,CAAC;IA2G3B,iFAAiF;IACjF,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IAKpD,kEAAkE;IAClE,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;IAUrE;;;OAGG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAczB,yEAAyE;IACzE,IAAI,IAAI,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAUvE;;;OAGG;IACH,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI;IAqDlD,OAAO,CAAC,uBAAuB;CAWhC"}
@@ -1,6 +1,7 @@
1
1
  /** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
2
2
  import { summarizeError } from '../../utils/error-display.js';
3
3
  import { logger } from '../../utils/logger.js';
4
+ import { sleep } from '../../utils/concurrency.js';
4
5
  const MAX_PROCESS_OUTPUT_BYTES = 256 * 1024;
5
6
  const MAX_COMPLETED_PROCESSES = 100;
6
7
  const COMPLETED_PROCESS_TTL_MS = 30 * 60 * 1000;
@@ -272,9 +273,3 @@ async function readProcessStream(stream) {
272
273
  reader.releaseLock();
273
274
  }
274
275
  }
275
- function sleep(ms) {
276
- return new Promise((resolve) => {
277
- const timer = setTimeout(resolve, ms);
278
- timer.unref?.();
279
- });
280
- }
@@ -1,3 +1,4 @@
1
+ export { sleep } from '../knowledge/cooperative.js';
1
2
  /** Run async work with a fixed concurrency cap while preserving input order. */
2
3
  export declare function mapWithConcurrency<T, R>(items: readonly T[], limit: number, worker: (item: T, index: number) => Promise<R>): Promise<R[]>;
3
4
  //# sourceMappingURL=concurrency.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"concurrency.d.ts","sourceRoot":"","sources":["../../../src/platform/utils/concurrency.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wBAAsB,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAC3C,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAC7C,OAAO,CAAC,CAAC,EAAE,CAAC,CAmBd"}
1
+ {"version":3,"file":"concurrency.d.ts","sourceRoot":"","sources":["../../../src/platform/utils/concurrency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEpD,gFAAgF;AAChF,wBAAsB,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAC3C,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAC7C,OAAO,CAAC,CAAC,EAAE,CAAC,CAmBd"}
@@ -1,3 +1,4 @@
1
+ export { sleep } from '../knowledge/cooperative.js';
1
2
  /** Run async work with a fixed concurrency cap while preserving input order. */
2
3
  export async function mapWithConcurrency(items, limit, worker) {
3
4
  const concurrency = Math.max(1, Math.floor(limit));
@@ -26,6 +26,15 @@ export interface ErrorNormalizationOptions {
26
26
  export interface ProviderErrorNormalizationOptions extends ProviderErrorOptions {
27
27
  readonly fallbackMessage?: string | undefined;
28
28
  }
29
+ /**
30
+ * redactedErrorMessage — extracts and redacts a human-readable message from any thrown value.
31
+ *
32
+ * Use for user-facing error output where the raw message should never leak
33
+ * bearer tokens, API keys, or other sensitive data. Do NOT use for logger
34
+ * fields, structured result/error fields, or diagnostic context — use
35
+ * `summarizeError` or the structured `normalizeError` for those.
36
+ */
37
+ export declare function redactedErrorMessage(error: unknown): string;
29
38
  export declare function normalizeError(error: unknown, options?: ErrorNormalizationOptions): NormalizedError;
30
39
  export declare function summarizeError(error: unknown, options?: ErrorNormalizationOptions): string;
31
40
  export declare function formatError(error: unknown, options?: ErrorNormalizationOptions): string;
@@ -1 +1 @@
1
- {"version":3,"file":"error-display.d.ts","sourceRoot":"","sources":["../../../src/platform/utils/error-display.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,aAAa,EAAE,KAAK,qBAAqB,EAAE,KAAK,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC9I,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAuBnF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;IACzC,QAAQ,CAAC,MAA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human-readable message from any thrown value.
182
+ *
183
+ * Use for user-facing error output where the raw message should never leak
184
+ * bearer tokens, API keys, or other sensitive data. Do NOT use for logger
185
+ * fields, structured result/error fields, or diagnostic context — use
186
+ * `summarizeError` or the structured `normalizeError` for those.
187
+ */
188
+ export function redactedErrorMessage(error) {
189
+ return redactSensitiveData(extractErrorMessage(error));
190
+ }
180
191
  export function normalizeError(error, options = {}) {
181
192
  // Redact Bearer tokens and API keys before any further processing.
182
193
  const rawMessage = redactSensitiveData(extractErrorMessage(error));
@@ -15,7 +15,25 @@ export declare function sanitizeUrlForLog(url: string | URL | Request): string;
15
15
  */
16
16
  export declare function instrumentedFetch(url: string | URL | Request, init?: RequestInit): Promise<Response>;
17
17
  /**
18
- * fetchWithTimeoutwraps the global fetch with an AbortController timeout.
18
+ * createTimeoutControllercreates an AbortController that fires after `timeoutMs`.
19
+ *
20
+ * When `parentSignal` is provided the returned signal is merged with it via
21
+ * AbortSignal.any so whichever fires first wins.
22
+ *
23
+ * Uses the faster `AbortSignal.timeout` fast-path when available and no parent
24
+ * signal needs to be merged.
25
+ *
26
+ * @param timeoutMs - Milliseconds before aborting.
27
+ * @param parentSignal - Optional caller signal to merge with the timeout.
28
+ * @returns `{ signal, dispose }` — call `dispose()` in a `finally` block to
29
+ * clear the underlying timer and avoid keeping the event loop alive.
30
+ */
31
+ export declare function createTimeoutController(timeoutMs: number, parentSignal?: AbortSignal): {
32
+ readonly signal: AbortSignal;
33
+ dispose(): void;
34
+ };
35
+ /**
36
+ * fetchWithTimeout — wraps a fetch implementation with an AbortController timeout.
19
37
  *
20
38
  * If the caller passes a signal that is already aborted, the request is
21
39
  * rejected immediately. When both a caller signal and the internal timeout
@@ -29,6 +47,8 @@ export declare function instrumentedFetch(url: string | URL | Request, init?: Re
29
47
  * @param url - The URL or Request to fetch.
30
48
  * @param init - Standard RequestInit (optional).
31
49
  * @param timeoutMs - Milliseconds before aborting. Default: 30 000.
50
+ * @param fetchImpl - Fetch implementation to use. Defaults to global `fetch`.
51
+ * Pass `instrumentedFetch` to include OUTBOUND_HTTP logging.
32
52
  */
33
- export declare function fetchWithTimeout(url: string | URL | Request, init?: RequestInit, timeoutMs?: number): Promise<Response>;
53
+ export declare function fetchWithTimeout(url: string | URL | Request, init?: RequestInit, timeoutMs?: number, fetchImpl?: (url: string | URL | Request, init?: RequestInit) => Promise<Response>): Promise<Response>;
34
54
  //# sourceMappingURL=fetch-with-timeout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetch-with-timeout.d.ts","sourceRoot":"","sources":["../../../src/platform/utils/fetch-with-timeout.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,GAAG,MAAM,CAarE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAC3B,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,QAAQ,CAAC,CAkBnB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAC3B,IAAI,CAAC,EAAE,WAAW,EAClB,SAAS,SAAS,GACjB,OAAO,CAAC,QAAQ,CAAC,CAmBnB"}
1
+ {"version":3,"file":"fetch-with-timeout.d.ts","sourceRoot":"","sources":["../../../src/platform/utils/fetch-with-timeout.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,GAAG,MAAM,CAarE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAC3B,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,QAAQ,CAAC,CAkBnB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,WAAW,GACzB;IAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAAC,OAAO,IAAI,IAAI,CAAA;CAAE,CAcnD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAC3B,IAAI,CAAC,EAAE,WAAW,EAClB,SAAS,SAAS,EAClB,SAAS,GAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAS,GACxF,OAAO,CAAC,QAAQ,CAAC,CAQnB"}
@@ -57,7 +57,33 @@ export async function instrumentedFetch(url, init) {
57
57
  }
58
58
  }
59
59
  /**
60
- * fetchWithTimeoutwraps the global fetch with an AbortController timeout.
60
+ * createTimeoutControllercreates an AbortController that fires after `timeoutMs`.
61
+ *
62
+ * When `parentSignal` is provided the returned signal is merged with it via
63
+ * AbortSignal.any so whichever fires first wins.
64
+ *
65
+ * Uses the faster `AbortSignal.timeout` fast-path when available and no parent
66
+ * signal needs to be merged.
67
+ *
68
+ * @param timeoutMs - Milliseconds before aborting.
69
+ * @param parentSignal - Optional caller signal to merge with the timeout.
70
+ * @returns `{ signal, dispose }` — call `dispose()` in a `finally` block to
71
+ * clear the underlying timer and avoid keeping the event loop alive.
72
+ */
73
+ export function createTimeoutController(timeoutMs, parentSignal) {
74
+ if (typeof AbortSignal.timeout === 'function' && !parentSignal) {
75
+ return { signal: AbortSignal.timeout(timeoutMs), dispose: () => { } };
76
+ }
77
+ const controller = new AbortController();
78
+ const timer = setTimeout(() => controller.abort(new DOMException('Request timed out', 'TimeoutError')), timeoutMs);
79
+ timer.unref?.();
80
+ const signal = parentSignal
81
+ ? AbortSignal.any([parentSignal, controller.signal])
82
+ : controller.signal;
83
+ return { signal, dispose: () => clearTimeout(timer) };
84
+ }
85
+ /**
86
+ * fetchWithTimeout — wraps a fetch implementation with an AbortController timeout.
61
87
  *
62
88
  * If the caller passes a signal that is already aborted, the request is
63
89
  * rejected immediately. When both a caller signal and the internal timeout
@@ -71,24 +97,16 @@ export async function instrumentedFetch(url, init) {
71
97
  * @param url - The URL or Request to fetch.
72
98
  * @param init - Standard RequestInit (optional).
73
99
  * @param timeoutMs - Milliseconds before aborting. Default: 30 000.
100
+ * @param fetchImpl - Fetch implementation to use. Defaults to global `fetch`.
101
+ * Pass `instrumentedFetch` to include OUTBOUND_HTTP logging.
74
102
  */
75
- export async function fetchWithTimeout(url, init, timeoutMs = 30_000) {
76
- const controller = new AbortController();
77
- const timer = setTimeout(() => controller.abort(new DOMException('Request timed out', 'TimeoutError')), timeoutMs);
78
- timer.unref?.();
79
- let signal;
103
+ export async function fetchWithTimeout(url, init, timeoutMs = 30_000, fetchImpl = fetch) {
80
104
  const callerSignal = init?.signal;
81
- if (callerSignal) {
82
- // Merge caller signal + our timeout: first one to fire wins
83
- signal = AbortSignal.any([callerSignal, controller.signal]);
84
- }
85
- else {
86
- signal = controller.signal;
87
- }
105
+ const { signal, dispose } = createTimeoutController(timeoutMs, callerSignal);
88
106
  try {
89
- return await fetch(url, { ...init, signal });
107
+ return await fetchImpl(url, { ...init, signal });
90
108
  }
91
109
  finally {
92
- clearTimeout(timer);
110
+ dispose();
93
111
  }
94
112
  }
@@ -8,4 +8,9 @@
8
8
  * satisfy TypeScript's type system at the generic-dispatch boundary.
9
9
  */
10
10
  export declare function toRecord(value: unknown): Record<string, unknown>;
11
+ /**
12
+ * Type guard: returns true iff `value` is a plain object (non-null, non-array).
13
+ * Use this in place of the commonly hand-rolled `typeof x === 'object' && x !== null && !Array.isArray(x)`.
14
+ */
15
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
11
16
  //# sourceMappingURL=record-coerce.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"record-coerce.d.ts","sourceRoot":"","sources":["../../../src/platform/utils/record-coerce.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEhE"}
1
+ {"version":3,"file":"record-coerce.d.ts","sourceRoot":"","sources":["../../../src/platform/utils/record-coerce.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEhE;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE"}
@@ -10,3 +10,10 @@
10
10
  export function toRecord(value) {
11
11
  return value;
12
12
  }
13
+ /**
14
+ * Type guard: returns true iff `value` is a plain object (non-null, non-array).
15
+ * Use this in place of the commonly hand-rolled `typeof x === 'object' && x !== null && !Array.isArray(x)`.
16
+ */
17
+ export function isRecord(value) {
18
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
19
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/platform/utils/retry.ts"],"names":[],"mappings":"AAIA,kEAAkE;AAClE,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB;AAQD,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAOzE;AAED,8EAA8E;AAC9E,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAOjE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAaxD;AASD;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC/B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,EAC7B,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GACjE,OAAO,CAAC,CAAC,CAAC,CA4BZ"}
1
+ {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/platform/utils/retry.ts"],"names":[],"mappings":"AAKA,kEAAkE;AAClE,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB;AAQD,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAOzE;AAED,8EAA8E;AAC9E,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAOjE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAaxD;AASD;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC/B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,EAC7B,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GACjE,OAAO,CAAC,CAAC,CAAC,CAyBZ"}
@@ -1,6 +1,7 @@
1
1
  import { randomInt } from 'node:crypto';
2
2
  import { AppError, RETRYABLE_STATUS_CODES } from '../types/errors.js';
3
3
  import { summarizeError } from './error-display.js';
4
+ import { sleep } from './concurrency.js';
4
5
  const DEFAULT_CONFIG = {
5
6
  maxRetries: 3,
6
7
  initialDelayMs: 1000,
@@ -70,10 +71,7 @@ export async function withRetry(fn, config, onRetry) {
70
71
  }
71
72
  const delayMs = computeDelay(attempt, cfg.initialDelayMs, cfg.maxDelayMs);
72
73
  onRetry?.(attempt + 1, lastError, delayMs);
73
- await new Promise((resolve) => {
74
- const timer = setTimeout(resolve, delayMs);
75
- timer.unref?.();
76
- });
74
+ await sleep(delayMs);
77
75
  }
78
76
  }
79
77
  throw lastError;
@@ -1,6 +1,6 @@
1
1
  import { readFileSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
- let version = '0.34.0';
3
+ let version = '0.34.1';
4
4
  try {
5
5
  const pkg = JSON.parse(readFileSync(join(import.meta.dir, '..', '..', 'package.json'), 'utf-8'));
6
6
  version = pkg.version ?? version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pellux/goodvibes-sdk",
3
- "version": "0.34.0",
3
+ "version": "0.34.1",
4
4
  "description": "TypeScript SDK for building GoodVibes operator, peer, web, mobile, and daemon-connected apps with typed contracts, auth, realtime events, and transport layers.",
5
5
  "keywords": [
6
6
  "goodvibes",
@@ -453,14 +453,14 @@
453
453
  "sideEffects": false,
454
454
  "type": "module",
455
455
  "dependencies": {
456
- "@pellux/goodvibes-contracts": "0.34.0",
457
- "@pellux/goodvibes-daemon-sdk": "0.34.0",
458
- "@pellux/goodvibes-errors": "0.34.0",
459
- "@pellux/goodvibes-operator-sdk": "0.34.0",
460
- "@pellux/goodvibes-peer-sdk": "0.34.0",
461
- "@pellux/goodvibes-transport-core": "0.34.0",
462
- "@pellux/goodvibes-transport-http": "0.34.0",
463
- "@pellux/goodvibes-transport-realtime": "0.34.0"
456
+ "@pellux/goodvibes-contracts": "0.34.1",
457
+ "@pellux/goodvibes-daemon-sdk": "0.34.1",
458
+ "@pellux/goodvibes-errors": "0.34.1",
459
+ "@pellux/goodvibes-operator-sdk": "0.34.1",
460
+ "@pellux/goodvibes-peer-sdk": "0.34.1",
461
+ "@pellux/goodvibes-transport-core": "0.34.1",
462
+ "@pellux/goodvibes-transport-http": "0.34.1",
463
+ "@pellux/goodvibes-transport-realtime": "0.34.1"
464
464
  },
465
465
  "optionalDependencies": {
466
466
  "@agentclientprotocol/sdk": "^0.21.0",