@liushuangls/open-connector-runtime 1.4.0-sider.2 → 1.4.0-sider.3
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.
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const MAX_UUID_V7_TIMESTAMP = 0xffffffffffff;
|
|
2
|
+
/** Generates an RFC 9562 UUIDv7 using the current Unix millisecond timestamp. */
|
|
3
|
+
export function generateUuidV7(timestampMs = Date.now()) {
|
|
4
|
+
if (!Number.isSafeInteger(timestampMs) || timestampMs < 0 || timestampMs > MAX_UUID_V7_TIMESTAMP) {
|
|
5
|
+
throw new RangeError("UUIDv7 timestamp must be an unsigned 48-bit integer.");
|
|
6
|
+
}
|
|
7
|
+
const bytes = crypto.getRandomValues(new Uint8Array(16));
|
|
8
|
+
let remainingTimestamp = timestampMs;
|
|
9
|
+
for (let index = 5; index >= 0; index -= 1) {
|
|
10
|
+
bytes[index] = remainingTimestamp & 0xff;
|
|
11
|
+
remainingTimestamp = Math.floor(remainingTimestamp / 0x100);
|
|
12
|
+
}
|
|
13
|
+
bytes[6] = ((bytes[6] ?? 0) & 0x0f) | 0x70;
|
|
14
|
+
bytes[8] = ((bytes[8] ?? 0) & 0x3f) | 0x80;
|
|
15
|
+
const hexadecimal = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
16
|
+
return `${hexadecimal.slice(0, 8)}-${hexadecimal.slice(8, 12)}-${hexadecimal.slice(12, 16)}-${hexadecimal.slice(16, 20)}-${hexadecimal.slice(20)}`;
|
|
17
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ConnectionError } from "../../connection-service.js";
|
|
2
2
|
import { executeAction as executeProviderAction } from "../../core/execution.js";
|
|
3
|
+
import { generateUuidV7 } from "../../core/uuid-v7.js";
|
|
3
4
|
import { safeRunLogError, summarizeForRunLog } from "./run-log-summary.js";
|
|
4
5
|
/**
|
|
5
6
|
* Shared execution boundary for HTTP, MCP, and future local callers.
|
|
@@ -19,7 +20,7 @@ export class ActionRunner {
|
|
|
19
20
|
}, "action run rejected");
|
|
20
21
|
return undefined;
|
|
21
22
|
}
|
|
22
|
-
const executionId =
|
|
23
|
+
const executionId = generateUuidV7();
|
|
23
24
|
const logContext = {
|
|
24
25
|
actionId: action.id,
|
|
25
26
|
service: action.service,
|
package/package.json
CHANGED