@bobannomi/client 0.8.0 → 0.8.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.
- package/README.md +18 -2
- package/dist/index.d.ts +282 -120
- package/dist/index.js +141 -24
- package/dist/index.js.map +3 -3
- package/dist/service.js +149 -32
- package/dist/service.js.map +3 -3
- package/package.json +4 -4
package/dist/service.js
CHANGED
|
@@ -1610,12 +1610,12 @@ var require_proper_lockfile = __commonJS({
|
|
|
1610
1610
|
|
|
1611
1611
|
// src/service/service.ts
|
|
1612
1612
|
import { access, realpath, unlink } from "node:fs/promises";
|
|
1613
|
-
import { basename as basename2, dirname as
|
|
1613
|
+
import { basename as basename2, dirname as dirname4, join as join2, resolve as resolve4 } from "node:path";
|
|
1614
1614
|
import { setTimeout as sleep2 } from "node:timers/promises";
|
|
1615
1615
|
|
|
1616
1616
|
// ../host-config/src/storage/paths.ts
|
|
1617
|
-
import { basename, isAbsolute, join, parse, resolve } from "node:path";
|
|
1618
|
-
import { userInfo } from "node:os";
|
|
1617
|
+
import { basename, dirname, isAbsolute, join, parse, relative, resolve, sep } from "node:path";
|
|
1618
|
+
import { homedir, userInfo } from "node:os";
|
|
1619
1619
|
var PROJECT_CONFIG_DIR_NAME = ".bobannomi";
|
|
1620
1620
|
function requireAbsoluteDataRoot(path2, source = "dataRoot") {
|
|
1621
1621
|
const incompleteWindowsPath = process.platform === "win32" && (parse(path2).root.length === 1 || /^[\\/]{2}[?.][\\/]/.test(path2));
|
|
@@ -1781,6 +1781,25 @@ var ScheduleResource = class {
|
|
|
1781
1781
|
}
|
|
1782
1782
|
};
|
|
1783
1783
|
|
|
1784
|
+
// ../plugin-contracts/src/manifest/desktop.ts
|
|
1785
|
+
var DESKTOP_COMPOSER_PLACEMENTS = [
|
|
1786
|
+
"composer.above",
|
|
1787
|
+
"composer.toolbar.left",
|
|
1788
|
+
"composer.toolbar.right"
|
|
1789
|
+
];
|
|
1790
|
+
var DESKTOP_PLACEMENTS = [
|
|
1791
|
+
"start.visual",
|
|
1792
|
+
"shell.floating",
|
|
1793
|
+
"appearance.theme",
|
|
1794
|
+
"shell.brand",
|
|
1795
|
+
"conversation.view",
|
|
1796
|
+
"tools.panel",
|
|
1797
|
+
"conversation.header.actions",
|
|
1798
|
+
...DESKTOP_COMPOSER_PLACEMENTS,
|
|
1799
|
+
"settings.extension",
|
|
1800
|
+
"main.page"
|
|
1801
|
+
];
|
|
1802
|
+
|
|
1784
1803
|
// ../domain-contracts/src/sessions/records.ts
|
|
1785
1804
|
var SESSION_EVENT_SCHEMA_VERSION = 1;
|
|
1786
1805
|
var SESSION_EVENT_SCHEMA_VERSIONS = {
|
|
@@ -2915,7 +2934,7 @@ function parseAttachmentUploadRequest(value) {
|
|
|
2915
2934
|
}
|
|
2916
2935
|
|
|
2917
2936
|
// ../protocol/src/runtime/capabilities.ts
|
|
2918
|
-
var CURRENT_PROTOCOL_VERSION =
|
|
2937
|
+
var CURRENT_PROTOCOL_VERSION = 1;
|
|
2919
2938
|
var PROTOCOL_VERSION_HEADER = "x-bobannomi-protocol-version";
|
|
2920
2939
|
function parseServerCapabilities(value) {
|
|
2921
2940
|
if (!isRecord(value))
|
|
@@ -3978,10 +3997,7 @@ async function create(transport, input, options = {}, prepareModel) {
|
|
|
3978
3997
|
{
|
|
3979
3998
|
method: "POST",
|
|
3980
3999
|
body,
|
|
3981
|
-
headers: {
|
|
3982
|
-
...body.workspaceId === void 0 ? {} : { "x-bobannomi-workspace-id": body.workspaceId },
|
|
3983
|
-
...modelConnection === void 0 ? {} : { "x-bobannomi-model-connection": modelConnection }
|
|
3984
|
-
},
|
|
4000
|
+
...modelConnection === void 0 ? {} : { headers: { "x-bobannomi-model-connection": modelConnection } },
|
|
3985
4001
|
signal: options.signal
|
|
3986
4002
|
}
|
|
3987
4003
|
);
|
|
@@ -4693,10 +4709,9 @@ async function waitForRun(client, options) {
|
|
|
4693
4709
|
const bucket = update.state.buckets[options.sessionId];
|
|
4694
4710
|
const run = bucket?.runs[options.runId];
|
|
4695
4711
|
if (!run || run.status === "pending" || run.status === "running") continue;
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
};
|
|
4712
|
+
const messages = getVisibleSessionMessages(bucket).filter((item) => item.message.runId === options.runId);
|
|
4713
|
+
const text3 = messages.filter(({ message }) => message.role === "assistant").flatMap(({ parts }) => parts.filter((part) => part.type === "text").map((part) => part.text ?? "")).join("");
|
|
4714
|
+
return { run, messages, text: text3 };
|
|
4700
4715
|
}
|
|
4701
4716
|
options.signal?.throwIfAborted();
|
|
4702
4717
|
throw new Error(`Run ${options.runId} observation ended before a terminal state was available`);
|
|
@@ -4957,8 +4972,8 @@ async function interrupt(transport, sessionId, options = {}) {
|
|
|
4957
4972
|
);
|
|
4958
4973
|
}
|
|
4959
4974
|
|
|
4960
|
-
// src/resources/session/session
|
|
4961
|
-
function
|
|
4975
|
+
// src/resources/session/session.ts
|
|
4976
|
+
function bindSession(transport, syncClient, management, sessionId, prepareModel) {
|
|
4962
4977
|
function cancelQueuedPrompt2(inputId, input, options) {
|
|
4963
4978
|
return cancelQueuedPrompt(transport, sessionId, inputId, input, options);
|
|
4964
4979
|
}
|
|
@@ -5007,7 +5022,12 @@ function createSessionHandle(transport, syncClient, management, sessionId, prepa
|
|
|
5007
5022
|
return decodeAgentSessionStateSnapshot(response);
|
|
5008
5023
|
},
|
|
5009
5024
|
/** `POST /sessions/:id/prompts` — 提交用户输入并触发/排队一次 run。 */
|
|
5010
|
-
prompt(input, options
|
|
5025
|
+
async prompt(input, options) {
|
|
5026
|
+
if (input.text !== void 0) {
|
|
5027
|
+
const { text: text3, ...fields3 } = input;
|
|
5028
|
+
if (fields3.items !== void 0) throw new TypeError("Pass either text or items to session.prompt()");
|
|
5029
|
+
return admitPrompt(transport, sessionId, { ...fields3, items: [{ type: "text", text: text3 }] }, options);
|
|
5030
|
+
}
|
|
5011
5031
|
return admitPrompt(transport, sessionId, input, options);
|
|
5012
5032
|
},
|
|
5013
5033
|
/** `POST /sessions/:id/interrupt` — 中断当前/排队中的 run。 */
|
|
@@ -5240,7 +5260,7 @@ var SessionResource = class {
|
|
|
5240
5260
|
/** Bind a session ID locally. Operations use this resource's daemon connection when called. */
|
|
5241
5261
|
byId(sessionId) {
|
|
5242
5262
|
if (typeof sessionId !== "string" || sessionId.length === 0) throw new TypeError("sessionId is required");
|
|
5243
|
-
return
|
|
5263
|
+
return bindSession(this.#transport, { sessions: this, events: this.#events }, this.#management, sessionId, this.prepareModel);
|
|
5244
5264
|
}
|
|
5245
5265
|
/** `GET /sessions/search` - search saved conversation text without opening it. */
|
|
5246
5266
|
async search(options) {
|
|
@@ -5269,9 +5289,10 @@ var SessionResource = class {
|
|
|
5269
5289
|
getDraftComposerOptions(input, options = {}) {
|
|
5270
5290
|
return getDraftComposerOptions(this.#transport, input, options);
|
|
5271
5291
|
}
|
|
5272
|
-
/**
|
|
5273
|
-
create(input, options = {}) {
|
|
5274
|
-
|
|
5292
|
+
/** Create a session and bind its operations to this connection. */
|
|
5293
|
+
async create(input, options = {}) {
|
|
5294
|
+
const record4 = await create(this.#transport, input, options, this.prepareModel);
|
|
5295
|
+
return { ...this.byId(record4.id), record: record4 };
|
|
5275
5296
|
}
|
|
5276
5297
|
getConfigurationOptions(input, options = {}) {
|
|
5277
5298
|
return getConfigurationOptions(this.#transport, input, options);
|
|
@@ -5287,7 +5308,7 @@ var AttachmentResource = class {
|
|
|
5287
5308
|
this.transport = transport;
|
|
5288
5309
|
}
|
|
5289
5310
|
transport;
|
|
5290
|
-
/**
|
|
5311
|
+
/** Inspect and maintain attachment storage for the current daemon. */
|
|
5291
5312
|
storage = {
|
|
5292
5313
|
scan: (options) => this.transport.request("/attachments/storage", options),
|
|
5293
5314
|
repair: (options) => this.transport.request("/attachments/storage/actions", { ...options, method: "POST", body: { action: "repair-safe" } }),
|
|
@@ -5302,19 +5323,24 @@ var AttachmentResource = class {
|
|
|
5302
5323
|
method: "POST",
|
|
5303
5324
|
headers: headers2,
|
|
5304
5325
|
body: input.body,
|
|
5326
|
+
query: { sessionId: input.sessionId },
|
|
5305
5327
|
signal: input.signal
|
|
5306
5328
|
});
|
|
5307
5329
|
return parseAttachmentAssetRecord(await response.json());
|
|
5308
5330
|
}
|
|
5309
5331
|
async getUpload(input) {
|
|
5310
|
-
const response = await this.transport.requestResponse("/attachments/uploads", {
|
|
5332
|
+
const response = await this.transport.requestResponse("/attachments/uploads", {
|
|
5333
|
+
headers: uploadIdentityHeaders(input),
|
|
5334
|
+
query: { sessionId: input.sessionId },
|
|
5335
|
+
signal: input.signal
|
|
5336
|
+
});
|
|
5311
5337
|
const value = await response.json();
|
|
5312
5338
|
return value === null ? null : parseAttachmentAssetRecord(value);
|
|
5313
5339
|
}
|
|
5314
5340
|
async get(id2, options = {}) {
|
|
5315
5341
|
const value = await this.transport.request(
|
|
5316
5342
|
`/attachments/${encodeURIComponent(id2)}`,
|
|
5317
|
-
{ signal: options.signal }
|
|
5343
|
+
{ query: { sessionId: options.sessionId }, signal: options.signal }
|
|
5318
5344
|
);
|
|
5319
5345
|
return parseAttachmentAssetRecord(value);
|
|
5320
5346
|
}
|
|
@@ -5325,13 +5351,13 @@ var AttachmentResource = class {
|
|
|
5325
5351
|
if (range) headers2.range = range;
|
|
5326
5352
|
return await this.transport.requestResponse(
|
|
5327
5353
|
`/attachments/${encodeURIComponent(id2)}/content`,
|
|
5328
|
-
{ method: "GET", headers: headers2, signal: options.signal }
|
|
5354
|
+
{ method: "GET", headers: headers2, query: { sessionId: options.sessionId }, signal: options.signal }
|
|
5329
5355
|
);
|
|
5330
5356
|
}
|
|
5331
|
-
async delete(id2, options
|
|
5357
|
+
async delete(id2, options) {
|
|
5332
5358
|
const value = await this.transport.request(
|
|
5333
5359
|
`/attachments/${encodeURIComponent(id2)}`,
|
|
5334
|
-
{ method: "DELETE", signal: options.signal }
|
|
5360
|
+
{ method: "DELETE", query: { sessionId: options.sessionId, draftId: options.draftId }, signal: options.signal }
|
|
5335
5361
|
);
|
|
5336
5362
|
return parseAttachmentAssetRecord(value);
|
|
5337
5363
|
}
|
|
@@ -5571,6 +5597,7 @@ function matchingOperation(receipt2, operationId) {
|
|
|
5571
5597
|
}
|
|
5572
5598
|
|
|
5573
5599
|
// src/resources/plugins/plugin-resource.ts
|
|
5600
|
+
var archiveUploads = "/plugins/archive/uploads";
|
|
5574
5601
|
var PluginResource = class {
|
|
5575
5602
|
constructor(transport) {
|
|
5576
5603
|
this.transport = transport;
|
|
@@ -5616,6 +5643,37 @@ var PluginResource = class {
|
|
|
5616
5643
|
installArchive(input, options) {
|
|
5617
5644
|
return this.transport.request("/plugins/archive/install", { ...options, method: "POST", body: input });
|
|
5618
5645
|
}
|
|
5646
|
+
/** Preview a client-selected archive by uploading its bytes to the daemon. */
|
|
5647
|
+
async uploadArchive(input, options) {
|
|
5648
|
+
const format = input.fileName.toLowerCase().match(/\.(zip|tar|tar\.gz|tgz)$/)?.[1];
|
|
5649
|
+
if (!format) throw new Error("Plugin archive must be ZIP, TAR, TAR.GZ or TGZ");
|
|
5650
|
+
const response = await this.transport.requestResponse(archiveUploads, {
|
|
5651
|
+
...options,
|
|
5652
|
+
method: "POST",
|
|
5653
|
+
body: input.archive,
|
|
5654
|
+
query: { cwd: input.cwd, format },
|
|
5655
|
+
headers: { "content-type": "application/octet-stream" }
|
|
5656
|
+
});
|
|
5657
|
+
const preview = await response.json();
|
|
5658
|
+
if (!preview?.candidateId || !/^[a-f0-9]{64}$/.test(preview.archiveDigest)) {
|
|
5659
|
+
throw new ProtocolDataError("Plugin archive preview is missing its candidate ID or SHA-256 digest");
|
|
5660
|
+
}
|
|
5661
|
+
return preview;
|
|
5662
|
+
}
|
|
5663
|
+
/** Release an uploaded archive preview. Unclaimed previews also expire. */
|
|
5664
|
+
cancelUploadedArchive(candidateId, options) {
|
|
5665
|
+
return this.transport.request(`${archiveUploads}/${encodeURIComponent(candidateId)}`, { ...options, method: "DELETE" });
|
|
5666
|
+
}
|
|
5667
|
+
/** Save the operation ID before submitting. Recover an uncertain result with getArchiveInstallOperation. */
|
|
5668
|
+
async installUploadedArchive(input, options) {
|
|
5669
|
+
const receipt2 = await this.transport.request(`${archiveUploads}/install`, { ...options, method: "POST", body: input });
|
|
5670
|
+
return matchingArchiveReceipt(receipt2, input.operationId);
|
|
5671
|
+
}
|
|
5672
|
+
/** Read the result of the original upload install without submitting it again. */
|
|
5673
|
+
async getArchiveInstallOperation(operationId, options) {
|
|
5674
|
+
const receipt2 = await this.transport.request(`${archiveUploads}/operations/${encodeURIComponent(operationId)}`, options);
|
|
5675
|
+
return matchingArchiveReceipt(receipt2, operationId);
|
|
5676
|
+
}
|
|
5619
5677
|
/** Read the digest and required permissions for a Git source. */
|
|
5620
5678
|
previewGit(input, options) {
|
|
5621
5679
|
return this.transport.request("/plugins/git/preview", { ...options, method: "POST", body: input });
|
|
@@ -5631,6 +5689,10 @@ var PluginResource = class {
|
|
|
5631
5689
|
return this.transport.request("/plugins/reload", { ...options, method: "POST", body: input });
|
|
5632
5690
|
}
|
|
5633
5691
|
};
|
|
5692
|
+
function matchingArchiveReceipt(receipt2, operationId) {
|
|
5693
|
+
if (receipt2?.operationId !== operationId) throw new ProtocolDataError("Plugin archive receipt does not match original operation", "operationId");
|
|
5694
|
+
return receipt2;
|
|
5695
|
+
}
|
|
5634
5696
|
|
|
5635
5697
|
// src/resources/channels/channel-resource.ts
|
|
5636
5698
|
var ChannelResource = class {
|
|
@@ -5697,6 +5759,14 @@ var ProjectResource = class {
|
|
|
5697
5759
|
this.transport = transport;
|
|
5698
5760
|
}
|
|
5699
5761
|
transport;
|
|
5762
|
+
/** Read the daemon's registered project directories and their current directory identities. */
|
|
5763
|
+
listDirectories(options) {
|
|
5764
|
+
return this.transport.request("/projects/directories", options);
|
|
5765
|
+
}
|
|
5766
|
+
/** Apply the default shell only while the observed project and registered directory still match. */
|
|
5767
|
+
setDirectoryDefaultShell(input, options) {
|
|
5768
|
+
return this.transport.request("/projects/directories/default-shell", { ...options, method: "PATCH", body: input });
|
|
5769
|
+
}
|
|
5700
5770
|
/** `GET /projects` */
|
|
5701
5771
|
async list(options = {}) {
|
|
5702
5772
|
const { signal, ...query } = options;
|
|
@@ -5706,7 +5776,7 @@ var ProjectResource = class {
|
|
|
5706
5776
|
);
|
|
5707
5777
|
return response.projects;
|
|
5708
5778
|
}
|
|
5709
|
-
/** Register or reopen a
|
|
5779
|
+
/** Register or reopen a project on the daemon host, recording the directory identity and last-opened time. */
|
|
5710
5780
|
async register(path2, options) {
|
|
5711
5781
|
return (await this.transport.request("/projects/inspect", {
|
|
5712
5782
|
...options,
|
|
@@ -5739,7 +5809,7 @@ var ProjectResource = class {
|
|
|
5739
5809
|
{ ...options, method: "PATCH", body: { defaultShell } }
|
|
5740
5810
|
)).project;
|
|
5741
5811
|
}
|
|
5742
|
-
/**
|
|
5812
|
+
/** Rebind a project to the current directory at path. Pass the prior project path as expectedPath to reject a stale update. */
|
|
5743
5813
|
async rebind(projectId, path2, options) {
|
|
5744
5814
|
const { expectedPath, signal } = typeof options === "string" ? { expectedPath: options } : options ?? {};
|
|
5745
5815
|
return (await this.transport.request(
|
|
@@ -5788,11 +5858,58 @@ var WorktreeResource = class {
|
|
|
5788
5858
|
};
|
|
5789
5859
|
|
|
5790
5860
|
// src/resources/workspace/git-resource.ts
|
|
5861
|
+
var GitWorkspaceResource = class {
|
|
5862
|
+
constructor(transport, target) {
|
|
5863
|
+
this.transport = transport;
|
|
5864
|
+
this.target = target;
|
|
5865
|
+
}
|
|
5866
|
+
transport;
|
|
5867
|
+
target;
|
|
5868
|
+
status(options) {
|
|
5869
|
+
return this.read("git.status", {}, options);
|
|
5870
|
+
}
|
|
5871
|
+
listBranches(options) {
|
|
5872
|
+
return this.read("git.listBranches", {}, options);
|
|
5873
|
+
}
|
|
5874
|
+
changes(params = {}, options) {
|
|
5875
|
+
return this.read("git.changes", params, options);
|
|
5876
|
+
}
|
|
5877
|
+
diff(params = {}, options) {
|
|
5878
|
+
return this.read("git.diff", params, options);
|
|
5879
|
+
}
|
|
5880
|
+
/** Submit an original branch operation for a registered project. */
|
|
5881
|
+
changeBranch(requestId, original, options) {
|
|
5882
|
+
return this.transport.request("/git/workspace/branch", {
|
|
5883
|
+
...options,
|
|
5884
|
+
method: "POST",
|
|
5885
|
+
body: { target: this.target, requestId, original }
|
|
5886
|
+
});
|
|
5887
|
+
}
|
|
5888
|
+
/** Query the same original body and request ID after an interrupted branch operation. */
|
|
5889
|
+
getBranchOperation(requestId, original, options) {
|
|
5890
|
+
return this.transport.request("/git/workspace/branch-result", {
|
|
5891
|
+
...options,
|
|
5892
|
+
method: "POST",
|
|
5893
|
+
body: { target: this.target, requestId, original }
|
|
5894
|
+
});
|
|
5895
|
+
}
|
|
5896
|
+
read(method, params, options) {
|
|
5897
|
+
return this.transport.request("/git/workspace/read", {
|
|
5898
|
+
...options,
|
|
5899
|
+
method: "POST",
|
|
5900
|
+
body: { target: this.target, method, params }
|
|
5901
|
+
});
|
|
5902
|
+
}
|
|
5903
|
+
};
|
|
5791
5904
|
var GitResource = class {
|
|
5792
5905
|
constructor(transport) {
|
|
5793
5906
|
this.transport = transport;
|
|
5794
5907
|
}
|
|
5795
5908
|
transport;
|
|
5909
|
+
/** Open Git operations for a registered project or an existing session in the current daemon. */
|
|
5910
|
+
workspace(target) {
|
|
5911
|
+
return new GitWorkspaceResource(this.transport, structuredClone(target));
|
|
5912
|
+
}
|
|
5796
5913
|
/** `GET /git/diff?cwd=&full=` */
|
|
5797
5914
|
async getDiff(options) {
|
|
5798
5915
|
const { signal, cwd, full } = options;
|
|
@@ -6470,7 +6587,7 @@ var BobanNomiClient = class {
|
|
|
6470
6587
|
import { spawn } from "node:child_process";
|
|
6471
6588
|
import { createRequire } from "node:module";
|
|
6472
6589
|
import { readFile } from "node:fs/promises";
|
|
6473
|
-
import { dirname, resolve as resolve2 } from "node:path";
|
|
6590
|
+
import { dirname as dirname2, resolve as resolve2 } from "node:path";
|
|
6474
6591
|
async function defaultCommand(cwd, dataRoot) {
|
|
6475
6592
|
try {
|
|
6476
6593
|
const require2 = createRequire(resolve2(cwd, "package.json"));
|
|
@@ -6478,7 +6595,7 @@ async function defaultCommand(cwd, dataRoot) {
|
|
|
6478
6595
|
const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
|
|
6479
6596
|
const bin = typeof manifest.bin === "string" ? manifest.bin : manifest.bin?.nomi;
|
|
6480
6597
|
if (typeof bin !== "string") throw new Error("CLI bin is missing");
|
|
6481
|
-
return [process.execPath, resolve2(
|
|
6598
|
+
return [process.execPath, resolve2(dirname2(manifestPath), bin), "--data-root", dataRoot, "serve", "--register", "--host", "127.0.0.1", "--port", "0"];
|
|
6482
6599
|
} catch {
|
|
6483
6600
|
throw new Error("Cannot locate BobanNomi CLI. Pass Service.ensure({ command: [executable, ...args] }) with a built CLI.");
|
|
6484
6601
|
}
|
|
@@ -6562,7 +6679,7 @@ function sameInstance(left, right) {
|
|
|
6562
6679
|
// src/service/startup-lock.ts
|
|
6563
6680
|
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
6564
6681
|
import { lstat, mkdir } from "node:fs/promises";
|
|
6565
|
-
import { dirname as
|
|
6682
|
+
import { dirname as dirname3 } from "node:path";
|
|
6566
6683
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
6567
6684
|
var startupLockPath = (file) => `${file}.sdk-start.lock`;
|
|
6568
6685
|
async function hasStartupLock(file) {
|
|
@@ -6575,7 +6692,7 @@ async function hasStartupLock(file) {
|
|
|
6575
6692
|
}
|
|
6576
6693
|
}
|
|
6577
6694
|
async function acquireStartupLock(file, end, signal) {
|
|
6578
|
-
await mkdir(
|
|
6695
|
+
await mkdir(dirname3(file), { recursive: true });
|
|
6579
6696
|
const compromised = new AbortController();
|
|
6580
6697
|
while (Date.now() < end) {
|
|
6581
6698
|
signal?.throwIfAborted();
|
|
@@ -6661,7 +6778,7 @@ async function realpathAllowMissing(path2) {
|
|
|
6661
6778
|
try {
|
|
6662
6779
|
return await realpath(path2);
|
|
6663
6780
|
} catch (error) {
|
|
6664
|
-
const parent =
|
|
6781
|
+
const parent = dirname4(path2);
|
|
6665
6782
|
if (error.code !== "ENOENT" || parent === path2) throw error;
|
|
6666
6783
|
return join2(await realpathAllowMissing(parent), basename2(path2));
|
|
6667
6784
|
}
|