ds-harness-remote 0.5.3 → 0.5.4
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/acp/method-policy.d.ts +2 -2
- package/dist/client.github.js +10 -8
- package/dist/client.js +10 -8
- package/dist/client.js.map +1 -1
- package/dist/codex/domain.d.ts.map +1 -1
- package/dist/codex/domain.js +40 -0
- package/dist/codex/domain.js.map +1 -1
- package/dist/codex/method-policy.d.ts +11 -1
- package/dist/codex/method-policy.d.ts.map +1 -1
- package/dist/codex/method-policy.js +4 -0
- package/dist/codex/method-policy.js.map +1 -1
- package/dist/harness-remote-bridge.js +19 -3
- package/dist/harness-remote-bridge.js.map +1 -1
- package/dist/index.js +64 -7
- package/dist/index.js.map +3 -3
- package/dist/remote-typert-gateway.js +9 -1
- package/dist/remote-typert-gateway.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dsh-plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15647,7 +15647,7 @@ var RemoteTypertGateway2 = class {
|
|
|
15647
15647
|
if (settingsResult !== void 0) return settingsResult;
|
|
15648
15648
|
if (result.ok) {
|
|
15649
15649
|
const value = this.compatibility === "legacy-to-v3" ? normalizeLegacySessionGatewayValue(endpoint, result.value) : normalizeAssistantMessageStreamValue(endpoint, result.value);
|
|
15650
|
-
return { ...result, value };
|
|
15650
|
+
return { ...result, value: normalizeWorkspaceBinaryResult(endpoint, value) };
|
|
15651
15651
|
}
|
|
15652
15652
|
return result;
|
|
15653
15653
|
}
|
|
@@ -15867,6 +15867,11 @@ function base64ToBytes3(value) {
|
|
|
15867
15867
|
if (bytesToBase643(bytes) !== value) throw new Error("The remote Host returned non-canonical Harness Remote transfer data.");
|
|
15868
15868
|
return bytes;
|
|
15869
15869
|
}
|
|
15870
|
+
function normalizeWorkspaceBinaryResult(endpoint, value) {
|
|
15871
|
+
if (endpoint !== "workspaceFiles/readBytes" && endpoint !== "officeToPdf/render") return value;
|
|
15872
|
+
if (!isRecord5(value) || typeof value.data !== "string") return value;
|
|
15873
|
+
return { ...value, data: base64ToBytes3(value.data) };
|
|
15874
|
+
}
|
|
15870
15875
|
function isRecord5(value) {
|
|
15871
15876
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15872
15877
|
}
|
|
@@ -20238,7 +20243,7 @@ function normalizeServerUrl(value) {
|
|
|
20238
20243
|
}
|
|
20239
20244
|
|
|
20240
20245
|
// src/version.ts
|
|
20241
|
-
var PLUGIN_VERSION = "0.5.
|
|
20246
|
+
var PLUGIN_VERSION = "0.5.4";
|
|
20242
20247
|
|
|
20243
20248
|
// src/server-api.ts
|
|
20244
20249
|
var TERMINAL_CONTROL_CHARACTERS = /[\u0000-\u001f\u007f-\u009f]/u;
|
|
@@ -23852,6 +23857,10 @@ var schemas = {
|
|
|
23852
23857
|
throughSeq: external_exports.number().int().min(-1).optional(),
|
|
23853
23858
|
maxMessages: external_exports.number().int().min(1).max(200).optional()
|
|
23854
23859
|
}).strict(),
|
|
23860
|
+
"dsh/sessionAttachment": external_exports.object({
|
|
23861
|
+
threadId: id2,
|
|
23862
|
+
attachmentId: id2
|
|
23863
|
+
}).strict(),
|
|
23855
23864
|
"dsh/directoryList": external_exports.object({
|
|
23856
23865
|
path: external_exports.string().min(1).max(4096)
|
|
23857
23866
|
}).strict(),
|
|
@@ -24321,6 +24330,16 @@ var CodexRemoteDomain = class {
|
|
|
24321
24330
|
permissionPreset: this.permissionPresets.get(threadId) ?? null
|
|
24322
24331
|
};
|
|
24323
24332
|
}
|
|
24333
|
+
if (call.method === "dsh/sessionAttachment") {
|
|
24334
|
+
const attachmentId = call.params.attachmentId;
|
|
24335
|
+
const thread = await this.readThreadForHistory(connectionId, threadId);
|
|
24336
|
+
const history = projectCodexNativeHistory(thread, `codex:${threadId}`);
|
|
24337
|
+
const found = findProjectedImageAttachment(history.entries, attachmentId);
|
|
24338
|
+
if (found === void 0) {
|
|
24339
|
+
throw new RpcError("CODEX_ATTACHMENT_NOT_FOUND", "The CodeX image is not available in this Session.");
|
|
24340
|
+
}
|
|
24341
|
+
return found;
|
|
24342
|
+
}
|
|
24324
24343
|
if (call.method === "dsh/directoryList") {
|
|
24325
24344
|
return this.listCodexDirectory(call.params.path);
|
|
24326
24345
|
}
|
|
@@ -25026,6 +25045,31 @@ var CodexRemoteDomain = class {
|
|
|
25026
25045
|
return paths;
|
|
25027
25046
|
}
|
|
25028
25047
|
};
|
|
25048
|
+
function findProjectedImageAttachment(entries, attachmentId) {
|
|
25049
|
+
for (const entry of entries) {
|
|
25050
|
+
const found = findImageBlock(entry.event.data, attachmentId);
|
|
25051
|
+
if (found !== void 0) return found;
|
|
25052
|
+
}
|
|
25053
|
+
return void 0;
|
|
25054
|
+
}
|
|
25055
|
+
function findImageBlock(value, attachmentId) {
|
|
25056
|
+
if (Array.isArray(value)) {
|
|
25057
|
+
for (const child of value) {
|
|
25058
|
+
const found = findImageBlock(child, attachmentId);
|
|
25059
|
+
if (found !== void 0) return found;
|
|
25060
|
+
}
|
|
25061
|
+
return void 0;
|
|
25062
|
+
}
|
|
25063
|
+
if (!isRecord13(value)) return void 0;
|
|
25064
|
+
if (value.type === "image" && isRecord13(value.attachment) && value.attachment.attachmentId === attachmentId && typeof value.data === "string") {
|
|
25065
|
+
return { attachment: value.attachment, data: value.data };
|
|
25066
|
+
}
|
|
25067
|
+
for (const child of Object.values(value)) {
|
|
25068
|
+
const found = findImageBlock(child, attachmentId);
|
|
25069
|
+
if (found !== void 0) return found;
|
|
25070
|
+
}
|
|
25071
|
+
return void 0;
|
|
25072
|
+
}
|
|
25029
25073
|
function codexBinaryCandidates(configured, hostPlatform = process.platform, userHome = homedir2()) {
|
|
25030
25074
|
if (configured !== "codex" || hostPlatform !== "darwin") return [configured];
|
|
25031
25075
|
const bundledCandidates = [
|
|
@@ -31584,7 +31628,7 @@ var HarnessRemoteBridge = class {
|
|
|
31584
31628
|
endpoint: params.endpoint,
|
|
31585
31629
|
durationMs: Math.round(performance.now() - startedAt)
|
|
31586
31630
|
});
|
|
31587
|
-
const wireResult =
|
|
31631
|
+
const wireResult = normalizeWorkspaceBinaryResult2(params.endpoint, result);
|
|
31588
31632
|
return reservation === void 0 ? wireResult : this.terminal.result(params.endpoint, params.payload, wireResult, reservation);
|
|
31589
31633
|
} catch (error) {
|
|
31590
31634
|
if (reservation !== void 0) this.terminal.result(params.endpoint, params.payload, { ok: false, error: { code: "FAILED", message: "", details: {} } }, reservation);
|
|
@@ -31848,17 +31892,30 @@ function decodeCanonicalBase644(value) {
|
|
|
31848
31892
|
if (bytes.toString("base64") !== value) throw new RpcError("INVALID_MESSAGE", "The Harness Remote transfer chunk is invalid.");
|
|
31849
31893
|
return bytes;
|
|
31850
31894
|
}
|
|
31851
|
-
function
|
|
31895
|
+
function normalizeWorkspaceBinaryResult2(endpoint, result) {
|
|
31852
31896
|
if (result.ok !== true || endpoint !== "workspaceFiles/readBytes" && endpoint !== "officeToPdf/render") return result;
|
|
31853
|
-
if (!isJsonRecord(result.value)
|
|
31897
|
+
if (!isJsonRecord(result.value)) return result;
|
|
31898
|
+
const directBytes = isBinary(result.value.data) ? result.value.data : void 0;
|
|
31899
|
+
const attachmentBytes = directBytes === void 0 ? attachmentAt(result, ["data"]) : void 0;
|
|
31900
|
+
if (directBytes === void 0 && attachmentBytes === void 0) return result;
|
|
31901
|
+
const bytes = directBytes ?? attachmentBytes;
|
|
31854
31902
|
return {
|
|
31855
|
-
|
|
31903
|
+
ok: true,
|
|
31856
31904
|
value: {
|
|
31857
31905
|
...result.value,
|
|
31858
|
-
data: Buffer.from(
|
|
31906
|
+
data: Buffer.from(bytes).toString("base64")
|
|
31859
31907
|
}
|
|
31860
31908
|
};
|
|
31861
31909
|
}
|
|
31910
|
+
function attachmentAt(result, path) {
|
|
31911
|
+
const attachments = result.attachments;
|
|
31912
|
+
if (!Array.isArray(attachments)) return void 0;
|
|
31913
|
+
const attachment = attachments.find((item) => {
|
|
31914
|
+
if (!isJsonRecord(item) || !Array.isArray(item.path) || item.path.length !== path.length) return false;
|
|
31915
|
+
return item.path.every((part, index) => part === path[index]);
|
|
31916
|
+
});
|
|
31917
|
+
return isJsonRecord(attachment) && isBinary(attachment.bytes) ? attachment.bytes : void 0;
|
|
31918
|
+
}
|
|
31862
31919
|
function isBinary(value) {
|
|
31863
31920
|
return value instanceof Uint8Array;
|
|
31864
31921
|
}
|