dsh-codex-subscription 2.1.0-beta.3 → 2.1.0-beta.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/lib/client.js +79 -28
- package/lib/index.js +2 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -29,8 +29,8 @@ window.__ModuleLoader__.load({
|
|
|
29
29
|
let react = require("react");
|
|
30
30
|
react = __toESM(react, 1);
|
|
31
31
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
-
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
33
32
|
let react_dom = require("react-dom");
|
|
33
|
+
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
34
34
|
//#region src/image-edit.js
|
|
35
35
|
const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
36
36
|
const validCoordinate = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= 1;
|
|
@@ -1351,8 +1351,39 @@ window.__ModuleLoader__.load({
|
|
|
1351
1351
|
};
|
|
1352
1352
|
}
|
|
1353
1353
|
function SketchViewControls({ navigation, t }) {
|
|
1354
|
-
const [open, setOpen] = (0, react.useState)(false),
|
|
1355
|
-
|
|
1354
|
+
const [open, setOpen] = (0, react.useState)(false), [placement, setPlacement] = (0, react.useState)(null);
|
|
1355
|
+
const host = (0, react.useRef)(null), trigger = (0, react.useRef)(null);
|
|
1356
|
+
const close = () => {
|
|
1357
|
+
setOpen(false);
|
|
1358
|
+
trigger.current?.focus({ preventScroll: true });
|
|
1359
|
+
};
|
|
1360
|
+
useSketchDismiss(open, setOpen, host, [".codexSketchViewControls", ".codexSketchKeyPanel"]);
|
|
1361
|
+
(0, react.useLayoutEffect)(() => {
|
|
1362
|
+
if (!open) return;
|
|
1363
|
+
const dialog = host.current.closest("dialog");
|
|
1364
|
+
const place = () => {
|
|
1365
|
+
const box = dialog.getBoundingClientRect(), anchor = trigger.current.getBoundingClientRect();
|
|
1366
|
+
const width = Math.min(360, box.width - 24);
|
|
1367
|
+
setPlacement({
|
|
1368
|
+
dialog,
|
|
1369
|
+
style: {
|
|
1370
|
+
width,
|
|
1371
|
+
left: Math.max(12, Math.min(anchor.left - box.left, box.width - width - 12)),
|
|
1372
|
+
bottom: box.bottom - anchor.top + 8,
|
|
1373
|
+
maxHeight: Math.max(80, anchor.top - box.top - 24)
|
|
1374
|
+
}
|
|
1375
|
+
});
|
|
1376
|
+
};
|
|
1377
|
+
place();
|
|
1378
|
+
const observer = new ResizeObserver(place);
|
|
1379
|
+
observer.observe(dialog);
|
|
1380
|
+
observer.observe(host.current);
|
|
1381
|
+
window.addEventListener("resize", place);
|
|
1382
|
+
return () => {
|
|
1383
|
+
observer.disconnect();
|
|
1384
|
+
window.removeEventListener("resize", place);
|
|
1385
|
+
};
|
|
1386
|
+
}, [open]);
|
|
1356
1387
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1357
1388
|
ref: host,
|
|
1358
1389
|
className: "codexSketchViewControls",
|
|
@@ -1376,40 +1407,56 @@ window.__ModuleLoader__.load({
|
|
|
1376
1407
|
children: "+"
|
|
1377
1408
|
}),
|
|
1378
1409
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1410
|
+
ref: trigger,
|
|
1379
1411
|
type: "button",
|
|
1412
|
+
"aria-expanded": open,
|
|
1380
1413
|
onClick: () => setOpen(!open),
|
|
1381
1414
|
children: t("sketchKeys")
|
|
1382
1415
|
}),
|
|
1383
|
-
open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1416
|
+
open && placement ? (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1384
1417
|
className: "codexSketchKeyPanel",
|
|
1418
|
+
"aria-label": t("sketchKeys"),
|
|
1419
|
+
style: placement.style,
|
|
1385
1420
|
onKeyDown: (e) => {
|
|
1386
1421
|
if (e.key === "Escape") {
|
|
1387
1422
|
e.preventDefault();
|
|
1388
1423
|
e.stopPropagation();
|
|
1389
|
-
|
|
1424
|
+
close();
|
|
1390
1425
|
}
|
|
1391
1426
|
},
|
|
1392
1427
|
children: [
|
|
1393
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("
|
|
1394
|
-
type: "
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1428
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("sketchKeys") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1429
|
+
type: "button",
|
|
1430
|
+
"aria-label": t("sketchFileClose"),
|
|
1431
|
+
onClick: close,
|
|
1432
|
+
children: "×"
|
|
1433
|
+
})] }),
|
|
1434
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
1435
|
+
className: "codexSketchKeysEnabled",
|
|
1436
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("sketchKeysEnabled") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1437
|
+
type: "checkbox",
|
|
1438
|
+
checked: navigation.shortcuts,
|
|
1439
|
+
onChange: navigation.toggle
|
|
1440
|
+
})]
|
|
1441
|
+
}),
|
|
1398
1442
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("sketchNavigationHint") }),
|
|
1399
|
-
|
|
1400
|
-
"
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
e
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1443
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1444
|
+
className: "codexSketchKeyGrid",
|
|
1445
|
+
children: Object.entries(navigation.keys).map(([action, key]) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [t(`sketchKey_${action}`), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1446
|
+
"aria-label": t(`sketchKey_${action}`),
|
|
1447
|
+
value: key === " " ? "Space" : key,
|
|
1448
|
+
readOnly: true,
|
|
1449
|
+
onKeyDown: (e) => {
|
|
1450
|
+
if (e.key === "Tab" || e.key === "Escape") return;
|
|
1451
|
+
e.preventDefault();
|
|
1452
|
+
e.stopPropagation();
|
|
1453
|
+
if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) navigation.setKey(action, e.key);
|
|
1454
|
+
}
|
|
1455
|
+
})] }, action))
|
|
1456
|
+
}),
|
|
1410
1457
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: t("sketchKeyHint") })
|
|
1411
1458
|
]
|
|
1412
|
-
}) : null
|
|
1459
|
+
}), placement.dialog) : null
|
|
1413
1460
|
]
|
|
1414
1461
|
});
|
|
1415
1462
|
}
|
|
@@ -1465,7 +1512,7 @@ window.__ModuleLoader__.load({
|
|
|
1465
1512
|
}
|
|
1466
1513
|
const SKETCH_COMMAND_HELP = {
|
|
1467
1514
|
coordinates: "Assign short meaningful stroke id values for later edits. Text uses two opposite box corners and text content; width is font size in pixels, automatic fitting within the box. Arrow uses two endpoints. Normalized x/y in [0,1]; width is canvas pixels. Read documentId and revision before editing.",
|
|
1468
|
-
shapes: "line: exactly two endpoints; rectangle/circle: exactly two opposite bounding-box corners (circle draws an ellipse within that box); polygon: three or more vertices, closed automatically; pen: ordered path points. bezier: start point, then groups of control1/control2/end; use 4 points for one cubic curve, max 64 segments. Prefer bezier for smooth designed curves instead of many pen samples. fill:true closes and fills the curve. fill:true fills rectangle/circle/polygon. Layers and strokes paint in list order, later ones on top. All commands needed for drawing are described here; no source-code search is required.",
|
|
1515
|
+
shapes: "line: exactly two endpoints; rectangle/circle (ellipse alias accepted): exactly two opposite bounding-box corners (circle draws an ellipse within that box); polygon: three or more vertices, closed automatically; pen: ordered path points. bezier: start point, then groups of control1/control2/end; use 4 points for one cubic curve, max 64 segments. Prefer bezier for smooth designed curves instead of many pen samples. fill:true closes and fills the curve. fill:true fills rectangle/circle/polygon. Layers and strokes paint in list order, later ones on top. All commands needed for drawing are described here; no source-code search is required.",
|
|
1469
1516
|
commands: {
|
|
1470
1517
|
stroke: "{op:\"stroke\",layer:1,shape:\"pen|line|arrow|text|rectangle|circle|polygon|bezier\",color:\"#rrggbb\",width:2,opacity:1,fill:false,points:[{x:0.1,y:0.1},...]}",
|
|
1471
1518
|
layer: "{op:\"layer\",action:\"add|select|rename|visible|duplicate|up|down|delete|clear\",id:1,value:\"name\"}",
|
|
@@ -1559,7 +1606,8 @@ window.__ModuleLoader__.load({
|
|
|
1559
1606
|
continue;
|
|
1560
1607
|
}
|
|
1561
1608
|
if (command.op !== "stroke") throw Error("Unknown command");
|
|
1562
|
-
const
|
|
1609
|
+
const shape = command.shape === "ellipse" ? "circle" : command.shape ?? "pen";
|
|
1610
|
+
const { points, color, width = shape === "text" ? 24 : 2, opacity = 1, fill = false } = command;
|
|
1563
1611
|
if (![
|
|
1564
1612
|
"pen",
|
|
1565
1613
|
"line",
|
|
@@ -1578,7 +1626,7 @@ window.__ModuleLoader__.load({
|
|
|
1578
1626
|
"rectangle",
|
|
1579
1627
|
"circle"
|
|
1580
1628
|
].includes(shape) && points.length !== 2 || shape === "polygon" && points.length < 3) throw Error("Invalid shape points");
|
|
1581
|
-
if (shape === "bezier" && (points.length < 4 || points.length > 193 || (points.length - 1) % 3 !== 0)) throw Error(
|
|
1629
|
+
if (shape === "bezier" && (points.length < 4 || points.length > 193 || (points.length - 1) % 3 !== 0)) throw Error(`commands[${commands.indexOf(command)}]: Bezier has ${points.length} points; expected 4, 7, 10, ... 193 (start + control1/control2/end per segment). No commands in this batch were applied.`);
|
|
1582
1630
|
if (fill && ![
|
|
1583
1631
|
"rectangle",
|
|
1584
1632
|
"circle",
|
|
@@ -2215,7 +2263,10 @@ window.__ModuleLoader__.load({
|
|
|
2215
2263
|
update("finished");
|
|
2216
2264
|
return completed.value;
|
|
2217
2265
|
} catch (error) {
|
|
2218
|
-
if (version === generation)
|
|
2266
|
+
if (version === generation) {
|
|
2267
|
+
update("failed");
|
|
2268
|
+
throw new Error(`${error.message} Call inspect to obtain the current runId and revision before retrying.`, { cause: error });
|
|
2269
|
+
}
|
|
2219
2270
|
throw error;
|
|
2220
2271
|
} finally {
|
|
2221
2272
|
pending = false;
|
|
@@ -3650,7 +3701,7 @@ window.__ModuleLoader__.load({
|
|
|
3650
3701
|
.codexLayerBody{overflow:hidden}.codexLayerStudio canvas{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ccircle cx='12' cy='12' r='7' fill='none' stroke='white' stroke-width='3'/%3E%3Ccircle cx='12' cy='12' r='7' fill='none' stroke='%23333' stroke-width='1'/%3E%3C/svg%3E") 12 12,crosshair}
|
|
3651
3702
|
.codexSketchDialog .codexSketchSwatch{width:32px;height:32px;padding:0;border-radius:50%;corner-shape:round}.codexSketchSwatch::before{width:22px;height:22px;flex-shrink:0;border-radius:50%;corner-shape:round;clip-path:circle(50%)}.codexSketchSwatch[aria-pressed=true]::after{inset:1px;border:1.5px solid var(--sketch-fg);border-radius:50%;corner-shape:round}.codexSketchCustom{width:30px;height:30px;margin:1px 4px;corner-shape:round;clip-path:circle(50%)}.codexSketchCustom span{width:22px;height:22px;border-width:2px;corner-shape:round}
|
|
3652
3703
|
.codexSketchPictures{position:absolute;left:0;top:0;z-index:3;background:var(--sketch-bg);border:1px solid var(--sketch-line);border-radius:12px;padding:10px;width:160px;max-height:100%;overflow:auto}.codexSketchPictures header{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}.codexSketchPictures>div{display:flex;gap:5px;align-items:center;padding:4px;border:1px solid transparent;border-radius:8px}.codexSketchPictures>div[data-active=true]{border-color:#0a84ff}.codexSketchPictures img{width:90px;height:65px;object-fit:contain}.codexSketchPictures small{color:var(--sketch-muted)}
|
|
3653
|
-
.codexSketchViewControls{display:flex;gap:2px;align-items:center}.codexSketchViewControls button{min-height:32px;padding:0 7px;border-radius:8px}.codexSketchKeyPanel{position:absolute;
|
|
3704
|
+
.codexSketchViewControls{display:flex;gap:2px;align-items:center}.codexSketchViewControls button{min-height:32px;padding:0 7px;border-radius:8px}.codexSketchKeyPanel{position:absolute;overflow:auto;overscroll-behavior:contain;padding:12px;border:1px solid var(--sketch-line);border-radius:14px;background:var(--sketch-bg);z-index:5;box-shadow:0 8px 30px #0003;scrollbar-width:thin}.codexSketchKeyPanel header{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}.codexSketchKeyPanel header button{width:28px;height:28px;border-radius:8px;font-size:20px}.codexSketchKeyPanel label{display:flex;align-items:center;justify-content:space-between;min-height:32px;gap:8px}.codexSketchKeysEnabled{padding-bottom:8px;border-bottom:1px solid var(--sketch-line)}.codexSketchKeysEnabled input{margin:0;accent-color:#0a84ff}.codexSketchKeyGrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 16px;margin:10px 0}.codexSketchKeyPanel input:not([type=checkbox]){width:52px;min-width:0;border:1px solid var(--sketch-line);border-radius:6px;color:inherit;background:color-mix(in srgb,var(--sketch-fg) 4%,transparent);padding:4px;text-align:center;font:inherit}.codexSketchKeyPanel p,.codexSketchKeyPanel small{display:block;color:var(--sketch-muted);font-size:11px;line-height:1.5;margin:0}.codexSketchKeyPanel small{border-top:1px solid var(--sketch-line);padding-top:8px}@media(max-width:380px){.codexSketchKeyGrid{grid-template-columns:1fr}}.codexSketchControls{position:static}
|
|
3654
3705
|
|
|
3655
3706
|
.codexSketchCursor{position:fixed;left:0;top:0;z-index:100;pointer-events:none;border:1px solid #222;border-radius:50%;corner-shape:round;box-shadow:0 0 0 1px #fff;box-sizing:border-box}.codexSketchCursor[hidden]{display:none}
|
|
3656
3707
|
`;
|
|
@@ -6410,7 +6461,7 @@ window.__ModuleLoader__.load({
|
|
|
6410
6461
|
}
|
|
6411
6462
|
//#endregion
|
|
6412
6463
|
//#region src/version.js
|
|
6413
|
-
const PACKAGE_VERSION = "2.1.0-beta.
|
|
6464
|
+
const PACKAGE_VERSION = "2.1.0-beta.4";
|
|
6414
6465
|
//#endregion
|
|
6415
6466
|
//#region src/client-recovery.js
|
|
6416
6467
|
async function recoveryCall(rpc, endpoint, payload = {}, timeoutMs = 1e4) {
|
package/lib/index.js
CHANGED
|
@@ -595,6 +595,7 @@ const sketchCommandArray = {
|
|
|
595
595
|
"text",
|
|
596
596
|
"rectangle",
|
|
597
597
|
"circle",
|
|
598
|
+
"ellipse",
|
|
598
599
|
"polygon",
|
|
599
600
|
"bezier",
|
|
600
601
|
"eraser"
|
|
@@ -1970,7 +1971,7 @@ function openaiCodexSubscriptionProvider({ resolveSpeedMode = () => void 0, reso
|
|
|
1970
1971
|
Object.freeze(["0.82.1", "0.85.1"]);
|
|
1971
1972
|
//#endregion
|
|
1972
1973
|
//#region src/version.js
|
|
1973
|
-
const PACKAGE_VERSION = "2.1.0-beta.
|
|
1974
|
+
const PACKAGE_VERSION = "2.1.0-beta.4";
|
|
1974
1975
|
const USER_AGENT = `dsh-codex-subscription/${PACKAGE_VERSION}`;
|
|
1975
1976
|
//#endregion
|
|
1976
1977
|
//#region src/model-catalog.js
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-codex-subscription",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.4",
|
|
4
4
|
"description": "Use ChatGPT and Codex subscriptions in DeepSeek Harness with OAuth, quota, safe resets, web search, images, and Fast mode",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|