shortcutxl 0.5.0 → 0.5.1

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.
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-10-29T08:42:29.315Z",
3
+ "generatedAt": "2026-10-30T19:28:04.498Z",
4
4
  "package": "shortcutxl",
5
5
  "build": {
6
6
  "builder": "github-actions",
7
7
  "repository": "lyfegame/shortcut",
8
8
  "sourceRef": "refs/heads/main",
9
- "sourceCommit": "4315cc64b08cee9268c81dc96c6cb239fd87b167",
9
+ "sourceCommit": "71ac7fa4e7e9dc9de36c6912549abccae75ba5c9",
10
10
  "workflowRef": "lyfegame/shortcut/.github/workflows/release-shortcut-cli-npm-package.yml@refs/heads/main",
11
- "runId": "40843694135",
11
+ "runId": "41115148744",
12
12
  "runnerOs": "Windows",
13
13
  "runnerImage": "win25-vs2026",
14
14
  "runnerImageVersion": "20261021.278.1"
@@ -47,7 +47,7 @@
47
47
  },
48
48
  {
49
49
  "path": "xll/python/Lib/site-packages.zip",
50
- "sha256": "1656d9ee83f085c90d6567a5e73fdd513152d33e47b61a2734949eb09b2f2732",
50
+ "sha256": "74eaa7eee977520e26f5113858de72b998854fa2a795d3de0373103b3c889370",
51
51
  "source": "Pure-Python packages of the embedded Python (pip, openpyxl, httpx and their dependencies), including pip's vendored distlib launcher executables, packed by xll/build-scripts/pack-site-packages.py",
52
52
  "version": "see embedded-python-requirements.lock and the pip version pinned in vendor-python.ps1",
53
53
  "builtBy": "shortcut",
@@ -511,7 +511,7 @@
511
511
  },
512
512
  {
513
513
  "path": "xll/python/Scripts/httpx.exe",
514
- "sha256": "c07f567a66a5482d556a760f0fc871fa2ee30704c69e5561bdce996be1a8fd84",
514
+ "sha256": "55bc74019d773c68b793fdf09ebc701fcf25269df2d6c3d92f05f31740688279",
515
515
  "source": "httpx console launcher installed into embedded Python",
516
516
  "version": "see packaged httpx distribution",
517
517
  "builtBy": "third-party",
@@ -519,7 +519,7 @@
519
519
  },
520
520
  {
521
521
  "path": "xll/python/Scripts/idna.exe",
522
- "sha256": "5cc00c2b7f84b493ada226db14bfca1b51cb5de82c4e7d79fb278d529170fede",
522
+ "sha256": "28bfbdb222ef12155f7fbd42986bd2e964969a9f490912b4d85398621abd820f",
523
523
  "source": "Python package console launcher installed into embedded Python",
524
524
  "version": "see owning Python package metadata in site-packages",
525
525
  "builtBy": "third-party",
@@ -527,7 +527,7 @@
527
527
  },
528
528
  {
529
529
  "path": "xll/python/Scripts/pip.exe",
530
- "sha256": "c74f13d8dd78bee6844a9324ccd98f5572436d85127db0204d7965d45cb483af",
530
+ "sha256": "d2dcc715b624c17d43a2a71f87cfeaf91d86632be2c405f21b4537227bd07d94",
531
531
  "source": "pip console launcher installed into embedded Python",
532
532
  "version": "see packaged pip distribution",
533
533
  "builtBy": "third-party",
@@ -535,7 +535,7 @@
535
535
  },
536
536
  {
537
537
  "path": "xll/python/Scripts/pip3.13.exe",
538
- "sha256": "c74f13d8dd78bee6844a9324ccd98f5572436d85127db0204d7965d45cb483af",
538
+ "sha256": "d2dcc715b624c17d43a2a71f87cfeaf91d86632be2c405f21b4537227bd07d94",
539
539
  "source": "pip console launcher installed into embedded Python",
540
540
  "version": "see packaged pip distribution",
541
541
  "builtBy": "third-party",
@@ -543,7 +543,7 @@
543
543
  },
544
544
  {
545
545
  "path": "xll/python/Scripts/pip3.exe",
546
- "sha256": "c74f13d8dd78bee6844a9324ccd98f5572436d85127db0204d7965d45cb483af",
546
+ "sha256": "d2dcc715b624c17d43a2a71f87cfeaf91d86632be2c405f21b4537227bd07d94",
547
547
  "source": "pip console launcher installed into embedded Python",
548
548
  "version": "see packaged pip distribution",
549
549
  "builtBy": "third-party",
@@ -551,7 +551,7 @@
551
551
  },
552
552
  {
553
553
  "path": "xll/python/Scripts/pywin32_postinstall.exe",
554
- "sha256": "951bf1d7e0974960d89ca5a620bbf328839ea3a43926658b0a750e9fe2d3b36c",
554
+ "sha256": "37c69c6f08cb3a780cd84e56f0e4330944354cb3a7828f454f03f4e12ad1786d",
555
555
  "source": "Python package console launcher installed into embedded Python",
556
556
  "version": "see owning Python package metadata in site-packages",
557
557
  "builtBy": "third-party",
@@ -559,7 +559,7 @@
559
559
  },
560
560
  {
561
561
  "path": "xll/python/Scripts/pywin32_testall.exe",
562
- "sha256": "2780a4cc076ae4cb566ced8c0f552d09de0c97e62fdf99c679eb9adc010d6480",
562
+ "sha256": "93445bebefbab64a4e3ee743028119b630ef8359e0e49c0e1274ad642a0033e3",
563
563
  "source": "Python package console launcher installed into embedded Python",
564
564
  "version": "see owning Python package metadata in site-packages",
565
565
  "builtBy": "third-party",
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.1]
4
+
5
+ - Restore `--skip-spreadsheet-permissions` as a compatibility alias for `--skip-office-permissions` so older RPC connectors can start. Both names grant the same Office access and auto-approval scope.
6
+
3
7
  ## [0.4.1]
4
8
 
5
9
  - Prevent unsupported thinking Off for Claude Opus 5.5 and repair saved Off selections to Medium.
@@ -317,18 +317,18 @@ shortcut config # Enable/disable package resources
317
317
 
318
318
  ### Permission Options
319
319
 
320
- Shortcut separates runtime permissions, Office operation approvals, and per-chat Office application access. The flags below do not grant application access.
320
+ Shortcut separates runtime permissions, Office operation approvals, and per-chat Office application access.
321
321
 
322
322
  | Option | Description |
323
323
  |--------|-------------|
324
324
  | `--skip-runtime-permissions` | Bypass runtime filesystem and shell approval checks for this session |
325
- | `--skip-office-permissions` | Auto-approve Excel, Word, and PowerPoint operations; does not grant application access |
325
+ | `--skip-office-permissions` | Grant initial Excel, Word and PowerPoint access and auto-approve Office operations for the initial chat |
326
326
 
327
- `--skip-runtime-permissions` affects runtime-owned filesystem and shell checks; it does not change Office approvals. `--skip-office-permissions` affects Office operation approvals only; it does not bypass runtime filesystem or shell checks or the separate application-consent gate.
327
+ In CLI 0.5.0, `--skip-office-permissions` is explicit launch-time consent for unattended Office work, including fresh print (`-p`), JSON and RPC runs. It does not bypass runtime filesystem or shell checks, read-only modes, or later application access revocation. Only use it when that scope is authorized.
328
328
 
329
- Native Office discovery and connection require interactive consent for each application in the current chat. Use `/office excel allow`, `/office word allow`, or `/office powerpoint allow` in the terminal; replace `allow` with `revoke` to withdraw access. The desktop app exposes equivalent application toggles in chat settings.
329
+ Without that flag, native Office tools require application access. Interactive chats can obtain initial access when an Office tool is used; explicit revocation remains authoritative. RPC connectors can use `set_office_access` for an authorized per-application grant and handle operation approvals separately. See the [RPC guide](docs/rpc.md#cli-launch-flags-and-older-connectors) for narrower access and the `--skip-spreadsheet-permissions` compatibility alias restored in 0.5.1. Fresh non-interactive runs without a grant cannot obtain access by silently retrying.
330
330
 
331
- Fresh print (`-p`) and JSON-mode runs cannot obtain this interactive consent, even with both bypass flags. Child agents sharing an already-granted live chat inherit its application grant; this does not authorize a new headless chat or persist grants across sessions.
331
+ Starting or switching RPC sessions resets application grants; the connector must reapply its authorized grants. Closing documents or quitting Office still requires explicit approval.
332
332
 
333
333
  In an interactive session, use `/permissions skip-runtime-permissions` to inspect or change the runtime bypass setting.
334
334
 
@@ -59,6 +59,38 @@ absolute `dist/cli.js` entrypoint, or a correctly configured Windows shell launc
59
59
  Direct Node launch does **not** execute npm's repaired `.cmd`/`.ps1` wrappers;
60
60
  see [Windows certificate trust](#windows-certificate-trust).
61
61
 
62
+ ### CLI launch flags and older connectors
63
+
64
+ CLI 0.5.1 accepts `--skip-spreadsheet-permissions` as a compatibility alias for
65
+ `--skip-office-permissions`; both names grant the same Office permission scope.
66
+ Prefer the canonical `--skip-office-permissions` name in new integrations.
67
+ CLI 0.5.0 accepts only the canonical name. Older clients silently ignored unsupported
68
+ options; current clients exit with an error. If stderr reports
69
+ `Unknown option --skip-spreadsheet-permissions`, the child has failed during
70
+ argument parsing, before RPC readiness, identity verification or Excel access.
71
+ On 0.5.0, correct the launch arguments or update to 0.5.1. Repeating login or
72
+ reinstalling 0.5.0 will not correct its arguments.
73
+
74
+ Have the connector owner inspect the arguments passed to the actual child and
75
+ confirm the intended permission scope. If the user or organization has explicitly authorized
76
+ unattended Office access and auto-approval, replace it with
77
+ `--skip-office-permissions`. This grants initial Excel, Word and PowerPoint
78
+ access and auto-approves Office operations for the initial chat; it is broader than
79
+ an Excel-only grant. Starting or switching RPC sessions resets application
80
+ grants; the connector must reapply its authorized per-application grants. Closing
81
+ workbooks, documents or presentations, or quitting Office, still requires explicit
82
+ approval. It does not bypass runtime filesystem or shell checks,
83
+ read-only modes, or later Office access revocation. Do not add
84
+ `--skip-runtime-permissions` as a connection workaround.
85
+
86
+ If the connector must enforce narrower permissions, omit the bypass flag and
87
+ use the per-application RPC access controls and approval interactions below.
88
+ Do not silently expand the connector's approved permission policy to make it
89
+ start. Match the installed CLI version and `shortcutxl/rpc` client, restart the
90
+ worker, wait for `ready`, and verify a harmless prompt followed by a read-only
91
+ Excel operation. Passing `--version` or receiving `ready` alone is not an
92
+ end-to-end connection test.
93
+
62
94
  ### Node.js client
63
95
 
64
96
  Install `shortcutxl` in the connector project and align its version with the CLI
@@ -204,7 +236,10 @@ Windows certificates does not configure a proxy or fix DNS/firewall rules.
204
236
  ### Capture the failing process, not just terminal health
205
237
 
206
238
  Record the worker's resolved Node executable and version, CLI entrypoint and
207
- version, OS account, agent directory, deployment and process start time. Inspect
239
+ version, OS account, agent directory, deployment and process start time. Capture
240
+ stderr and the exit code even when the child exits before `ready`. Argument
241
+ parsing errors occur before the CLI's operational logger is initialized, so
242
+ these failures may appear only in the connector's local diagnostics, not Orb. Inspect
208
243
  the `ready` or `get_snapshot` response's `auth` and `model` fields. These checks
209
244
  describe the local process; they do not prove identity or network access.
210
245
 
@@ -221,6 +256,7 @@ before assigning the failure to either Shortcut or the customer's infrastructure
221
256
 
222
257
  | Evidence | Next step |
223
258
  | --- | --- |
259
+ | `Unknown option --skip-spreadsheet-permissions` | Correct the connector launch flags as described above; re-login will not fix argument parsing. |
224
260
  | `Invalid RPC command envelope` | Correct the version-2 envelope and response/event parsing. Re-login will not fix it. |
225
261
  | Certificate-chain error | Check the worker's Node trust configuration and approved company CA. |
226
262
  | DNS, timeout or connection error | Check that worker's network/proxy route and service availability. |
package/dist/cli.js CHANGED
@@ -19091,7 +19091,7 @@ print(json.dumps([
19091
19091
  }
19092
19092
  for wb in app.Workbooks
19093
19093
  ]))
19094
- `.trim();n(wCr,"describeUnavailableExcel");kMo={edit_mode:"ShortcutXL is connected to Excel, but Excel is in cell edit mode, so it cannot list or change workbooks right now. Ask the user to finish the cell edit in Excel (press Enter or Esc), then try again.",busy:"ShortcutXL is connected to Excel, but Excel is busy and did not list its workbooks: it may still be running another request, or have a dialog open. If a dialog is open in Excel, ask the user to close it, then try again."};n(PMo,"formatWorkbookScopeReminder");n(DMo,"postWorkbookExecCode");n(OMo,"parseWorkbookInventory");n(NMo,"fetchWorkbookConnectionStateOnce");n(ige,"fetchWorkbookConnectionStateForHost");n(tKt,"fetchWorkbookConnectionState");n(kCr,"emitInventoryDiagnostic");n(PCr,"buildWorkbookPromptContext")});import{spawn as FMo}from"node:child_process";import{homedir as MMo}from"node:os";import{setTimeout as LMo}from"node:timers/promises";function BMo(t,e){return new Promise((r,o)=>{let{ELECTRON_RUN_AS_NODE:s,...l}=process.env,d=FMo(t,["/x","/t",e],{detached:!0,stdio:"ignore",cwd:MMo(),env:l});d.once("error",o),d.once("spawn",()=>{d.unref(),d.pid?r(d.pid):o(new Error("Excel started without a process identity."))})})}async function DCr(t={}){let{signal:e}=t;if(e?.throwIfAborted(),(t.platform??process.platform)!=="win32")throw new Error("Starting a separate native Excel process requires Windows and desktop Excel.");let r=await(t.findExecutable??(()=>qRt(e)))();if(!r)throw new Error("Desktop Excel was not found. Install Excel before starting a new process.");let o=await(t.ensureTemplate??(()=>zRt(e)))();if(!o)throw new Error("Shortcut could not prepare a blank Excel workbook. Repair the ShortcutXL bridge installation and retry.");let s=await(t.listProcessIds??(()=>TEe(e)))();e?.throwIfAborted();let l=await(t.startProcess??BMo)(r,o);if(!Number.isSafeInteger(l)||l<=0||s.includes(l))throw new Error("Excel did not return a distinct new process. The session binding was not changed.");let d=t.now??Date.now,f=d()+(t.timeoutMs??6e4),_=t.sleep??(x=>LMo(x,void 0,{signal:e})),y=t.listHosts??(()=>p0({timeoutMs:1e3})),A=t.connectProcess??(x=>ewn(x,{signal:e}));try{for(;d()<f;){e?.throwIfAborted();let x=(await y()).find(O=>O.pid===l);e?.throwIfAborted();let E=await A(l);if(E==="other-installation")throw new Error("Another Shortcut installation owns its bridge. Save your work and close that Excel window, then retry this task to use this installation.");if(e?.throwIfAborted(),E==="ready"&&x&&!x.error&&!x.busy){let O,N=await ige(x,{signal:e,observer:n(F=>{O=F.errorCode},"observer"),waitForReadyMs:Math.max(0,Math.min(1e4,f-d()))});if(O==="excel_host_auth_rejected"||O==="excel_invalid_response")throw new Error("The new Excel bridge rejected its connection identity or returned an invalid inventory. Inspect that process before retrying.");if(N.connected&&!N.unavailable&&N.workbooks.length>0)return x}await _(500)}throw new Error("Its ShortcutXL bridge did not become ready. Check that window for a dialog or disabled add-in.")}catch(x){throw new Error(`Excel process ${l} was started but not bound. ${x instanceof Error?x.message:String(x)} The previous session binding was retained. The new process was left open; inspect it before retrying, rather than creating another process.`,{cause:x})}}var OCr=J(()=>{"use strict";HPe();EEe();uJ();n(BMo,"spawnSeparateExcel");n(DCr,"startNewExcelProcess")});import{stat as UMo}from"node:fs/promises";import{win32 as WMo}from"node:path";var Gnt,NCr=J(()=>{"use strict";HPe();r4();rje();EEe();OCr();uJ();Gnt=class{static{n(this,"ExcelTargetController")}selectedHost;selectionWasLost=!1;selector;resolving;listeners=new Set;bindingGeneration=0;startingProcess=!1;observer;setObserver(e){this.observer=e}setSelector(e){this.selector=e}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}async getAvailability(){let e=await p0();return this.reconcileSelection(e),{hosts:e.map(({hostId:r,pid:o,busy:s})=>({hostId:r,pid:o,...s?{busy:s}:{}})),...this.selectedHost?{selectedHostId:this.selectedHost.hostId}:{},selectionWasLost:this.selectionWasLost}}async listTargets(){let e=await p0();return this.reconcileSelection(e),{options:await this.buildOptions(e),...this.selectedHost?{selectedHostId:this.selectedHost.hostId}:{},selectionWasLost:this.selectionWasLost}}async selectTarget(e){let r=(await p0()).find(o=>o.hostId===e);if(!r)throw new hm("excel_host_unavailable",`That Excel process is no longer available. ${n4}`);return this.bind(r)}async startNewProcess(e={}){if(this.startingProcess)throw new Error("This session is already starting a new Excel process. Wait for that result before retrying.");this.startingProcess=!0;let r=this.bindingGeneration;try{let o=await DCr(e);if(e.signal?.aborted||r!==this.bindingGeneration)throw new Error(`Excel process ${o.pid} was started but not bound because the operation was cancelled or the session selection changed. Your current selection was retained. Inspect that process before retrying.`);return this.bind(o)}finally{this.startingProcess=!1}}resolveTargetOpeningExcel(e,r,o){return o?.document||o?.hostId?this.resolveExecutionTarget(o,e):rwn(()=>this.resolveExecutionTarget(void 0,e),{signal:e},r)}async resolveExecutionTarget(e={},r,o=!0){r?.throwIfAborted();let s=await p0();if(r?.throwIfAborted(),this.reconcileSelection(s),this.selectionWasLost&&!e.document&&!e.hostId)throw new hm("excel_document_selection_required",`The previous Excel connection was lost. ${n4}`);let l=e.hostId??(e.document?void 0:this.selectedHost?.hostId),d=l?s.filter(O=>O.hostId===l):s;if(l&&!e.hostId&&d.length===0)throw new hm("excel_document_selection_required","The previously selected Excel process is not responding or has closed. Retry when it is ready, select the intended process with /excel or the desktop Excel controls. Shortcut will not redirect this operation to another workbook.",{host_count:s.length,selection_state:"lost"});if(d.length===0&&(!e.document||e.hostId||!o))throw new hm("excel_host_unavailable","The requested Excel process is not available. Open the intended workbook and retry.",{host_count:s.length,selection_state:this.selectionWasLost?"lost":"unbound"});let f=n(O=>O.replaceAll("\\","/").toLowerCase(),"normalize"),_=e.document?f(e.document):void 0,y=[],A=!1,x=!1,E=await Promise.all(d.map(O=>{if(O.busy)return;let N=!this.selectedHost||!this.sameBinding(O,this.selectedHost)||!o;return ige(O,{signal:r,waitForReadyMs:N?12e3:0})}));r?.throwIfAborted();for(let[O,N]of d.entries()){let F=E[O];if(!F){x=d.length===1,A=!0;continue}if(!F.connected||F.unavailable){x=d.length===1&&F.connected&&F.unavailable==="busy",A=!0;continue}for(let z of F.workbooks){let le=F.workbookSheets?.find(xe=>xe.workbook===z)?.fullName??z;(!_||f(z)===_||f(le)===_)&&y.push({host:N,document:le})}}if(A)throw new hm("excel_document_unavailable",x?`Excel is busy and could not verify the intended workbook. Wait or close its dialog, then try again.${SEe()}`:"Excel could not verify the intended workbook because a process is busy or disconnected. Finish any cell edit or dialog, then retry with the workbook and Excel process identity.");if(y.length===0&&e.document&&!e.hostId&&o){let O=await twn(e.document,s.map(N=>N.pid),{signal:r});if(O==="connected")return this.resolveExecutionTarget(e,r,!1);if(O==="ambiguous")throw new hm("excel_document_selection_required","More than one unconnected Excel workbook matches. Ask for the intended workbook\u2019s full path; no add-in was loaded and no workbook was edited.");if(O==="other-installation")throw new hm("excel_host_unavailable","The intended Excel workbook is open, but another Shortcut installation owns its add-in connection. Save your work and close Excel, then retry this task to use this installation; no running add-in was replaced.");if(O==="unavailable")throw new hm("excel_document_unavailable","Excel could not verify or connect the intended workbook. Finish any cell edit or dialog, check that the ShortcutXL add-in is enabled, then retry the same workbook; no workbook edit was attempted.")}if(y.length===1){let O=y[0];return{...this.bind(O.host),document:O.document}}if(y.length===0&&e.document&&process.platform==="win32"&&WMo.isAbsolute(e.document)&&/\.(xlsx|xlsm|xlsb|xls)$/i.test(e.document)&&(await UMo(e.document).catch(()=>{}))?.isFile()){let O=d.find(N=>N.hostId===this.selectedHost?.hostId)??(d.length===1?d[0]:void 0);if(O)return{...this.bind(O),documentToOpen:e.document}}if(y.length===0&&!_&&d.length===1)return this.bind(d[0]);throw new hm(y.length===0?"excel_document_unavailable":"excel_document_selection_required",y.length===0?`The requested workbook ${JSON.stringify(e.document)} is not open. Open that workbook or ask the user to confirm its identity; do not substitute another workbook.`:`More than one workbook matches. Ask the user which workbook to use, then supply its full path and, when needed, hostId. Available matches: ${y.map(O=>`${O.document} (hostId: ${O.host.hostId})`).join(", ")}`)}async resolveTarget(){return this.resolving||(this.resolving=this.resolveTargetOnce().finally(()=>{this.resolving=void 0})),this.resolving}async resolveTargetOnce(){if(this.invalidateExitedProcess(),this.selectedHost){let l=this.selectedHost,d=WIn().find(f=>f.hostId===l.hostId||f.url===l.url);if(!d||this.sameBinding(d,l))return l}let e=await p0();if(this.reconcileSelection(e),this.selectedHost)return this.selectedHost;if(e.length===0)throw new hm("excel_host_unavailable","ShortcutXL is not connected to Excel. Open Excel and try again. Check that the ShortcutXL add-in is enabled. If Excel shows a signature or policy warning, preserve it for your IT team rather than repeatedly approving it.",{host_count:0,selection_state:this.selectionWasLost?"lost":"unbound"});if(e.length===1&&!this.selectionWasLost){let l=e[0];if(l)return this.bind(l)}if(!this.selector)throw new hm("excel_host_selection_required",this.selectionWasLost?`The selected Excel process disconnected. Choose an Excel process to continue. ${n4}`:"Multiple Excel processes are connected. Headless mode requires exactly one Excel process. Close the others and retry.",{host_count:e.length,selection_state:this.selectionWasLost?"lost":"unbound"});let r=await this.buildOptions(e),o=await this.selector(r),s=e.find(l=>l.hostId===o);if(!s)throw new hm("excel_cancelled","No Excel process was selected.");return this.bind(s)}invalidateExitedProcess(){let e=this.selectedHost;e&&!oje(e.pid)&&e.onUnavailable("unavailable")}reconcileSelection(e){this.invalidateExitedProcess();let r=this.selectedHost;if(!r)return;let o=e.find(s=>!s.busy&&(s.hostId===r.hostId||s.url===r.url));if(o&&!this.sameBinding(o,r)){let s=[];o.hostId!==r.hostId&&s.push("host_id"),o.pid!==r.pid&&s.push("pid"),o.port!==r.port&&s.push("port"),o.token!==r.token&&s.push("credential"),this.observe({event:"excel_binding_invalidated",bindingGeneration:this.bindingGeneration,reason:"identity_changed",changedFields:s}),r.onUnavailable("identity_changed")}}sameBinding(e,r){return e.hostId===r.hostId&&e.pid===r.pid&&e.port===r.port&&e.token===r.token}async buildOptions(e){return Promise.all(e.map(async r=>{let o=r.busy?{connected:!0,unavailable:"busy",workbooks:[]}:await ige(r),s=o.unavailable?wCr(o.unavailable):o.workbooks.length>0?o.workbooks.join(", "):"No open workbooks";return{hostId:r.hostId,pid:r.pid,label:`${s} (Excel PID ${r.pid})`}}))}bind(e){let r=++this.bindingGeneration,o=this.selectionWasLost,s={...e,onUnavailable:n((l="unavailable")=>{let d=l==="identity_changed"||l==="transport_failed"||l==="auth_rejected"?l:"unavailable";if(this.selectedHost!==s){this.selectedHost&&r!==this.bindingGeneration&&this.observe({event:"excel_previous_binding_failure_ignored",bindingGeneration:r,currentBindingGeneration:this.bindingGeneration,sameHostId:this.selectedHost.hostId===s.hostId,reason:d});return}this.selectedHost=void 0,this.selectionWasLost=!0,d!=="identity_changed"&&this.observe({event:"excel_binding_invalidated",bindingGeneration:r,reason:d}),this.notify()},"onUnavailable")};return this.selectedHost=s,this.selectionWasLost=!1,this.observe({event:"excel_target_selected",bindingGeneration:r,recovered:o}),this.notify(),s}observe(e){try{this.observer?.(e)}catch{}}notify(){for(let e of this.listeners)e()}}});import{spawn as VMo}from"child_process";import{existsSync as jMo}from"fs";import{join as $Mo}from"path";function GPe(t){return t==="word"?"Word":"PowerPoint"}function GMo(t,e=process.env){let r=HMo[t],o=[e.ProgramW6432,e.ProgramFiles,e["ProgramFiles(x86)"]].filter(l=>typeof l=="string"&&l.length>0),s=[["Microsoft Office","root","Office16"],["Microsoft Office","Office16"],["Microsoft Office","Office15"],["Microsoft Office","Office14"]];for(let l of o)for(let d of s){let f=$Mo(l,...d,r);if(jMo(f))return f}return r}function QMo(t,e=process.platform){return e!=="win32"?Promise.reject(new Error(`${GPe(t)} COM execution is available only on Windows.`)):new Promise((r,o)=>{let s=VMo(GMo(t),[],{detached:!0,stdio:"ignore",windowsHide:!1});s.once("spawn",()=>{s.unref(),r()}),s.once("error",l=>{o(new Error(`Could not start ${GPe(t)}: ${l.message}`,{cause:l}))})})}function qMo(t){return new Promise(e=>setTimeout(e,t))}var HMo,QPe,FCr=J(()=>{"use strict";uJ();HMo={word:"WINWORD.EXE",powerpoint:"POWERPNT.EXE"};n(GPe,"applicationLabel");n(GMo,"resolveOfficeExecutable");n(QMo,"launchOfficeApplication");n(qMo,"delay");QPe=class{constructor(e,r={}){this.application=e;this.options=r;this.listHosts=r.listHosts??(o=>sje(o)),this.launchApplication=r.launchApplication??(o=>QMo(o,r.platform))}application;options;static{n(this,"OfficeTargetController")}selectedHost;selectedIdentity;resolving;listHosts;launchApplication;async resolveTarget(e){if(e?.hostId){this.resolving&&await this.resolving;let o=(await this.listHosts(this.application)).find(s=>s.hostId===e.hostId);if(!o)throw new Error(`The selected ${GPe(this.application)} process is unavailable.`);if(o.error)throw new Error(`${GPe(this.application)} bridge failed to initialize: ${o.error}`);return this.bind(o)}return this.resolving||(this.resolving=this.resolveTargetOnce().finally(()=>{this.resolving=void 0})),this.resolving}async resolveTargetOnce(){if(this.selectedHost)return this.selectedHost;let e=GPe(this.application),r=await this.listHosts(this.application);if(this.selectedIdentity){let s=r.find(l=>l.hostId===this.selectedIdentity?.hostId&&l.pid===this.selectedIdentity?.pid);if(!s)throw new Error(`The selected ${e} process disconnected. Restore its ShortcutXL connection and retry in this chat. No other process was selected; check whether the previous operation completed before retrying it.`);if(s.error)throw new Error(`${e} bridge failed to initialize: ${s.error}`);return this.bind(s)}if(r.length===0&&(await this.launchApplication(this.application),r=await this.waitForHost()),r.length===0)throw new Error(`${e} started but the ShortcutXL bridge did not connect. Restart ${e} after repairing the ShortcutXL installation.`);if(r.length>1)throw new Error(`Multiple ${e} processes are connected (${r.map(s=>s.hostId).join(", ")}). Select the intended target.hostId before running code; keep unrelated documents open.`);let o=r[0];if(!o)throw new Error(`${e} bridge discovery failed.`);if(o.error)throw new Error(`${e} bridge failed to initialize: ${o.error}`);return this.bind(o)}async waitForHost(){let e=this.options.launchTimeoutMs??3e4,r=this.options.pollIntervalMs??250,o=Date.now()+e;do{let s=await this.listHosts(this.application);if(s.length>0)return s;await qMo(r)}while(Date.now()<o);return[]}bind(e){let r={...e,onUnavailable:n(()=>{this.selectedHost===r&&(this.selectedHost=void 0)},"onUnavailable")};return this.selectedHost=r,this.selectedIdentity={hostId:e.hostId,pid:e.pid},r}}});function nKt(t){let e={messages:[],fileArgs:[]};for(let r=0;r<t.length;r++){let o=t[r],s=n(()=>{if(r+1>=t.length)throw new Zv(`${o} requires a value.`);return t[++r]},"value");if(o==="--help"||o==="-h")e.help=!0;else if(o==="--version"||o==="-v")e.version=!0;else if(o==="--mode"){let l=s();if(l!=="text"&&l!=="json"&&l!=="rpc")throw new Zv(`Invalid --mode "${l}". Use text, json, or rpc.`);e.mode=l}else if(o==="--continue"||o==="-c")e.continue=!0;else if(o==="--resume"||o==="-r")e.resume=!0;else if(o==="--provider")e.provider=s();else if(o==="--model")e.model=s();else if(o==="--api-key")e.apiKey=s();else if(o==="--system-prompt")e.systemPrompt=s();else if(o==="--append-system-prompt")e.appendSystemPrompt=s();else if(o==="--no-session")e.noSession=!0;else if(o==="--session")e.session=s();else if(o==="--session-dir")e.sessionDir=s();else if(o==="--thinking"){let l=s();H3(l)?e.thinking=l:console.error(sr.yellow(`Warning: Invalid thinking level "${l}". Valid values: ${tde.join(", ")}`))}else if(o==="--print"||o==="-p")e.print=!0;else if(o==="--export")e.export=s();else if(o==="--extension"||o==="-e")e.extensions=e.extensions??[],e.extensions.push(s());else if(o==="--no-extensions"||o==="-ne")e.noExtensions=!0;else if(o==="--skill")e.skills=e.skills??[],e.skills.push(s());else if(o==="--prompt-template")e.promptTemplates=e.promptTemplates??[],e.promptTemplates.push(s());else if(o==="--theme")e.themes=e.themes??[],e.themes.push(s());else if(o==="--no-skills"||o==="-ns")e.noSkills=!0;else if(o==="--no-prompt-templates"||o==="-np")e.noPromptTemplates=!0;else if(o==="--no-themes")e.noThemes=!0;else if(o==="--list-models")r+1<t.length&&!t[r+1].startsWith("-")&&!t[r+1].startsWith("@")?e.listModels=s():e.listModels=!0;else if(o==="--verbose")e.verbose=!0;else if(o==="--dev-mode")e.devMode=!0;else if(o==="--agent-mode")e.agentMode=s();else if(o==="--offline")e.offline=!0;else if(o==="--max-turns"){let l=parseInt(s(),10);!Number.isNaN(l)&&l>=0&&(e.maxTurns=l)}else if(o==="--max-tool-uses"){let l=parseInt(s(),10);!Number.isNaN(l)&&l>=0&&(e.maxToolUses=l)}else if(o==="--max-tokens"){let l=parseInt(s(),10);!Number.isNaN(l)&&l>=0&&(e.maxTokens=l)}else if(o==="--speed"){let l=t[++r];if(l!=="standard"&&l!=="fast"&&l!=="ultrafast"&&l!=="flex")throw new Zv("Invalid --speed. Use standard, fast, ultrafast, or flex.");e.speed=l}else if(o==="--require-task-outcome")e.requireTaskOutcome=!0;else if(o==="--originating-mode"){let l=t[++r];if(l!=="plan")throw new Zv("Invalid --originating-mode. Use plan.");e.originatingMode=l}else if(o==="--platform-api")e.platformApi=!0;else if(o==="--output-workbook")e.outputWorkbook=s();else if(o==="--artifact-dir")e.artifactDir=s();else if(o==="--event-log-path")e.eventLogPath=s();else if(o==="--request-id")e.requestId=s();else if(o==="--file-id")e.fileId=s();else if(o==="--assume-installed")e.assumeInstalled=!0;else if(o==="--host-preflight-result")e.hostPreflightResult=s();else if(o==="--disable-memory")e.disableMemory=!0;else if(o==="--runtime-model-overlay-file")e.runtimeModelOverlayFile=s();else if(o==="--prefer-current-model-for-subagents")e.preferCurrentModelForSubagents=!0;else if(o==="--subagent-model"){let l=s();if(!Fyr(l))throw new Zv(`Invalid --subagent-model "${l}". Valid values: ${Nzt.join(", ")}`);e.subagentModel=l}else if(o==="--watch")r+1<t.length&&!t[r+1].startsWith("-")?e.watch=s():e.watch="";else if(o==="--skip-runtime-permissions")e.dangerouslySkipRuntimePermissions=!0;else if(o==="--skip-office-permissions")e.dangerouslySkipOfficePermissions=!0;else if(o.startsWith("@"))e.fileArgs.push(o.slice(1));else{if(o.startsWith("-"))throw new Zv(`Unknown option ${o}. Use "${Si} --help" to see the options.`);e.messages.push(o)}}return e}function MCr(){console.log(`${sr.bold(Si)} - AI coding assistant with read, bash, edit, write tools
19094
+ `.trim();n(wCr,"describeUnavailableExcel");kMo={edit_mode:"ShortcutXL is connected to Excel, but Excel is in cell edit mode, so it cannot list or change workbooks right now. Ask the user to finish the cell edit in Excel (press Enter or Esc), then try again.",busy:"ShortcutXL is connected to Excel, but Excel is busy and did not list its workbooks: it may still be running another request, or have a dialog open. If a dialog is open in Excel, ask the user to close it, then try again."};n(PMo,"formatWorkbookScopeReminder");n(DMo,"postWorkbookExecCode");n(OMo,"parseWorkbookInventory");n(NMo,"fetchWorkbookConnectionStateOnce");n(ige,"fetchWorkbookConnectionStateForHost");n(tKt,"fetchWorkbookConnectionState");n(kCr,"emitInventoryDiagnostic");n(PCr,"buildWorkbookPromptContext")});import{spawn as FMo}from"node:child_process";import{homedir as MMo}from"node:os";import{setTimeout as LMo}from"node:timers/promises";function BMo(t,e){return new Promise((r,o)=>{let{ELECTRON_RUN_AS_NODE:s,...l}=process.env,d=FMo(t,["/x","/t",e],{detached:!0,stdio:"ignore",cwd:MMo(),env:l});d.once("error",o),d.once("spawn",()=>{d.unref(),d.pid?r(d.pid):o(new Error("Excel started without a process identity."))})})}async function DCr(t={}){let{signal:e}=t;if(e?.throwIfAborted(),(t.platform??process.platform)!=="win32")throw new Error("Starting a separate native Excel process requires Windows and desktop Excel.");let r=await(t.findExecutable??(()=>qRt(e)))();if(!r)throw new Error("Desktop Excel was not found. Install Excel before starting a new process.");let o=await(t.ensureTemplate??(()=>zRt(e)))();if(!o)throw new Error("Shortcut could not prepare a blank Excel workbook. Repair the ShortcutXL bridge installation and retry.");let s=await(t.listProcessIds??(()=>TEe(e)))();e?.throwIfAborted();let l=await(t.startProcess??BMo)(r,o);if(!Number.isSafeInteger(l)||l<=0||s.includes(l))throw new Error("Excel did not return a distinct new process. The session binding was not changed.");let d=t.now??Date.now,f=d()+(t.timeoutMs??6e4),_=t.sleep??(x=>LMo(x,void 0,{signal:e})),y=t.listHosts??(()=>p0({timeoutMs:1e3})),A=t.connectProcess??(x=>ewn(x,{signal:e}));try{for(;d()<f;){e?.throwIfAborted();let x=(await y()).find(O=>O.pid===l);e?.throwIfAborted();let E=await A(l);if(E==="other-installation")throw new Error("Another Shortcut installation owns its bridge. Save your work and close that Excel window, then retry this task to use this installation.");if(e?.throwIfAborted(),E==="ready"&&x&&!x.error&&!x.busy){let O,N=await ige(x,{signal:e,observer:n(F=>{O=F.errorCode},"observer"),waitForReadyMs:Math.max(0,Math.min(1e4,f-d()))});if(O==="excel_host_auth_rejected"||O==="excel_invalid_response")throw new Error("The new Excel bridge rejected its connection identity or returned an invalid inventory. Inspect that process before retrying.");if(N.connected&&!N.unavailable&&N.workbooks.length>0)return x}await _(500)}throw new Error("Its ShortcutXL bridge did not become ready. Check that window for a dialog or disabled add-in.")}catch(x){throw new Error(`Excel process ${l} was started but not bound. ${x instanceof Error?x.message:String(x)} The previous session binding was retained. The new process was left open; inspect it before retrying, rather than creating another process.`,{cause:x})}}var OCr=J(()=>{"use strict";HPe();EEe();uJ();n(BMo,"spawnSeparateExcel");n(DCr,"startNewExcelProcess")});import{stat as UMo}from"node:fs/promises";import{win32 as WMo}from"node:path";var Gnt,NCr=J(()=>{"use strict";HPe();r4();rje();EEe();OCr();uJ();Gnt=class{static{n(this,"ExcelTargetController")}selectedHost;selectionWasLost=!1;selector;resolving;listeners=new Set;bindingGeneration=0;startingProcess=!1;observer;setObserver(e){this.observer=e}setSelector(e){this.selector=e}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}async getAvailability(){let e=await p0();return this.reconcileSelection(e),{hosts:e.map(({hostId:r,pid:o,busy:s})=>({hostId:r,pid:o,...s?{busy:s}:{}})),...this.selectedHost?{selectedHostId:this.selectedHost.hostId}:{},selectionWasLost:this.selectionWasLost}}async listTargets(){let e=await p0();return this.reconcileSelection(e),{options:await this.buildOptions(e),...this.selectedHost?{selectedHostId:this.selectedHost.hostId}:{},selectionWasLost:this.selectionWasLost}}async selectTarget(e){let r=(await p0()).find(o=>o.hostId===e);if(!r)throw new hm("excel_host_unavailable",`That Excel process is no longer available. ${n4}`);return this.bind(r)}async startNewProcess(e={}){if(this.startingProcess)throw new Error("This session is already starting a new Excel process. Wait for that result before retrying.");this.startingProcess=!0;let r=this.bindingGeneration;try{let o=await DCr(e);if(e.signal?.aborted||r!==this.bindingGeneration)throw new Error(`Excel process ${o.pid} was started but not bound because the operation was cancelled or the session selection changed. Your current selection was retained. Inspect that process before retrying.`);return this.bind(o)}finally{this.startingProcess=!1}}resolveTargetOpeningExcel(e,r,o){return o?.document||o?.hostId?this.resolveExecutionTarget(o,e):rwn(()=>this.resolveExecutionTarget(void 0,e),{signal:e},r)}async resolveExecutionTarget(e={},r,o=!0){r?.throwIfAborted();let s=await p0();if(r?.throwIfAborted(),this.reconcileSelection(s),this.selectionWasLost&&!e.document&&!e.hostId)throw new hm("excel_document_selection_required",`The previous Excel connection was lost. ${n4}`);let l=e.hostId??(e.document?void 0:this.selectedHost?.hostId),d=l?s.filter(O=>O.hostId===l):s;if(l&&!e.hostId&&d.length===0)throw new hm("excel_document_selection_required","The previously selected Excel process is not responding or has closed. Retry when it is ready, select the intended process with /excel or the desktop Excel controls. Shortcut will not redirect this operation to another workbook.",{host_count:s.length,selection_state:"lost"});if(d.length===0&&(!e.document||e.hostId||!o))throw new hm("excel_host_unavailable","The requested Excel process is not available. Open the intended workbook and retry.",{host_count:s.length,selection_state:this.selectionWasLost?"lost":"unbound"});let f=n(O=>O.replaceAll("\\","/").toLowerCase(),"normalize"),_=e.document?f(e.document):void 0,y=[],A=!1,x=!1,E=await Promise.all(d.map(O=>{if(O.busy)return;let N=!this.selectedHost||!this.sameBinding(O,this.selectedHost)||!o;return ige(O,{signal:r,waitForReadyMs:N?12e3:0})}));r?.throwIfAborted();for(let[O,N]of d.entries()){let F=E[O];if(!F){x=d.length===1,A=!0;continue}if(!F.connected||F.unavailable){x=d.length===1&&F.connected&&F.unavailable==="busy",A=!0;continue}for(let z of F.workbooks){let le=F.workbookSheets?.find(xe=>xe.workbook===z)?.fullName??z;(!_||f(z)===_||f(le)===_)&&y.push({host:N,document:le})}}if(A)throw new hm("excel_document_unavailable",x?`Excel is busy and could not verify the intended workbook. Wait or close its dialog, then try again.${SEe()}`:"Excel could not verify the intended workbook because a process is busy or disconnected. Finish any cell edit or dialog, then retry with the workbook and Excel process identity.");if(y.length===0&&e.document&&!e.hostId&&o){let O=await twn(e.document,s.map(N=>N.pid),{signal:r});if(O==="connected")return this.resolveExecutionTarget(e,r,!1);if(O==="ambiguous")throw new hm("excel_document_selection_required","More than one unconnected Excel workbook matches. Ask for the intended workbook\u2019s full path; no add-in was loaded and no workbook was edited.");if(O==="other-installation")throw new hm("excel_host_unavailable","The intended Excel workbook is open, but another Shortcut installation owns its add-in connection. Save your work and close Excel, then retry this task to use this installation; no running add-in was replaced.");if(O==="unavailable")throw new hm("excel_document_unavailable","Excel could not verify or connect the intended workbook. Finish any cell edit or dialog, check that the ShortcutXL add-in is enabled, then retry the same workbook; no workbook edit was attempted.")}if(y.length===1){let O=y[0];return{...this.bind(O.host),document:O.document}}if(y.length===0&&e.document&&process.platform==="win32"&&WMo.isAbsolute(e.document)&&/\.(xlsx|xlsm|xlsb|xls)$/i.test(e.document)&&(await UMo(e.document).catch(()=>{}))?.isFile()){let O=d.find(N=>N.hostId===this.selectedHost?.hostId)??(d.length===1?d[0]:void 0);if(O)return{...this.bind(O),documentToOpen:e.document}}if(y.length===0&&!_&&d.length===1)return this.bind(d[0]);throw new hm(y.length===0?"excel_document_unavailable":"excel_document_selection_required",y.length===0?`The requested workbook ${JSON.stringify(e.document)} is not open. Open that workbook or ask the user to confirm its identity; do not substitute another workbook.`:`More than one workbook matches. Ask the user which workbook to use, then supply its full path and, when needed, hostId. Available matches: ${y.map(O=>`${O.document} (hostId: ${O.host.hostId})`).join(", ")}`)}async resolveTarget(){return this.resolving||(this.resolving=this.resolveTargetOnce().finally(()=>{this.resolving=void 0})),this.resolving}async resolveTargetOnce(){if(this.invalidateExitedProcess(),this.selectedHost){let l=this.selectedHost,d=WIn().find(f=>f.hostId===l.hostId||f.url===l.url);if(!d||this.sameBinding(d,l))return l}let e=await p0();if(this.reconcileSelection(e),this.selectedHost)return this.selectedHost;if(e.length===0)throw new hm("excel_host_unavailable","ShortcutXL is not connected to Excel. Open Excel and try again. Check that the ShortcutXL add-in is enabled. If Excel shows a signature or policy warning, preserve it for your IT team rather than repeatedly approving it.",{host_count:0,selection_state:this.selectionWasLost?"lost":"unbound"});if(e.length===1&&!this.selectionWasLost){let l=e[0];if(l)return this.bind(l)}if(!this.selector)throw new hm("excel_host_selection_required",this.selectionWasLost?`The selected Excel process disconnected. Choose an Excel process to continue. ${n4}`:"Multiple Excel processes are connected. Headless mode requires exactly one Excel process. Close the others and retry.",{host_count:e.length,selection_state:this.selectionWasLost?"lost":"unbound"});let r=await this.buildOptions(e),o=await this.selector(r),s=e.find(l=>l.hostId===o);if(!s)throw new hm("excel_cancelled","No Excel process was selected.");return this.bind(s)}invalidateExitedProcess(){let e=this.selectedHost;e&&!oje(e.pid)&&e.onUnavailable("unavailable")}reconcileSelection(e){this.invalidateExitedProcess();let r=this.selectedHost;if(!r)return;let o=e.find(s=>!s.busy&&(s.hostId===r.hostId||s.url===r.url));if(o&&!this.sameBinding(o,r)){let s=[];o.hostId!==r.hostId&&s.push("host_id"),o.pid!==r.pid&&s.push("pid"),o.port!==r.port&&s.push("port"),o.token!==r.token&&s.push("credential"),this.observe({event:"excel_binding_invalidated",bindingGeneration:this.bindingGeneration,reason:"identity_changed",changedFields:s}),r.onUnavailable("identity_changed")}}sameBinding(e,r){return e.hostId===r.hostId&&e.pid===r.pid&&e.port===r.port&&e.token===r.token}async buildOptions(e){return Promise.all(e.map(async r=>{let o=r.busy?{connected:!0,unavailable:"busy",workbooks:[]}:await ige(r),s=o.unavailable?wCr(o.unavailable):o.workbooks.length>0?o.workbooks.join(", "):"No open workbooks";return{hostId:r.hostId,pid:r.pid,label:`${s} (Excel PID ${r.pid})`}}))}bind(e){let r=++this.bindingGeneration,o=this.selectionWasLost,s={...e,onUnavailable:n((l="unavailable")=>{let d=l==="identity_changed"||l==="transport_failed"||l==="auth_rejected"?l:"unavailable";if(this.selectedHost!==s){this.selectedHost&&r!==this.bindingGeneration&&this.observe({event:"excel_previous_binding_failure_ignored",bindingGeneration:r,currentBindingGeneration:this.bindingGeneration,sameHostId:this.selectedHost.hostId===s.hostId,reason:d});return}this.selectedHost=void 0,this.selectionWasLost=!0,d!=="identity_changed"&&this.observe({event:"excel_binding_invalidated",bindingGeneration:r,reason:d}),this.notify()},"onUnavailable")};return this.selectedHost=s,this.selectionWasLost=!1,this.observe({event:"excel_target_selected",bindingGeneration:r,recovered:o}),this.notify(),s}observe(e){try{this.observer?.(e)}catch{}}notify(){for(let e of this.listeners)e()}}});import{spawn as VMo}from"child_process";import{existsSync as jMo}from"fs";import{join as $Mo}from"path";function GPe(t){return t==="word"?"Word":"PowerPoint"}function GMo(t,e=process.env){let r=HMo[t],o=[e.ProgramW6432,e.ProgramFiles,e["ProgramFiles(x86)"]].filter(l=>typeof l=="string"&&l.length>0),s=[["Microsoft Office","root","Office16"],["Microsoft Office","Office16"],["Microsoft Office","Office15"],["Microsoft Office","Office14"]];for(let l of o)for(let d of s){let f=$Mo(l,...d,r);if(jMo(f))return f}return r}function QMo(t,e=process.platform){return e!=="win32"?Promise.reject(new Error(`${GPe(t)} COM execution is available only on Windows.`)):new Promise((r,o)=>{let s=VMo(GMo(t),[],{detached:!0,stdio:"ignore",windowsHide:!1});s.once("spawn",()=>{s.unref(),r()}),s.once("error",l=>{o(new Error(`Could not start ${GPe(t)}: ${l.message}`,{cause:l}))})})}function qMo(t){return new Promise(e=>setTimeout(e,t))}var HMo,QPe,FCr=J(()=>{"use strict";uJ();HMo={word:"WINWORD.EXE",powerpoint:"POWERPNT.EXE"};n(GPe,"applicationLabel");n(GMo,"resolveOfficeExecutable");n(QMo,"launchOfficeApplication");n(qMo,"delay");QPe=class{constructor(e,r={}){this.application=e;this.options=r;this.listHosts=r.listHosts??(o=>sje(o)),this.launchApplication=r.launchApplication??(o=>QMo(o,r.platform))}application;options;static{n(this,"OfficeTargetController")}selectedHost;selectedIdentity;resolving;listHosts;launchApplication;async resolveTarget(e){if(e?.hostId){this.resolving&&await this.resolving;let o=(await this.listHosts(this.application)).find(s=>s.hostId===e.hostId);if(!o)throw new Error(`The selected ${GPe(this.application)} process is unavailable.`);if(o.error)throw new Error(`${GPe(this.application)} bridge failed to initialize: ${o.error}`);return this.bind(o)}return this.resolving||(this.resolving=this.resolveTargetOnce().finally(()=>{this.resolving=void 0})),this.resolving}async resolveTargetOnce(){if(this.selectedHost)return this.selectedHost;let e=GPe(this.application),r=await this.listHosts(this.application);if(this.selectedIdentity){let s=r.find(l=>l.hostId===this.selectedIdentity?.hostId&&l.pid===this.selectedIdentity?.pid);if(!s)throw new Error(`The selected ${e} process disconnected. Restore its ShortcutXL connection and retry in this chat. No other process was selected; check whether the previous operation completed before retrying it.`);if(s.error)throw new Error(`${e} bridge failed to initialize: ${s.error}`);return this.bind(s)}if(r.length===0&&(await this.launchApplication(this.application),r=await this.waitForHost()),r.length===0)throw new Error(`${e} started but the ShortcutXL bridge did not connect. Restart ${e} after repairing the ShortcutXL installation.`);if(r.length>1)throw new Error(`Multiple ${e} processes are connected (${r.map(s=>s.hostId).join(", ")}). Select the intended target.hostId before running code; keep unrelated documents open.`);let o=r[0];if(!o)throw new Error(`${e} bridge discovery failed.`);if(o.error)throw new Error(`${e} bridge failed to initialize: ${o.error}`);return this.bind(o)}async waitForHost(){let e=this.options.launchTimeoutMs??3e4,r=this.options.pollIntervalMs??250,o=Date.now()+e;do{let s=await this.listHosts(this.application);if(s.length>0)return s;await qMo(r)}while(Date.now()<o);return[]}bind(e){let r={...e,onUnavailable:n(()=>{this.selectedHost===r&&(this.selectedHost=void 0)},"onUnavailable")};return this.selectedHost=r,this.selectedIdentity={hostId:e.hostId,pid:e.pid},r}}});function nKt(t){let e={messages:[],fileArgs:[]};for(let r=0;r<t.length;r++){let o=t[r],s=n(()=>{if(r+1>=t.length)throw new Zv(`${o} requires a value.`);return t[++r]},"value");if(o==="--help"||o==="-h")e.help=!0;else if(o==="--version"||o==="-v")e.version=!0;else if(o==="--mode"){let l=s();if(l!=="text"&&l!=="json"&&l!=="rpc")throw new Zv(`Invalid --mode "${l}". Use text, json, or rpc.`);e.mode=l}else if(o==="--continue"||o==="-c")e.continue=!0;else if(o==="--resume"||o==="-r")e.resume=!0;else if(o==="--provider")e.provider=s();else if(o==="--model")e.model=s();else if(o==="--api-key")e.apiKey=s();else if(o==="--system-prompt")e.systemPrompt=s();else if(o==="--append-system-prompt")e.appendSystemPrompt=s();else if(o==="--no-session")e.noSession=!0;else if(o==="--session")e.session=s();else if(o==="--session-dir")e.sessionDir=s();else if(o==="--thinking"){let l=s();H3(l)?e.thinking=l:console.error(sr.yellow(`Warning: Invalid thinking level "${l}". Valid values: ${tde.join(", ")}`))}else if(o==="--print"||o==="-p")e.print=!0;else if(o==="--export")e.export=s();else if(o==="--extension"||o==="-e")e.extensions=e.extensions??[],e.extensions.push(s());else if(o==="--no-extensions"||o==="-ne")e.noExtensions=!0;else if(o==="--skill")e.skills=e.skills??[],e.skills.push(s());else if(o==="--prompt-template")e.promptTemplates=e.promptTemplates??[],e.promptTemplates.push(s());else if(o==="--theme")e.themes=e.themes??[],e.themes.push(s());else if(o==="--no-skills"||o==="-ns")e.noSkills=!0;else if(o==="--no-prompt-templates"||o==="-np")e.noPromptTemplates=!0;else if(o==="--no-themes")e.noThemes=!0;else if(o==="--list-models")r+1<t.length&&!t[r+1].startsWith("-")&&!t[r+1].startsWith("@")?e.listModels=s():e.listModels=!0;else if(o==="--verbose")e.verbose=!0;else if(o==="--dev-mode")e.devMode=!0;else if(o==="--agent-mode")e.agentMode=s();else if(o==="--offline")e.offline=!0;else if(o==="--max-turns"){let l=parseInt(s(),10);!Number.isNaN(l)&&l>=0&&(e.maxTurns=l)}else if(o==="--max-tool-uses"){let l=parseInt(s(),10);!Number.isNaN(l)&&l>=0&&(e.maxToolUses=l)}else if(o==="--max-tokens"){let l=parseInt(s(),10);!Number.isNaN(l)&&l>=0&&(e.maxTokens=l)}else if(o==="--speed"){let l=t[++r];if(l!=="standard"&&l!=="fast"&&l!=="ultrafast"&&l!=="flex")throw new Zv("Invalid --speed. Use standard, fast, ultrafast, or flex.");e.speed=l}else if(o==="--require-task-outcome")e.requireTaskOutcome=!0;else if(o==="--originating-mode"){let l=t[++r];if(l!=="plan")throw new Zv("Invalid --originating-mode. Use plan.");e.originatingMode=l}else if(o==="--platform-api")e.platformApi=!0;else if(o==="--output-workbook")e.outputWorkbook=s();else if(o==="--artifact-dir")e.artifactDir=s();else if(o==="--event-log-path")e.eventLogPath=s();else if(o==="--request-id")e.requestId=s();else if(o==="--file-id")e.fileId=s();else if(o==="--assume-installed")e.assumeInstalled=!0;else if(o==="--host-preflight-result")e.hostPreflightResult=s();else if(o==="--disable-memory")e.disableMemory=!0;else if(o==="--runtime-model-overlay-file")e.runtimeModelOverlayFile=s();else if(o==="--prefer-current-model-for-subagents")e.preferCurrentModelForSubagents=!0;else if(o==="--subagent-model"){let l=s();if(!Fyr(l))throw new Zv(`Invalid --subagent-model "${l}". Valid values: ${Nzt.join(", ")}`);e.subagentModel=l}else if(o==="--watch")r+1<t.length&&!t[r+1].startsWith("-")?e.watch=s():e.watch="";else if(o==="--skip-runtime-permissions")e.dangerouslySkipRuntimePermissions=!0;else if(o==="--skip-office-permissions"||o==="--skip-spreadsheet-permissions")e.dangerouslySkipOfficePermissions=!0;else if(o.startsWith("@"))e.fileArgs.push(o.slice(1));else{if(o.startsWith("-"))throw new Zv(`Unknown option ${o}. Use "${Si} --help" to see the options.`);e.messages.push(o)}}return e}function MCr(){console.log(`${sr.bold(Si)} - AI coding assistant with read, bash, edit, write tools
19095
19095
 
19096
19096
  ${sr.bold("Usage:")}
19097
19097
  ${Si} [options] [@files...] [messages...]
@@ -19162,6 +19162,7 @@ ${sr.bold("Options:")}
19162
19162
  --watch [dir] Watch directory and auto-restart on changes (dev workflow)
19163
19163
  --skip-runtime-permissions Bypass runtime filesystem and shell approval checks for this session
19164
19164
  --skip-office-permissions Allow native Office access and auto-approve Office operations
19165
+ --skip-spreadsheet-permissions Compatibility alias for --skip-office-permissions
19165
19166
  --verbose Force verbose startup (overrides quietStartup setting)
19166
19167
  --offline Disable startup network operations (same as SHORTCUT_OFFLINE=1)
19167
19168
  --help, -h Show this help
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __bundleRequire } from 'module'; import { fileURLToPath as __bundleFileURLToPath } from 'url'; import { dirname as __bundleDirname } from 'path'; const require = __bundleRequire(import.meta.url); const __shortcutBundleFilename = __bundleFileURLToPath(import.meta.url); const __shortcutBundleDirname = __bundleDirname(__shortcutBundleFilename);
2
- import{d as h,e as A}from"../chunks/chunk-C4EDALSC.js";import{b as u}from"../chunks/chunk-IJKM27E6.js";import{e as g}from"../chunks/chunk-UZDXH3U3.js";import{d as f,i as c}from"../chunks/chunk-3IKYSXAL.js";import{a as d,b as m}from"../chunks/chunk-D2N4HEB6.js";import"../chunks/chunk-PYO3T22Z.js";import"../chunks/chunk-KTGWB25M.js";import"../chunks/chunk-BUXD5F7O.js";import{n as p}from"../chunks/chunk-XNUW35JQ.js";import{a as r}from"../chunks/chunk-PP7O3DDT.js";var a=class extends Error{static{r(this,"CliUsageError")}userFacing=!0};function l(i){let e={messages:[],fileArgs:[]};for(let n=0;n<i.length;n++){let t=i[n],o=r(()=>{if(n+1>=i.length)throw new a(`${t} requires a value.`);return i[++n]},"value");if(t==="--help"||t==="-h")e.help=!0;else if(t==="--version"||t==="-v")e.version=!0;else if(t==="--mode"){let s=o();if(s!=="text"&&s!=="json"&&s!=="rpc")throw new a(`Invalid --mode "${s}". Use text, json, or rpc.`);e.mode=s}else if(t==="--continue"||t==="-c")e.continue=!0;else if(t==="--resume"||t==="-r")e.resume=!0;else if(t==="--provider")e.provider=o();else if(t==="--model")e.model=o();else if(t==="--api-key")e.apiKey=o();else if(t==="--system-prompt")e.systemPrompt=o();else if(t==="--append-system-prompt")e.appendSystemPrompt=o();else if(t==="--no-session")e.noSession=!0;else if(t==="--session")e.session=o();else if(t==="--session-dir")e.sessionDir=o();else if(t==="--thinking"){let s=o();m(s)?e.thinking=s:console.error(u.yellow(`Warning: Invalid thinking level "${s}". Valid values: ${d.join(", ")}`))}else if(t==="--print"||t==="-p")e.print=!0;else if(t==="--export")e.export=o();else if(t==="--extension"||t==="-e")e.extensions=e.extensions??[],e.extensions.push(o());else if(t==="--no-extensions"||t==="-ne")e.noExtensions=!0;else if(t==="--skill")e.skills=e.skills??[],e.skills.push(o());else if(t==="--prompt-template")e.promptTemplates=e.promptTemplates??[],e.promptTemplates.push(o());else if(t==="--theme")e.themes=e.themes??[],e.themes.push(o());else if(t==="--no-skills"||t==="-ns")e.noSkills=!0;else if(t==="--no-prompt-templates"||t==="-np")e.noPromptTemplates=!0;else if(t==="--no-themes")e.noThemes=!0;else if(t==="--list-models")n+1<i.length&&!i[n+1].startsWith("-")&&!i[n+1].startsWith("@")?e.listModels=o():e.listModels=!0;else if(t==="--verbose")e.verbose=!0;else if(t==="--dev-mode")e.devMode=!0;else if(t==="--agent-mode")e.agentMode=o();else if(t==="--offline")e.offline=!0;else if(t==="--max-turns"){let s=parseInt(o(),10);!Number.isNaN(s)&&s>=0&&(e.maxTurns=s)}else if(t==="--max-tool-uses"){let s=parseInt(o(),10);!Number.isNaN(s)&&s>=0&&(e.maxToolUses=s)}else if(t==="--max-tokens"){let s=parseInt(o(),10);!Number.isNaN(s)&&s>=0&&(e.maxTokens=s)}else if(t==="--speed"){let s=i[++n];if(s!=="standard"&&s!=="fast"&&s!=="ultrafast"&&s!=="flex")throw new a("Invalid --speed. Use standard, fast, ultrafast, or flex.");e.speed=s}else if(t==="--require-task-outcome")e.requireTaskOutcome=!0;else if(t==="--originating-mode"){let s=i[++n];if(s!=="plan")throw new a("Invalid --originating-mode. Use plan.");e.originatingMode=s}else if(t==="--platform-api")e.platformApi=!0;else if(t==="--output-workbook")e.outputWorkbook=o();else if(t==="--artifact-dir")e.artifactDir=o();else if(t==="--event-log-path")e.eventLogPath=o();else if(t==="--request-id")e.requestId=o();else if(t==="--file-id")e.fileId=o();else if(t==="--assume-installed")e.assumeInstalled=!0;else if(t==="--host-preflight-result")e.hostPreflightResult=o();else if(t==="--disable-memory")e.disableMemory=!0;else if(t==="--runtime-model-overlay-file")e.runtimeModelOverlayFile=o();else if(t==="--prefer-current-model-for-subagents")e.preferCurrentModelForSubagents=!0;else if(t==="--subagent-model"){let s=o();if(!A(s))throw new a(`Invalid --subagent-model "${s}". Valid values: ${h.join(", ")}`);e.subagentModel=s}else if(t==="--watch")n+1<i.length&&!i[n+1].startsWith("-")?e.watch=o():e.watch="";else if(t==="--skip-runtime-permissions")e.dangerouslySkipRuntimePermissions=!0;else if(t==="--skip-office-permissions")e.dangerouslySkipOfficePermissions=!0;else if(t.startsWith("@"))e.fileArgs.push(t.slice(1));else{if(t.startsWith("-"))throw new a(`Unknown option ${t}. Use "${p} --help" to see the options.`);e.messages.push(t)}}return e}r(l,"parseArgs");function v(i){return{mode:c(i.agentMode),availableModes:f}}r(v,"profileFromArguments");function b(i,e){return i.setDangerouslySkipRuntimePermissionsOverride(e.dangerouslySkipRuntimePermissions?!0:void 0),i.setDangerouslySkipOfficePermissionsOverride(e.dangerouslySkipOfficePermissions?!0:void 0),v(e)}r(b,"applyRuntimeLaunchArguments");function U(i){return v(l([...i]))}r(U,"resolveRuntimeLaunchProfile");function D(i,e){let n=g.create(i);return b(n,l([...e])),{runtimeBypass:n.getDangerouslySkipRuntimePermissions(),officeAutoApprove:n.getSessionAutoApproveDefault()}}r(D,"resolveRuntimePermissionDefaults");export{b as applyRuntimeLaunchArguments,U as resolveRuntimeLaunchProfile,D as resolveRuntimePermissionDefaults};
2
+ import{d as h,e as A}from"../chunks/chunk-C4EDALSC.js";import{b as u}from"../chunks/chunk-IJKM27E6.js";import{e as g}from"../chunks/chunk-UZDXH3U3.js";import{d as f,i as c}from"../chunks/chunk-3IKYSXAL.js";import{a as d,b as m}from"../chunks/chunk-D2N4HEB6.js";import"../chunks/chunk-PYO3T22Z.js";import"../chunks/chunk-KTGWB25M.js";import"../chunks/chunk-BUXD5F7O.js";import{n as p}from"../chunks/chunk-XNUW35JQ.js";import{a as r}from"../chunks/chunk-PP7O3DDT.js";var a=class extends Error{static{r(this,"CliUsageError")}userFacing=!0};function l(i){let e={messages:[],fileArgs:[]};for(let n=0;n<i.length;n++){let t=i[n],o=r(()=>{if(n+1>=i.length)throw new a(`${t} requires a value.`);return i[++n]},"value");if(t==="--help"||t==="-h")e.help=!0;else if(t==="--version"||t==="-v")e.version=!0;else if(t==="--mode"){let s=o();if(s!=="text"&&s!=="json"&&s!=="rpc")throw new a(`Invalid --mode "${s}". Use text, json, or rpc.`);e.mode=s}else if(t==="--continue"||t==="-c")e.continue=!0;else if(t==="--resume"||t==="-r")e.resume=!0;else if(t==="--provider")e.provider=o();else if(t==="--model")e.model=o();else if(t==="--api-key")e.apiKey=o();else if(t==="--system-prompt")e.systemPrompt=o();else if(t==="--append-system-prompt")e.appendSystemPrompt=o();else if(t==="--no-session")e.noSession=!0;else if(t==="--session")e.session=o();else if(t==="--session-dir")e.sessionDir=o();else if(t==="--thinking"){let s=o();m(s)?e.thinking=s:console.error(u.yellow(`Warning: Invalid thinking level "${s}". Valid values: ${d.join(", ")}`))}else if(t==="--print"||t==="-p")e.print=!0;else if(t==="--export")e.export=o();else if(t==="--extension"||t==="-e")e.extensions=e.extensions??[],e.extensions.push(o());else if(t==="--no-extensions"||t==="-ne")e.noExtensions=!0;else if(t==="--skill")e.skills=e.skills??[],e.skills.push(o());else if(t==="--prompt-template")e.promptTemplates=e.promptTemplates??[],e.promptTemplates.push(o());else if(t==="--theme")e.themes=e.themes??[],e.themes.push(o());else if(t==="--no-skills"||t==="-ns")e.noSkills=!0;else if(t==="--no-prompt-templates"||t==="-np")e.noPromptTemplates=!0;else if(t==="--no-themes")e.noThemes=!0;else if(t==="--list-models")n+1<i.length&&!i[n+1].startsWith("-")&&!i[n+1].startsWith("@")?e.listModels=o():e.listModels=!0;else if(t==="--verbose")e.verbose=!0;else if(t==="--dev-mode")e.devMode=!0;else if(t==="--agent-mode")e.agentMode=o();else if(t==="--offline")e.offline=!0;else if(t==="--max-turns"){let s=parseInt(o(),10);!Number.isNaN(s)&&s>=0&&(e.maxTurns=s)}else if(t==="--max-tool-uses"){let s=parseInt(o(),10);!Number.isNaN(s)&&s>=0&&(e.maxToolUses=s)}else if(t==="--max-tokens"){let s=parseInt(o(),10);!Number.isNaN(s)&&s>=0&&(e.maxTokens=s)}else if(t==="--speed"){let s=i[++n];if(s!=="standard"&&s!=="fast"&&s!=="ultrafast"&&s!=="flex")throw new a("Invalid --speed. Use standard, fast, ultrafast, or flex.");e.speed=s}else if(t==="--require-task-outcome")e.requireTaskOutcome=!0;else if(t==="--originating-mode"){let s=i[++n];if(s!=="plan")throw new a("Invalid --originating-mode. Use plan.");e.originatingMode=s}else if(t==="--platform-api")e.platformApi=!0;else if(t==="--output-workbook")e.outputWorkbook=o();else if(t==="--artifact-dir")e.artifactDir=o();else if(t==="--event-log-path")e.eventLogPath=o();else if(t==="--request-id")e.requestId=o();else if(t==="--file-id")e.fileId=o();else if(t==="--assume-installed")e.assumeInstalled=!0;else if(t==="--host-preflight-result")e.hostPreflightResult=o();else if(t==="--disable-memory")e.disableMemory=!0;else if(t==="--runtime-model-overlay-file")e.runtimeModelOverlayFile=o();else if(t==="--prefer-current-model-for-subagents")e.preferCurrentModelForSubagents=!0;else if(t==="--subagent-model"){let s=o();if(!A(s))throw new a(`Invalid --subagent-model "${s}". Valid values: ${h.join(", ")}`);e.subagentModel=s}else if(t==="--watch")n+1<i.length&&!i[n+1].startsWith("-")?e.watch=o():e.watch="";else if(t==="--skip-runtime-permissions")e.dangerouslySkipRuntimePermissions=!0;else if(t==="--skip-office-permissions"||t==="--skip-spreadsheet-permissions")e.dangerouslySkipOfficePermissions=!0;else if(t.startsWith("@"))e.fileArgs.push(t.slice(1));else{if(t.startsWith("-"))throw new a(`Unknown option ${t}. Use "${p} --help" to see the options.`);e.messages.push(t)}}return e}r(l,"parseArgs");function v(i){return{mode:c(i.agentMode),availableModes:f}}r(v,"profileFromArguments");function b(i,e){return i.setDangerouslySkipRuntimePermissionsOverride(e.dangerouslySkipRuntimePermissions?!0:void 0),i.setDangerouslySkipOfficePermissionsOverride(e.dangerouslySkipOfficePermissions?!0:void 0),v(e)}r(b,"applyRuntimeLaunchArguments");function U(i){return v(l([...i]))}r(U,"resolveRuntimeLaunchProfile");function D(i,e){let n=g.create(i);return b(n,l([...e])),{runtimeBypass:n.getDangerouslySkipRuntimePermissions(),officeAutoApprove:n.getSessionAutoApproveDefault()}}r(D,"resolveRuntimePermissionDefaults");export{b as applyRuntimeLaunchArguments,U as resolveRuntimeLaunchProfile,D as resolveRuntimePermissionDefaults};