@poe-platform/safe-bash 0.1.825 → 0.1.827
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/image-ast/index.js +39 -18
- package/dist/pdf-ast/image.js +1 -1
- package/dist/pdf-ast/index.js +1 -1
- package/dist/pdf-ast/vendor/pdfjs-fonts.mjs +9 -3
- package/dist/safe-bash/chunks/{chunk-AGHV53VF.js → chunk-M6XFU6LQ.js} +3 -1
- package/dist/safe-bash/chunks/{chunk-363QOIDR.js → chunk-T6FHWSHM.js} +3 -1
- package/dist/safe-bash/command-chunks/{chunk-ZPBL7TYJ.js → chunk-2JRHCVMQ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-FMGNXOMV.js → chunk-2L3NMRLG.js} +7 -3
- package/dist/safe-bash/command-chunks/{chunk-DAQO64WC.js → chunk-2YKOJPIW.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-EPYJSPOY.js → chunk-3QCW4VQF.js} +12 -8
- package/dist/safe-bash/command-chunks/{chunk-YRBFNT5B.js → chunk-3YL2TMLA.js} +10 -1
- package/dist/safe-bash/command-chunks/{chunk-5H7ZHP7F.js → chunk-43NDRBKY.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-BBOYR6LV.js → chunk-46GA576V.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-WPT2FCHH.js → chunk-4SLPM2WM.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-7ZQVMPSB.js → chunk-5CAXR62E.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3DTHX5UU.js → chunk-66653AEZ.js} +40 -14
- package/dist/safe-bash/command-chunks/{chunk-ETFJ4L7F.js → chunk-6OLE6CLV.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-ZIDESNHW.js → chunk-7M3M6FKC.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-2KMNVJB7.js → chunk-A7PKUIJT.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-AVSINNZ6.js → chunk-DEQ47SBQ.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-EV7A5FNN.js → chunk-FFFRLPXU.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-4MVQE6CT.js → chunk-FYTBEGSY.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-LFTGMUAV.js → chunk-HQIZR6EU.js} +192 -489
- package/dist/safe-bash/command-chunks/chunk-HS2L7I4N.js +219 -0
- package/dist/safe-bash/command-chunks/{chunk-WKS2PAZL.js → chunk-HUGKO4ZE.js} +10 -1
- package/dist/safe-bash/command-chunks/chunk-IGXH5W5Z.js +111 -0
- package/dist/safe-bash/command-chunks/{chunk-CMJBRGU2.js → chunk-IHQZKUBS.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-JADJ4BMN.js +1519 -0
- package/dist/safe-bash/command-chunks/{chunk-5AQAWIYK.js → chunk-JEZC5V3B.js} +4 -0
- package/dist/safe-bash/command-chunks/{chunk-YB5TNDY6.js → chunk-K5VJ4NNL.js} +39 -5
- package/dist/safe-bash/command-chunks/{chunk-7RQGRFHJ.js → chunk-KHWDEAE4.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-L54KVUSY.js +604 -0
- package/dist/safe-bash/command-chunks/{chunk-3NJETNC2.js → chunk-MBXNG6C3.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-HCPEYQKT.js → chunk-N4SH6QY5.js} +285 -302
- package/dist/safe-bash/command-chunks/{chunk-3DID6MQY.js → chunk-OWTQYLID.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-4EA7WI3L.js → chunk-QOOQD6BD.js} +42 -33
- package/dist/safe-bash/command-chunks/{chunk-RQTFK7AV.js → chunk-QZYEI4N6.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-R3SLT3ZX.js → chunk-R6GON4H3.js} +11 -1
- package/dist/safe-bash/command-chunks/{chunk-2GILUQJY.js → chunk-R7ZGDHME.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-HNEWGADJ.js → chunk-RUXOFW5G.js} +7 -6
- package/dist/safe-bash/command-chunks/{chunk-LKAFLJ5L.js → chunk-RWQKX44L.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-PKH57OIC.js → chunk-SG2KOOD4.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-T4TGJYFV.js +60 -0
- package/dist/safe-bash/command-chunks/chunk-TGSNVLFZ.js +105 -0
- package/dist/safe-bash/command-chunks/{chunk-NXCJNPL3.js → chunk-UCE77LYV.js} +2 -1
- package/dist/safe-bash/command-chunks/{chunk-EWECMOQ5.js → chunk-UIHPHIKI.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-XSZNL3GV.js → chunk-UJPWPRVB.js} +191 -146
- package/dist/safe-bash/command-chunks/{chunk-E5CDHXFA.js → chunk-VOR6YDZC.js} +26 -1
- package/dist/safe-bash/command-chunks/chunk-VSNVYOK2.js +30 -0
- package/dist/safe-bash/command-chunks/{chunk-4XYGJB24.js → chunk-VTH4AORO.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-W5LH7D23.js → chunk-WKKJJBJQ.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-OLXMWQJ5.js → chunk-WRO3PB2M.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-RUAGHZNF.js → chunk-X5ODTF3E.js} +7 -5
- package/dist/safe-bash/command-chunks/{chunk-LH4VBNF6.js → chunk-XGTSP2CP.js} +84 -16
- package/dist/safe-bash/command-chunks/{chunk-K576GZED.js → chunk-XTHKXCF2.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-J3VS55K4.js → chunk-YHRESVJ7.js} +9 -3
- package/dist/safe-bash/command-chunks/{chunk-UWIDPTOB.js → chunk-YSCKOUQP.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-UYNJF5QN.js → chunk-ZALAWNOE.js} +76 -122
- package/dist/safe-bash/command-chunks/{chunk-OT75C5YS.js → chunk-ZYXKW2K7.js} +1 -1
- package/dist/safe-bash/command-chunks/{pdf-renderer-346WYKSZ.js → pdf-renderer-5QWOVFA4.js} +1 -1
- package/dist/safe-bash/command-chunks/{prompt-tool-debug-3POFNRYP.js → prompt-tool-debug-G7ATE7D5.js} +6 -4
- package/dist/safe-bash/commands/llm/index.browser.js +5 -1
- package/dist/safe-bash/commands/llm/index.js +1 -1
- package/dist/safe-bash/commands/python/executor.browser.js +3 -1
- package/dist/safe-bash/commands/python/executor.js +1 -1
- package/dist/safe-bash/commands/python/index.browser.js +5 -1
- package/dist/safe-bash/commands/python/index.js +1 -1
- package/dist/safe-bash/core.browser.js +2 -2
- package/dist/safe-bash/full-core.browser.js +10 -2
- package/dist/safe-bash-command-awk/awk-runtime.js +2 -2
- package/dist/safe-bash-command-awk/awk-syntax.js +1 -1
- package/dist/safe-bash-command-awk/awk.js +3 -3
- package/dist/safe-bash-command-awk/index.js +3 -3
- package/dist/safe-bash-command-gpg/index.js +11 -3
- package/dist/safe-bash-command-imagemagick/index.js +2 -2
- package/dist/safe-bash-command-llm/collections.js +6 -4
- package/dist/safe-bash-command-llm/command.js +4 -4
- package/dist/safe-bash-command-llm/import-json-document.d.ts +9 -2
- package/dist/safe-bash-command-llm/index.d.ts +2 -1
- package/dist/safe-bash-command-llm/index.js +10 -4
- package/dist/safe-bash-command-llm/loader-provider.d.ts +5 -0
- package/dist/safe-bash-command-mcp/index.js +10 -13
- package/dist/safe-bash-command-pdftoppm/index.js +2 -2
- package/dist/safe-bash-command-playwright-cli/index.js +2 -2
- package/dist/safe-bash-command-playwright-cli/playwright/ability-execution.d.ts +1 -0
- package/dist/safe-bash-command-playwright-cli/playwright/ability-execution.js +1 -1
- package/dist/safe-bash-command-playwright-cli/playwright/controller.d.ts +2 -0
- package/dist/safe-bash-command-playwright-cli/playwright/controller.js +2 -2
- package/dist/safe-bash-command-playwright-cli/playwright/index.js +2 -2
- package/dist/safe-bash-command-python/build-backend.d.ts +2 -0
- package/dist/safe-bash-command-python/cache.d.ts +1 -1
- package/dist/safe-bash-command-python/executor.d.ts +5 -2
- package/dist/safe-bash-command-python/executor.js +11 -6
- package/dist/safe-bash-command-python/host-capabilities.js +1 -1
- package/dist/safe-bash-command-python/index.js +11 -6
- package/dist/safe-bash-command-python/jspi.js +5 -3
- package/dist/safe-bash-command-python/manifest-file.d.ts +44 -0
- package/dist/safe-bash-command-python/manifest.d.ts +45 -0
- package/dist/safe-bash-command-python/provisioning.d.ts +20 -1
- package/dist/safe-bash-command-python/provisioning.js +3 -2
- package/dist/safe-bash-command-python/reply.js +7 -11
- package/dist/safe-bash-command-python/source-archive.js +2 -2
- package/dist/safe-bash-command-python/source-zip.js +2 -2
- package/dist/safe-bash-command-python/worker.js +34 -21
- package/dist/safe-bash-command-sqlite3/engine.d.ts +4 -0
- package/dist/safe-bash-command-sqlite3/index.js +174 -18
- package/dist/safe-bash-command-svgo/index.js +1 -1
- package/dist/safe-bash-command-tar/create.js +3 -3
- package/dist/safe-bash-command-tar/extract.js +3 -3
- package/dist/safe-bash-command-tar/index.js +5 -5
- package/dist/safe-bash-command-tar/modes.js +5 -5
- package/dist/safe-bash-command-tar/options.d.ts +1 -1
- package/dist/safe-bash-command-tar/options.js +1 -1
- package/dist/safe-bash-command-tar/stream.js +1 -1
- package/dist/safe-bash-command-wkhtmltopdf/index.js +1 -1
- package/dist/safe-bash-command-xan/argv.js +1 -1
- package/dist/safe-bash-command-xan/commands.js +3 -3
- package/dist/safe-bash-command-xan/index.js +3 -3
- package/dist/safe-bash-command-xan/io.js +2 -2
- package/dist/safe-bash-compression-engine/bounded-codec.js +3 -3
- package/dist/safe-bash-compression-engine/codec-loader.js +2 -2
- package/dist/safe-bash-compression-engine/files.js +6 -6
- package/dist/safe-bash-compression-engine/index.js +5 -5
- package/dist/safe-bash-compression-engine/operand.js +6 -6
- package/dist/safe-bash-compression-engine/options.js +1 -1
- package/dist/safe-bash-compression-engine/stream.js +5 -5
- package/dist/safe-bash-compression-engine/zstd-decode.js +4 -4
- package/dist/safe-bash-contracts/filesystem-descriptor.js +1 -1
- package/dist/safe-bash-contracts/filesystem-output.js +1 -1
- package/dist/safe-bash-csv-engine/index.js +6 -6
- package/dist/safe-bash-csv-engine/python-codec-aliases.js +1 -1
- package/dist/safe-bash-csv-engine/python-codepages.js +3 -3
- package/dist/safe-bash-csv-engine/python-file-codepages.js +2 -2
- package/dist/safe-bash-csv-engine/python-utf16.js +4 -4
- package/dist/safe-bash-csv-engine/text-decoder.js +6 -6
- package/dist/safe-bash-graphviz-engine/index.js +1 -1
- package/dist/safe-bash-pager-engine/index.js +2 -2
- package/dist/safe-bash-query-engine/capture.js +3 -3
- package/dist/safe-bash-query-engine/delpaths.js +3 -3
- package/dist/safe-bash-query-engine/formats.js +2 -2
- package/dist/safe-bash-query-engine/index.js +10 -10
- package/dist/safe-bash-query-engine/indices.js +3 -3
- package/dist/safe-bash-query-engine/input.d.ts +3 -3
- package/dist/safe-bash-query-engine/input.js +1 -1
- package/dist/safe-bash-query-engine/interpreter.js +9 -9
- package/dist/safe-bash-query-engine/query-core.js +10 -10
- package/dist/safe-bash-query-engine/regex.js +4 -4
- package/dist/safe-bash-query-engine/splits.js +5 -5
- package/dist/safe-bash-query-engine/values.js +2 -2
- package/package.json +2 -2
- package/dist/safe-bash/command-chunks/chunk-OOYVZAWL.js +0 -90
- package/dist/safe-bash/command-chunks/chunk-RZOHZGEZ.js +0 -772
- package/dist/safe-bash/command-chunks/chunk-WIUEM7HP.js +0 -58
- package/dist/safe-bash/command-chunks/chunk-WY6THI6J.js +0 -673
- package/dist/safe-bash/command-chunks/chunk-ZERCTWUI.js +0 -467
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import {
|
|
2
|
+
openPythonPackageFile
|
|
3
|
+
} from "./chunk-UCE77LYV.js";
|
|
4
|
+
|
|
5
|
+
// packages/safe-bash-command-python/src/record-reader.ts
|
|
6
|
+
function createPythonRecordReader(encode) {
|
|
7
|
+
let source, row;
|
|
8
|
+
let text = "", previous = "", position = 0, tail = Promise.resolve();
|
|
9
|
+
return {
|
|
10
|
+
read(nextRow, offset) {
|
|
11
|
+
const work = tail.then(async () => {
|
|
12
|
+
if (row === nextRow && offset === position - 1 && previous) {
|
|
13
|
+
text = previous + text;
|
|
14
|
+
position--;
|
|
15
|
+
}
|
|
16
|
+
if (row !== nextRow || offset < position) {
|
|
17
|
+
source = void 0;
|
|
18
|
+
position = 0;
|
|
19
|
+
text = previous = "";
|
|
20
|
+
row = nextRow;
|
|
21
|
+
}
|
|
22
|
+
source ??= encode(nextRow)[Symbol.asyncIterator]();
|
|
23
|
+
const decoder = new TextDecoder();
|
|
24
|
+
while (true) {
|
|
25
|
+
if (position < offset) {
|
|
26
|
+
const skip = Math.min(offset - position, text.length);
|
|
27
|
+
if (skip) previous = text[skip - 1];
|
|
28
|
+
text = text.slice(skip);
|
|
29
|
+
position += skip;
|
|
30
|
+
}
|
|
31
|
+
if (text.length >= 8192) break;
|
|
32
|
+
const next = await source.next();
|
|
33
|
+
if (next.done) break;
|
|
34
|
+
text += decoder.decode(next.value);
|
|
35
|
+
}
|
|
36
|
+
const result = text.slice(0, 8192);
|
|
37
|
+
previous = result.at(-1) ?? previous;
|
|
38
|
+
text = text.slice(result.length);
|
|
39
|
+
position += result.length;
|
|
40
|
+
return result;
|
|
41
|
+
});
|
|
42
|
+
tail = work.catch(() => {
|
|
43
|
+
});
|
|
44
|
+
return work;
|
|
45
|
+
},
|
|
46
|
+
async close() {
|
|
47
|
+
await tail;
|
|
48
|
+
source = void 0;
|
|
49
|
+
text = previous = "";
|
|
50
|
+
row = void 0;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// packages/safe-bash-command-python/src/manifest-backed.ts
|
|
56
|
+
import { openLlmJsonDocument } from "../../safe-bash-command-llm/index.js";
|
|
57
|
+
import { IntegerTable, PagedStorage } from "@poe-platform/safe-fs/storage";
|
|
58
|
+
async function readBackedPythonManifest(fs, directory, signal, input, collectInstalled = true) {
|
|
59
|
+
const document = await openLlmJsonDocument({ fs, directory, signal, maxFileBytes: Number.MAX_SAFE_INTEGER, maxOpenFiles: 1, profile: "javascript", maxControlBytes: Number.MAX_SAFE_INTEGER }, input);
|
|
60
|
+
const storage = new PagedStorage({ fs, cwd: directory, env: {}, signal }, 4), index = new IntegerTable(storage, 64);
|
|
61
|
+
const invalid = () => {
|
|
62
|
+
throw new Error("Invalid Python package environment manifest");
|
|
63
|
+
};
|
|
64
|
+
const close = async () => {
|
|
65
|
+
const results = await Promise.allSettled([document.close(), storage.close()]);
|
|
66
|
+
for (const result of results) if (result.status === "rejected") throw result.reason;
|
|
67
|
+
};
|
|
68
|
+
async function* children(node) {
|
|
69
|
+
for (let child = await document.child(node.id); child; child = await document.child(node.id, child.position)) yield child;
|
|
70
|
+
}
|
|
71
|
+
const string = async (node) => {
|
|
72
|
+
if (node.type !== "string") invalid();
|
|
73
|
+
let text = "";
|
|
74
|
+
for await (const chunk of document.text(node)) text += chunk;
|
|
75
|
+
return text;
|
|
76
|
+
};
|
|
77
|
+
let version = 0, records, installedNode = document.root, recordCount = -1;
|
|
78
|
+
try {
|
|
79
|
+
if (document.root.type !== "array") {
|
|
80
|
+
if (document.root.type !== "object") invalid();
|
|
81
|
+
let count = 0, found = false;
|
|
82
|
+
for await (const { node, key } of children(document.root)) {
|
|
83
|
+
count++;
|
|
84
|
+
if (key === "version") {
|
|
85
|
+
const value = Number(node.token);
|
|
86
|
+
if (node.type !== "number" || ![1, 2, 3].includes(value)) invalid();
|
|
87
|
+
version = value;
|
|
88
|
+
} else if (key === "installed") {
|
|
89
|
+
installedNode = node;
|
|
90
|
+
found = true;
|
|
91
|
+
} else if (key === "records") records = node;
|
|
92
|
+
else invalid();
|
|
93
|
+
}
|
|
94
|
+
if (!found || !version || count !== (version === 1 ? 2 : 3) || version !== 1 && !records) invalid();
|
|
95
|
+
}
|
|
96
|
+
if (installedNode.type !== "array") invalid();
|
|
97
|
+
const installed = [];
|
|
98
|
+
for await (const { node } of children(installedNode)) {
|
|
99
|
+
if (node.type !== "string") invalid();
|
|
100
|
+
if (collectInstalled) installed.push(await string(node));
|
|
101
|
+
}
|
|
102
|
+
if (records) {
|
|
103
|
+
if (records.type !== "array") invalid();
|
|
104
|
+
recordCount = 0;
|
|
105
|
+
let previous = -1;
|
|
106
|
+
for await (const entry of children(records)) {
|
|
107
|
+
const row = entry.node;
|
|
108
|
+
if (row.type !== "array") invalid();
|
|
109
|
+
let field = 0;
|
|
110
|
+
for await (const { node } of children(row)) {
|
|
111
|
+
if (field === 3 || field === 4) {
|
|
112
|
+
if (node.type !== "array") invalid();
|
|
113
|
+
for await (const { node: item } of children(node)) if (item.type !== "string") invalid();
|
|
114
|
+
} else if (node.type !== "string" && !(field === 5 && node.type === "null")) invalid();
|
|
115
|
+
field++;
|
|
116
|
+
}
|
|
117
|
+
if (field !== version + 3) invalid();
|
|
118
|
+
await index.set(BigInt(recordCount++), BigInt(previous + 1));
|
|
119
|
+
previous = entry.position;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const encoder = new TextEncoder();
|
|
123
|
+
async function* json(node, legacy = false) {
|
|
124
|
+
if (!node || node.type === "null") {
|
|
125
|
+
yield "null";
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (node.type === "string") {
|
|
129
|
+
yield '"';
|
|
130
|
+
for await (const text of document.text(node)) for (let offset = 0; offset < text.length; offset += 1024) yield JSON.stringify(text.slice(offset, offset + 1024)).slice(1, -1);
|
|
131
|
+
yield '"';
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
yield "[";
|
|
135
|
+
let count = 0;
|
|
136
|
+
for await (const { node: item } of children(node)) {
|
|
137
|
+
if (count++) yield ",";
|
|
138
|
+
yield* json(item);
|
|
139
|
+
}
|
|
140
|
+
if (legacy) yield ",null";
|
|
141
|
+
yield "]";
|
|
142
|
+
}
|
|
143
|
+
const reader = createPythonRecordReader(async function* (key) {
|
|
144
|
+
const ordinal = Math.floor(key / 7), field = key % 7 - 1;
|
|
145
|
+
const previous = await index.get(BigInt(ordinal));
|
|
146
|
+
if (previous === void 0) invalid();
|
|
147
|
+
const entry = await document.child(records.id, Number(previous) - 1);
|
|
148
|
+
if (!entry) invalid();
|
|
149
|
+
let selected = entry.node;
|
|
150
|
+
if (field >= 0) {
|
|
151
|
+
selected = void 0;
|
|
152
|
+
let position = 0;
|
|
153
|
+
for await (const { node } of children(entry.node)) if (position++ === field) {
|
|
154
|
+
selected = node;
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
for await (const part of json(selected, field < 0 && version === 2)) yield encoder.encode(part);
|
|
159
|
+
});
|
|
160
|
+
const read = async (ordinal, offset, field = -1) => {
|
|
161
|
+
if (!Number.isSafeInteger(ordinal) || ordinal < 0 || ordinal >= recordCount || !Number.isSafeInteger(offset) || offset < 0 || !Number.isInteger(field) || field < -1 || field > 5) invalid();
|
|
162
|
+
return reader.read(ordinal * 7 + field + 1, offset);
|
|
163
|
+
};
|
|
164
|
+
return { installed, version, recordCount, readRecord: read, async readField(ordinal, field, offset) {
|
|
165
|
+
if (field < 0) invalid();
|
|
166
|
+
return read(ordinal, offset, field);
|
|
167
|
+
}, async close() {
|
|
168
|
+
try {
|
|
169
|
+
await reader.close();
|
|
170
|
+
} finally {
|
|
171
|
+
await close();
|
|
172
|
+
}
|
|
173
|
+
} };
|
|
174
|
+
} catch (error) {
|
|
175
|
+
await close();
|
|
176
|
+
throw error;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// packages/safe-bash-command-python/src/manifest-publication.ts
|
|
181
|
+
var pythonPublicationFile = "publication.json";
|
|
182
|
+
async function withPythonManifestPublication(context, maxBytes, publish) {
|
|
183
|
+
const { fs, signal, cwd } = context, path = cwd + "/" + pythonPublicationFile, stat = await fs.lstat(path, { signal });
|
|
184
|
+
if (stat.type !== "file") throw new Error("Invalid Python manifest publication file");
|
|
185
|
+
if (stat.size > maxBytes) throw new Error("Python package manifest exceeds maxManifestBytes");
|
|
186
|
+
const file = await openPythonPackageFile(context, path, maxBytes, stat);
|
|
187
|
+
if (!file) throw new Error("Python manifest publication requires retained caller reads");
|
|
188
|
+
let consumed = false;
|
|
189
|
+
async function* source() {
|
|
190
|
+
for (let offset = 0; offset < file.size; ) {
|
|
191
|
+
const bytes = await file.read(offset, 65536);
|
|
192
|
+
offset += bytes.length;
|
|
193
|
+
yield bytes;
|
|
194
|
+
}
|
|
195
|
+
consumed = true;
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
const snapshot = await readBackedPythonManifest(fs, cwd, signal, source(), false);
|
|
199
|
+
try {
|
|
200
|
+
if (snapshot.version !== 3) throw new Error("Invalid Python manifest publication version");
|
|
201
|
+
} finally {
|
|
202
|
+
await snapshot.close();
|
|
203
|
+
}
|
|
204
|
+
consumed = false;
|
|
205
|
+
const committed = await publish(source());
|
|
206
|
+
signal.throwIfAborted();
|
|
207
|
+
if (committed && !consumed) throw new Error("Python manifest store returned before consuming its source");
|
|
208
|
+
return committed;
|
|
209
|
+
} finally {
|
|
210
|
+
await file.close();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export {
|
|
215
|
+
createPythonRecordReader,
|
|
216
|
+
readBackedPythonManifest,
|
|
217
|
+
pythonPublicationFile,
|
|
218
|
+
withPythonManifestPublication
|
|
219
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
stringify
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-N4SH6QY5.js";
|
|
4
4
|
import {
|
|
5
5
|
JqError
|
|
6
6
|
} from "./chunk-3K5FCRUG.js";
|
|
@@ -53,6 +53,15 @@ async function formatValue(name, input, budget) {
|
|
|
53
53
|
}
|
|
54
54
|
break;
|
|
55
55
|
}
|
|
56
|
+
case "urid": {
|
|
57
|
+
if (typeof input !== "string") throw new JqError("urid requires a string");
|
|
58
|
+
try {
|
|
59
|
+
result = decodeURIComponent(input);
|
|
60
|
+
} catch {
|
|
61
|
+
throw new JqError("invalid uri string");
|
|
62
|
+
}
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
56
65
|
case "html": {
|
|
57
66
|
const escapes = { "&": "&", "<": "<", ">": ">", "'": "'", '"': """ };
|
|
58
67
|
result = "";
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import {
|
|
2
|
+
normalizeEncoding,
|
|
3
|
+
pythonCodecAliases
|
|
4
|
+
} from "./chunk-VSNVYOK2.js";
|
|
5
|
+
import {
|
|
6
|
+
unpackCodepage
|
|
7
|
+
} from "./chunk-RUXOFW5G.js";
|
|
8
|
+
|
|
9
|
+
// packages/safe-bash-csv-engine/src/python-codepages.ts
|
|
10
|
+
var table0 = unpackCodepage("gKwggf//gQOFJiCG//+GCpEYIJEBkxwgkwGVIiCWEyCWAZj//5gHoQEOoTnb///bA98/Dt8c/P///AM=");
|
|
11
|
+
var table1 = unpackCodepage("ghogg5IBhB4ghiAghgGJMCCLOSCZIiGbOiChhQOhAaOjAKMGqv//q6sAqwOvFSCwsACwA7SEA7W1ALUCuIgDuAK7uwC8jAO9vQC+jgO+E9L//9OjA9Mr", table0);
|
|
12
|
+
var table2 = unpackCodepage("iMYCmNwCoaEAoQGkqiCq1wCvrwC0tAC4uAC4Abr3ALy8AL6+AL4BwLAFwAnK///LuwXLCNTwBdQE2f//2Qbg0AXgGvv///sB/Q4g/QE=", table1);
|
|
13
|
+
var table3 = unpackCodepage("imABjFIBmmEBnFMBn3gBpKQAqqoAuroAwMAAwA/QHgHR0QDRC90wAd5eAd/fAN8Q8B8B8fEA8Qv9MQH+XwH//wA=", table2);
|
|
14
|
+
var table4 = unpackCodepage("gX4GinkGjYYGjpgGj4gGkK8GmKkGmpEGnQwgnQGfugahDAaqvga6Gwa/HwbAwQbBIQbBFdg3BtgD3EAG3APhRAbjRQbjA+xJBuwB8EsG8AP1Twb1AfhRBvpSBv0OIP0B/9IG", table3);
|
|
15
|
+
var table5 = unpackCodepage("gAIEgAGDUwSIrCCKCQSMCgSNDASOCwSPDwSQUgSaWQScWgSdXASeWwSfXwShDgSiXgSjCASlkASoAQSqBASvBwSyBgSzVgS0kQS4UQS5FiG6VAS8WAS9BQS+VQS/VwTAEATAPw==", table1);
|
|
16
|
+
var table6 = unpackCodepage("gBAEgC+wkSWwArMCJbQkJbVhJbUBt1YluFUluWMlulElu1clvF0lvVwlvlslvxAlwBQlwTQlwiwlwxwlxAAlxTwlxl4lxgHIWiXJVCXKaSXLZiXMYCXNUCXObCXPZyXPAdFkJdEB01kl1Fgl1VIl1QHXayXYaiXZGCXaDCXbiCXchCXdjCXekCXfgCXgQATgD/ABBPFRBPIEBPNUBPQHBPVXBPYOBPdeBPiwAPkZIvq3APsaIvwWIf2kAP6gJf+gAA==");
|
|
17
|
+
var table7 = unpackCodepage("gJEDgBCRowORBpixA5gQqcMDqsIDq8QDqwTgyQPhrAPhAuTKA+WvA+bMA+YB6MsD6c4D6oYD64gD6wLujAPvjgPvAfGxAPJlIvNkIvSqA/QB9vcA90gi/H8g/bIA", table6);
|
|
18
|
+
var table8 = unpackCodepage("gBAEgB+gICChsACikASkpwClIiCmtgCnBgSorgCqIiGrAgSsUgStYCKuAwSvUwSwHiKyZCKyAbRWBLaRBLcIBLgEBLlUBLoHBLtXBLwJBL1ZBL4KBL9aBMBYBMEFBMKsAMMaIsSSAcVIIsYGIserAMi7AMkmIMqgAMsLBMxbBM0MBM5cBM9VBNATINAB0hwg0gHUGCDUAdb3ANceINgOBNleBNoPBNtfBNwWId0BBN5RBN9PBOAwBOAe/6wg");
|
|
19
|
+
var table9 = unpackCodepage("g///iP//jFoBjWQBjn0Bj3kBmP//nFsBnWUBnn4Bn3oBoccCotgCo0EBpQQBql4Br3sBstsCs0IBuQUBul8BvD0Bvd0Cvj4Bv3wBwFQBwwIBxTkBxgYByAwByhgBzBoBzw4B0BAB0UMB0kcB1VAB2FgB2W4B23AB3d0A3mIB4FUB4wMB5ToB5gcB6A0B6hkB7BsB7w8B8BEB8UQB8kgB9VEB+FkB+W8B+3EB/f0A/mMB/9kC", table3);
|
|
20
|
+
var table10 = unpackCodepage("gMcAgfwAgukAg+IAhOQAheAAhuUAh+cAiOoAiAGK6ACL7wCM7gCN7ACOxACOAZDJAJHmAJLGAJP0AJT2AJXyAJb7AJf5AJj/AJnWAJrcAJuiAJsBnaUAnqcgn5IBoOEAoe0AovMAo/oApPEApdEApqoAp7oAqL8AqRAjqqwAq70ArLwAraEArqsAr7sA4LED4d8A4pMD48AD5KMD5cMD5rUA58QD6KYD6ZgD6qkD67QD7B4i7cYD7rUD7yki8GEi9CAj9AE=", table7);
|
|
21
|
+
var table11 = unpackCodepage("m/gAndgAr6QA", table10);
|
|
22
|
+
var table12 = unpackCodepage("i9AAjPAAjd4Alf4Al90AmP0ApMEApc0AptMAp9oAr7sA", table11);
|
|
23
|
+
var table13 = unpackCodepage("hOMAhsEAicoAi80AjNQAjsMAj8IAkcAAksgAlPUAltoAmMwAmdUAndkAn9MAqdIA", table10);
|
|
24
|
+
var table14 = unpackCodepage("hMIAhrYAjRcgjsAAj6cAkcgAksoAlMsAlc8AmKQAmdQAndkAntsAoKYAobQApKgApbgAprMAp68AqM4Arb4A", table10);
|
|
25
|
+
var table15 = unpackCodepage("ntcAqa4Ar7sAtcEAtQG3wAC4qQC9ogC+pQDG4wDHwwDPpADQ8ADR0ADSygDSAdTIANUxAdbNANYC3aYA3swA4NMA4tQA49IA5PUA5dUA5/4A6N4A6doA6QHr2QDs/QDt3QDurwDvtADwrQDyFyDzvgD0tgD1pwD3uAD5qAD7uQD8swA=", table11);
|
|
26
|
+
var table16 = unpackCodepage("jTEBmDABnl4BngGmHgGmAdC6ANGqANX//+f//+jXAOzsAO3/APL//w==", table15);
|
|
27
|
+
var table17 = unpackCodepage("hW8BhgcBiEIBilABigGNeQGPBgGROQGRAZU9AZUBl1oBlwGbZAGbAZ1BAZ8NAaQEAaQBpn0BpgGoGAGoAat6AawMAa1fAbcaAbheAb17Ab0BxgIBxgHQEQHREAHSDgHUDwHVRwHYGwHdYgHebgHjQwHjAeVIAeZgAeYB6FQB6lUB63AB7mMB8d0C8tsC88cC9NgC+tkC+3EB/FgB/AE=", table15);
|
|
28
|
+
var table18 = unpackCodepage("gMQAgQABgQGDyQCEBAGF1gCG3ACH4QCIBQGJDAGK5ACLDQGMBgGMAY7pAI95AY8BkQ4Bku0Akw8BlBIBlAGWFgGX8wCYFwGZ9ACa9gCb9QCc+gCdGgGdAZ/8AKIYAaffAKsZAayoAK4jAa8uAa8BsSoBtCsBtTYBtgIitxEiuEIBuTsBuQO9OQG9Ab9FAb8BwUMBxEQBxUcBy0gBzFABzdUAzlEBz0wB18ol2E0B2VQB2QHbWAHcOSDcAd5ZAd9WAd8B4WAB4hog4x4g5GEB5VoB5QHnwQDoZAHoAerNAOt9AesB7WoB7tMA7gHwawHxbgHy2gDzbwHzBPjdAPn9APo3Aft7AfxBAf18Af4iAf/HAg==", table8);
|
|
29
|
+
var table19 = unpackCodepage("gcUAgscAhNEAiOAAieIAi+MAjOUAjecAj+gAkOoAkAGT7ACU7gCUAZbxAJjyAJ35AJ77AKKiAKu0AK7GAK/YALAeIrGxALSlALW1ALgPIrnAA7orIruqALy6AL2pA77mAL/4AMC/AMGhAMSSAcVIIsvAAMzDAM5SAc4B2P8A2XgB2kQg26wg3gH73gHgISDhtwDkMCDlwgDmygDoywDpyADrzgDrAe3MAPD/+PHSAPPbAPTZAPUxAfbGAvfcAvivAPnYAvkC/LgA/d0C/tsC", table18);
|
|
30
|
+
var table20 = unpackCodepage("gbkAgrIAhLMAh4UDi4QDjKgAkqMAkyIhliIgl70AmDAgm6YAnKwgoZMDoQGjmAOkmwOlngOmoAOqowOrqgOspwCusACvtwCwkQO1kgO2lQO2ArmZA7kBu5wDvKYDvasDvqgDvgHArAPBnQPDnwPEoQPGpAPLpQPMpwPNhgPOiAPRFSDXiQPXAdmMA9qOA9utA9sC3swD348D4M0D4bED4QHjyAPktAPkAebGA+ezA+i3A+m5A+q+A+u6A+sD778D7wHxzgPywQPzwwPzAfW4A/bJA/fCA/jHA/nFA/q2A/vKA/sB/ZAD/rAD/60A", table19);
|
|
31
|
+
var dbfCodepages = Object.freeze({
|
|
32
|
+
"cp1250": table9,
|
|
33
|
+
"cp1251": table5,
|
|
34
|
+
"cp1253": table1,
|
|
35
|
+
"cp1254": table3,
|
|
36
|
+
"cp1255": table2,
|
|
37
|
+
"cp1256": table4,
|
|
38
|
+
"cp437": table10,
|
|
39
|
+
"cp737": table7,
|
|
40
|
+
"cp850": table15,
|
|
41
|
+
"cp852": table17,
|
|
42
|
+
"cp857": table16,
|
|
43
|
+
"cp860": table13,
|
|
44
|
+
"cp861": table12,
|
|
45
|
+
"cp863": table14,
|
|
46
|
+
"cp865": table11,
|
|
47
|
+
"cp866": table6,
|
|
48
|
+
"cp874": table0,
|
|
49
|
+
"mac_cyrillic": table8,
|
|
50
|
+
"mac_greek": table20,
|
|
51
|
+
"mac_latin2": table18,
|
|
52
|
+
"mac_roman": table19
|
|
53
|
+
});
|
|
54
|
+
var cp1252High = [
|
|
55
|
+
8364,
|
|
56
|
+
-1,
|
|
57
|
+
8218,
|
|
58
|
+
402,
|
|
59
|
+
8222,
|
|
60
|
+
8230,
|
|
61
|
+
8224,
|
|
62
|
+
8225,
|
|
63
|
+
710,
|
|
64
|
+
8240,
|
|
65
|
+
352,
|
|
66
|
+
8249,
|
|
67
|
+
338,
|
|
68
|
+
-1,
|
|
69
|
+
381,
|
|
70
|
+
-1,
|
|
71
|
+
-1,
|
|
72
|
+
8216,
|
|
73
|
+
8217,
|
|
74
|
+
8220,
|
|
75
|
+
8221,
|
|
76
|
+
8226,
|
|
77
|
+
8211,
|
|
78
|
+
8212,
|
|
79
|
+
732,
|
|
80
|
+
8482,
|
|
81
|
+
353,
|
|
82
|
+
8250,
|
|
83
|
+
339,
|
|
84
|
+
-1,
|
|
85
|
+
382,
|
|
86
|
+
376
|
|
87
|
+
];
|
|
88
|
+
var PythonTextDecodeError = class extends Error {
|
|
89
|
+
};
|
|
90
|
+
function decodePythonSingleByte(bytes, codepoints, encoding) {
|
|
91
|
+
let text = "";
|
|
92
|
+
for (const byte of bytes) {
|
|
93
|
+
const code = codepoints[byte];
|
|
94
|
+
if (code < 0) throw new PythonTextDecodeError(`Invalid ${encoding} input`);
|
|
95
|
+
text += String.fromCodePoint(code);
|
|
96
|
+
}
|
|
97
|
+
return text;
|
|
98
|
+
}
|
|
99
|
+
var pythonSingleByteCodepages = Object.freeze({
|
|
100
|
+
...Object.fromEntries(Object.entries(dbfCodepages).map(([name, codepoints]) => [pythonCodecAliases[normalizeEncoding(name)], codepoints])),
|
|
101
|
+
ascii: Object.freeze(Array.from({ length: 256 }, (_, byte) => byte < 128 ? byte : -1)),
|
|
102
|
+
"iso8859-1": Object.freeze(Array.from({ length: 256 }, (_, byte) => byte)),
|
|
103
|
+
cp1252: Object.freeze(Array.from({ length: 256 }, (_, byte) => byte >= 128 && byte < 160 ? cp1252High[byte - 128] : byte))
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
export {
|
|
107
|
+
dbfCodepages,
|
|
108
|
+
PythonTextDecodeError,
|
|
109
|
+
decodePythonSingleByte,
|
|
110
|
+
pythonSingleByteCodepages
|
|
111
|
+
};
|