openwork-server 0.18.70 → 0.18.72
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/opencode-plugin-deps-1.18.33.tgz +0 -0
- package/dist/opencode-plugins/agent-instruction-compose.js +0 -24
- package/dist/opencode-plugins/approval-loopback-fetch.js +0 -9
- package/dist/opencode-plugins/browser-tool-args.js +37 -0
- package/dist/opencode-plugins/computer-listing-files.js +0 -19
- package/dist/opencode-plugins/drive-file-tools.js +0 -4
- package/dist/opencode-plugins/gmail-attachment-fulfillment.js +0 -14
- package/dist/opencode-plugins/managed-policy-client.js +0 -2
- package/dist/opencode-plugins/opencode-stop-fence-client.js +0 -1
- package/dist/opencode-plugins/openwork-agent-permissions-v2.js +16 -3
- package/dist/opencode-plugins/openwork-agent-questions.js +2 -10
- package/dist/opencode-plugins/openwork-capabilities-knowledge.js +2 -2
- package/dist/opencode-plugins/openwork-chrome-devtools.js +47 -4
- package/dist/opencode-plugins/openwork-cloud-skills-v2.js +34 -49
- package/dist/opencode-plugins/openwork-codemode-discovery-v2.js +0 -7
- package/dist/opencode-plugins/openwork-context-v2.js +81 -12
- package/dist/opencode-plugins/openwork-extensions-preview-steering.js +0 -16
- package/dist/opencode-plugins/openwork-extensions-preview.js +1 -1
- package/dist/opencode-plugins/openwork-office-attachments.js +1401 -10
- package/dist/opencode-plugins/openwork-provider-adapters.js +0 -11
- package/dist/opencode-plugins/openwork-sandbox-v2.js +28 -26
- package/dist/opencode-plugins/openwork-session-groups.js +0 -13
- package/dist/opencode-plugins/openwork-spreadsheets.js +1401 -10
- package/dist/opencode-plugins/openwork-ui-bridge.js +1 -6
- package/dist/opencode-plugins/provider-safe-tool-schema.js +0 -10
- package/dist/opencode-plugins/session-read-detail.js +0 -36
- package/dist/opencode-plugins/workspace-file-destinations.js +0 -5
- package/dist/openwork-server.mjs +5227 -2144
- package/package.json +1 -1
- package/web/assets/{abnfDiagram-VCTEODGH-BfWj70CF.js → abnfDiagram-VCTEODGH-Bk2JrJ3j.js} +1 -1
- package/web/assets/app-BinIaXyk.css +32 -0
- package/web/assets/{app-CtII-ooM.js → app-CNo6L1tq.js} +494 -486
- package/web/assets/{arc-Cz5KTFDj.js → arc-BeMgz_zn.js} +1 -1
- package/web/assets/{architectureDiagram-5GKGNRK7-BFd6EGv5.js → architectureDiagram-5GKGNRK7-CRxylST_.js} +1 -1
- package/web/assets/{artifact-code-view-CfXGXYRR.js → artifact-code-view-BwBuxnOh.js} +1 -1
- package/web/assets/artifact-office-preview-v_N9yGCg.js +6 -0
- package/web/assets/artifact-spreadsheet-editor-5lpd49cl.js +4 -0
- package/web/assets/{artifact-text-editor-BzmSVt6K.js → artifact-text-editor-Dj0SDUYJ.js} +1 -1
- package/web/assets/{blockDiagram-OSKFZWR5--dd2K6D0.js → blockDiagram-OSKFZWR5-CYcFpnr1.js} +1 -1
- package/web/assets/{c4Diagram-7LVT6UL2-CCycmUvG.js → c4Diagram-7LVT6UL2-KL6win2t.js} +1 -1
- package/web/assets/channel-C7q2VHY_.js +1 -0
- package/web/assets/{chunk-2Q5K7J3B-90KYWV7T.js → chunk-2Q5K7J3B-CjBMu5Dk.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-CLQaz_GH.js → chunk-5VM5RSS4-CVfSxxeV.js} +1 -1
- package/web/assets/{chunk-F27PBJKO-MT74J5Z1.js → chunk-F27PBJKO-Da-CK7uS.js} +1 -1
- package/web/assets/{chunk-HLEWEB6X-tTtGU2Xj.js → chunk-HLEWEB6X-DaBpQjxM.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-DWP93t5G.js → chunk-JWPE2WC7-eZhhKb-9.js} +1 -1
- package/web/assets/{chunk-POPQ4Y6H-RbW8ZiSg.js → chunk-POPQ4Y6H-BuQza4Dl.js} +1 -1
- package/web/assets/{chunk-SVP7TREG-CO4LWTWe.js → chunk-SVP7TREG-MuA1wNzK.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-Dk6SwkRo.js → chunk-XXDRQBXY-CIpJOQtx.js} +1 -1
- package/web/assets/{chunk-ZLD2IHE6-DbudI5Ai.js → chunk-ZLD2IHE6-NhKoLW1Y.js} +1 -1
- package/web/assets/classDiagram-CYGNFDIV-DKD7FwJZ.js +1 -0
- package/web/assets/classDiagram-v2-TLXNO2FR-DKD7FwJZ.js +1 -0
- package/web/assets/{cose-bilkent-JH36ORCC-DnjeuL46.js → cose-bilkent-JH36ORCC-B_lNY9db.js} +1 -1
- package/web/assets/{cynefin-OW5HDTMX-T49OK4gf.js → cynefin-OW5HDTMX-BmqyCndA.js} +1 -1
- package/web/assets/{cynefinDiagram-5FMLGOSQ-Cl2-VYbB.js → cynefinDiagram-5FMLGOSQ-By2KC7b4.js} +1 -1
- package/web/assets/{dagre-OS7QT2EB-DVmRIfRg.js → dagre-OS7QT2EB-By7csWyW.js} +1 -1
- package/web/assets/{diagram-S7CK7UJ4-B4HosGU_.js → diagram-S7CK7UJ4-5_mhvlGk.js} +1 -1
- package/web/assets/{diagram-UQ7AKVKN-BZipTqE-.js → diagram-UQ7AKVKN-BPHF9t90.js} +1 -1
- package/web/assets/{diagram-VSXAHHWV-CqnZ8iAC.js → diagram-VSXAHHWV-CyVv5z8B.js} +1 -1
- package/web/assets/{diagram-VX7I27RA-u6TXpwMA.js → diagram-VX7I27RA-BdfxwGwk.js} +1 -1
- package/web/assets/{diagram-Z3DM3KII-D9Sx-QCn.js → diagram-Z3DM3KII-BXg_HOys.js} +1 -1
- package/web/assets/{ebnfDiagram-PWID7BFC-MZzyo5bT.js → ebnfDiagram-PWID7BFC-57--ZiB5.js} +1 -1
- package/web/assets/{erDiagram-2YWLMYGG-Cp4Uqe7T.js → erDiagram-2YWLMYGG-2WR_i4mr.js} +1 -1
- package/web/assets/{flowDiagram-T62WH6J4-DCIZoWMb.js → flowDiagram-T62WH6J4-1qB430Tj.js} +1 -1
- package/web/assets/{ganttDiagram-EL5Y4UJY-wc3QTJBu.js → ganttDiagram-EL5Y4UJY-DlsKL-gN.js} +1 -1
- package/web/assets/{gitGraphDiagram-WWUBYQGX-BQFprEQM.js → gitGraphDiagram-WWUBYQGX-DQ8IU_wC.js} +1 -1
- package/web/assets/{infoDiagram-FKFFQAWI-DvlmsTbd.js → infoDiagram-FKFFQAWI-kh9s5sRC.js} +1 -1
- package/web/assets/{ishikawaDiagram-5VMMS53U-DCvoBIzt.js → ishikawaDiagram-5VMMS53U-CaknQUcm.js} +1 -1
- package/web/assets/{journeyDiagram-EYS64GPL-BuCERl5u.js → journeyDiagram-EYS64GPL-DenZYZs9.js} +1 -1
- package/web/assets/{kanban-definition-UXKFOSKX-CyYDmi1h.js → kanban-definition-UXKFOSKX-ptoI6qD1.js} +1 -1
- package/web/assets/{layout-CEcDiw1D.js → layout-B4UdHd1t.js} +1 -1
- package/web/assets/{linear-BA9oEO_U.js → linear-DbhtXtCn.js} +1 -1
- package/web/assets/{mermaid.core-CpK4FHY9.js → mermaid.core-BoXM2BMZ.js} +6 -6
- package/web/assets/{mindmap-definition-THT77NOG-BNapAGkQ.js → mindmap-definition-THT77NOG-Bcw34klO.js} +1 -1
- package/web/assets/{pegDiagram-XKGWAZYB-DOACjZVK.js → pegDiagram-XKGWAZYB-CZ49Cylj.js} +1 -1
- package/web/assets/{pieDiagram-E7YTZNPT-BFj12eki.js → pieDiagram-E7YTZNPT-F5Tl-jOo.js} +1 -1
- package/web/assets/{quadrantDiagram-AXDQQJYC-CJp4T9Qc.js → quadrantDiagram-AXDQQJYC-BindC9Ln.js} +1 -1
- package/web/assets/{railroadDiagram-O6MQD6OU-C5iGnU_p.js → railroadDiagram-O6MQD6OU-BHfARQKt.js} +1 -1
- package/web/assets/{requirementDiagram-IS5BZ75X-n60vIsGm.js → requirementDiagram-IS5BZ75X-DeyyjrFZ.js} +1 -1
- package/web/assets/{sankeyDiagram-P5KCCOFB-DYlkrlW8.js → sankeyDiagram-P5KCCOFB-Bf4RYjdY.js} +1 -1
- package/web/assets/{sequenceDiagram-WJ2MYXX4-D_nrAKD2.js → sequenceDiagram-WJ2MYXX4-D0I5Iail.js} +1 -1
- package/web/assets/{sizeCapture-INFHLROL-sdI5LzZL.js → sizeCapture-INFHLROL-ZMHjeD6L.js} +1 -1
- package/web/assets/{stateDiagram-XQSTLZYL-BUq5qUN3.js → stateDiagram-XQSTLZYL-XMu0akCC.js} +1 -1
- package/web/assets/stateDiagram-v2-IH3M54BS-CNv5Ofd5.js +1 -0
- package/web/assets/{swimlanes-V6O3JKXN-LSlgNBco.js → swimlanes-V6O3JKXN-BX1vgjAt.js} +1 -1
- package/web/assets/swimlanesDiagram-JKAHXJPX-yIR7kUmA.js +8 -0
- package/web/assets/{timeline-definition-24CTP7MA-D01Xu3oD.js → timeline-definition-24CTP7MA-B-V8Y7U9.js} +1 -1
- package/web/assets/{vennDiagram-4TSXK5OY-DxW5KqmM.js → vennDiagram-4TSXK5OY-iHvsobDU.js} +1 -1
- package/web/assets/{wardleyDiagram-VM6X3IG4-DN1IzAEa.js → wardleyDiagram-VM6X3IG4-BTl7bSNi.js} +1 -1
- package/web/assets/{workspace-file-tree-B4a_8llr.js → workspace-file-tree-EJaUSokl.js} +1 -1
- package/web/assets/xlsx-workbook-DVIQLEdk.js +9 -0
- package/web/assets/{xychartDiagram-S5SC5T6Z-DyLIA7zi.js → xychartDiagram-S5SC5T6Z-BKhJK0Av.js} +1 -1
- package/web/index.html +2 -2
- package/web/assets/app-CS1SPYq0.css +0 -32
- package/web/assets/artifact-spreadsheet-editor-BIO9_bv7.js +0 -11
- package/web/assets/channel-DSUEEVke.js +0 -1
- package/web/assets/classDiagram-CYGNFDIV-NJFrvIrX.js +0 -1
- package/web/assets/classDiagram-v2-TLXNO2FR-NJFrvIrX.js +0 -1
- package/web/assets/stateDiagram-v2-IH3M54BS-DOZDIr7B.js +0 -1
- package/web/assets/swimlanesDiagram-JKAHXJPX-B6NATjf_.js +0 -8
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { openworkModelSelectorSchema, openworkModelsListArgsSchema, } from "@openwork/types/openwork-affordance";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
/**
|
|
4
|
-
* An affordance's argument object. Keys it does not define are refused with
|
|
5
|
-
* the valid names, so a wrong name (`limit` for `count`) fails loudly instead
|
|
6
|
-
* of being dropped and silently falling back to a default.
|
|
7
|
-
*/
|
|
8
3
|
export function strictArgsSchema(shape) {
|
|
9
4
|
const valid = Object.keys(shape).join(", ");
|
|
10
5
|
return z.strictObject(shape, {
|
|
@@ -13,7 +8,6 @@ export function strictArgsSchema(shape) {
|
|
|
13
8
|
: undefined,
|
|
14
9
|
});
|
|
15
10
|
}
|
|
16
|
-
// Epoch milliseconds or an ISO-8601 string; resolve with sessionTimestampMs.
|
|
17
11
|
const sessionTimestampArgSchema = z.union([z.number().int().nonnegative(), z.string().trim().min(1)])
|
|
18
12
|
.refine((value) => typeof value === "number" || Number.isFinite(Date.parse(value)), {
|
|
19
13
|
message: "Expected epoch milliseconds or an ISO-8601 date string.",
|
|
@@ -57,21 +51,18 @@ export const sessionSendArgsSchema = strictArgsSchema({
|
|
|
57
51
|
workspaceId: z.string().trim().optional().describe("Optional OpenWork workspace id/name. Omit to resolve the session across all workspaces."),
|
|
58
52
|
reveal: z.boolean().optional().describe("true to also open that session in the person's focused pane after sending. Defaults to false: nothing on screen changes."),
|
|
59
53
|
});
|
|
60
|
-
/** The engine permission a person answers before the agent answers another session's question for them. */
|
|
61
54
|
export const SESSION_QUESTION_ANSWER_PERMISSION = "openwork_session_question_answer";
|
|
62
55
|
const sessionQuestionListArgsShape = {
|
|
63
56
|
sessionId: z.string().trim().min(1).describe("Session ID from session.search or session.read."),
|
|
64
57
|
workspaceId: z.string().trim().optional().describe("Optional OpenWork workspace id/name. Omit to resolve the session across all workspaces."),
|
|
65
58
|
};
|
|
66
59
|
export const sessionQuestionListArgsSchema = strictArgsSchema(sessionQuestionListArgsShape);
|
|
67
|
-
// Built from the shape, not extended: an extended schema keeps the list of valid names it was made with.
|
|
68
60
|
export const sessionQuestionAnswerArgsSchema = strictArgsSchema({
|
|
69
61
|
...sessionQuestionListArgsShape,
|
|
70
62
|
requestId: z.string().trim().min(1).describe("Pending question id from session.question.list."),
|
|
71
63
|
answers: z.array(z.array(z.string().trim().min(1).max(10_000)).min(1).max(50)).min(1).max(20)
|
|
72
64
|
.describe("One array per question, in order: the chosen option labels, or the person's own text where the question allows it."),
|
|
73
65
|
});
|
|
74
|
-
/** Argument schemas by affordance id; sessionContribution must advertise exactly these keys. */
|
|
75
66
|
export const sessionAffordanceArgsSchemas = {
|
|
76
67
|
"models.list": openworkModelsListArgsSchema,
|
|
77
68
|
"session.search": sessionSearchArgsSchema,
|
|
@@ -375,8 +366,6 @@ function connectContribution(skills, cloudMcp) {
|
|
|
375
366
|
argument("name", "string", false, "Exact capability ref returned by Connect search or remote skill guidance."),
|
|
376
367
|
argument("arguments", "object", false, "Arguments matching the search match's inputSchema."),
|
|
377
368
|
argument("schemaDigest", "string", false, "Optional schema digest from the search match."),
|
|
378
|
-
// Den keeps accepting these older inputs for a while, for callers
|
|
379
|
-
// and older Den builds from before `arguments`.
|
|
380
369
|
argument("path", "object", false, "Older form of arguments.path."),
|
|
381
370
|
argument("query", "object", false, "Older form of arguments.query."),
|
|
382
371
|
argument("body", "object", false, "Older form of arguments."),
|
|
@@ -19585,7 +19585,7 @@ function removeHostCatalog(event) {
|
|
|
19585
19585
|
continue;
|
|
19586
19586
|
const start = part.text.indexOf(source.text);
|
|
19587
19587
|
if (start < 0)
|
|
19588
|
-
throw new Error("
|
|
19588
|
+
throw new Error("OpenWork couldn’t verify which tools were safe to offer. Restart OpenWork and send your message again.");
|
|
19589
19589
|
part.text = part.text.slice(0, start) + part.text.slice(start + source.text.length);
|
|
19590
19590
|
}
|
|
19591
19591
|
part.metadata = { ...parsed.data, experimental: {
|
|
@@ -19595,27 +19595,26 @@ function removeHostCatalog(event) {
|
|
|
19595
19595
|
}
|
|
19596
19596
|
}
|
|
19597
19597
|
async function setupSandboxTools(context, dependencies) {
|
|
19598
|
-
const offeredMode = async (previous) => {
|
|
19599
|
-
try {
|
|
19600
|
-
return modeSchema.parse(await dependencies.status());
|
|
19601
|
-
} catch {
|
|
19602
|
-
return previous === "only" ? "only" : "off";
|
|
19603
|
-
}
|
|
19604
|
-
};
|
|
19605
19598
|
let mode;
|
|
19606
19599
|
try {
|
|
19607
19600
|
mode = modeSchema.parse(await dependencies.status());
|
|
19608
19601
|
} catch {
|
|
19609
19602
|
mode = "only";
|
|
19610
19603
|
}
|
|
19604
|
+
let lastKnownMode = mode;
|
|
19605
|
+
const readMode = async () => {
|
|
19606
|
+
lastKnownMode = modeSchema.parse(await dependencies.status());
|
|
19607
|
+
return lastKnownMode;
|
|
19608
|
+
};
|
|
19609
|
+
const offeredMode = () => readMode().catch(() => lastKnownMode === "only" ? "only" : "off");
|
|
19611
19610
|
let closed = false;
|
|
19612
19611
|
const assertProjectIsolation = () => {
|
|
19613
19612
|
if (dependencies.projectConfigDisabled === false)
|
|
19614
|
-
throw new Error("
|
|
19613
|
+
throw new Error("Restart OpenWork to apply your sandbox setting, then try again. Nothing ran.");
|
|
19615
19614
|
};
|
|
19616
19615
|
const hooksAvailable = !!context.tool.hook && !!context.mcp;
|
|
19617
19616
|
if (mode === "only" && !hooksAvailable)
|
|
19618
|
-
throw new Error("
|
|
19617
|
+
throw new Error("OpenWork couldn’t enforce your sandbox setting. Restart OpenWork and try again.");
|
|
19619
19618
|
let mcpMode = mode;
|
|
19620
19619
|
const guard = await context.tool.hook?.("execute.before", async (event) => {
|
|
19621
19620
|
if (SANDBOX_TOOL_NAMES.some((name) => event.tool === name))
|
|
@@ -19623,7 +19622,7 @@ async function setupSandboxTools(context, dependencies) {
|
|
|
19623
19622
|
if (dependencies.assertHostExecution)
|
|
19624
19623
|
return dependencies.assertHostExecution();
|
|
19625
19624
|
if (modeSchema.parse(await dependencies.status()) === "only") {
|
|
19626
|
-
throw new Error("
|
|
19625
|
+
throw new Error("This tool can’t run with your sandbox setting. Use the sandbox tools instead.");
|
|
19627
19626
|
}
|
|
19628
19627
|
});
|
|
19629
19628
|
const servers = await context.mcp?.transform((editor) => {
|
|
@@ -19651,13 +19650,13 @@ async function setupSandboxTools(context, dependencies) {
|
|
|
19651
19650
|
for (const original of editor.list()) {
|
|
19652
19651
|
const execute = original.execute;
|
|
19653
19652
|
if (!execute || !original.name || original.description === undefined || !original.input)
|
|
19654
|
-
throw new Error("
|
|
19653
|
+
throw new Error("OpenWork couldn’t check its tools. Update OpenWork and try again.");
|
|
19655
19654
|
editor.remove(original.id);
|
|
19656
19655
|
editor.add({ ...original, name: original.name, description: original.description, input: original.input, async execute(input2, call) {
|
|
19657
19656
|
if (dependencies.assertHostExecution)
|
|
19658
19657
|
await dependencies.assertHostExecution();
|
|
19659
19658
|
else if (await dependencies.status() === "only")
|
|
19660
|
-
throw new Error("
|
|
19659
|
+
throw new Error("This tool can’t run with your current sandbox setting. Nothing ran.");
|
|
19661
19660
|
return execute(input2, call);
|
|
19662
19661
|
} });
|
|
19663
19662
|
}
|
|
@@ -19674,13 +19673,10 @@ async function setupSandboxTools(context, dependencies) {
|
|
|
19674
19673
|
async execute(input2, call) {
|
|
19675
19674
|
call.signal.throwIfAborted();
|
|
19676
19675
|
if (closed)
|
|
19677
|
-
throw new Error("
|
|
19678
|
-
|
|
19679
|
-
if (current === "only")
|
|
19676
|
+
throw new Error("The sandbox has closed. Reopen OpenWork and try again.");
|
|
19677
|
+
if (await readMode() === "only")
|
|
19680
19678
|
assertProjectIsolation();
|
|
19681
19679
|
call.signal.throwIfAborted();
|
|
19682
|
-
if (current === "off" || current !== catalogMode)
|
|
19683
|
-
throw new Error("Sandbox tool mode changed; refresh the tool catalog before retrying.");
|
|
19684
19680
|
const parsed = sandboxToolSchemas[name].parse(input2);
|
|
19685
19681
|
return resultSchema.parse(await dependencies.execute(name, parsed, call));
|
|
19686
19682
|
}
|
|
@@ -19690,14 +19686,18 @@ async function setupSandboxTools(context, dependencies) {
|
|
|
19690
19686
|
let prompt;
|
|
19691
19687
|
try {
|
|
19692
19688
|
prompt = await context.session.hook("prompt", async () => {
|
|
19693
|
-
const next = await offeredMode(
|
|
19689
|
+
const next = await offeredMode();
|
|
19690
|
+
if (next !== "off")
|
|
19691
|
+
dependencies.prewarm?.().catch(() => {
|
|
19692
|
+
return;
|
|
19693
|
+
});
|
|
19694
19694
|
if (next === "only")
|
|
19695
19695
|
assertProjectIsolation();
|
|
19696
19696
|
if (next === "only" && !hooksAvailable)
|
|
19697
|
-
throw new Error("
|
|
19697
|
+
throw new Error("Restart OpenWork to apply your sandbox setting, then send your message again.");
|
|
19698
19698
|
if (next !== mcpMode && (next === "only" || mcpMode === "only")) {
|
|
19699
19699
|
if (!context.mcp?.reload)
|
|
19700
|
-
throw new Error("
|
|
19700
|
+
throw new Error("Restart OpenWork to apply your sandbox setting to connected tools, then try again.");
|
|
19701
19701
|
mode = next;
|
|
19702
19702
|
await context.mcp.reload();
|
|
19703
19703
|
mcpMode = next;
|
|
@@ -19721,7 +19721,7 @@ async function setupSandboxTools(context, dependencies) {
|
|
|
19721
19721
|
const inference = [];
|
|
19722
19722
|
for (const name of ["context", "generate", "compaction"]) {
|
|
19723
19723
|
inference.push(await context.session.hook(name, async (event) => {
|
|
19724
|
-
const current =
|
|
19724
|
+
const current = await readMode().catch(() => lastKnownMode);
|
|
19725
19725
|
if (current !== "only")
|
|
19726
19726
|
return;
|
|
19727
19727
|
assertProjectIsolation();
|
|
@@ -19758,10 +19758,10 @@ var openwork_sandbox_v2_default = {
|
|
|
19758
19758
|
const options = exports_external.object({ url: exports_external.string().url(), token: exports_external.string().min(1) }).strict().parse(context.options);
|
|
19759
19759
|
const url2 = new URL(options.url);
|
|
19760
19760
|
if (url2.protocol !== "http:" || !["127.0.0.1", "localhost", "[::1]"].includes(url2.hostname) || url2.username || url2.password || url2.hash)
|
|
19761
|
-
throw new Error("
|
|
19761
|
+
throw new Error("OpenWork couldn’t connect to the sandbox on this computer.");
|
|
19762
19762
|
const directory = context.location?.directory;
|
|
19763
19763
|
if (!directory)
|
|
19764
|
-
throw new Error("
|
|
19764
|
+
throw new Error("Open a project folder in OpenWork before using the sandbox.");
|
|
19765
19765
|
const request = async (body, signal) => {
|
|
19766
19766
|
const response = await fetch(url2, {
|
|
19767
19767
|
method: "POST",
|
|
@@ -19772,8 +19772,7 @@ var openwork_sandbox_v2_default = {
|
|
|
19772
19772
|
});
|
|
19773
19773
|
if (!response.ok) {
|
|
19774
19774
|
const failure2 = exports_external.object({ error: exports_external.string() }).safeParse(await response.json().catch(() => null));
|
|
19775
|
-
|
|
19776
|
-
throw new Error(`Sandbox bridge request failed (${response.status}); host fallback is disabled.${reason}`);
|
|
19775
|
+
throw new Error(failure2.success ? failure2.data.error.slice(0, 500) : "The sandbox request failed. Try again. Nothing ran on this computer.");
|
|
19777
19776
|
}
|
|
19778
19777
|
return response.json();
|
|
19779
19778
|
};
|
|
@@ -19782,6 +19781,9 @@ var openwork_sandbox_v2_default = {
|
|
|
19782
19781
|
async status() {
|
|
19783
19782
|
return exports_external.object({ mode: modeSchema }).strict().parse(await request({ operation: "status" })).mode;
|
|
19784
19783
|
},
|
|
19784
|
+
async prewarm() {
|
|
19785
|
+
await request({ operation: "prompt" });
|
|
19786
|
+
},
|
|
19785
19787
|
async assertHostExecution() {
|
|
19786
19788
|
exports_external.object({ allowed: exports_external.literal(true) }).strict().parse(await request({ operation: "host" }));
|
|
19787
19789
|
},
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { strictArgsSchema } from "./openwork-provider-adapters.js";
|
|
3
|
-
// Sidebar groups live in the OpenWork server's workspace store, so the agent
|
|
4
|
-
// changes them there directly. Nothing here needs the desktop window: the app
|
|
5
|
-
// follows these writes through its session-group event feed.
|
|
6
3
|
export const SESSION_GROUP_COMMAND_IDS = ["session.group.create", "session.group.move", "session.group.remove"];
|
|
7
4
|
export const SESSION_GROUP_AFFORDANCE_IDS = ["session.group.list", ...SESSION_GROUP_COMMAND_IDS];
|
|
8
5
|
const workspaceIdArg = z.string().trim().optional()
|
|
@@ -29,7 +26,6 @@ const sessionGroupStateSchema = z.object({
|
|
|
29
26
|
assignments: z.record(z.string(), z.string()),
|
|
30
27
|
}),
|
|
31
28
|
});
|
|
32
|
-
// Bounds the cleanup done alongside one command; the rest goes on the next one.
|
|
33
29
|
const STALE_PRUNE_LIMIT = 50;
|
|
34
30
|
function groupsPath(workspaceId, suffix = "") {
|
|
35
31
|
return `/workspace/${encodeURIComponent(workspaceId)}/session-groups${suffix}`;
|
|
@@ -42,7 +38,6 @@ function describeGroups(state) {
|
|
|
42
38
|
? state.groups.map((group) => `${group.label} (${group.id})`).join(", ")
|
|
43
39
|
: "none yet; create one with session.group.create";
|
|
44
40
|
}
|
|
45
|
-
/** An exact id wins; otherwise one case-insensitive label match. */
|
|
46
41
|
function resolveGroup(state, ref) {
|
|
47
42
|
const byId = state.groups.find((group) => group.id === ref);
|
|
48
43
|
if (byId)
|
|
@@ -63,11 +58,6 @@ function staleSessionIds(state, live) {
|
|
|
63
58
|
return [];
|
|
64
59
|
return Object.keys(state.assignments).filter((sessionId) => !live.has(sessionId));
|
|
65
60
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Drop assignments whose session no longer exists, one key at a time so a
|
|
68
|
-
* concurrent sidebar edit is never overwritten. Skipped when the session list
|
|
69
|
-
* is incomplete: an unknown session is not proof that it was deleted.
|
|
70
|
-
*/
|
|
71
61
|
async function pruneStaleAssignments(host, workspaceId, state, live) {
|
|
72
62
|
const stale = staleSessionIds(state, live).slice(0, STALE_PRUNE_LIMIT);
|
|
73
63
|
for (const sessionId of stale) {
|
|
@@ -89,7 +79,6 @@ export async function listSessionGroups(host, workspaceId) {
|
|
|
89
79
|
ok: true,
|
|
90
80
|
workspaceId,
|
|
91
81
|
groups: state.groups.map((group) => ({ id: group.id, label: group.label, sessions: sessionsByGroup.get(group.id) ?? [] })),
|
|
92
|
-
// Sessions not listed under any group are ungrouped.
|
|
93
82
|
...(stale.size ? { staleAssignments: stale.size } : {}),
|
|
94
83
|
...(live ? {} : { note: "Session titles are unavailable; deleted sessions may still be listed." }),
|
|
95
84
|
};
|
|
@@ -97,7 +86,6 @@ export async function listSessionGroups(host, workspaceId) {
|
|
|
97
86
|
export async function createSessionGroup(host, workspaceId, label) {
|
|
98
87
|
const [state, live] = await Promise.all([readState(host, workspaceId), host.liveSessions(workspaceId)]);
|
|
99
88
|
const pruned = await pruneStaleAssignments(host, workspaceId, state, live);
|
|
100
|
-
// Retried or repeated requests reuse the group instead of adding a twin.
|
|
101
89
|
const existing = state.groups.find((group) => group.label.trim().toLowerCase() === label.toLowerCase());
|
|
102
90
|
if (existing)
|
|
103
91
|
return { ok: true, workspaceId, groupId: existing.id, label: existing.label, created: false, ...(pruned ? { pruned } : {}) };
|
|
@@ -116,7 +104,6 @@ export async function moveSessionToGroup(host, workspaceId, sessionId, groupRef)
|
|
|
116
104
|
return { ok: false, error: `Session ${sessionId} is not a task in this workspace` };
|
|
117
105
|
const pruned = await pruneStaleAssignments(host, workspaceId, state, live);
|
|
118
106
|
const after = sessionGroupStateSchema.parse(await host.send("PATCH", groupsPath(workspaceId, `/assignments/${encodeURIComponent(sessionId)}`), group ? { groupId: group.id } : {})).state;
|
|
119
|
-
// The server ignores unknown groups, so confirm the saved assignment.
|
|
120
107
|
if ((after.assignments[sessionId] ?? null) !== (group?.id ?? null)) {
|
|
121
108
|
return { ok: false, error: `Session ${sessionId} could not be moved; read session.group.list and retry` };
|
|
122
109
|
}
|