openwork-server 0.18.65 → 0.18.67

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.
Files changed (81) hide show
  1. package/dist/opencode-plugin-deps-1.18.33.tgz +0 -0
  2. package/dist/opencode-plugins/managed-policy-next.js +11 -0
  3. package/dist/opencode-plugins/openwork-agent-permissions-v2.js +17 -2
  4. package/dist/opencode-plugins/openwork-agent-questions.js +2 -9
  5. package/dist/opencode-plugins/openwork-auto-route-v2.js +1 -0
  6. package/dist/opencode-plugins/openwork-capabilities-knowledge.js +2 -2
  7. package/dist/opencode-plugins/openwork-computer-use.js +4 -14
  8. package/dist/opencode-plugins/openwork-context-v2.js +11 -63
  9. package/dist/opencode-plugins/openwork-extensions-preview.js +66 -13
  10. package/dist/opencode-plugins/openwork-provider-adapters.js +1 -0
  11. package/dist/opencode-plugins/openwork-provider-sync-v2.js +136 -19
  12. package/dist/openwork-server.mjs +5062 -7507
  13. package/package.json +1 -1
  14. package/web/assets/{abnfDiagram-VCTEODGH-_euFTfuE.js → abnfDiagram-VCTEODGH-D3rS6DjN.js} +1 -1
  15. package/web/assets/app-BUb4-37_.css +32 -0
  16. package/web/assets/{app-B_eR6sGg.js → app-DnDiUeJ_.js} +466 -443
  17. package/web/assets/{arc-DIIHEUK5.js → arc-1nwR3BuI.js} +1 -1
  18. package/web/assets/{architectureDiagram-5GKGNRK7-DD7V4Nl6.js → architectureDiagram-5GKGNRK7-CGr_AnX8.js} +1 -1
  19. package/web/assets/{artifact-code-view-2fHBrzKl.js → artifact-code-view-op4noM_j.js} +1 -1
  20. package/web/assets/{artifact-spreadsheet-editor-D2kPT8kU.js → artifact-spreadsheet-editor-OOE-8BBB.js} +1 -1
  21. package/web/assets/{artifact-text-editor-uJetA3RS.js → artifact-text-editor-CvG4fImt.js} +1 -1
  22. package/web/assets/{blockDiagram-OSKFZWR5-B5VTERzj.js → blockDiagram-OSKFZWR5-DcGHjZxr.js} +1 -1
  23. package/web/assets/{c4Diagram-7LVT6UL2-1Lh6d98a.js → c4Diagram-7LVT6UL2-o2lny2Rm.js} +1 -1
  24. package/web/assets/channel-Bw8HKEF7.js +1 -0
  25. package/web/assets/{chunk-2Q5K7J3B-BYSg2PtF.js → chunk-2Q5K7J3B-Btg11SQH.js} +1 -1
  26. package/web/assets/{chunk-5VM5RSS4-CUeEqVp6.js → chunk-5VM5RSS4-BKmIdwHz.js} +1 -1
  27. package/web/assets/{chunk-F27PBJKO-BYl1gIUK.js → chunk-F27PBJKO-Da3YRoya.js} +1 -1
  28. package/web/assets/{chunk-HLEWEB6X-CSHTqizU.js → chunk-HLEWEB6X-C35q0ph_.js} +1 -1
  29. package/web/assets/{chunk-JWPE2WC7-C3M9OIeQ.js → chunk-JWPE2WC7-B5UTV1rv.js} +1 -1
  30. package/web/assets/{chunk-POPQ4Y6H-CBer2BDK.js → chunk-POPQ4Y6H-DxbwOxng.js} +1 -1
  31. package/web/assets/{chunk-SVP7TREG-gh6XHnDe.js → chunk-SVP7TREG-Rcv8F-aG.js} +1 -1
  32. package/web/assets/{chunk-XXDRQBXY-BWW96PGH.js → chunk-XXDRQBXY-DzI8m20a.js} +1 -1
  33. package/web/assets/{chunk-ZLD2IHE6-BwjCpFv6.js → chunk-ZLD2IHE6-I_R2Af3b.js} +1 -1
  34. package/web/assets/classDiagram-CYGNFDIV-Dgehf2qM.js +1 -0
  35. package/web/assets/classDiagram-v2-TLXNO2FR-Dgehf2qM.js +1 -0
  36. package/web/assets/{cose-bilkent-JH36ORCC-lJjj59Sx.js → cose-bilkent-JH36ORCC-B9pJF5iu.js} +1 -1
  37. package/web/assets/{cynefin-OW5HDTMX-CAIFZQxV.js → cynefin-OW5HDTMX-BbJ34Xko.js} +1 -1
  38. package/web/assets/{cynefinDiagram-5FMLGOSQ-BNCAcb93.js → cynefinDiagram-5FMLGOSQ-BF_NZucr.js} +1 -1
  39. package/web/assets/{dagre-OS7QT2EB-DMlHDwrG.js → dagre-OS7QT2EB-Djr2ERNz.js} +1 -1
  40. package/web/assets/{diagram-S7CK7UJ4-Dbpa25GK.js → diagram-S7CK7UJ4-Br-qbMBh.js} +1 -1
  41. package/web/assets/{diagram-UQ7AKVKN-BCT_Qc9p.js → diagram-UQ7AKVKN-DYVDN8PC.js} +1 -1
  42. package/web/assets/{diagram-VSXAHHWV-CapON9I2.js → diagram-VSXAHHWV-LxYw5zGG.js} +1 -1
  43. package/web/assets/{diagram-VX7I27RA-CCMsrHOR.js → diagram-VX7I27RA-C0eoRvBk.js} +1 -1
  44. package/web/assets/{diagram-Z3DM3KII-BOpKxuDL.js → diagram-Z3DM3KII-DWgkcERO.js} +1 -1
  45. package/web/assets/{ebnfDiagram-PWID7BFC-C1sb3HsT.js → ebnfDiagram-PWID7BFC-Cez2iaxe.js} +1 -1
  46. package/web/assets/{erDiagram-2YWLMYGG-3TIcbkY2.js → erDiagram-2YWLMYGG-BaPzOQg7.js} +1 -1
  47. package/web/assets/{flowDiagram-T62WH6J4-C3YP5_VV.js → flowDiagram-T62WH6J4-BZMN8XWi.js} +1 -1
  48. package/web/assets/{ganttDiagram-EL5Y4UJY-BWO0IFRX.js → ganttDiagram-EL5Y4UJY-B71eSBEQ.js} +1 -1
  49. package/web/assets/{gitGraphDiagram-WWUBYQGX-Dpi4d5u9.js → gitGraphDiagram-WWUBYQGX-DhuvhkGK.js} +1 -1
  50. package/web/assets/{infoDiagram-FKFFQAWI-C3t_XWD1.js → infoDiagram-FKFFQAWI-Devpgkju.js} +1 -1
  51. package/web/assets/{ishikawaDiagram-5VMMS53U-Duhj9xvC.js → ishikawaDiagram-5VMMS53U-B9UrQ14y.js} +1 -1
  52. package/web/assets/{journeyDiagram-EYS64GPL-Bq_tWeLz.js → journeyDiagram-EYS64GPL-BFK11Iww.js} +1 -1
  53. package/web/assets/{kanban-definition-UXKFOSKX-C7zCaEcE.js → kanban-definition-UXKFOSKX-PPExTrNG.js} +1 -1
  54. package/web/assets/{layout-BGV5k35C.js → layout-kCZSGp9r.js} +1 -1
  55. package/web/assets/{linear-jBjiubEm.js → linear-BXCvSAaf.js} +1 -1
  56. package/web/assets/{mermaid.core-DcEA9CwK.js → mermaid.core-CWPg7y8d.js} +6 -6
  57. package/web/assets/{mindmap-definition-THT77NOG-DWi2qNO-.js → mindmap-definition-THT77NOG-uvGv44sD.js} +1 -1
  58. package/web/assets/{pegDiagram-XKGWAZYB-mpdETODF.js → pegDiagram-XKGWAZYB-DSPBLDwA.js} +1 -1
  59. package/web/assets/{pieDiagram-E7YTZNPT-B_E8xv7R.js → pieDiagram-E7YTZNPT-B5nP9Y1z.js} +1 -1
  60. package/web/assets/{quadrantDiagram-AXDQQJYC-C3DLSKZx.js → quadrantDiagram-AXDQQJYC-BWthwN9w.js} +1 -1
  61. package/web/assets/{railroadDiagram-O6MQD6OU-CV8e2EYD.js → railroadDiagram-O6MQD6OU-DAXwCa18.js} +1 -1
  62. package/web/assets/{requirementDiagram-IS5BZ75X-D8_GWwzL.js → requirementDiagram-IS5BZ75X-BmHtbdJS.js} +1 -1
  63. package/web/assets/{sankeyDiagram-P5KCCOFB-BedccLEd.js → sankeyDiagram-P5KCCOFB-UR3FQTYa.js} +1 -1
  64. package/web/assets/{sequenceDiagram-WJ2MYXX4-Cf9QsPD1.js → sequenceDiagram-WJ2MYXX4-DGCx4UQK.js} +1 -1
  65. package/web/assets/{sizeCapture-INFHLROL-BZXVwOZ-.js → sizeCapture-INFHLROL-C2q53DG3.js} +1 -1
  66. package/web/assets/{stateDiagram-XQSTLZYL-JaEqdUWJ.js → stateDiagram-XQSTLZYL-r9Sk3D6F.js} +1 -1
  67. package/web/assets/stateDiagram-v2-IH3M54BS-BoRR34S1.js +1 -0
  68. package/web/assets/{swimlanes-V6O3JKXN-CIkru_FY.js → swimlanes-V6O3JKXN-C99OzjKu.js} +1 -1
  69. package/web/assets/swimlanesDiagram-JKAHXJPX-Bz7seo8f.js +8 -0
  70. package/web/assets/{timeline-definition-24CTP7MA-BDahVZ3U.js → timeline-definition-24CTP7MA-bX_ZEoDi.js} +1 -1
  71. package/web/assets/{vennDiagram-4TSXK5OY-yi0sphxQ.js → vennDiagram-4TSXK5OY-WWxZXXkY.js} +1 -1
  72. package/web/assets/{wardleyDiagram-VM6X3IG4-PXKHpuHP.js → wardleyDiagram-VM6X3IG4-DWxNbx_H.js} +1 -1
  73. package/web/assets/{workspace-file-tree-BoW3xSOx.js → workspace-file-tree-C3bZb5LL.js} +1 -1
  74. package/web/assets/{xychartDiagram-S5SC5T6Z-2ZN6-3RY.js → xychartDiagram-S5SC5T6Z-Cyx8sJUe.js} +1 -1
  75. package/web/index.html +2 -2
  76. package/web/assets/app-BL4DzbHg.css +0 -32
  77. package/web/assets/channel-CLju5G1-.js +0 -1
  78. package/web/assets/classDiagram-CYGNFDIV-DZO1M7Ic.js +0 -1
  79. package/web/assets/classDiagram-v2-TLXNO2FR-DZO1M7Ic.js +0 -1
  80. package/web/assets/stateDiagram-v2-IH3M54BS-BVaVsTdq.js +0 -1
  81. package/web/assets/swimlanesDiagram-JKAHXJPX-AGVU67SD.js +0 -8
@@ -19522,6 +19522,16 @@ var desktopPolicyDefinitions = [
19522
19522
  defaultValue: true,
19523
19523
  restrictedValue: false
19524
19524
  },
19525
+ {
19526
+ id: "allowLocalModels",
19527
+ teamLabel: "Use local models",
19528
+ group: "ai",
19529
+ name: "Local models (Ollama, LM Studio)",
19530
+ description: "Allow users to run models on their own computer with Ollama or LM Studio.",
19531
+ userNotice: "Your organization administrator has turned off local models.",
19532
+ defaultValue: true,
19533
+ restrictedValue: false
19534
+ },
19525
19535
  {
19526
19536
  id: "allowZenModel",
19527
19537
  teamLabel: "Use the free starter model",
@@ -19710,6 +19720,7 @@ var desktopConfigSchema = desktopPolicyValueSchema.extend({
19710
19720
  onboardingPromptDescriptions: onboardingPromptDescriptionsSchema.optional(),
19711
19721
  agentPermissions: desktopAgentPermissionsSchema.optional(),
19712
19722
  browserUploadPermissions: desktopBrowserUploadPermissionsSchema.optional(),
19723
+ fileSendPermissions: desktopBrowserUploadPermissionsSchema.optional(),
19713
19724
  defaultModel: desktopConfigDefaultModelSchema.optional()
19714
19725
  }).meta({ ref: "DenDesktopConfig" });
19715
19726
 
@@ -19466,7 +19466,7 @@ function date4(params) {
19466
19466
  }
19467
19467
  // ../../packages/types/src/den/agent-permissions.ts
19468
19468
  var AGENT_PERMISSION_DECISIONS = ["allow", "ask", "deny"];
19469
- var AGENT_PERMISSION_ACTIONS = ["shell", "edit", "webfetch", "websearch", "skill", "mcp", "external_directory", "computer", "computer_files", "computer_clipboard", "script", "browser_upload"];
19469
+ var AGENT_PERMISSION_ACTIONS = ["shell", "edit", "webfetch", "websearch", "skill", "mcp", "external_directory", "computer", "computer_files", "computer_clipboard", "script", "browser_upload", "file_send"];
19470
19470
  var agentPermissionDefinitions = [
19471
19471
  {
19472
19472
  key: "commands",
@@ -19558,6 +19558,16 @@ var agentPermissionDefinitions = [
19558
19558
  patterns: "website",
19559
19559
  patternNoun: "website"
19560
19560
  },
19561
+ {
19562
+ key: "fileSends",
19563
+ section: "files",
19564
+ label: "Send files to connected accounts",
19565
+ description: "Files the agent uploads to Google Drive, saves back to Drive, OneDrive or SharePoint, or attaches to Gmail and Outlook drafts. Member decides asks unless the member remembered approval. Ask first requires approval for every file, even when the member previously allowed it.",
19566
+ action: "file_send",
19567
+ control: "choice",
19568
+ patterns: null,
19569
+ patternNoun: null
19570
+ },
19561
19571
  {
19562
19572
  key: "webSearch",
19563
19573
  section: "web",
@@ -19593,6 +19603,10 @@ var agentPermissionKeys = agentPermissionDefinitions.map((definition) => definit
19593
19603
  function agentPermissionDecisionsFor(definition) {
19594
19604
  return definition.control === "toggle" ? ["allow", "deny"] : AGENT_PERMISSION_DECISIONS;
19595
19605
  }
19606
+ var AGENT_PERMISSION_MEMBER_DECIDES_ACTIONS = ["browser_upload", "file_send"];
19607
+ function actionMemberDecides(action) {
19608
+ return AGENT_PERMISSION_MEMBER_DECIDES_ACTIONS.some((entry) => entry === action);
19609
+ }
19596
19610
  var AGENT_PERMISSION_LIST_MAX = 100;
19597
19611
  var PATTERN_MAX_LENGTH = { command: 300, website: 300 };
19598
19612
  function websiteScheme(value) {
@@ -19786,7 +19800,7 @@ function matchingAgentPermissionRule(rules, action, resource) {
19786
19800
  return null;
19787
19801
  }
19788
19802
  function decideAgentPermission(rules, action, resources) {
19789
- const defaultEffect = action === "browser_upload" ? "ask" : "allow";
19803
+ const defaultEffect = actionMemberDecides(action) ? "ask" : "allow";
19790
19804
  let result = null;
19791
19805
  for (const resource of resources.length > 0 ? resources : ["*"]) {
19792
19806
  const rule = matchingAgentPermissionRule(rules, action, resource);
@@ -19807,6 +19821,7 @@ var BLOCKED_SUBJECT = {
19807
19821
  script: () => "running app scripts",
19808
19822
  webfetch: (resource) => resource === "*" ? "opening websites" : `opening ${resource}`,
19809
19823
  browser_upload: (resource) => resource === "*" ? "uploading files to websites" : `uploading files to ${resource}`,
19824
+ file_send: () => "sending files to connected accounts",
19810
19825
  websearch: () => "searching the web",
19811
19826
  skill: (resource) => resource === "*" ? "local skills" : `the local skill "${resource}"`,
19812
19827
  mcp: (resource) => resource === "*" ? "local MCP servers" : `the local MCP server "${resource}"`
@@ -1,9 +1,7 @@
1
- // A question the agent asks without stopping its work, behind the desktop's
2
- // `agentQuestions` feature. The engine's own question tool blocks the turn
1
+ // A question the agent asks without stopping its work. The engine's own question tool blocks the turn
3
2
  // until the person answers; this one returns at once and the answer reaches
4
3
  // the chat later (see opencode-v2-background-questions.ts).
5
4
  import { z } from "zod";
6
- import { uiBridgeRequest } from "./openwork-ui-bridge.js";
7
5
  export const ASK_WITHOUT_WAITING = "ask_without_waiting";
8
6
  // The same questions the engine's question tool takes, so the agent can use either.
9
7
  export const askArgs = z.object({
@@ -15,10 +13,5 @@ export const askArgs = z.object({
15
13
  multiple: z.boolean().optional().describe("true lets the person pick more than one option."),
16
14
  }).strict()).min(1).max(4),
17
15
  }).strict();
18
- // All model-facing guidance for asking lives here, offered only with the feature on.
16
+ // All model-facing guidance for asking lives here.
19
17
  export const askDescription = "Ask the person something without stopping. Takes the same questions as the question tool but returns at once: their answer arrives later as a message in this chat, and starts a new turn if yours has ended. Use it when other parts of the task do not depend on the answer, and keep working on those; use question when nothing useful can continue until they answer. Either way, never end your turn asking the person to reply, approve or tell you when they are done: ask with one of these tools instead. Do not ask again while a question is open.";
20
- /** On only when the desktop says the `agentQuestions` feature is on; any other host keeps it off. */
21
- export async function agentQuestionsOffered() {
22
- const result = await uiBridgeRequest("/agent-questions/enabled");
23
- return Boolean(result && typeof result === "object" && "enabled" in result && result.enabled === true);
24
- }
@@ -19575,6 +19575,7 @@ var autoRouterConnectSchema = exports_external.object({
19575
19575
  apiKey: exports_external.string(),
19576
19576
  models: exports_external.array(exports_external.object({ id: exports_external.string(), name: exports_external.string() })).min(1)
19577
19577
  }).meta({ ref: "AutoRouterConnect" });
19578
+ var autoRouterMemberListSchema = exports_external.object({ routers: exports_external.array(exports_external.object({ id: exports_external.string(), name: exports_external.string() })) }).meta({ ref: "AutoRouterMemberList" });
19578
19579
 
19579
19580
  // src/opencode-plugins/openwork-auto-route-v2.ts
19580
19581
  function decodeName(value) {
@@ -19716,8 +19716,8 @@ function automationRuntimeKnowledge(runtimeProvider = process.env.DEN_RUNTIME_PR
19716
19716
  }
19717
19717
  return [
19718
19718
  ...shared,
19719
- "This chat is running in OpenWork Desktop. For new recurring work, use openwork_execute id automation.propose so the person can review and create it in the app. Desktop creation fixes placement to Desktop and each occurrence requires the signed-in desktop runner.",
19720
- "Do not use createCloudAutomation from Desktop chat and never claim a Desktop Automation will run while the app is offline."
19719
+ "This chat is running in OpenWork Desktop. For new recurring work, use openwork_execute id automation.propose so the person can review and create it in the app. The card lets them choose where it runs when both are available: Desktop (each occurrence requires the signed-in desktop runner) or Cloud (headless in OpenWork Cloud, runs while this computer is off).",
19720
+ 'When the person asks for Cloud, or for work that must run while their computer is off, pass executionTarget "cloud" in the proposal; calendar schedules always need Cloud. Do not tell them Desktop chat can only make Desktop Automations. Still propose rather than calling createCloudAutomation directly from Desktop chat, and never claim a Desktop Automation will run while the app is offline.'
19721
19721
  ].map((line) => `- ${line}`).join(`
19722
19722
  `);
19723
19723
  }
@@ -37202,18 +37202,10 @@ var actSchema = exports_external.union([
37202
37202
  ]);
37203
37203
  var scriptArgs = { app: exports_external.enum(["applescript", "jxa", "blender"]), code: exports_external.string().min(1).max(32000), timeoutMs: exports_external.number().int().min(1000).max(120000).optional() };
37204
37204
  var scriptResult = exports_external.object({ ok: exports_external.boolean().optional() }).passthrough();
37205
- async function computerToolsOffered() {
37206
- return (await computerFeatures()).offered;
37207
- }
37208
- async function computerFeatures() {
37209
- const result = await uiBridgeRequest("/computer/enabled");
37210
- const body = result && typeof result === "object" ? result : {};
37211
- return { offered: body.enabled !== false, parallel: body.parallel === true };
37212
- }
37213
37205
  var parallelAgents = ` When a task spans two or more apps, give each app to its own subagent, described by its app (such as "Maps"): plan them in waves by which needs another's file, start each wave's agents together in one message, and tell each its one app, its done condition, the file names it reads and writes in save_folder (every agent of this chat gets the same one); OpenWork places their windows while the person watches, so they need not arrange them. Pass work between them as files by path, not the clipboard, and check the final file yourself before answering.`;
37214
- var server = async ({ parallel = false } = {}) => ({ tool: {
37206
+ var server = async () => ({ tool: {
37215
37207
  computer_run: {
37216
- description: `Run a short JavaScript program against this chat's computer or built-in browser. The computerUse rollout enables the tools. Personal app windows require the person's choice in the Computer view; dedicated conversation cloud VM windows open automatically. Use tools.ui methods with object arguments: open({appId,mode?,purpose?}) (mode defaults to control) or open({url}); observe({screenshot?}); exists({target}); find({target}); act({action}); click({target}); fill({target,text,append?}); fillForm({fields:[{target,text}]}); setChecked({target,checked}); select({target,option}); key({key,modifiers?}); findText({text}); menu({path:[names]}); waitFor({target,state?:"visible"|"hidden"|"enabled",timeoutMs?}); scroll({container?,direction?:"up"|"down",pages?}); scrollUntil({target,container?,direction?,maxPages?}). Targets contain role/name/text, exact=false for substring matching, and nth for ambiguity. Programs use await, if, loops, and return; input contains your supplied JSON. Each action re-resolves its target; waits and scrolling run locally. Return a concise result and call observe({screenshot:true}) when visual judgment is needed. Screenshots are attached automatically. Do not replay a stopped/partial program; inspect its receipts and current view. Keep one program to a bounded task stage. Example: await tools.ui.fill({target:{role:"textbox",name:"Search"},text:"release notes"}); return await tools.ui.observe({screenshot:true});`,
37208
+ description: `Run a short JavaScript program against this chat's computer or built-in browser. Personal app windows require the person's choice in the Computer view; dedicated conversation cloud VM windows open automatically. Use tools.ui methods with object arguments: open({appId,mode?,purpose?}) (mode defaults to control) or open({url}); observe({screenshot?}); exists({target}); find({target}); act({action}); click({target}); fill({target,text,append?}); fillForm({fields:[{target,text}]}); setChecked({target,checked}); select({target,option}); key({key,modifiers?}); findText({text}); menu({path:[names]}); waitFor({target,state?:"visible"|"hidden"|"enabled",timeoutMs?}); scroll({container?,direction?:"up"|"down",pages?}); scrollUntil({target,container?,direction?,maxPages?}). Targets contain role/name/text, exact=false for substring matching, and nth for ambiguity. Programs use await, if, loops, and return; input contains your supplied JSON. Each action re-resolves its target; waits and scrolling run locally. Return a concise result and call observe({screenshot:true}) when visual judgment is needed. Screenshots are attached automatically. Do not replay a stopped/partial program; inspect its receipts and current view. Keep one program to a bounded task stage. Example: await tools.ui.fill({target:{role:"textbox",name:"Search"},text:"release notes"}); return await tools.ui.observe({screenshot:true});`,
37217
37209
  args: { surface: exports_external.enum(["computer", "browser"]), code: exports_external.string().min(1).max(32000), tabId: exports_external.string().optional(), input: exports_external.unknown().optional().describe("Any JSON value; the program reads it as input."), timeoutMs: exports_external.number().int().min(1000).max(60000).optional() },
37218
37210
  async execute(raw, context) {
37219
37211
  const caller = contextSchema.parse(context);
@@ -37235,7 +37227,7 @@ var server = async ({ parallel = false } = {}) => ({ tool: {
37235
37227
  }
37236
37228
  } },
37237
37229
  computer_discover: computerTool("computer_discover", "List apps, modes, keys and readiness on the chat's selected computer. On Linux VMs, use app_id desktop to work across windows and menus.", exports_external.object({}).strict(), {}),
37238
- computer_open: computerTool("computer_open", "Open an app window on the chat's selected computer so you can do the person's task in it: click, type, scroll and use shortcuts until the result is finished, rather than handing the steps back to them. Mode defaults to control, which does all of that and may bring the window to the front while it works. Use observe only when the person asks you just to look, or assist when they want to keep using that window themselves. Supply window_id for a particular target; otherwise use the sole or focused window. On a remote Linux VM or a Windows PC, act on screenshot coordinates; assist mode and native semantic controls are unavailable. Before opening, name the finished result the person should see; that is your done condition for the act loop. On a Mac a chat keeps up to three apps open at once, each in its own window: open the next app without closing the first, and pass the session_id each open returned to observe, act, zoom, status or close the app you mean (omitted, calls go to the app opened last). Arrange windows side by side only for such a two-app task or when the person asks. Close each app when you are done with it; arranged windows go back where they were. On a Mac the result names save_folder, this chat's output folder: put every file you make for the person there, whether an app saves it, a script exports it or a shell command writes it, never only in a temporary folder; the chat lists the files there." + (parallel ? parallelAgents : "") + safety, exports_external.object(open2).strict(), open2),
37230
+ computer_open: computerTool("computer_open", "Open an app window on the chat's selected computer so you can do the person's task in it: click, type, scroll and use shortcuts until the result is finished, rather than handing the steps back to them. Mode defaults to control, which does all of that and may bring the window to the front while it works. Use observe only when the person asks you just to look, or assist when they want to keep using that window themselves. Supply window_id for a particular target; otherwise use the sole or focused window. On a remote Linux VM or a Windows PC, act on screenshot coordinates; assist mode and native semantic controls are unavailable. Before opening, name the finished result the person should see; that is your done condition for the act loop. On a Mac a chat keeps up to three apps open at once, each in its own window: open the next app without closing the first, and pass the session_id each open returned to observe, act, zoom, status or close the app you mean (omitted, calls go to the app opened last). Arrange windows side by side only for such a two-app task or when the person asks. Close each app when you are done with it; arranged windows go back where they were. On a Mac the result names save_folder, this chat's output folder: put every file you make for the person there, whether an app saves it, a script exports it or a shell command writes it, never only in a temporary folder; the chat lists the files there." + parallelAgents + safety, exports_external.object(open2).strict(), open2),
37239
37231
  computer_observe: computerTool("computer_observe", "See the selected window: returns interactive accessible elements (ref, role, label, read-only values, x/y/w/h in image pixels, press/settable/disabled flags) and an observation_id valid for one act within 60 seconds, plus a screenshot when it adds something: always on a Windows PC or Linux VM and for a control session in front, otherwise when the elements name too few controls. image.omitted=unchanged means the window looks exactly like the image from same_as_observation, so its coordinates still apply. Every act already returns a fresh settled observation, so call this only at the start, after a person handoff, or when told to. Editable-field values are withheld from Accessibility output; read visible field content from the image, with include_image true when none was sent. elements=all adds static text for reading; none returns only the image. If no screenshot reaches you (some models read text only) and the elements are not enough, the session is fine: tell the person your current model cannot see the screen and to choose one that can see images.", exports_external.object(observe).strict(), observe),
37240
37232
  computer_act: computerTool("computer_act", "Prefer computer_script when the app supports scripting, and computer_run for multi-step forms, searches, scrolling and waits. Use this low-level tool for individual visual actions. Plan the whole stage before acting. Act on the selected window, then read the fresh observation returned with the receipt; it carries a screenshot only when one adds something; set screenshot true when you must see the result, such as typed text or layout, and false when its elements alone will confirm the step. Pass one action, or actions (up to 8) for a predictable sequence in one round trip: click a field, type, key enter; set_value several refs then press Save; key command+f, type, key enter. Several drags in a row draw several strokes in one call. On a Mac, right_click or a control click opens a context menu, show_menu opens a control's own menu, and click with hold_ms opens a tool's flyout; the open menu is then observed and pressed like a dialog. An app's own shortcuts go to it when no text field has the keyboard: a single letter (optionally with shift), or a control or option chord, in any app. In design, photo, video and music apps editing keys (enter, tab, escape, backspace, delete, arrows, home/end, with shift, option or command) go to what has the keyboard in the window. Any app can take real input, the real pointer and keyboard with the window in front (step path real_input): apps that draw their own interface, such as Blender, game engines and Qt or Tk apps, ignore other input and start with it, and after a step that changed nothing after_action.real_input says to repeat it once with input real. Work in such apps' interface rather than through computer_script unless the person asks for a script. Blender sends keys to the editor under the pointer, so move over the viewport or panel first, then press its own shortcuts (shift+a, g, r, s, tab, control or option chords) and type values; double_click a number field to type into it, and drag to orbit or move. To type where no text field is observed, click where it goes first: in the same batch, type and editing keys go to what that click gave the keyboard, so click, key command+a, type, key enter is one batch. A design app's value field (width, font size, opacity): click it, type the number, key enter, or use enter_value. Canvas text: select the Type tool, double_click the text, key command+a, type, then commit with the app's commit control or command+enter; until the app is editing text, typing is refused with text_edit_not_active, since letters would pick tools. When the observation lists nothing that has the keyboard, add target focused to type, key or enter_value to send to whatever has it; after a step with path raw_input_unverified, check the result with computer_zoom on that area. A set_value step with path value_not_applied left the control unchanged: use enter_value on the same ref instead. For edits of several steps, use focus and expect around the keys rather than observing between them: focus e12, expect {focused: e12}, key command+a, type 120, key enter, expect {value: {ref: e12, equals: 120}}. Steps run in order and each is validated live; the batch stops at the first failure and the receipt names the completed, failed and skipped steps. Prefer press/set_value on refs for forms. For app commands, prefer a menu action with a path from the menus computer_open listed: it runs at once without opening the menu or needing focus, works in assist mode, and the person still sees the cursor pick it. Use key with modifiers for editing and navigation shortcuts; quit, close, hide and app-switch chords are refused. Another Command shortcut, such as command+n, runs as the menu command when the app's menus list it, and otherwise goes to the app as a key. On a Mac, to move a table, text or image between apps, key command+c or command+x in one app and command+v in the other, each as its own step: the step path is copied, cut, copy_unconfirmed (nothing was selected) or pasted. A paste uses only what you copied in this chat, never the person's clipboard, which comes back when the chat's last app closes; you never see the clipboard's contents, so check the result in the observation. Moving between apps: copy and paste content (a table, a selection, a layer); to carry on with a file you saved in another app, such as an exported PNG made into a PDF in Preview, use computer_open with file instead. Use move to hover, click/double_click/triple_click (optionally with modifiers) to choose, drag to select or move, scroll (positive delta_y up, positive delta_x left); these need control mode and a screenshot. Use wait (ms) inside a batch for a load, not between round trips. To save or export on a Mac, open the app's Save or Export sheet, observe it, and send save_as with a path in the save_folder computer_open returned, unless the person named a folder. When an app needs a file through its own Open, Place, Insert or Attach command, open that panel, then send open_in_panel with the file's path rather than typing the path or asking the person; it waits briefly for a panel that is still opening. End the final reply by naming each file you delivered and its folder: the chat lists them for the person to open, show in Finder or attach. Coordinates are image pixels, never screen coordinates. A dispatched receipt is not proof of completion; verify in the returned observation and never replay an uncertain dispatch. Loop until done: act, read the returned observation, decide the next step, and repeat until it shows the done condition you named. When a step fails, is refused or changes nothing, change route rather than repeating: a ref instead of coordinates, coordinates instead of a ref, the app's own shortcut, a menu command, scroll or search, or input real. Try up to three different routes before you report what blocked you. Zoom instead of guessing at small text. Ask rather than guess when the request lacks something you need; otherwise ask only when missing information or a takeover blocks you. Before finishing, check every part of the request against the final observation, then state what it shows, or exactly what blocked you and what you tried.", actSchema, act),
37241
37233
  computer_zoom: computerTool("computer_zoom", "Look closer at part of the current observation: returns that region (x, y, width, height in the observation's image pixels) at full display resolution, to read small text or check detail before acting. Read only: keep using the same observation_id and the original image coordinates for act.", exports_external.object(zoom).strict(), zoom),
@@ -37243,7 +37235,5 @@ var server = async ({ parallel = false } = {}) => ({ tool: {
37243
37235
  computer_close: computerTool("computer_close", "Close one of this chat's native computer sessions and discard its observations; the chat's other apps stay open.", exports_external.object({ session_id }).strict(), { session_id })
37244
37236
  } });
37245
37237
  export {
37246
- server,
37247
- computerToolsOffered,
37248
- computerFeatures
37238
+ server
37249
37239
  };
@@ -37262,18 +37262,10 @@ var actSchema = exports_external.union([
37262
37262
  ]);
37263
37263
  var scriptArgs = { app: exports_external.enum(["applescript", "jxa", "blender"]), code: exports_external.string().min(1).max(32000), timeoutMs: exports_external.number().int().min(1000).max(120000).optional() };
37264
37264
  var scriptResult = exports_external.object({ ok: exports_external.boolean().optional() }).passthrough();
37265
- async function computerToolsOffered() {
37266
- return (await computerFeatures()).offered;
37267
- }
37268
- async function computerFeatures() {
37269
- const result = await uiBridgeRequest("/computer/enabled");
37270
- const body = result && typeof result === "object" ? result : {};
37271
- return { offered: body.enabled !== false, parallel: body.parallel === true };
37272
- }
37273
37265
  var parallelAgents = ` When a task spans two or more apps, give each app to its own subagent, described by its app (such as "Maps"): plan them in waves by which needs another's file, start each wave's agents together in one message, and tell each its one app, its done condition, the file names it reads and writes in save_folder (every agent of this chat gets the same one); OpenWork places their windows while the person watches, so they need not arrange them. Pass work between them as files by path, not the clipboard, and check the final file yourself before answering.`;
37274
- var server2 = async ({ parallel = false } = {}) => ({ tool: {
37266
+ var server2 = async () => ({ tool: {
37275
37267
  computer_run: {
37276
- description: `Run a short JavaScript program against this chat's computer or built-in browser. The computerUse rollout enables the tools. Personal app windows require the person's choice in the Computer view; dedicated conversation cloud VM windows open automatically. Use tools.ui methods with object arguments: open({appId,mode?,purpose?}) (mode defaults to control) or open({url}); observe({screenshot?}); exists({target}); find({target}); act({action}); click({target}); fill({target,text,append?}); fillForm({fields:[{target,text}]}); setChecked({target,checked}); select({target,option}); key({key,modifiers?}); findText({text}); menu({path:[names]}); waitFor({target,state?:"visible"|"hidden"|"enabled",timeoutMs?}); scroll({container?,direction?:"up"|"down",pages?}); scrollUntil({target,container?,direction?,maxPages?}). Targets contain role/name/text, exact=false for substring matching, and nth for ambiguity. Programs use await, if, loops, and return; input contains your supplied JSON. Each action re-resolves its target; waits and scrolling run locally. Return a concise result and call observe({screenshot:true}) when visual judgment is needed. Screenshots are attached automatically. Do not replay a stopped/partial program; inspect its receipts and current view. Keep one program to a bounded task stage. Example: await tools.ui.fill({target:{role:"textbox",name:"Search"},text:"release notes"}); return await tools.ui.observe({screenshot:true});`,
37268
+ description: `Run a short JavaScript program against this chat's computer or built-in browser. Personal app windows require the person's choice in the Computer view; dedicated conversation cloud VM windows open automatically. Use tools.ui methods with object arguments: open({appId,mode?,purpose?}) (mode defaults to control) or open({url}); observe({screenshot?}); exists({target}); find({target}); act({action}); click({target}); fill({target,text,append?}); fillForm({fields:[{target,text}]}); setChecked({target,checked}); select({target,option}); key({key,modifiers?}); findText({text}); menu({path:[names]}); waitFor({target,state?:"visible"|"hidden"|"enabled",timeoutMs?}); scroll({container?,direction?:"up"|"down",pages?}); scrollUntil({target,container?,direction?,maxPages?}). Targets contain role/name/text, exact=false for substring matching, and nth for ambiguity. Programs use await, if, loops, and return; input contains your supplied JSON. Each action re-resolves its target; waits and scrolling run locally. Return a concise result and call observe({screenshot:true}) when visual judgment is needed. Screenshots are attached automatically. Do not replay a stopped/partial program; inspect its receipts and current view. Keep one program to a bounded task stage. Example: await tools.ui.fill({target:{role:"textbox",name:"Search"},text:"release notes"}); return await tools.ui.observe({screenshot:true});`,
37277
37269
  args: { surface: exports_external.enum(["computer", "browser"]), code: exports_external.string().min(1).max(32000), tabId: exports_external.string().optional(), input: exports_external.unknown().optional().describe("Any JSON value; the program reads it as input."), timeoutMs: exports_external.number().int().min(1000).max(60000).optional() },
37278
37270
  async execute(raw, context) {
37279
37271
  const caller = contextSchema2.parse(context);
@@ -37295,7 +37287,7 @@ var server2 = async ({ parallel = false } = {}) => ({ tool: {
37295
37287
  }
37296
37288
  } },
37297
37289
  computer_discover: computerTool("computer_discover", "List apps, modes, keys and readiness on the chat's selected computer. On Linux VMs, use app_id desktop to work across windows and menus.", exports_external.object({}).strict(), {}),
37298
- computer_open: computerTool("computer_open", "Open an app window on the chat's selected computer so you can do the person's task in it: click, type, scroll and use shortcuts until the result is finished, rather than handing the steps back to them. Mode defaults to control, which does all of that and may bring the window to the front while it works. Use observe only when the person asks you just to look, or assist when they want to keep using that window themselves. Supply window_id for a particular target; otherwise use the sole or focused window. On a remote Linux VM or a Windows PC, act on screenshot coordinates; assist mode and native semantic controls are unavailable. Before opening, name the finished result the person should see; that is your done condition for the act loop. On a Mac a chat keeps up to three apps open at once, each in its own window: open the next app without closing the first, and pass the session_id each open returned to observe, act, zoom, status or close the app you mean (omitted, calls go to the app opened last). Arrange windows side by side only for such a two-app task or when the person asks. Close each app when you are done with it; arranged windows go back where they were. On a Mac the result names save_folder, this chat's output folder: put every file you make for the person there, whether an app saves it, a script exports it or a shell command writes it, never only in a temporary folder; the chat lists the files there." + (parallel ? parallelAgents : "") + safety, exports_external.object(open2).strict(), open2),
37290
+ computer_open: computerTool("computer_open", "Open an app window on the chat's selected computer so you can do the person's task in it: click, type, scroll and use shortcuts until the result is finished, rather than handing the steps back to them. Mode defaults to control, which does all of that and may bring the window to the front while it works. Use observe only when the person asks you just to look, or assist when they want to keep using that window themselves. Supply window_id for a particular target; otherwise use the sole or focused window. On a remote Linux VM or a Windows PC, act on screenshot coordinates; assist mode and native semantic controls are unavailable. Before opening, name the finished result the person should see; that is your done condition for the act loop. On a Mac a chat keeps up to three apps open at once, each in its own window: open the next app without closing the first, and pass the session_id each open returned to observe, act, zoom, status or close the app you mean (omitted, calls go to the app opened last). Arrange windows side by side only for such a two-app task or when the person asks. Close each app when you are done with it; arranged windows go back where they were. On a Mac the result names save_folder, this chat's output folder: put every file you make for the person there, whether an app saves it, a script exports it or a shell command writes it, never only in a temporary folder; the chat lists the files there." + parallelAgents + safety, exports_external.object(open2).strict(), open2),
37299
37291
  computer_observe: computerTool("computer_observe", "See the selected window: returns interactive accessible elements (ref, role, label, read-only values, x/y/w/h in image pixels, press/settable/disabled flags) and an observation_id valid for one act within 60 seconds, plus a screenshot when it adds something: always on a Windows PC or Linux VM and for a control session in front, otherwise when the elements name too few controls. image.omitted=unchanged means the window looks exactly like the image from same_as_observation, so its coordinates still apply. Every act already returns a fresh settled observation, so call this only at the start, after a person handoff, or when told to. Editable-field values are withheld from Accessibility output; read visible field content from the image, with include_image true when none was sent. elements=all adds static text for reading; none returns only the image. If no screenshot reaches you (some models read text only) and the elements are not enough, the session is fine: tell the person your current model cannot see the screen and to choose one that can see images.", exports_external.object(observe).strict(), observe),
37300
37292
  computer_act: computerTool("computer_act", "Prefer computer_script when the app supports scripting, and computer_run for multi-step forms, searches, scrolling and waits. Use this low-level tool for individual visual actions. Plan the whole stage before acting. Act on the selected window, then read the fresh observation returned with the receipt; it carries a screenshot only when one adds something; set screenshot true when you must see the result, such as typed text or layout, and false when its elements alone will confirm the step. Pass one action, or actions (up to 8) for a predictable sequence in one round trip: click a field, type, key enter; set_value several refs then press Save; key command+f, type, key enter. Several drags in a row draw several strokes in one call. On a Mac, right_click or a control click opens a context menu, show_menu opens a control's own menu, and click with hold_ms opens a tool's flyout; the open menu is then observed and pressed like a dialog. An app's own shortcuts go to it when no text field has the keyboard: a single letter (optionally with shift), or a control or option chord, in any app. In design, photo, video and music apps editing keys (enter, tab, escape, backspace, delete, arrows, home/end, with shift, option or command) go to what has the keyboard in the window. Any app can take real input, the real pointer and keyboard with the window in front (step path real_input): apps that draw their own interface, such as Blender, game engines and Qt or Tk apps, ignore other input and start with it, and after a step that changed nothing after_action.real_input says to repeat it once with input real. Work in such apps' interface rather than through computer_script unless the person asks for a script. Blender sends keys to the editor under the pointer, so move over the viewport or panel first, then press its own shortcuts (shift+a, g, r, s, tab, control or option chords) and type values; double_click a number field to type into it, and drag to orbit or move. To type where no text field is observed, click where it goes first: in the same batch, type and editing keys go to what that click gave the keyboard, so click, key command+a, type, key enter is one batch. A design app's value field (width, font size, opacity): click it, type the number, key enter, or use enter_value. Canvas text: select the Type tool, double_click the text, key command+a, type, then commit with the app's commit control or command+enter; until the app is editing text, typing is refused with text_edit_not_active, since letters would pick tools. When the observation lists nothing that has the keyboard, add target focused to type, key or enter_value to send to whatever has it; after a step with path raw_input_unverified, check the result with computer_zoom on that area. A set_value step with path value_not_applied left the control unchanged: use enter_value on the same ref instead. For edits of several steps, use focus and expect around the keys rather than observing between them: focus e12, expect {focused: e12}, key command+a, type 120, key enter, expect {value: {ref: e12, equals: 120}}. Steps run in order and each is validated live; the batch stops at the first failure and the receipt names the completed, failed and skipped steps. Prefer press/set_value on refs for forms. For app commands, prefer a menu action with a path from the menus computer_open listed: it runs at once without opening the menu or needing focus, works in assist mode, and the person still sees the cursor pick it. Use key with modifiers for editing and navigation shortcuts; quit, close, hide and app-switch chords are refused. Another Command shortcut, such as command+n, runs as the menu command when the app's menus list it, and otherwise goes to the app as a key. On a Mac, to move a table, text or image between apps, key command+c or command+x in one app and command+v in the other, each as its own step: the step path is copied, cut, copy_unconfirmed (nothing was selected) or pasted. A paste uses only what you copied in this chat, never the person's clipboard, which comes back when the chat's last app closes; you never see the clipboard's contents, so check the result in the observation. Moving between apps: copy and paste content (a table, a selection, a layer); to carry on with a file you saved in another app, such as an exported PNG made into a PDF in Preview, use computer_open with file instead. Use move to hover, click/double_click/triple_click (optionally with modifiers) to choose, drag to select or move, scroll (positive delta_y up, positive delta_x left); these need control mode and a screenshot. Use wait (ms) inside a batch for a load, not between round trips. To save or export on a Mac, open the app's Save or Export sheet, observe it, and send save_as with a path in the save_folder computer_open returned, unless the person named a folder. When an app needs a file through its own Open, Place, Insert or Attach command, open that panel, then send open_in_panel with the file's path rather than typing the path or asking the person; it waits briefly for a panel that is still opening. End the final reply by naming each file you delivered and its folder: the chat lists them for the person to open, show in Finder or attach. Coordinates are image pixels, never screen coordinates. A dispatched receipt is not proof of completion; verify in the returned observation and never replay an uncertain dispatch. Loop until done: act, read the returned observation, decide the next step, and repeat until it shows the done condition you named. When a step fails, is refused or changes nothing, change route rather than repeating: a ref instead of coordinates, coordinates instead of a ref, the app's own shortcut, a menu command, scroll or search, or input real. Try up to three different routes before you report what blocked you. Zoom instead of guessing at small text. Ask rather than guess when the request lacks something you need; otherwise ask only when missing information or a takeover blocks you. Before finishing, check every part of the request against the final observation, then state what it shows, or exactly what blocked you and what you tried.", actSchema, act),
37301
37293
  computer_zoom: computerTool("computer_zoom", "Look closer at part of the current observation: returns that region (x, y, width, height in the observation's image pixels) at full display resolution, to read small text or check detail before acting. Read only: keep using the same observation_id and the original image coordinates for act.", exports_external.object(zoom).strict(), zoom),
@@ -37688,6 +37680,11 @@ var browserResult = exports_external.object({
37688
37680
  ])),
37689
37681
  metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
37690
37682
  });
37683
+ async function refusalReason(response) {
37684
+ const body = await response.json().catch(() => null);
37685
+ const reason = body && typeof body === "object" && "error" in body && typeof body.error === "string" ? body.error.trim() : "";
37686
+ return reason ? `: ${reason.slice(0, 500)}` : "";
37687
+ }
37691
37688
  var openwork_context_v2_default = {
37692
37689
  id: "openwork.context",
37693
37690
  async setup(context) {
@@ -37707,11 +37704,8 @@ var openwork_context_v2_default = {
37707
37704
  return { content: [{ type: "text", text: text2 }] };
37708
37705
  };
37709
37706
  const browser = context.options.browser;
37710
- let parallelOn = false;
37711
37707
  const roots = new Map;
37712
37708
  const rootOf = async (sessionID, agent) => {
37713
- if (!parallelOn)
37714
- return;
37715
37709
  const known = roots.get(sessionID);
37716
37710
  if (known)
37717
37711
  return known;
@@ -37738,42 +37732,6 @@ var openwork_context_v2_default = {
37738
37732
  };
37739
37733
  const browserDefinitions = browser ? (await server()).tool : undefined;
37740
37734
  const computerDefinitions = browser ? (await server2()).tool : undefined;
37741
- const parallelDefinitions = browser ? (await server2({ parallel: true })).tool : undefined;
37742
- const gated = typeof context.tool.reload === "function" && context.session !== undefined;
37743
- const computerOffered = async (current) => {
37744
- if (!browser || !gated)
37745
- return true;
37746
- try {
37747
- const response = await fetch(new URL("/computer", browser.url), {
37748
- redirect: "error",
37749
- signal: AbortSignal.timeout(5000),
37750
- headers: { Authorization: `Bearer ${browser.token}` }
37751
- });
37752
- const body = response.ok ? await response.json() : undefined;
37753
- if (body && typeof body === "object" && "parallel" in body)
37754
- parallelOn = body.parallel === true;
37755
- return body && typeof body === "object" && "offered" in body && typeof body.offered === "boolean" ? body.offered : current;
37756
- } catch {
37757
- return current;
37758
- }
37759
- };
37760
- let computerOn = await computerOffered(true);
37761
- const questionsOffered = async (current) => {
37762
- if (!browser || !gated)
37763
- return false;
37764
- try {
37765
- const response = await fetch(new URL("/agent-questions", browser.url), {
37766
- redirect: "error",
37767
- signal: AbortSignal.timeout(5000),
37768
- headers: { Authorization: `Bearer ${browser.token}` }
37769
- });
37770
- const body = response.ok ? await response.json() : undefined;
37771
- return body && typeof body === "object" && "offered" in body && typeof body.offered === "boolean" ? body.offered : current;
37772
- } catch {
37773
- return current;
37774
- }
37775
- };
37776
- let questionsOn = await questionsOffered(false);
37777
37735
  const registration = await context.tool.transform((editor) => {
37778
37736
  for (const name of ["openwork_context", "openwork_query", "openwork_execute"]) {
37779
37737
  addProviderSafeTool(editor, {
@@ -37803,7 +37761,7 @@ var openwork_context_v2_default = {
37803
37761
  })
37804
37762
  });
37805
37763
  if (!response.ok)
37806
- throw new Error(`OpenWork ${name === "openwork_execute" ? "command" : "read"} failed (${response.status})`);
37764
+ throw new Error(`OpenWork ${name === "openwork_execute" ? "command" : "read"} failed (${response.status})${await refusalReason(response)}`);
37807
37765
  return { content: [{ type: "text", text: await response.text() }] };
37808
37766
  }
37809
37767
  });
@@ -37861,7 +37819,7 @@ var openwork_context_v2_default = {
37861
37819
  execute: (input3, call) => driveCall(name, input3, call, `${name} failed`)
37862
37820
  });
37863
37821
  }
37864
- if (questionsOn)
37822
+ if (browser)
37865
37823
  addProviderSafeTool(editor, {
37866
37824
  name: ASK_WITHOUT_WAITING,
37867
37825
  description: askDescription,
@@ -37869,7 +37827,7 @@ var openwork_context_v2_default = {
37869
37827
  options: { codemode: false },
37870
37828
  execute: (input3, call) => driveCall(ASK_WITHOUT_WAITING, input3, call, "Asking failed")
37871
37829
  });
37872
- const bridged = { ...browserDefinitions, ...computerOn ? parallelOn ? parallelDefinitions : computerDefinitions : undefined };
37830
+ const bridged = { ...browserDefinitions, ...computerDefinitions };
37873
37831
  if (browser)
37874
37832
  for (const [name, definition] of Object.entries(bridged)) {
37875
37833
  addProviderSafeTool(editor, {
@@ -37893,19 +37851,9 @@ var openwork_context_v2_default = {
37893
37851
  });
37894
37852
  }
37895
37853
  });
37896
- const promptHook = browser && gated && context.session ? await context.session.hook("prompt", async () => {
37897
- const parallel = parallelOn;
37898
- const [computer, questions] = await Promise.all([computerOffered(computerOn), questionsOffered(questionsOn)]);
37899
- if (computer === computerOn && questions === questionsOn && parallel === parallelOn)
37900
- return;
37901
- computerOn = computer;
37902
- questionsOn = questions;
37903
- await context.tool.reload?.();
37904
- }) : undefined;
37905
37854
  const stopSkills = await registerCloudSkillDiscovery(context);
37906
37855
  return async () => {
37907
37856
  await stopSkills();
37908
- await promptHook?.dispose();
37909
37857
  await registration.dispose();
37910
37858
  };
37911
37859
  }
@@ -20546,6 +20546,7 @@ var openworkAffordanceFailureCodeSchema = exports_external.enum([
20546
20546
  "conflict",
20547
20547
  "failed",
20548
20548
  "target_working",
20549
+ "target_waiting",
20549
20550
  "self_archive_while_working",
20550
20551
  "verification_failed",
20551
20552
  "archive_outcome_unknown"
@@ -20736,15 +20737,19 @@ var REMOTE_SESSION_CONTROL_RUNNER_CAPABILITY = "remote_session_control_v1";
20736
20737
  var REMOTE_SESSION_ONLY_RUNNER_CAPABILITY = "remote_session_only_v1";
20737
20738
  var REMOTE_SESSION_RECOVERY_RUNNER_CAPABILITY = "remote_session_recovery_v1";
20738
20739
  var REMOTE_SESSION_ANSWER_RUNNER_CAPABILITY = "remote_session_answer_v1";
20740
+ var REMOTE_SESSION_ACCESS_RUNNER_CAPABILITY = "remote_session_access_v1";
20741
+ var REMOTE_SESSION_CHOICE_RUNNER_CAPABILITY = "remote_session_choice_v1";
20739
20742
  var automationDesktopRunnerCapabilitySchema = exports_external.enum([
20740
20743
  AUTOMATION_MODEL_ATTENTION_CAPABILITY,
20741
20744
  REMOTE_SESSION_DESKTOP_RUNNER_CAPABILITY,
20742
20745
  REMOTE_SESSION_CONTROL_RUNNER_CAPABILITY,
20743
20746
  REMOTE_SESSION_ONLY_RUNNER_CAPABILITY,
20744
20747
  REMOTE_SESSION_RECOVERY_RUNNER_CAPABILITY,
20745
- REMOTE_SESSION_ANSWER_RUNNER_CAPABILITY
20748
+ REMOTE_SESSION_ANSWER_RUNNER_CAPABILITY,
20749
+ REMOTE_SESSION_ACCESS_RUNNER_CAPABILITY,
20750
+ REMOTE_SESSION_CHOICE_RUNNER_CAPABILITY
20746
20751
  ]);
20747
- var AUTOMATION_DESKTOP_RUNNER_CAPABILITY_LIMIT = 5;
20752
+ var AUTOMATION_DESKTOP_RUNNER_CAPABILITY_LIMIT = 8;
20748
20753
  var automationDesktopRunnerRegistrationSchema = exports_external.object({
20749
20754
  runnerId: idSchema.min(8),
20750
20755
  protocolVersion: exports_external.literal(1),
@@ -20787,13 +20792,20 @@ var automationRunnerWorkItemSchema = exports_external.union([
20787
20792
  workspaceId: automationWorkspaceIdSchema.optional()
20788
20793
  }),
20789
20794
  exports_external.object({ kind: exports_external.literal("remote_session_create"), commandId: idSchema }),
20790
- exports_external.object({ kind: exports_external.literal("remote_session_request"), requestId: idSchema })
20795
+ exports_external.object({ kind: exports_external.literal("remote_session_request"), requestId: idSchema }),
20796
+ exports_external.object({ kind: exports_external.literal("remote_session_attach"), commandId: idSchema })
20791
20797
  ]);
20792
20798
  var AUTOMATION_RUNNER_WORK_RUN_LIMIT = 20;
20793
20799
  var runnerEnginePolicySchema = exports_external.object({ upgrade: exports_external.boolean() });
20800
+ var remoteSessionAccessModeSchema = exports_external.enum(["off", "created", "all"]);
20801
+ var runnerSessionAccessPolicySchema = exports_external.object({
20802
+ ceiling: remoteSessionAccessModeSchema,
20803
+ optIn: exports_external.boolean().optional()
20804
+ });
20794
20805
  var automationRunnerWorkResponseSchema = exports_external.object({
20795
- items: exports_external.array(automationRunnerWorkItemSchema).max(AUTOMATION_RUNNER_WORK_RUN_LIMIT + 10),
20796
- enginePolicy: runnerEnginePolicySchema.optional()
20806
+ items: exports_external.array(automationRunnerWorkItemSchema).max(AUTOMATION_RUNNER_WORK_RUN_LIMIT + 15),
20807
+ enginePolicy: runnerEnginePolicySchema.optional(),
20808
+ sessionAccess: runnerSessionAccessPolicySchema.optional()
20797
20809
  });
20798
20810
  var DESKTOP_INVENTORY_WORKSPACE_LIMIT = 50;
20799
20811
  var DESKTOP_INVENTORY_MODEL_LIMIT = 200;
@@ -20828,6 +20840,28 @@ var desktopRunnerInventoryResponseSchema = exports_external.object({
20828
20840
  updatedAt: timestampSchema,
20829
20841
  enginePolicy: runnerEnginePolicySchema.optional()
20830
20842
  });
20843
+ var RUNNER_SESSION_REPORT_LIMIT = 100;
20844
+ var RUNNER_SESSION_TIMESTAMP_MAX = 253402300799999;
20845
+ var runnerReportedSessionSchema = exports_external.object({
20846
+ workspaceId: desktopInventoryIdSchema,
20847
+ sessionId: desktopInventoryIdSchema,
20848
+ title: exports_external.string().max(240),
20849
+ engine: exports_external.enum(["v1", "v2"]),
20850
+ updatedAt: timestampSchema.max(RUNNER_SESSION_TIMESTAMP_MAX),
20851
+ working: exports_external.boolean().optional()
20852
+ });
20853
+ var runnerSessionReportSchema = exports_external.object({
20854
+ access: remoteSessionAccessModeSchema,
20855
+ chosen: exports_external.boolean().optional(),
20856
+ sessions: exports_external.array(runnerReportedSessionSchema).max(RUNNER_SESSION_REPORT_LIMIT)
20857
+ }).refine((report) => report.access === "all" || report.sessions.length === 0, {
20858
+ message: "Sessions are reported only while access is all."
20859
+ });
20860
+ var runnerSessionReportResponseSchema = exports_external.object({
20861
+ ok: exports_external.literal(true),
20862
+ updatedAt: timestampSchema,
20863
+ sessionAccess: runnerSessionAccessPolicySchema
20864
+ });
20831
20865
  var remoteSessionCommandAssignmentSchema = exports_external.object({
20832
20866
  commandId: idSchema,
20833
20867
  kind: exports_external.literal("remote_session_create"),
@@ -20841,8 +20875,18 @@ var remoteSessionCommandAssignmentSchema = exports_external.object({
20841
20875
  expiresAt: timestampSchema,
20842
20876
  workspaceId: desktopInventoryIdSchema.nullable().optional()
20843
20877
  });
20878
+ var remoteSessionAttachAssignmentSchema = exports_external.object({
20879
+ commandId: idSchema,
20880
+ kind: exports_external.literal("remote_session_attach"),
20881
+ title: exports_external.string().trim().min(1).max(120),
20882
+ prompt: exports_external.null(),
20883
+ model: exports_external.null(),
20884
+ expiresAt: timestampSchema,
20885
+ workspaceId: desktopInventoryIdSchema,
20886
+ sessionId: desktopInventoryIdSchema
20887
+ });
20844
20888
  var remoteSessionCommandClaimResponseSchema = exports_external.object({
20845
- assignment: remoteSessionCommandAssignmentSchema
20889
+ assignment: exports_external.discriminatedUnion("kind", [remoteSessionCommandAssignmentSchema, remoteSessionAttachAssignmentSchema])
20846
20890
  });
20847
20891
  var remoteSessionCommandResultSummarySchema = exports_external.string().max(4096).optional();
20848
20892
  var remoteSessionCommandErrorSchema = exports_external.object({
@@ -20900,6 +20944,7 @@ var remoteSessionPendingSchema = exports_external.discriminatedUnion("kind", [
20900
20944
  command: exports_external.string().min(1).max(2000).optional()
20901
20945
  })
20902
20946
  ]);
20947
+ var REMOTE_SESSION_PENDING_ITEMS_MAX = 5;
20903
20948
  var remoteSessionAnswerInputSchema = exports_external.discriminatedUnion("kind", [
20904
20949
  exports_external.object({
20905
20950
  kind: exports_external.literal("question"),
@@ -20910,6 +20955,10 @@ var remoteSessionAnswerInputSchema = exports_external.discriminatedUnion("kind",
20910
20955
  kind: exports_external.literal("permission"),
20911
20956
  requestId: exports_external.string().trim().min(1).max(240),
20912
20957
  decision: exports_external.enum(["once", "reject"])
20958
+ }),
20959
+ exports_external.object({
20960
+ kind: exports_external.literal("dismiss"),
20961
+ requestId: exports_external.string().trim().min(1).max(240)
20913
20962
  })
20914
20963
  ]);
20915
20964
  var remoteSessionPendingSummarySchema = exports_external.discriminatedUnion("kind", [
@@ -21088,7 +21137,8 @@ var remoteSessionReadResultSchema = exports_external.object({
21088
21137
  from: exports_external.enum(["start", "end"]),
21089
21138
  messages: exports_external.array(remoteSessionTranscriptMessageSchema).max(REMOTE_SESSION_TRANSCRIPT_PAGE_MAX),
21090
21139
  nextCursor: exports_external.string().max(160).nullable(),
21091
- pending: remoteSessionPendingSchema.nullable().optional()
21140
+ pending: remoteSessionPendingSchema.nullable().optional(),
21141
+ pendingItems: exports_external.array(remoteSessionPendingSchema).max(REMOTE_SESSION_PENDING_ITEMS_MAX).optional()
21092
21142
  });
21093
21143
  var remoteSessionSendResultSchema = exports_external.object({
21094
21144
  messageId: exports_external.string().max(160).nullable(),
@@ -21264,6 +21314,7 @@ var automationProposalSchema = exports_external.object({
21264
21314
  instructions: exports_external.string().trim().min(1).max(1e5),
21265
21315
  schedule: automationScheduleSchema,
21266
21316
  model: automationModelSchema.optional(),
21317
+ executionTarget: automationExecutionTargetSchema.optional(),
21267
21318
  workspaceId: automationWorkspaceIdSchema.optional()
21268
21319
  });
21269
21320
  var updateAutomationSchema = exports_external.object({
@@ -21891,7 +21942,8 @@ function automationContribution() {
21891
21942
  argument("name", "string", true, "Short Automation name, at most 120 characters."),
21892
21943
  argument("instructions", "string", true, "Self-contained instructions the Automation runs on its schedule."),
21893
21944
  argument("schedule", "object", true, "Schedule with an IANA timezone: once {at}, daily {hour, minute}, weekly {daysOfWeek, hour, minute}, or interval {everyHours 1-24, optional daysOfWeek (0=Sunday), startHour, endHour} for every few hours on the hour, e.g. every 3 hours from 9 to 18, or calendar {edge start|end, offsetMinutes -120..120, rule {withExternalAttendees, titleIncludes}} to run around each meeting on the person's Google Calendar (Cloud only). Interval and calendar need their organization features."),
21894
- argument("model", "object", false, "Optional providerId and modelId. Omit to use the person's default.")
21945
+ argument("model", "object", false, "Optional providerId and modelId. Omit to use the person's default."),
21946
+ argument("executionTarget", "string", false, 'Optional suggested place to run: "cloud" (headless in OpenWork Cloud, runs while this computer is off) or "desktop" (this computer, only while OpenWork is open). The person can change it on the card. Omit to default to this desktop.')
21895
21947
  ],
21896
21948
  effects: noEffects
21897
21949
  })
@@ -22383,7 +22435,7 @@ async function readOpenworkAgentContext(engineMcpStatusClient, engineMcpStatusDi
22383
22435
  }
22384
22436
  };
22385
22437
  }
22386
- async function queryOpenworkAffordance(rawArgs) {
22438
+ async function queryOpenworkAffordance(rawArgs, context) {
22387
22439
  const request = openworkAffordanceRequestSchema2.parse(rawArgs);
22388
22440
  if (request.id === "session.search") {
22389
22441
  return affordanceResult(request.id, await searchOpenWorkSessions(request.args ?? {}), affordanceReadEffects);
@@ -22392,7 +22444,7 @@ async function queryOpenworkAffordance(rawArgs) {
22392
22444
  return affordanceResult(request.id, await readOpenWorkSession(request.args ?? {}), affordanceReadEffects);
22393
22445
  }
22394
22446
  if (request.id === "session.group.list") {
22395
- return affordanceResult(request.id, await runSessionGroupAffordance(request.id, request.args ?? {}, {}), affordanceReadEffects);
22447
+ return affordanceResult(request.id, await runSessionGroupAffordance(request.id, request.args ?? {}, context), affordanceReadEffects);
22396
22448
  }
22397
22449
  if (request.id === "session.question.list") {
22398
22450
  return affordanceResult(request.id, await listSessionQuestions(request.args ?? {}), affordanceReadEffects);
@@ -23432,7 +23484,7 @@ function proposeAutomation(rawArgs, context) {
23432
23484
  kind: "automation-proposal",
23433
23485
  proposal,
23434
23486
  created: false,
23435
- limitation: "This Desktop proposal creates Desktop placement and runs only while a signed-in desktop runner is connected. Use Web or Cloud Chat to create headless Cloud placement."
23487
+ limitation: "Nothing is created until the person reviews the card. The card offers the places this member can run it: Desktop runs only while a signed-in desktop is connected; Cloud runs headlessly in OpenWork Cloud when the organization and member have Cloud available."
23436
23488
  };
23437
23489
  }
23438
23490
  async function postJson(path, body, signal, gmailAttachment = false) {
@@ -23527,8 +23579,9 @@ var OpenWorkExtensionsPreview = async (factoryInput, _options, dependencies) =>
23527
23579
  openwork_query: {
23528
23580
  description: "Run a side-effect-free OpenWork affordance whose executor is OpenWork. Use the exact id and arguments from openwork_context. This reads backend or app state without navigation or window focus.",
23529
23581
  args: openworkAffordanceRequestSchema2.shape,
23530
- async execute(rawArgs) {
23531
- return JSON.stringify(await queryOpenworkAffordance(rawArgs), null, 2);
23582
+ async execute(rawArgs, context) {
23583
+ const mergedContext = { ...factoryContext, ...normalizeOpenCodeContext(context) };
23584
+ return JSON.stringify(await queryOpenworkAffordance(rawArgs, mergedContext), null, 2);
23532
23585
  }
23533
23586
  },
23534
23587
  openwork_execute: {
@@ -296,6 +296,7 @@ function automationContribution() {
296
296
  argument("instructions", "string", true, "Self-contained instructions the Automation runs on its schedule."),
297
297
  argument("schedule", "object", true, "Schedule with an IANA timezone: once {at}, daily {hour, minute}, weekly {daysOfWeek, hour, minute}, or interval {everyHours 1-24, optional daysOfWeek (0=Sunday), startHour, endHour} for every few hours on the hour, e.g. every 3 hours from 9 to 18, or calendar {edge start|end, offsetMinutes -120..120, rule {withExternalAttendees, titleIncludes}} to run around each meeting on the person's Google Calendar (Cloud only). Interval and calendar need their organization features."),
298
298
  argument("model", "object", false, "Optional providerId and modelId. Omit to use the person's default."),
299
+ argument("executionTarget", "string", false, "Optional suggested place to run: \"cloud\" (headless in OpenWork Cloud, runs while this computer is off) or \"desktop\" (this computer, only while OpenWork is open). The person can change it on the card. Omit to default to this desktop."),
299
300
  ],
300
301
  effects: noEffects,
301
302
  }),