openmates 0.27.0-alpha.21 → 0.27.0-alpha.23
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/{chunk-UIW7XY2C.js → chunk-NQP5QUVR.js} +471 -197
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/fixtures/privacy-runtime/linux-arm64/libggml-base.so +0 -0
- package/fixtures/privacy-runtime/linux-arm64/libggml-base.so.0 +0 -0
- package/fixtures/privacy-runtime/linux-arm64/libggml-base.so.0.15.1 +0 -0
- package/fixtures/privacy-runtime/linux-arm64/libggml-cpu.so +0 -0
- package/fixtures/privacy-runtime/linux-arm64/libggml-cpu.so.0 +0 -0
- package/fixtures/privacy-runtime/linux-arm64/libggml-cpu.so.0.15.1 +0 -0
- package/fixtures/privacy-runtime/linux-arm64/libggml.so +0 -0
- package/fixtures/privacy-runtime/linux-arm64/libggml.so.0 +0 -0
- package/fixtures/privacy-runtime/linux-arm64/libggml.so.0.15.1 +0 -0
- package/fixtures/privacy-runtime/linux-arm64/manifest.json +9 -9
- package/package.json +1 -1
|
@@ -1733,6 +1733,227 @@ function coalesceMemoryRequestMessages(messages) {
|
|
|
1733
1733
|
return result;
|
|
1734
1734
|
}
|
|
1735
1735
|
|
|
1736
|
+
// ../ui/src/utils/projectFilePatch.ts
|
|
1737
|
+
var ProjectFilePatchError = class extends Error {
|
|
1738
|
+
constructor(message) {
|
|
1739
|
+
super(message);
|
|
1740
|
+
this.name = "ProjectFilePatchError";
|
|
1741
|
+
}
|
|
1742
|
+
};
|
|
1743
|
+
var HEADER = /^(---|\+\+\+) ([^\t]+)(?:\t.*)?$/;
|
|
1744
|
+
var HUNK = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: .*)?$/;
|
|
1745
|
+
function applyProjectFilePatch(original, unifiedDiff, expectedPath) {
|
|
1746
|
+
if (!unifiedDiff || unifiedDiff.includes("\0") || unifiedDiff.includes("\r")) {
|
|
1747
|
+
throw new ProjectFilePatchError("Patch must be a non-empty LF unified diff");
|
|
1748
|
+
}
|
|
1749
|
+
const rows2 = unifiedDiff.split("\n");
|
|
1750
|
+
if (rows2.at(-1) === "") rows2.pop();
|
|
1751
|
+
if (rows2.length < 3) throw new ProjectFilePatchError("Patch is missing file headers or hunks");
|
|
1752
|
+
const oldHeader = HEADER.exec(rows2[0] ?? "");
|
|
1753
|
+
const newHeader = HEADER.exec(rows2[1] ?? "");
|
|
1754
|
+
if (!oldHeader || oldHeader[1] !== "---" || !newHeader || newHeader[1] !== "+++") {
|
|
1755
|
+
throw new ProjectFilePatchError("Patch must start with one old and one new file header");
|
|
1756
|
+
}
|
|
1757
|
+
const oldPath = normalizeHeaderPath(oldHeader[2] ?? "");
|
|
1758
|
+
const newPath = normalizeHeaderPath(newHeader[2] ?? "");
|
|
1759
|
+
if (oldPath === "/dev/null" || newPath === "/dev/null") {
|
|
1760
|
+
throw new ProjectFilePatchError("Update patches cannot create or delete files");
|
|
1761
|
+
}
|
|
1762
|
+
if (expectedPath && (oldPath !== expectedPath || newPath !== expectedPath)) {
|
|
1763
|
+
throw new ProjectFilePatchError("Patch file headers do not match the requested path");
|
|
1764
|
+
}
|
|
1765
|
+
const hunks = [];
|
|
1766
|
+
let row = 2;
|
|
1767
|
+
while (row < rows2.length) {
|
|
1768
|
+
const match = HUNK.exec(rows2[row] ?? "");
|
|
1769
|
+
if (!match) throw new ProjectFilePatchError("Patch contains data outside a valid hunk");
|
|
1770
|
+
const hunk = {
|
|
1771
|
+
oldStart: parseCoordinate(match[1]),
|
|
1772
|
+
oldCount: match[2] === void 0 ? 1 : parseCoordinate(match[2]),
|
|
1773
|
+
newStart: parseCoordinate(match[3]),
|
|
1774
|
+
newCount: match[4] === void 0 ? 1 : parseCoordinate(match[4]),
|
|
1775
|
+
lines: []
|
|
1776
|
+
};
|
|
1777
|
+
row += 1;
|
|
1778
|
+
let oldSeen = 0;
|
|
1779
|
+
let newSeen = 0;
|
|
1780
|
+
while (row < rows2.length && !rows2[row]?.startsWith("@@ ")) {
|
|
1781
|
+
const value = rows2[row] ?? "";
|
|
1782
|
+
if (value === "\") {
|
|
1783
|
+
const previous = hunk.lines.at(-1);
|
|
1784
|
+
if (!previous || !previous.line.hasNewline) {
|
|
1785
|
+
throw new ProjectFilePatchError("Misplaced no-newline marker");
|
|
1786
|
+
}
|
|
1787
|
+
previous.line.hasNewline = false;
|
|
1788
|
+
row += 1;
|
|
1789
|
+
continue;
|
|
1790
|
+
}
|
|
1791
|
+
const prefix = value[0];
|
|
1792
|
+
if (prefix !== " " && prefix !== "-" && prefix !== "+") {
|
|
1793
|
+
throw new ProjectFilePatchError("Every hunk line must have a unified-diff prefix");
|
|
1794
|
+
}
|
|
1795
|
+
const kind = prefix === " " ? "context" : prefix === "-" ? "remove" : "add";
|
|
1796
|
+
hunk.lines.push({ kind, line: { value: value.slice(1), hasNewline: true } });
|
|
1797
|
+
if (kind !== "add") oldSeen += 1;
|
|
1798
|
+
if (kind !== "remove") newSeen += 1;
|
|
1799
|
+
row += 1;
|
|
1800
|
+
}
|
|
1801
|
+
if (oldSeen !== hunk.oldCount || newSeen !== hunk.newCount) {
|
|
1802
|
+
throw new ProjectFilePatchError("Hunk line counts do not match its header");
|
|
1803
|
+
}
|
|
1804
|
+
hunks.push(hunk);
|
|
1805
|
+
}
|
|
1806
|
+
if (hunks.length === 0) throw new ProjectFilePatchError("Patch has no hunks");
|
|
1807
|
+
const source = splitContentLines(original);
|
|
1808
|
+
const output = [];
|
|
1809
|
+
let sourceIndex = 0;
|
|
1810
|
+
let outputLine = 1;
|
|
1811
|
+
for (const hunk of hunks) {
|
|
1812
|
+
const expectedSourceIndex = hunk.oldCount === 0 ? hunk.oldStart : hunk.oldStart - 1;
|
|
1813
|
+
const expectedOutputLine = hunk.newCount === 0 ? hunk.newStart + 1 : hunk.newStart;
|
|
1814
|
+
if (expectedSourceIndex < sourceIndex || expectedSourceIndex > source.length) {
|
|
1815
|
+
throw new ProjectFilePatchError("Patch hunks overlap or are outside the source");
|
|
1816
|
+
}
|
|
1817
|
+
while (sourceIndex < expectedSourceIndex) {
|
|
1818
|
+
output.push(source[sourceIndex]);
|
|
1819
|
+
sourceIndex += 1;
|
|
1820
|
+
outputLine += 1;
|
|
1821
|
+
}
|
|
1822
|
+
if (outputLine !== expectedOutputLine) {
|
|
1823
|
+
throw new ProjectFilePatchError("Patch new-file coordinates are inconsistent");
|
|
1824
|
+
}
|
|
1825
|
+
for (const item of hunk.lines) {
|
|
1826
|
+
if (item.kind !== "add") {
|
|
1827
|
+
const actual = source[sourceIndex];
|
|
1828
|
+
if (!actual || actual.value !== item.line.value || actual.hasNewline !== item.line.hasNewline) {
|
|
1829
|
+
throw new ProjectFilePatchError("Patch context does not match the source exactly");
|
|
1830
|
+
}
|
|
1831
|
+
sourceIndex += 1;
|
|
1832
|
+
}
|
|
1833
|
+
if (item.kind !== "remove") {
|
|
1834
|
+
output.push({ ...item.line });
|
|
1835
|
+
outputLine += 1;
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
output.push(...source.slice(sourceIndex));
|
|
1840
|
+
validateNewlinePlacement(output);
|
|
1841
|
+
return {
|
|
1842
|
+
content: output.map((line) => line.value + (line.hasNewline ? "\n" : "")).join(""),
|
|
1843
|
+
appliedDiff: unifiedDiff,
|
|
1844
|
+
oldPath,
|
|
1845
|
+
newPath
|
|
1846
|
+
};
|
|
1847
|
+
}
|
|
1848
|
+
function parseCoordinate(value) {
|
|
1849
|
+
const number = Number(value);
|
|
1850
|
+
if (!Number.isSafeInteger(number) || number < 0) throw new ProjectFilePatchError("Invalid hunk coordinate");
|
|
1851
|
+
return number;
|
|
1852
|
+
}
|
|
1853
|
+
function normalizeHeaderPath(value) {
|
|
1854
|
+
if (value === "/dev/null") return value;
|
|
1855
|
+
if (value.startsWith("a/") || value.startsWith("b/")) return value.slice(2);
|
|
1856
|
+
return value;
|
|
1857
|
+
}
|
|
1858
|
+
function splitContentLines(content) {
|
|
1859
|
+
if (content === "") return [];
|
|
1860
|
+
const lines = [];
|
|
1861
|
+
let start = 0;
|
|
1862
|
+
for (let index = 0; index < content.length; index += 1) {
|
|
1863
|
+
if (content[index] !== "\n") continue;
|
|
1864
|
+
lines.push({ value: content.slice(start, index), hasNewline: true });
|
|
1865
|
+
start = index + 1;
|
|
1866
|
+
}
|
|
1867
|
+
if (start < content.length) lines.push({ value: content.slice(start), hasNewline: false });
|
|
1868
|
+
return lines;
|
|
1869
|
+
}
|
|
1870
|
+
function validateNewlinePlacement(lines) {
|
|
1871
|
+
for (let index = 0; index < lines.length - 1; index += 1) {
|
|
1872
|
+
if (!lines[index]?.hasNewline) throw new ProjectFilePatchError("No-newline marker is only valid at end of file");
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
// ../ui/src/utils/embedVersionReconstruction.ts
|
|
1877
|
+
async function reconstructVersionRows(rows2, decrypt) {
|
|
1878
|
+
const sorted2 = [...rows2].sort((a, b) => a.version_number - b.version_number);
|
|
1879
|
+
let content = null;
|
|
1880
|
+
let expected = sorted2[0]?.version_number ?? 1;
|
|
1881
|
+
for (const row of sorted2) {
|
|
1882
|
+
if (!Number.isSafeInteger(row.version_number) || row.version_number < 1 || row.version_number !== expected) {
|
|
1883
|
+
throw new Error("Version chain is incomplete");
|
|
1884
|
+
}
|
|
1885
|
+
expected += 1;
|
|
1886
|
+
if (row.encrypted_snapshot) {
|
|
1887
|
+
content = await decrypt(row.encrypted_snapshot);
|
|
1888
|
+
if (content === null) throw new Error("Version snapshot could not be decrypted");
|
|
1889
|
+
} else {
|
|
1890
|
+
if (content === null) throw new Error("Version history is missing the initial snapshot");
|
|
1891
|
+
if (!row.encrypted_patch) throw new Error("Version patch is missing");
|
|
1892
|
+
const patch = await decrypt(row.encrypted_patch);
|
|
1893
|
+
if (patch === null) throw new Error("Version patch could not be decrypted");
|
|
1894
|
+
content = applyVersionPatch(content, patch);
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
if (content === null) throw new Error("Version history is missing the initial snapshot");
|
|
1898
|
+
return content;
|
|
1899
|
+
}
|
|
1900
|
+
function applyVersionPatch(content, patch) {
|
|
1901
|
+
if (patch.includes("\")) {
|
|
1902
|
+
const withHeaders = patch.startsWith("@@ ") ? `--- version
|
|
1903
|
+
+++ version
|
|
1904
|
+
${patch}` : patch;
|
|
1905
|
+
return applyProjectFilePatch(content, withHeaders).content;
|
|
1906
|
+
}
|
|
1907
|
+
const source = content === "" ? [] : content.split("\n");
|
|
1908
|
+
const lines = patch.split("\n");
|
|
1909
|
+
if (lines.at(-1) === "") lines.pop();
|
|
1910
|
+
let index = 0;
|
|
1911
|
+
if (lines[0]?.startsWith("--- ") && lines[1]?.startsWith("+++ ")) index = 2;
|
|
1912
|
+
const output = [];
|
|
1913
|
+
let sourceIndex = 0;
|
|
1914
|
+
let hunkCount = 0;
|
|
1915
|
+
while (index < lines.length) {
|
|
1916
|
+
const header2 = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: .*)?$/.exec(lines[index] ?? "");
|
|
1917
|
+
if (!header2) throw new Error("Version patch contains an invalid hunk");
|
|
1918
|
+
const oldStart = Number(header2[1]);
|
|
1919
|
+
const oldCount = header2[2] === void 0 ? 1 : Number(header2[2]);
|
|
1920
|
+
const newStart = Number(header2[3]);
|
|
1921
|
+
const newCount = header2[4] === void 0 ? 1 : Number(header2[4]);
|
|
1922
|
+
const start = oldCount === 0 ? oldStart : oldStart - 1;
|
|
1923
|
+
const outputStart = newCount === 0 ? newStart : newStart - 1;
|
|
1924
|
+
if (![oldStart, oldCount, newStart, newCount].every(Number.isSafeInteger) || start < sourceIndex || start > source.length) throw new Error("Version patch hunks overlap or exceed content");
|
|
1925
|
+
output.push(...source.slice(sourceIndex, start));
|
|
1926
|
+
if (output.length !== outputStart) throw new Error("Version patch coordinates do not match content");
|
|
1927
|
+
sourceIndex = start;
|
|
1928
|
+
let removed = 0;
|
|
1929
|
+
let added = 0;
|
|
1930
|
+
index += 1;
|
|
1931
|
+
while (index < lines.length && !lines[index]?.startsWith("@@ ")) {
|
|
1932
|
+
const line = lines[index] ?? "";
|
|
1933
|
+
if (line === "\") {
|
|
1934
|
+
index += 1;
|
|
1935
|
+
continue;
|
|
1936
|
+
}
|
|
1937
|
+
if (![" ", "-", "+"].includes(line[0] ?? "")) throw new Error("Version patch has an invalid line");
|
|
1938
|
+
if (line[0] !== "+") {
|
|
1939
|
+
if (source[sourceIndex] !== line.slice(1)) throw new Error("Version patch context does not match local content");
|
|
1940
|
+
sourceIndex += 1;
|
|
1941
|
+
removed += 1;
|
|
1942
|
+
}
|
|
1943
|
+
if (line[0] !== "-") {
|
|
1944
|
+
output.push(line.slice(1));
|
|
1945
|
+
added += 1;
|
|
1946
|
+
}
|
|
1947
|
+
index += 1;
|
|
1948
|
+
}
|
|
1949
|
+
if (removed !== oldCount || added !== newCount) throw new Error("Version patch line counts do not match its header");
|
|
1950
|
+
hunkCount += 1;
|
|
1951
|
+
}
|
|
1952
|
+
if (hunkCount === 0) throw new Error("Version patch has no hunks");
|
|
1953
|
+
output.push(...source.slice(sourceIndex));
|
|
1954
|
+
return output.join("\n");
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1736
1957
|
// src/accountImport.ts
|
|
1737
1958
|
import { createDecipheriv, createHash as createHash4, scryptSync } from "crypto";
|
|
1738
1959
|
import JSZip from "jszip";
|
|
@@ -2863,146 +3084,6 @@ function createProjectFileJobExecutor(options) {
|
|
|
2863
3084
|
} };
|
|
2864
3085
|
}
|
|
2865
3086
|
|
|
2866
|
-
// ../ui/src/utils/projectFilePatch.ts
|
|
2867
|
-
var ProjectFilePatchError = class extends Error {
|
|
2868
|
-
constructor(message) {
|
|
2869
|
-
super(message);
|
|
2870
|
-
this.name = "ProjectFilePatchError";
|
|
2871
|
-
}
|
|
2872
|
-
};
|
|
2873
|
-
var HEADER = /^(---|\+\+\+) ([^\t]+)(?:\t.*)?$/;
|
|
2874
|
-
var HUNK = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: .*)?$/;
|
|
2875
|
-
function applyProjectFilePatch(original, unifiedDiff, expectedPath) {
|
|
2876
|
-
if (!unifiedDiff || unifiedDiff.includes("\0") || unifiedDiff.includes("\r")) {
|
|
2877
|
-
throw new ProjectFilePatchError("Patch must be a non-empty LF unified diff");
|
|
2878
|
-
}
|
|
2879
|
-
const rows2 = unifiedDiff.split("\n");
|
|
2880
|
-
if (rows2.at(-1) === "") rows2.pop();
|
|
2881
|
-
if (rows2.length < 3) throw new ProjectFilePatchError("Patch is missing file headers or hunks");
|
|
2882
|
-
const oldHeader = HEADER.exec(rows2[0] ?? "");
|
|
2883
|
-
const newHeader = HEADER.exec(rows2[1] ?? "");
|
|
2884
|
-
if (!oldHeader || oldHeader[1] !== "---" || !newHeader || newHeader[1] !== "+++") {
|
|
2885
|
-
throw new ProjectFilePatchError("Patch must start with one old and one new file header");
|
|
2886
|
-
}
|
|
2887
|
-
const oldPath = normalizeHeaderPath(oldHeader[2] ?? "");
|
|
2888
|
-
const newPath = normalizeHeaderPath(newHeader[2] ?? "");
|
|
2889
|
-
if (oldPath === "/dev/null" || newPath === "/dev/null") {
|
|
2890
|
-
throw new ProjectFilePatchError("Update patches cannot create or delete files");
|
|
2891
|
-
}
|
|
2892
|
-
if (expectedPath && (oldPath !== expectedPath || newPath !== expectedPath)) {
|
|
2893
|
-
throw new ProjectFilePatchError("Patch file headers do not match the requested path");
|
|
2894
|
-
}
|
|
2895
|
-
const hunks = [];
|
|
2896
|
-
let row = 2;
|
|
2897
|
-
while (row < rows2.length) {
|
|
2898
|
-
const match = HUNK.exec(rows2[row] ?? "");
|
|
2899
|
-
if (!match) throw new ProjectFilePatchError("Patch contains data outside a valid hunk");
|
|
2900
|
-
const hunk = {
|
|
2901
|
-
oldStart: parseCoordinate(match[1]),
|
|
2902
|
-
oldCount: match[2] === void 0 ? 1 : parseCoordinate(match[2]),
|
|
2903
|
-
newStart: parseCoordinate(match[3]),
|
|
2904
|
-
newCount: match[4] === void 0 ? 1 : parseCoordinate(match[4]),
|
|
2905
|
-
lines: []
|
|
2906
|
-
};
|
|
2907
|
-
row += 1;
|
|
2908
|
-
let oldSeen = 0;
|
|
2909
|
-
let newSeen = 0;
|
|
2910
|
-
while (row < rows2.length && !rows2[row]?.startsWith("@@ ")) {
|
|
2911
|
-
const value = rows2[row] ?? "";
|
|
2912
|
-
if (value === "\") {
|
|
2913
|
-
const previous = hunk.lines.at(-1);
|
|
2914
|
-
if (!previous || !previous.line.hasNewline) {
|
|
2915
|
-
throw new ProjectFilePatchError("Misplaced no-newline marker");
|
|
2916
|
-
}
|
|
2917
|
-
previous.line.hasNewline = false;
|
|
2918
|
-
row += 1;
|
|
2919
|
-
continue;
|
|
2920
|
-
}
|
|
2921
|
-
const prefix = value[0];
|
|
2922
|
-
if (prefix !== " " && prefix !== "-" && prefix !== "+") {
|
|
2923
|
-
throw new ProjectFilePatchError("Every hunk line must have a unified-diff prefix");
|
|
2924
|
-
}
|
|
2925
|
-
const kind = prefix === " " ? "context" : prefix === "-" ? "remove" : "add";
|
|
2926
|
-
hunk.lines.push({ kind, line: { value: value.slice(1), hasNewline: true } });
|
|
2927
|
-
if (kind !== "add") oldSeen += 1;
|
|
2928
|
-
if (kind !== "remove") newSeen += 1;
|
|
2929
|
-
row += 1;
|
|
2930
|
-
}
|
|
2931
|
-
if (oldSeen !== hunk.oldCount || newSeen !== hunk.newCount) {
|
|
2932
|
-
throw new ProjectFilePatchError("Hunk line counts do not match its header");
|
|
2933
|
-
}
|
|
2934
|
-
hunks.push(hunk);
|
|
2935
|
-
}
|
|
2936
|
-
if (hunks.length === 0) throw new ProjectFilePatchError("Patch has no hunks");
|
|
2937
|
-
const source = splitContentLines(original);
|
|
2938
|
-
const output = [];
|
|
2939
|
-
let sourceIndex = 0;
|
|
2940
|
-
let outputLine = 1;
|
|
2941
|
-
for (const hunk of hunks) {
|
|
2942
|
-
const expectedSourceIndex = hunk.oldCount === 0 ? hunk.oldStart : hunk.oldStart - 1;
|
|
2943
|
-
const expectedOutputLine = hunk.newCount === 0 ? hunk.newStart + 1 : hunk.newStart;
|
|
2944
|
-
if (expectedSourceIndex < sourceIndex || expectedSourceIndex > source.length) {
|
|
2945
|
-
throw new ProjectFilePatchError("Patch hunks overlap or are outside the source");
|
|
2946
|
-
}
|
|
2947
|
-
while (sourceIndex < expectedSourceIndex) {
|
|
2948
|
-
output.push(source[sourceIndex]);
|
|
2949
|
-
sourceIndex += 1;
|
|
2950
|
-
outputLine += 1;
|
|
2951
|
-
}
|
|
2952
|
-
if (outputLine !== expectedOutputLine) {
|
|
2953
|
-
throw new ProjectFilePatchError("Patch new-file coordinates are inconsistent");
|
|
2954
|
-
}
|
|
2955
|
-
for (const item of hunk.lines) {
|
|
2956
|
-
if (item.kind !== "add") {
|
|
2957
|
-
const actual = source[sourceIndex];
|
|
2958
|
-
if (!actual || actual.value !== item.line.value || actual.hasNewline !== item.line.hasNewline) {
|
|
2959
|
-
throw new ProjectFilePatchError("Patch context does not match the source exactly");
|
|
2960
|
-
}
|
|
2961
|
-
sourceIndex += 1;
|
|
2962
|
-
}
|
|
2963
|
-
if (item.kind !== "remove") {
|
|
2964
|
-
output.push({ ...item.line });
|
|
2965
|
-
outputLine += 1;
|
|
2966
|
-
}
|
|
2967
|
-
}
|
|
2968
|
-
}
|
|
2969
|
-
output.push(...source.slice(sourceIndex));
|
|
2970
|
-
validateNewlinePlacement(output);
|
|
2971
|
-
return {
|
|
2972
|
-
content: output.map((line) => line.value + (line.hasNewline ? "\n" : "")).join(""),
|
|
2973
|
-
appliedDiff: unifiedDiff,
|
|
2974
|
-
oldPath,
|
|
2975
|
-
newPath
|
|
2976
|
-
};
|
|
2977
|
-
}
|
|
2978
|
-
function parseCoordinate(value) {
|
|
2979
|
-
const number = Number(value);
|
|
2980
|
-
if (!Number.isSafeInteger(number) || number < 0) throw new ProjectFilePatchError("Invalid hunk coordinate");
|
|
2981
|
-
return number;
|
|
2982
|
-
}
|
|
2983
|
-
function normalizeHeaderPath(value) {
|
|
2984
|
-
if (value === "/dev/null") return value;
|
|
2985
|
-
if (value.startsWith("a/") || value.startsWith("b/")) return value.slice(2);
|
|
2986
|
-
return value;
|
|
2987
|
-
}
|
|
2988
|
-
function splitContentLines(content) {
|
|
2989
|
-
if (content === "") return [];
|
|
2990
|
-
const lines = [];
|
|
2991
|
-
let start = 0;
|
|
2992
|
-
for (let index = 0; index < content.length; index += 1) {
|
|
2993
|
-
if (content[index] !== "\n") continue;
|
|
2994
|
-
lines.push({ value: content.slice(start, index), hasNewline: true });
|
|
2995
|
-
start = index + 1;
|
|
2996
|
-
}
|
|
2997
|
-
if (start < content.length) lines.push({ value: content.slice(start), hasNewline: false });
|
|
2998
|
-
return lines;
|
|
2999
|
-
}
|
|
3000
|
-
function validateNewlinePlacement(lines) {
|
|
3001
|
-
for (let index = 0; index < lines.length - 1; index += 1) {
|
|
3002
|
-
if (!lines[index]?.hasNewline) throw new ProjectFilePatchError("No-newline marker is only valid at end of file");
|
|
3003
|
-
}
|
|
3004
|
-
}
|
|
3005
|
-
|
|
3006
3087
|
// ../ui/src/utils/projectSearchProtocol.ts
|
|
3007
3088
|
var ProjectSearchProtocolError = class extends Error {
|
|
3008
3089
|
code;
|
|
@@ -4884,6 +4965,7 @@ var OpenMatesWsClient = class {
|
|
|
4884
4965
|
const clientCapabilities = [
|
|
4885
4966
|
"canonical_embed_receipts_v1",
|
|
4886
4967
|
"typed_recovery_outputs_v2",
|
|
4968
|
+
"agentic-storage-v2",
|
|
4887
4969
|
...options.taskUpdateJobs !== false ? ["task_update_jobs"] : [],
|
|
4888
4970
|
...options.projectFileJobs === true ? ["project_file_jobs"] : [],
|
|
4889
4971
|
...options.remoteCommandJobs === true ? ["remote_command_jobs"] : []
|
|
@@ -10749,45 +10831,13 @@ var BLOCKED_SETTINGS_MUTATE_PATHS = /* @__PURE__ */ new Set([
|
|
|
10749
10831
|
"/v1/settings/verify-action-code",
|
|
10750
10832
|
"/v1/settings/user/disable-2fa"
|
|
10751
10833
|
]);
|
|
10752
|
-
function applyUnifiedDiffForEmbedVersion(content, patch) {
|
|
10753
|
-
const contentLines = content.split("\n");
|
|
10754
|
-
const lines = patch.split("\n");
|
|
10755
|
-
const hunks = [];
|
|
10756
|
-
let current = null;
|
|
10757
|
-
for (const line of lines) {
|
|
10758
|
-
const match = /^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(line);
|
|
10759
|
-
if (match) {
|
|
10760
|
-
if (current) hunks.push(current);
|
|
10761
|
-
current = { start: Number(match[1]) - 1, oldLines: [], newLines: [] };
|
|
10762
|
-
continue;
|
|
10763
|
-
}
|
|
10764
|
-
if (!current) continue;
|
|
10765
|
-
if (line.startsWith(" ")) {
|
|
10766
|
-
current.oldLines.push(line.slice(1));
|
|
10767
|
-
current.newLines.push(line.slice(1));
|
|
10768
|
-
} else if (line.startsWith("-")) {
|
|
10769
|
-
current.oldLines.push(line.slice(1));
|
|
10770
|
-
} else if (line.startsWith("+")) {
|
|
10771
|
-
current.newLines.push(line.slice(1));
|
|
10772
|
-
}
|
|
10773
|
-
}
|
|
10774
|
-
if (current) hunks.push(current);
|
|
10775
|
-
for (const hunk of hunks.sort((a, b) => b.start - a.start)) {
|
|
10776
|
-
const actual = contentLines.slice(hunk.start, hunk.start + hunk.oldLines.length);
|
|
10777
|
-
if (actual.join("\n") !== hunk.oldLines.join("\n")) {
|
|
10778
|
-
throw new Error("Version patch context does not match local content");
|
|
10779
|
-
}
|
|
10780
|
-
contentLines.splice(hunk.start, hunk.oldLines.length, ...hunk.newLines);
|
|
10781
|
-
}
|
|
10782
|
-
return contentLines.join("\n");
|
|
10783
|
-
}
|
|
10784
10834
|
function buildUnifiedDiffForEmbedRestore(currentContent, restoredContent, currentVersion, newVersion) {
|
|
10785
|
-
const currentLines = currentContent.split("\n");
|
|
10786
|
-
const restoredLines = restoredContent.split("\n");
|
|
10835
|
+
const currentLines = currentContent ? currentContent.split("\n") : [];
|
|
10836
|
+
const restoredLines = restoredContent ? restoredContent.split("\n") : [];
|
|
10787
10837
|
return [
|
|
10788
10838
|
`--- v${currentVersion}`,
|
|
10789
10839
|
`+++ v${newVersion}`,
|
|
10790
|
-
`@@
|
|
10840
|
+
`@@ -${currentLines.length ? 1 : 0},${currentLines.length} +${restoredLines.length ? 1 : 0},${restoredLines.length} @@`,
|
|
10791
10841
|
...currentLines.map((line) => `-${line}`),
|
|
10792
10842
|
...restoredLines.map((line) => `+${line}`)
|
|
10793
10843
|
].join("\n");
|
|
@@ -11388,7 +11438,11 @@ var OpenMatesClient = class _OpenMatesClient {
|
|
|
11388
11438
|
artifact,
|
|
11389
11439
|
imported_at: Math.floor(Date.now() / 1e3)
|
|
11390
11440
|
}, this.getCliRequestHeaders());
|
|
11391
|
-
if (!response.ok)
|
|
11441
|
+
if (!response.ok) {
|
|
11442
|
+
const detail = response.data?.detail;
|
|
11443
|
+
const explanation = typeof detail === "string" && detail.length <= 500 ? `: ${detail}` : "";
|
|
11444
|
+
throw new Error(`Team import failed with HTTP ${response.status}${explanation}`);
|
|
11445
|
+
}
|
|
11392
11446
|
return response.data;
|
|
11393
11447
|
}
|
|
11394
11448
|
async updateTeamMemberRole(teamId, memberUserId, role) {
|
|
@@ -14261,7 +14315,7 @@ var OpenMatesClient = class _OpenMatesClient {
|
|
|
14261
14315
|
historicalContent = await decryptWithAesGcmCombined(versionRow.encrypted_snapshot, embedKey);
|
|
14262
14316
|
} else if (typeof versionRow.encrypted_patch === "string" && historicalContent !== null) {
|
|
14263
14317
|
const patch = await decryptWithAesGcmCombined(versionRow.encrypted_patch, embedKey);
|
|
14264
|
-
historicalContent =
|
|
14318
|
+
historicalContent = applyVersionPatch(historicalContent, patch ?? "");
|
|
14265
14319
|
} else {
|
|
14266
14320
|
throw new Error("Canonical recovery embed history lacks a starting snapshot.");
|
|
14267
14321
|
}
|
|
@@ -19616,8 +19670,12 @@ Required: ${schema.required.join(", ")}`
|
|
|
19616
19670
|
if (!response.ok || !response.data) {
|
|
19617
19671
|
throw new Error(this.formatEmbedVersionError(response.data, `Failed to load embed version ${version} (HTTP ${response.status})`));
|
|
19618
19672
|
}
|
|
19619
|
-
if (
|
|
19620
|
-
|
|
19673
|
+
if (response.data.embed_id !== embedId || response.data.version_number !== version) {
|
|
19674
|
+
throw new Error("Version response does not match the selected version");
|
|
19675
|
+
}
|
|
19676
|
+
if (typeof response.data.content === "string") return response.data;
|
|
19677
|
+
if (!Array.isArray(response.data.rows) || response.data.rows.at(-1)?.version_number !== version) {
|
|
19678
|
+
throw new Error("Version response does not match the selected version");
|
|
19621
19679
|
}
|
|
19622
19680
|
const content = await this.reconstructEncryptedEmbedVersion(embedId, response.data.rows, context);
|
|
19623
19681
|
if (response.data.rows.length > 32 && response.data.readonly === false) {
|
|
@@ -19770,22 +19828,7 @@ Required: ${schema.required.join(", ")}`
|
|
|
19770
19828
|
if (!embedKey) {
|
|
19771
19829
|
throw new Error("Could not resolve embed encryption key for version history.");
|
|
19772
19830
|
}
|
|
19773
|
-
|
|
19774
|
-
let content = null;
|
|
19775
|
-
for (const row of sortedRows) {
|
|
19776
|
-
if (row.encrypted_snapshot) {
|
|
19777
|
-
content = await decryptWithAesGcmCombined(row.encrypted_snapshot, embedKey);
|
|
19778
|
-
continue;
|
|
19779
|
-
}
|
|
19780
|
-
if (row.encrypted_patch && content !== null) {
|
|
19781
|
-
const patch = await decryptWithAesGcmCombined(row.encrypted_patch, embedKey);
|
|
19782
|
-
content = applyUnifiedDiffForEmbedVersion(content, patch ?? "");
|
|
19783
|
-
}
|
|
19784
|
-
}
|
|
19785
|
-
if (content === null) {
|
|
19786
|
-
throw new Error("Version history is missing the initial snapshot");
|
|
19787
|
-
}
|
|
19788
|
-
return content;
|
|
19831
|
+
return reconstructVersionRows(rows2, (ciphertext) => decryptWithAesGcmCombined(ciphertext, embedKey));
|
|
19789
19832
|
}
|
|
19790
19833
|
async resolveVersionEmbedKey(embedId, context) {
|
|
19791
19834
|
if (context?.projectId) {
|
|
@@ -20700,6 +20743,7 @@ Required: ${schema.required.join(", ")}`
|
|
|
20700
20743
|
return {
|
|
20701
20744
|
"User-Agent": this.getCliUserAgent(),
|
|
20702
20745
|
"X-OpenMates-SDK": "cli",
|
|
20746
|
+
"X-OpenMates-Client-Capabilities": "agentic-storage-v2",
|
|
20703
20747
|
"X-OpenMates-Device-Identity": this.getCliApiKeyDeviceIdentity(),
|
|
20704
20748
|
Origin: deriveAppUrl(this.apiUrl)
|
|
20705
20749
|
};
|
|
@@ -27804,6 +27848,7 @@ var OpenMates = class {
|
|
|
27804
27848
|
Authorization: `Bearer ${splitApiKeyCredential(this.apiKey ?? "").bearer}`,
|
|
27805
27849
|
Origin: sdkOrigin(this.apiUrl),
|
|
27806
27850
|
"X-OpenMates-SDK": this.sdkName,
|
|
27851
|
+
"X-OpenMates-Client-Capabilities": "agentic-storage-v2",
|
|
27807
27852
|
"X-OpenMates-Device-Identity": this.deviceId
|
|
27808
27853
|
};
|
|
27809
27854
|
if (hasBody) {
|
|
@@ -27815,6 +27860,7 @@ var OpenMates = class {
|
|
|
27815
27860
|
return {
|
|
27816
27861
|
Accept: "application/json",
|
|
27817
27862
|
"X-OpenMates-SDK": this.sdkName,
|
|
27863
|
+
"X-OpenMates-Client-Capabilities": "agentic-storage-v2",
|
|
27818
27864
|
"X-OpenMates-Device-Identity": this.deviceId
|
|
27819
27865
|
};
|
|
27820
27866
|
}
|
|
@@ -34880,7 +34926,7 @@ function planRuntimeMonitoringServices(input) {
|
|
|
34880
34926
|
"",
|
|
34881
34927
|
"[Timer]",
|
|
34882
34928
|
"OnBootSec=2min",
|
|
34883
|
-
"OnUnitActiveSec=
|
|
34929
|
+
"OnUnitActiveSec=1min",
|
|
34884
34930
|
"Persistent=true",
|
|
34885
34931
|
`Unit=${serviceName}`,
|
|
34886
34932
|
"",
|
|
@@ -34940,6 +34986,60 @@ function validateServerEnvironmentTarget(command, environment) {
|
|
|
34940
34986
|
throw new Error("Unknown server environment target; use shared-dev for explicit server administration.");
|
|
34941
34987
|
}
|
|
34942
34988
|
|
|
34989
|
+
// src/serverStorageMigration.ts
|
|
34990
|
+
function parseStorageMigrationOutcome(value) {
|
|
34991
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
34992
|
+
return { status: "paused", reason: "migration_coordinator_response_invalid" };
|
|
34993
|
+
}
|
|
34994
|
+
const row = value;
|
|
34995
|
+
if (!["pending", "paused", "reader_enabled", "prune_enabled", "not_applicable"].includes(String(row.status))) {
|
|
34996
|
+
return { status: "paused", reason: "migration_coordinator_response_invalid" };
|
|
34997
|
+
}
|
|
34998
|
+
const result = { status: row.status };
|
|
34999
|
+
if (typeof row.reason === "string" && /^[a-z_]{1,80}$/.test(row.reason)) result.reason = row.reason;
|
|
35000
|
+
if (typeof row.source_commit === "string" && /^[a-f0-9]{40}$/.test(row.source_commit)) result.source_commit = row.source_commit;
|
|
35001
|
+
if (Number.isInteger(row.retry_seconds) && Number(row.retry_seconds) > 0 && Number(row.retry_seconds) <= 86400) {
|
|
35002
|
+
result.retry_seconds = Number(row.retry_seconds);
|
|
35003
|
+
}
|
|
35004
|
+
return result;
|
|
35005
|
+
}
|
|
35006
|
+
function parseStorageMigrationProgress(value) {
|
|
35007
|
+
const row = value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
35008
|
+
const result = { automatic: parseStorageMigrationOutcome(row.automatic) };
|
|
35009
|
+
if (row.legacy_full_graph !== void 0) result.legacy_full_graph = parseStorageMigrationOutcome(row.legacy_full_graph);
|
|
35010
|
+
const fields = {
|
|
35011
|
+
message_segments: ["copying", "verified", "reader_active"],
|
|
35012
|
+
message_pages: ["read_enabled", "pruned"],
|
|
35013
|
+
version_rows: ["copied", "reader_active", "pruned", "stale"]
|
|
35014
|
+
};
|
|
35015
|
+
for (const [name, names] of Object.entries(fields)) {
|
|
35016
|
+
const counts = row[name];
|
|
35017
|
+
if (!counts || typeof counts !== "object" || Array.isArray(counts)) continue;
|
|
35018
|
+
const selected = {};
|
|
35019
|
+
for (const key of names) {
|
|
35020
|
+
const count = counts[key];
|
|
35021
|
+
if (typeof count === "number" && Number.isSafeInteger(count) && count >= 0) selected[key] = count;
|
|
35022
|
+
}
|
|
35023
|
+
result[name] = selected;
|
|
35024
|
+
}
|
|
35025
|
+
return result;
|
|
35026
|
+
}
|
|
35027
|
+
function storageMigrationCommand(composePrefix, operation, sourceRevision) {
|
|
35028
|
+
if (sourceRevision !== void 0 && !/^[a-f0-9]{40}$/i.test(sourceRevision)) {
|
|
35029
|
+
throw new Error("source_revision_unavailable");
|
|
35030
|
+
}
|
|
35031
|
+
return [
|
|
35032
|
+
...composePrefix,
|
|
35033
|
+
"exec",
|
|
35034
|
+
"-T",
|
|
35035
|
+
...sourceRevision ? ["-e", `BUILD_COMMIT_SHA=${sourceRevision.toLowerCase()}`] : [],
|
|
35036
|
+
"api",
|
|
35037
|
+
"python",
|
|
35038
|
+
"/app/scripts/storage_rollout.py",
|
|
35039
|
+
operation
|
|
35040
|
+
];
|
|
35041
|
+
}
|
|
35042
|
+
|
|
34943
35043
|
// src/serverBackupArchive.ts
|
|
34944
35044
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
34945
35045
|
import { chmodSync as chmodSync4, lstatSync as lstatSync2, readdirSync as readdirSync4, renameSync as renameSync3, rmSync as rmSync4 } from "fs";
|
|
@@ -37378,6 +37478,100 @@ function sourceUpdateMetadata(installPath) {
|
|
|
37378
37478
|
}
|
|
37379
37479
|
};
|
|
37380
37480
|
}
|
|
37481
|
+
function runAutomaticStorageMigration(installPath, role, installMode, withOverrides) {
|
|
37482
|
+
if (role !== "core") return { status: "not_applicable" };
|
|
37483
|
+
if (!shouldAutoInstallRuntimeMonitoringServices(process.env)) {
|
|
37484
|
+
return { status: "paused", reason: "inventory_refresh_service_disabled", retry_seconds: 60 };
|
|
37485
|
+
}
|
|
37486
|
+
if (!refreshStorageRuntimeInventory(installPath, role, installMode, withOverrides)) {
|
|
37487
|
+
return { status: "paused", reason: "runtime_inventory_refresh_unavailable", retry_seconds: 60 };
|
|
37488
|
+
}
|
|
37489
|
+
let sourceRevision;
|
|
37490
|
+
if (installMode === "source") {
|
|
37491
|
+
if (exec("git status --porcelain", installPath).trim()) {
|
|
37492
|
+
return { status: "pending", reason: "source_worktree_unverified" };
|
|
37493
|
+
}
|
|
37494
|
+
const revision = exec("git rev-parse HEAD", installPath).trim();
|
|
37495
|
+
if (!/^[a-f0-9]{40}$/i.test(revision)) {
|
|
37496
|
+
return { status: "pending", reason: "source_revision_unavailable" };
|
|
37497
|
+
}
|
|
37498
|
+
sourceRevision = revision;
|
|
37499
|
+
}
|
|
37500
|
+
const args = storageMigrationCommand(composeArgs(installPath, withOverrides, installMode, role), "auto", sourceRevision);
|
|
37501
|
+
const result = spawnSync("docker", args, {
|
|
37502
|
+
cwd: installPath,
|
|
37503
|
+
encoding: "utf8",
|
|
37504
|
+
timeout: 45e3,
|
|
37505
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
37506
|
+
maxBuffer: 64 * 1024
|
|
37507
|
+
});
|
|
37508
|
+
if (result.error || result.status !== 0) {
|
|
37509
|
+
return { status: "paused", reason: "migration_coordinator_unavailable" };
|
|
37510
|
+
}
|
|
37511
|
+
try {
|
|
37512
|
+
return parseStorageMigrationOutcome(JSON.parse(result.stdout.trim()));
|
|
37513
|
+
} catch {
|
|
37514
|
+
}
|
|
37515
|
+
return { status: "paused", reason: "migration_coordinator_response_invalid" };
|
|
37516
|
+
}
|
|
37517
|
+
function refreshStorageRuntimeInventory(installPath, role, installMode, withOverrides) {
|
|
37518
|
+
if (role !== "core") return true;
|
|
37519
|
+
if (installMode === "source" && exec("git status --porcelain", installPath).trim()) return false;
|
|
37520
|
+
try {
|
|
37521
|
+
const containers = execFileSync4(
|
|
37522
|
+
"docker",
|
|
37523
|
+
[...composeArgs(installPath, withOverrides, installMode, role), "ps", "--all", "-q", "api"],
|
|
37524
|
+
{ cwd: installPath, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: 15e3 }
|
|
37525
|
+
).trim().split(/\s+/).filter(Boolean);
|
|
37526
|
+
if (containers.length < 1 || containers.length > 128 || new Set(containers).size !== containers.length || containers.some((id) => !/^[a-f0-9]{12,64}$/.test(id))) return false;
|
|
37527
|
+
const cohort = [];
|
|
37528
|
+
for (const container of containers) {
|
|
37529
|
+
const output = execFileSync4(
|
|
37530
|
+
"docker",
|
|
37531
|
+
["exec", container, "python", "/app/scripts/storage_runtime_inventory.py", "inspect"],
|
|
37532
|
+
{ cwd: installPath, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: 15e3, maxBuffer: 64 * 1024 }
|
|
37533
|
+
);
|
|
37534
|
+
cohort.push(JSON.parse(output.trim()));
|
|
37535
|
+
}
|
|
37536
|
+
const result = spawnSync(
|
|
37537
|
+
"docker",
|
|
37538
|
+
["exec", "-i", containers[0], "python", "/app/scripts/storage_runtime_inventory.py", "publish"],
|
|
37539
|
+
{
|
|
37540
|
+
cwd: installPath,
|
|
37541
|
+
encoding: "utf8",
|
|
37542
|
+
input: JSON.stringify(cohort),
|
|
37543
|
+
timeout: 45e3,
|
|
37544
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
37545
|
+
maxBuffer: 64 * 1024
|
|
37546
|
+
}
|
|
37547
|
+
);
|
|
37548
|
+
if (result.error || result.status !== 0) return false;
|
|
37549
|
+
const published = JSON.parse(result.stdout.trim());
|
|
37550
|
+
return published.status === "published";
|
|
37551
|
+
} catch {
|
|
37552
|
+
return false;
|
|
37553
|
+
}
|
|
37554
|
+
}
|
|
37555
|
+
function readStorageMigrationProgress(installPath, role, installMode, withOverrides) {
|
|
37556
|
+
if (role !== "core") return { automatic: { status: "not_applicable" } };
|
|
37557
|
+
const result = spawnSync("docker", storageMigrationCommand(
|
|
37558
|
+
composeArgs(installPath, withOverrides, installMode, role),
|
|
37559
|
+
"status"
|
|
37560
|
+
), {
|
|
37561
|
+
cwd: installPath,
|
|
37562
|
+
encoding: "utf8",
|
|
37563
|
+
timeout: 45e3,
|
|
37564
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
37565
|
+
maxBuffer: 64 * 1024
|
|
37566
|
+
});
|
|
37567
|
+
if (!result.error && result.status === 0) {
|
|
37568
|
+
try {
|
|
37569
|
+
return parseStorageMigrationProgress(JSON.parse(result.stdout.trim()));
|
|
37570
|
+
} catch {
|
|
37571
|
+
}
|
|
37572
|
+
}
|
|
37573
|
+
return { automatic: { status: "paused", reason: "migration_coordinator_unavailable", retry_seconds: 60 } };
|
|
37574
|
+
}
|
|
37381
37575
|
function copyIfExists(source, destination) {
|
|
37382
37576
|
if (!existsSync11(source)) return;
|
|
37383
37577
|
mkdirSync12(dirname9(destination), { recursive: true });
|
|
@@ -37887,8 +38081,40 @@ async function serverStatus(flags) {
|
|
|
37887
38081
|
args.push("--format", "json");
|
|
37888
38082
|
}
|
|
37889
38083
|
if (selection.requested) args.push(...selection.services);
|
|
38084
|
+
if (flags.json === true) {
|
|
38085
|
+
const output = execFileSync4("docker", args, { cwd: installPath, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
38086
|
+
const containers = [];
|
|
38087
|
+
if (output) {
|
|
38088
|
+
if (output.startsWith("[")) containers.push(...JSON.parse(output));
|
|
38089
|
+
else for (const line of output.split("\n")) containers.push(JSON.parse(line));
|
|
38090
|
+
}
|
|
38091
|
+
printJson({
|
|
38092
|
+
command: "status",
|
|
38093
|
+
path: installPath,
|
|
38094
|
+
role,
|
|
38095
|
+
containers,
|
|
38096
|
+
storageMigration: readStorageMigrationProgress(installPath, role, getInstallMode(installPath, config), withOverrides)
|
|
38097
|
+
});
|
|
38098
|
+
return;
|
|
38099
|
+
}
|
|
37890
38100
|
const code = await runInteractive("docker", args, installPath);
|
|
37891
38101
|
if (code !== 0) process.exit(code);
|
|
38102
|
+
const migration = readStorageMigrationProgress(installPath, role, getInstallMode(installPath, config), withOverrides);
|
|
38103
|
+
const outcome = migration.automatic;
|
|
38104
|
+
console.log(`Storage migration: ${outcome.status}${outcome.reason ? ` (${outcome.reason})` : ""}${outcome.retry_seconds ? `; retry in ${outcome.retry_seconds}s` : ""}`);
|
|
38105
|
+
if (migration.legacy_full_graph) console.log(`Legacy full graph migration: ${migration.legacy_full_graph.status} (${migration.legacy_full_graph.reason ?? "policy_pending"})`);
|
|
38106
|
+
if (migration.message_segments) console.log(`Message segments: ${JSON.stringify(migration.message_segments)}`);
|
|
38107
|
+
if (migration.message_pages) console.log(`Message pages: ${JSON.stringify(migration.message_pages)}`);
|
|
38108
|
+
if (migration.version_rows) console.log(`Version rows: ${JSON.stringify(migration.version_rows)}`);
|
|
38109
|
+
}
|
|
38110
|
+
function sourceBuildCommitSha(installPath) {
|
|
38111
|
+
try {
|
|
38112
|
+
if (exec("git status --porcelain", installPath).trim()) return "";
|
|
38113
|
+
const revision = exec("git rev-parse HEAD", installPath).trim();
|
|
38114
|
+
return /^[a-f0-9]{40}$/i.test(revision) ? revision.toLowerCase() : "";
|
|
38115
|
+
} catch {
|
|
38116
|
+
return "";
|
|
38117
|
+
}
|
|
37892
38118
|
}
|
|
37893
38119
|
async function serverStart(flags) {
|
|
37894
38120
|
requireDocker();
|
|
@@ -37921,6 +38147,18 @@ async function serverStart(flags) {
|
|
|
37921
38147
|
code = await runInteractive("docker", pullArgs, installPath);
|
|
37922
38148
|
if (code !== 0) process.exit(code);
|
|
37923
38149
|
}
|
|
38150
|
+
if (installMode === "source") {
|
|
38151
|
+
const buildArgs = [
|
|
38152
|
+
...composeArgs(installPath, withOverrides, installMode, role),
|
|
38153
|
+
"build",
|
|
38154
|
+
"--build-arg",
|
|
38155
|
+
`BUILD_COMMIT_SHA=${sourceBuildCommitSha(installPath)}`
|
|
38156
|
+
];
|
|
38157
|
+
if (selection.requested) buildArgs.push(...selection.services);
|
|
38158
|
+
console.error("Building source containers...");
|
|
38159
|
+
code = await runInteractive("docker", buildArgs, installPath);
|
|
38160
|
+
if (code !== 0) process.exit(code);
|
|
38161
|
+
}
|
|
37924
38162
|
code = await runInteractive("docker", args, installPath);
|
|
37925
38163
|
if (code !== 0) process.exit(code);
|
|
37926
38164
|
if (flags.json === true) {
|
|
@@ -38562,6 +38800,8 @@ async function installRuntimeMonitoringServices(installPath, role) {
|
|
|
38562
38800
|
execSync("systemctl daemon-reload", { stdio: "pipe" });
|
|
38563
38801
|
const timers = files.filter(([name]) => name.endsWith(".timer")).map(([name]) => name);
|
|
38564
38802
|
execSync(`systemctl enable --now ${timers.map(shellQuote).join(" ")}`, { stdio: "pipe" });
|
|
38803
|
+
execFileSync4("systemctl", ["restart", plan.timerName], { stdio: "pipe" });
|
|
38804
|
+
execFileSync4("systemctl", ["--no-block", "try-restart", plan.serviceName], { stdio: "pipe" });
|
|
38565
38805
|
for (const timer of timers) execFileSync4("systemctl", ["is-active", "--quiet", timer], { stdio: "pipe" });
|
|
38566
38806
|
}
|
|
38567
38807
|
async function autoInstallRuntimeMonitoringServices(installPath, role) {
|
|
@@ -38933,6 +39173,8 @@ async function serverUpdate(client2, rest, flags) {
|
|
|
38933
39173
|
await runInteractive("docker", [...composeArgs(installPath, withOverrides, installMode, role), "ps"], installPath);
|
|
38934
39174
|
throw error;
|
|
38935
39175
|
}
|
|
39176
|
+
const automaticStorageMigration2 = runAutomaticStorageMigration(installPath, role, installMode, withOverrides);
|
|
39177
|
+
console.error(`Storage migration: ${automaticStorageMigration2.status}${automaticStorageMigration2.reason ? ` (${automaticStorageMigration2.reason})` : ""}`);
|
|
38936
39178
|
if (config) {
|
|
38937
39179
|
saveServerConfig({ ...config, imageTag: target.tag, imageChannel: target.channel });
|
|
38938
39180
|
}
|
|
@@ -38970,6 +39212,7 @@ async function serverUpdate(client2, rest, flags) {
|
|
|
38970
39212
|
checks: successfulRuntimeOutput2?.checks ?? [],
|
|
38971
39213
|
runtimeCompletedAt: successfulRuntimeOutput2?.completed_at,
|
|
38972
39214
|
quickTest: quickTest2,
|
|
39215
|
+
automaticStorageMigration: automaticStorageMigration2,
|
|
38973
39216
|
completionEmailDelivery: completion3.delivery
|
|
38974
39217
|
});
|
|
38975
39218
|
if (flags.json === true) {
|
|
@@ -38999,6 +39242,7 @@ async function serverUpdate(client2, rest, flags) {
|
|
|
38999
39242
|
checks: successfulRuntimeOutput2?.checks ?? [],
|
|
39000
39243
|
runtimeCompletedAt: successfulRuntimeOutput2?.completed_at,
|
|
39001
39244
|
quickTest: quickTest2,
|
|
39245
|
+
automaticStorageMigration: automaticStorageMigration2,
|
|
39002
39246
|
completionEmailDelivery: completion2.delivery,
|
|
39003
39247
|
completionEmailDeliveryId: completion2.deliveryId,
|
|
39004
39248
|
completionEmailPendingAt: completion2.deliveryPendingAt,
|
|
@@ -39014,6 +39258,7 @@ async function serverUpdate(client2, rest, flags) {
|
|
|
39014
39258
|
runtimeVerification: successfulRuntimeOutput2,
|
|
39015
39259
|
caddy: caddy2,
|
|
39016
39260
|
quickTest: quickTest2,
|
|
39261
|
+
automaticStorageMigration: automaticStorageMigration2,
|
|
39017
39262
|
completionEmailDelivery: completion2.delivery,
|
|
39018
39263
|
completedAt: completion2.completedAt
|
|
39019
39264
|
});
|
|
@@ -39078,8 +39323,16 @@ async function serverUpdate(client2, rest, flags) {
|
|
|
39078
39323
|
);
|
|
39079
39324
|
}
|
|
39080
39325
|
}
|
|
39326
|
+
let sourceBuildRevision = "";
|
|
39327
|
+
try {
|
|
39328
|
+
if (!exec("git status --porcelain", installPath).trim()) {
|
|
39329
|
+
const revision = exec("git rev-parse HEAD", installPath).trim();
|
|
39330
|
+
if (/^[a-f0-9]{40}$/i.test(revision)) sourceBuildRevision = revision.toLowerCase();
|
|
39331
|
+
}
|
|
39332
|
+
} catch {
|
|
39333
|
+
}
|
|
39081
39334
|
const buildArgs = appendSelectedServices(
|
|
39082
|
-
[...composeArgs(installPath, withOverrides, installMode, role), "build"],
|
|
39335
|
+
[...composeArgs(installPath, withOverrides, installMode, role), "build", "--build-arg", `BUILD_COMMIT_SHA=${sourceBuildRevision}`],
|
|
39083
39336
|
coreSetupPlan.pullOrBuildServices,
|
|
39084
39337
|
filterRequested
|
|
39085
39338
|
);
|
|
@@ -39146,6 +39399,8 @@ async function serverUpdate(client2, rest, flags) {
|
|
|
39146
39399
|
await runInteractive("docker", [...composeArgs(installPath, withOverrides, installMode, role), "ps"], installPath);
|
|
39147
39400
|
throw error;
|
|
39148
39401
|
}
|
|
39402
|
+
const automaticStorageMigration = runAutomaticStorageMigration(installPath, role, installMode, withOverrides);
|
|
39403
|
+
console.error(`Storage migration: ${automaticStorageMigration.status}${automaticStorageMigration.reason ? ` (${automaticStorageMigration.reason})` : ""}`);
|
|
39149
39404
|
try {
|
|
39150
39405
|
await autoInstallRuntimeMonitoringServices(installPath, role);
|
|
39151
39406
|
} catch (error) {
|
|
@@ -39172,6 +39427,7 @@ async function serverUpdate(client2, rest, flags) {
|
|
|
39172
39427
|
checks: successfulRuntimeOutput?.checks ?? [],
|
|
39173
39428
|
runtimeCompletedAt: successfulRuntimeOutput?.completed_at,
|
|
39174
39429
|
quickTest,
|
|
39430
|
+
automaticStorageMigration,
|
|
39175
39431
|
completionEmailDelivery: completion2.delivery
|
|
39176
39432
|
});
|
|
39177
39433
|
if (flags.json === true) {
|
|
@@ -39199,6 +39455,7 @@ async function serverUpdate(client2, rest, flags) {
|
|
|
39199
39455
|
checks: successfulRuntimeOutput?.checks ?? [],
|
|
39200
39456
|
runtimeCompletedAt: successfulRuntimeOutput?.completed_at,
|
|
39201
39457
|
quickTest,
|
|
39458
|
+
automaticStorageMigration,
|
|
39202
39459
|
completionEmailDelivery: completion.delivery,
|
|
39203
39460
|
completionEmailDeliveryId: completion.deliveryId,
|
|
39204
39461
|
completionEmailPendingAt: completion.deliveryPendingAt,
|
|
@@ -39215,6 +39472,7 @@ async function serverUpdate(client2, rest, flags) {
|
|
|
39215
39472
|
runtimeVerification: successfulRuntimeOutput,
|
|
39216
39473
|
caddy,
|
|
39217
39474
|
quickTest,
|
|
39475
|
+
automaticStorageMigration,
|
|
39218
39476
|
completionEmailDelivery: completion.delivery,
|
|
39219
39477
|
completedAt: completion.completedAt
|
|
39220
39478
|
});
|
|
@@ -39371,7 +39629,23 @@ async function serverMonitoring(rest, flags) {
|
|
|
39371
39629
|
let output;
|
|
39372
39630
|
try {
|
|
39373
39631
|
requireDocker();
|
|
39632
|
+
const inventoryRefreshed = refreshStorageRuntimeInventory(
|
|
39633
|
+
installPath,
|
|
39634
|
+
role,
|
|
39635
|
+
getInstallMode(installPath, config),
|
|
39636
|
+
config?.composeProfile === "full"
|
|
39637
|
+
);
|
|
39374
39638
|
output = runRuntimeVerification(installPath, role, config);
|
|
39639
|
+
if (!inventoryRefreshed) {
|
|
39640
|
+
output.checks.push({
|
|
39641
|
+
id: "core.storage_migration_inventory",
|
|
39642
|
+
status: "failed",
|
|
39643
|
+
required: false,
|
|
39644
|
+
duration_ms: 0,
|
|
39645
|
+
failureClass: "configuration",
|
|
39646
|
+
sanitized_reason: "runtime_inventory_refresh_unavailable"
|
|
39647
|
+
});
|
|
39648
|
+
}
|
|
39375
39649
|
} catch (error) {
|
|
39376
39650
|
console.error(`Runtime verifier unavailable: ${error instanceof Error ? error.name : "UnknownError"}`);
|
|
39377
39651
|
output = {
|
package/dist/cli.js
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
shouldRequireTrustedAccountGuard,
|
|
22
22
|
waitForSafeE2ETotpWindow,
|
|
23
23
|
waitForWorkflowRun
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-NQP5QUVR.js";
|
|
25
25
|
import "./chunk-FRNW5Q2V.js";
|
|
26
26
|
import "./chunk-IWKP55ZB.js";
|
|
27
27
|
import "./chunk-4IRYB3YN.js";
|
package/dist/index.js
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -17,47 +17,47 @@
|
|
|
17
17
|
{
|
|
18
18
|
"name": "libggml-base.so",
|
|
19
19
|
"bytes": 1110088,
|
|
20
|
-
"sha256": "
|
|
20
|
+
"sha256": "92d2614c50936307afdc6524b801d1c2d0f25af5969c04aea4e37b3f47797c42"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"name": "libggml-base.so.0",
|
|
24
24
|
"bytes": 1110088,
|
|
25
|
-
"sha256": "
|
|
25
|
+
"sha256": "92d2614c50936307afdc6524b801d1c2d0f25af5969c04aea4e37b3f47797c42"
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
"name": "libggml-base.so.0.15.1",
|
|
29
29
|
"bytes": 1110088,
|
|
30
|
-
"sha256": "
|
|
30
|
+
"sha256": "92d2614c50936307afdc6524b801d1c2d0f25af5969c04aea4e37b3f47797c42"
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
"name": "libggml-cpu.so",
|
|
34
34
|
"bytes": 869800,
|
|
35
|
-
"sha256": "
|
|
35
|
+
"sha256": "efdc4d1aa71b49b084eb26c2e751e356ca43a44d3f5dc553e91dd6610cc291d5"
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
"name": "libggml-cpu.so.0",
|
|
39
39
|
"bytes": 869800,
|
|
40
|
-
"sha256": "
|
|
40
|
+
"sha256": "efdc4d1aa71b49b084eb26c2e751e356ca43a44d3f5dc553e91dd6610cc291d5"
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
"name": "libggml-cpu.so.0.15.1",
|
|
44
44
|
"bytes": 869800,
|
|
45
|
-
"sha256": "
|
|
45
|
+
"sha256": "efdc4d1aa71b49b084eb26c2e751e356ca43a44d3f5dc553e91dd6610cc291d5"
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
"name": "libggml.so",
|
|
49
49
|
"bytes": 1899104,
|
|
50
|
-
"sha256": "
|
|
50
|
+
"sha256": "684599527a3492b456a658e0676f54df02cd27290d2d2b87ee3bb36286414c64"
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
"name": "libggml.so.0",
|
|
54
54
|
"bytes": 1899104,
|
|
55
|
-
"sha256": "
|
|
55
|
+
"sha256": "684599527a3492b456a658e0676f54df02cd27290d2d2b87ee3bb36286414c64"
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"name": "libggml.so.0.15.1",
|
|
59
59
|
"bytes": 1899104,
|
|
60
|
-
"sha256": "
|
|
60
|
+
"sha256": "684599527a3492b456a658e0676f54df02cd27290d2d2b87ee3bb36286414c64"
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
"name": "openmates-pii-worker",
|