@magic-markdown/cli 0.3.10 → 0.3.11
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/index.js +10 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10997,7 +10997,7 @@ var RemoteDocumentIO = class {
|
|
|
10997
10997
|
};
|
|
10998
10998
|
|
|
10999
10999
|
// src/agent.ts
|
|
11000
|
-
var CLI_VERSION = "0.3.
|
|
11000
|
+
var CLI_VERSION = "0.3.11";
|
|
11001
11001
|
var CLI_PACKAGE_NAME = "@magic-markdown/cli";
|
|
11002
11002
|
var AGENT_COMMANDS = [
|
|
11003
11003
|
{
|
|
@@ -11565,6 +11565,7 @@ function nextCommands(map) {
|
|
|
11565
11565
|
}
|
|
11566
11566
|
|
|
11567
11567
|
// src/fs-io.ts
|
|
11568
|
+
import { randomUUID } from "node:crypto";
|
|
11568
11569
|
import { mkdir as mkdir2, readFile as readFile2, readdir as readdir2, realpath, rename, rm as rm2, stat as stat2, writeFile as writeFile2 } from "node:fs/promises";
|
|
11569
11570
|
import { dirname as dirname4, join as join2, relative, resolve } from "node:path";
|
|
11570
11571
|
var NodeWorkspaceIO = class {
|
|
@@ -11585,7 +11586,7 @@ var NodeWorkspaceIO = class {
|
|
|
11585
11586
|
async writeTextAtomic(path, content) {
|
|
11586
11587
|
const target = await this.resolveWritablePath(path, Buffer.byteLength(content, "utf8"));
|
|
11587
11588
|
await mkdir2(dirname4(target), { recursive: true });
|
|
11588
|
-
const temporary = `${target}.${process.pid}.${Date.now()}.tmp`;
|
|
11589
|
+
const temporary = `${target}.${process.pid}.${Date.now()}.${randomUUID()}.tmp`;
|
|
11589
11590
|
await writeFile2(temporary, content, "utf8");
|
|
11590
11591
|
await rename(temporary, target);
|
|
11591
11592
|
}
|
|
@@ -12304,7 +12305,7 @@ function respond(payload) {
|
|
|
12304
12305
|
}
|
|
12305
12306
|
|
|
12306
12307
|
// src/remote-api.ts
|
|
12307
|
-
import { randomUUID } from "node:crypto";
|
|
12308
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
12308
12309
|
async function postPresence(share, shareUrl, docId, agentId, agentName) {
|
|
12309
12310
|
await fetchJson(agentUrl({ ...share, shareUrl }, docId, "presence"), {
|
|
12310
12311
|
method: "POST",
|
|
@@ -12462,7 +12463,7 @@ async function postReview(record, docId, additions, actor) {
|
|
|
12462
12463
|
{
|
|
12463
12464
|
method: "POST",
|
|
12464
12465
|
headers: { ...shareHeaders(record.shareUrl), "Content-Type": "application/json" },
|
|
12465
|
-
body: JSON.stringify({ actor, changeId:
|
|
12466
|
+
body: JSON.stringify({ actor, changeId: randomUUID2(), ...additions })
|
|
12466
12467
|
}
|
|
12467
12468
|
);
|
|
12468
12469
|
return response.document;
|
|
@@ -12487,7 +12488,7 @@ async function pushDocument(record, baseDocument, markdown, sidecar) {
|
|
|
12487
12488
|
// Full identity so version-history commits show the agent's name.
|
|
12488
12489
|
actor: { id: record.agentId, name: record.agentName, kind: "agent" },
|
|
12489
12490
|
sourceId: record.agentId,
|
|
12490
|
-
changeId:
|
|
12491
|
+
changeId: randomUUID2(),
|
|
12491
12492
|
payload,
|
|
12492
12493
|
createdAt
|
|
12493
12494
|
})
|
|
@@ -13399,7 +13400,7 @@ function optionalFolderTarget(value) {
|
|
|
13399
13400
|
}
|
|
13400
13401
|
|
|
13401
13402
|
// src/bridge.ts
|
|
13402
|
-
import { createHash as createHash2, randomUUID as
|
|
13403
|
+
import { createHash as createHash2, randomUUID as randomUUID3 } from "node:crypto";
|
|
13403
13404
|
import { basename as basename2, resolve as resolve4 } from "node:path";
|
|
13404
13405
|
function bridgeSetupIdentity(input) {
|
|
13405
13406
|
const actorName = input.actorName?.trim() || "Agent";
|
|
@@ -13444,7 +13445,7 @@ async function runBridge(options) {
|
|
|
13444
13445
|
replicaPrefix: options.replicaPrefix,
|
|
13445
13446
|
lastAppliedHead: localManifestSource?.canonicalHead
|
|
13446
13447
|
});
|
|
13447
|
-
const sourceId = `bridge_${replicaId}_${
|
|
13448
|
+
const sourceId = `bridge_${replicaId}_${randomUUID3().replaceAll("-", "").slice(0, 8)}`;
|
|
13448
13449
|
const io = new PathMappedWorkspaceIO(root, mapping);
|
|
13449
13450
|
const signatures = /* @__PURE__ */ new Map();
|
|
13450
13451
|
const pendingDocs = /* @__PURE__ */ new Set();
|
|
@@ -13665,7 +13666,7 @@ async function runBridge(options) {
|
|
|
13665
13666
|
kind: actorKindForBridge(options.actorId)
|
|
13666
13667
|
},
|
|
13667
13668
|
sourceId,
|
|
13668
|
-
changeId:
|
|
13669
|
+
changeId: randomUUID3(),
|
|
13669
13670
|
payload,
|
|
13670
13671
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
13671
13672
|
})
|
|
@@ -13784,7 +13785,7 @@ async function fetchScopedRoot(options, rootId) {
|
|
|
13784
13785
|
async function registerRoot(options, root, rootId, mapping) {
|
|
13785
13786
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
13786
13787
|
const existingRoot = await fetchExistingRoot(options, rootId);
|
|
13787
|
-
const canonicalHead = existingRoot?.canonical.head ?? mapping.lastAppliedHead ?? `head_${
|
|
13788
|
+
const canonicalHead = existingRoot?.canonical.head ?? mapping.lastAppliedHead ?? `head_${randomUUID3().replaceAll("-", "").slice(0, 16)}`;
|
|
13788
13789
|
const rootName = options.sourceName ?? existingRoot?.name ?? (basename2(root) || rootId);
|
|
13789
13790
|
const owner = ownerForBridge(options.actorId, rootName, options.actorName);
|
|
13790
13791
|
const replica = { ...mapping, lastAppliedHead: canonicalHead, status: "synced", updatedAt: now };
|
package/package.json
CHANGED