shortcutxl 0.3.83 → 0.3.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BINARY-INVENTORY.json +30 -14
- package/CHANGELOG.md +9 -0
- package/agent-docs/README.md +5 -5
- package/binary-provenance.json +14 -0
- package/dist/app/agent-session.d.ts +2 -0
- package/dist/app/agent-session.js +45 -27
- package/dist/app/approvals/runtime-approval-gates.d.ts +2 -2
- package/dist/app/extensions/types.d.ts +6 -0
- package/dist/app/local/tools/execute-code/approval-payload.d.ts +4 -4
- package/dist/app/local/tools/execute-code/executor.d.ts +8 -8
- package/dist/app/local/tools/execute-code/executor.js +3 -3
- package/dist/app/local/tools/execute-code/tool.d.ts +2 -2
- package/dist/app/local/tools/execute-code/tool.js +4 -4
- package/dist/app/local/tools/execute-code/write-analyzer.d.ts +2 -2
- package/dist/app/local/tools/office-exec/analyzer.d.ts +14 -0
- package/dist/app/local/tools/office-exec/analyzer.js +106 -0
- package/dist/app/local/tools/office-exec/tool.d.ts +23 -0
- package/dist/app/local/tools/office-exec/tool.js +174 -0
- package/dist/app/modes/action/prompt.js +0 -1
- package/dist/app/office-context/office-summary.d.ts +30 -0
- package/dist/app/office-context/office-summary.js +116 -0
- package/dist/app/permissions/capability-catalog.js +3 -3
- package/dist/app/permissions/compiler.d.ts +1 -1
- package/dist/app/permissions/compiler.js +6 -6
- package/dist/app/permissions/effective-view.d.ts +1 -1
- package/dist/app/permissions/effective-view.js +15 -15
- package/dist/app/permissions/permissions-command.js +16 -18
- package/dist/app/permissions/policy.d.ts +1 -1
- package/dist/app/permissions/policy.js +2 -2
- package/dist/app/permissions/runtime-permission-bypass.js +2 -2
- package/dist/app/permissions/settings.d.ts +6 -6
- package/dist/app/permissions/settings.js +49 -28
- package/dist/app/permissions/tool-gates.d.ts +8 -2
- package/dist/app/permissions/tool-gates.js +3 -1
- package/dist/app/resources/external-skill-roots.d.ts +2 -2
- package/dist/app/resources/external-skill-roots.js +12 -0
- package/dist/app/session/run-agent-observability.d.ts +20 -2
- package/dist/app/session/run-agent-observability.js +14 -2
- package/dist/app/session/session-reader.d.ts +7 -2
- package/dist/app/session/session-reader.js +31 -4
- package/dist/app/session/tool-registry.d.ts +1 -1
- package/dist/app/session/tool-registry.js +14 -6
- package/dist/app/settings-manager.d.ts +5 -5
- package/dist/app/settings-manager.js +16 -16
- package/dist/app/shared/tools/execute-code/mog.d.ts +2 -2
- package/dist/app/shared/tools/execute-code/mog.js +6 -6
- package/dist/app/sync/skills-delete.d.ts +6 -0
- package/dist/app/sync/skills-delete.js +28 -0
- package/dist/app/sync/skills-presentation.d.ts +18 -0
- package/dist/app/sync/skills-presentation.js +123 -0
- package/dist/app/sync/skills-status.d.ts +6 -2
- package/dist/app/sync/skills-status.js +9 -2
- package/dist/app/tools/execute-code/index.d.ts +4 -4
- package/dist/app/tools/index.d.ts +1 -1
- package/dist/app/tools/task/task.js +5 -7
- package/dist/app/tools/tool-binaries.d.ts +2 -0
- package/dist/app/tools/tool-binaries.js +14 -17
- package/dist/app/xll/host-registry.d.ts +12 -1
- package/dist/app/xll/host-registry.js +27 -5
- package/dist/app/xll/office-target.d.ts +37 -0
- package/dist/app/xll/office-target.js +135 -0
- package/dist/cli/args.d.ts +1 -1
- package/dist/cli/args.js +3 -3
- package/dist/cli/runtime-launch-profile.d.ts +2 -2
- package/dist/cli/runtime-launch-profile.js +1 -1
- package/dist/cli.js +7038 -7179
- package/dist/config.d.ts +2 -0
- package/dist/config.js +16 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +4 -0
- package/dist/contracts/agent-api.d.ts +38 -5
- package/dist/contracts/agent-api.js +68 -18
- package/dist/contracts/agent-settings.d.ts +1 -1
- package/dist/contracts/model-call.d.ts +1 -1
- package/dist/contracts/model-stream.d.ts +2 -2
- package/dist/contracts/model-stream.js +3 -2
- package/dist/core/agent-controller.d.ts +3 -1
- package/dist/core/agent-controller.js +6 -0
- package/dist/core/agent-engine.d.ts +5 -1
- package/dist/core/agent-engine.js +9 -0
- package/dist/core/agent-loop.js +23 -0
- package/dist/core/core-types.d.ts +15 -0
- package/dist/core/index.d.ts +2 -2
- package/dist/core/permission-capabilities.d.ts +1 -1
- package/dist/core/permission-capabilities.js +1 -1
- package/dist/core/permission-policy.d.ts +4 -4
- package/dist/core/prompts/agent-guidelines.d.ts +3 -3
- package/dist/core/prompts/agent-guidelines.js +15 -18
- package/dist/embedded-agent/compose.js +17 -3
- package/dist/embedded-agent/context-review/agent.d.ts +2 -2
- package/dist/embedded-agent/context-review/agent.js +38 -49
- package/dist/embedded-agent/context-review/result.d.ts +2 -5
- package/dist/embedded-agent/context-review/result.js +36 -5
- package/dist/embedded-agent/host-runtime-options.d.ts +1 -1
- package/dist/embedded-agent/host-runtime-options.js +10 -42
- package/dist/embedded-agent/host-tools/build-tool-list.js +1 -0
- package/dist/embedded-agent/host-tools/execute-code/contract.d.ts +2 -0
- package/dist/embedded-agent/host-tools/execute-code/contract.js +15 -4
- package/dist/embedded-agent/host-tools/task/lifecycle.js +1 -0
- package/dist/embedded-agent/index.d.ts +2 -2
- package/dist/embedded-agent/prompt/modes/action.js +0 -1
- package/dist/embedded-agent/review/activity.d.ts +10 -0
- package/dist/embedded-agent/review/activity.js +44 -0
- package/dist/embedded-agent/review/agent.d.ts +1 -1
- package/dist/embedded-agent/review/agent.js +3 -2
- package/dist/embedded-agent/review/coordinator.d.ts +5 -3
- package/dist/embedded-agent/review/coordinator.js +19 -6
- package/dist/embedded-agent/review/findings.js +2 -2
- package/dist/main.js +68 -5
- package/dist/packages/mog-sandbox-runtime/src/prompts/mog-api-reference.json +645 -192
- package/dist/remote-control/whatsapp/transport.d.ts +2 -3
- package/dist/remote-control/whatsapp/transport.js +3 -20
- package/dist/rpc/index.d.ts +1 -1
- package/dist/rpc/rpc-approval-gates.js +1 -1
- package/dist/rpc/rpc-host.d.ts +13 -1
- package/dist/rpc/rpc-host.js +92 -15
- package/dist/rpc/rpc-mode.d.ts +1 -1
- package/dist/rpc/rpc-types.d.ts +65 -3
- package/dist/rpc/rpc-types.js +1 -1
- package/dist/sea/bootstrap.d.ts +11 -0
- package/dist/sea/bootstrap.js +17 -0
- package/dist/sea/runtime-assets.d.ts +14 -0
- package/dist/sea/runtime-assets.js +110 -0
- package/dist/sea/smoke.d.ts +3 -0
- package/dist/sea/smoke.js +52 -0
- package/dist/shared/images/photon.js +5 -3
- package/dist/shell/approvals/office-approval.d.ts +14 -0
- package/dist/shell/approvals/{excel-approval.js → office-approval.js} +3 -3
- package/dist/shell/approvals/runtime-approval-gates.js +2 -2
- package/dist/shell/commands/shorty-command.js +1 -1
- package/dist/shell/components/selectors/settings-selector.js +2 -2
- package/dist/shell/index.d.ts +1 -1
- package/dist/shell/index.js +1 -1
- package/dist/shell/interactive/interactive-mode.d.ts +1 -4
- package/dist/shell/interactive/interactive-mode.js +15 -68
- package/dist/shell/interactive/skills-workflow.d.ts +0 -6
- package/dist/shell/interactive/skills-workflow.js +9 -79
- package/dist/shell/presentation/slash-command-rendering.js +1 -1
- package/dist/shell/session-client.d.ts +2 -1
- package/dist/startup/interactive-commands.d.ts +2 -0
- package/dist/startup/interactive-commands.js +7 -1
- package/dist/startup/preflight/windows.d.ts +1 -0
- package/dist/startup/preflight/windows.js +62 -1
- package/dist/startup/sea-release.d.ts +5 -0
- package/dist/startup/sea-release.js +17 -0
- package/dist/startup/sea-update.d.ts +19 -0
- package/dist/startup/sea-update.js +100 -0
- package/dist/startup/skill-sync-commands.d.ts +22 -0
- package/dist/startup/skill-sync-commands.js +81 -0
- package/dist/startup/sync-xll.d.ts +1 -0
- package/dist/startup/sync-xll.js +34 -1
- package/dist/startup/terminal-update-flow.d.ts +1 -0
- package/dist/startup/terminal-update-flow.js +6 -3
- package/dist/startup/uninstall.js +34 -5
- package/dist/startup/update-execution.js +19 -7
- package/dist/startup/update-manager.d.ts +4 -0
- package/dist/startup/update-manager.js +22 -6
- package/dist/startup/windows-excel-runtime-upgrade.js +17 -15
- package/dist/startup/workbook-pre-prompt.d.ts +4 -2
- package/dist/startup/workbook-pre-prompt.js +17 -4
- package/dist/tool-names.d.ts +2 -0
- package/dist/tool-names.js +2 -0
- package/native-app/main/chunks/constants-D1yo8u9C.js +32 -0
- package/native-app/main/chunks/{linux-BNzCbzEv.js → linux-BbyBJPUK.js} +5 -3
- package/native-app/main/chunks/{mac-Brys445r.js → mac-CEzb62LU.js} +5 -3
- package/native-app/main/chunks/{setup-worker-protocol-DkeuNPNE.js → setup-worker-protocol-Bk1EVQnX.js} +32 -17
- package/native-app/main/chunks/{shared-DdhTDmUY.js → shared-Kic2CBJF.js} +2 -24
- package/native-app/main/index.js +91 -1777
- package/native-app/main/setup-worker.js +124 -23
- package/native-app/package.json +1 -1
- package/native-app/renderer/assets/{index-Beh8sTpE.css → index-CjXWevtW.css} +756 -90
- package/native-app/renderer/assets/{index-hkPksres.js → index-DttUIDtA.js} +883 -172
- package/native-app/renderer/index.html +2 -2
- package/package.json +4 -3
- package/plugins/shortcutxl/SKILL.md +13 -13
- package/plugins/shortcutxl/references/INSTALLATION.md +6 -6
- package/plugins/shortcutxl/skills/shortcutxl/SKILL.md +13 -13
- package/skills/advanced-mog-api/api-reference.json +645 -192
- package/skills/autonomous/SKILL.md +17 -13
- package/user-docs/dist/index.html +18 -19
- package/user-docs/security.md +1 -1
- package/xll/ShortcutPowerPoint.dll +0 -0
- package/xll/ShortcutWord.dll +0 -0
- package/xll/ShortcutXL.xll +0 -0
- package/xll/modules/shortcut_xl/_exec_entry.py +4 -1
- package/xll/modules/shortcut_xl/_office_com.py +50 -0
- package/xll/modules/shortcut_xl/_office_exec_entry.py +107 -0
- package/xll/modules/shortcut_xl/_threading.py +15 -5
- package/xll/python/Lib/site-packages/httpx-0.28.1.dist-info/RECORD +1 -1
- package/xll/python/Lib/site-packages/idna-3.18.dist-info/RECORD +1 -1
- package/xll/python/Lib/site-packages/pip-26.2.dist-info/RECORD +3 -3
- package/xll/python/Lib/site-packages/pywin32-311.dist-info/RECORD +2 -2
- package/xll/python/Scripts/httpx.exe +0 -0
- package/xll/python/Scripts/idna.exe +0 -0
- package/xll/python/Scripts/pip.exe +0 -0
- package/xll/python/Scripts/pip3.13.exe +0 -0
- package/xll/python/Scripts/pip3.exe +0 -0
- package/xll/python/Scripts/pywin32_postinstall.exe +0 -0
- package/xll/python/Scripts/pywin32_testall.exe +0 -0
- package/dist/embedded-agent/context-review/activity.d.ts +0 -4
- package/dist/embedded-agent/context-review/activity.js +0 -22
- package/dist/shell/approvals/excel-approval.d.ts +0 -14
- package/native-app/main/chunks/photon_rs-BibpYw4G.js +0 -1456
package/BINARY-INVENTORY.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-08-
|
|
3
|
+
"generatedAt": "2026-08-20T19:59:33.921Z",
|
|
4
4
|
"package": "shortcutxl",
|
|
5
5
|
"build": {
|
|
6
6
|
"builder": "github-actions",
|
|
7
7
|
"repository": "lyfegame/shortcut",
|
|
8
|
-
"sourceRef": "refs/heads/fix
|
|
9
|
-
"sourceCommit": "
|
|
10
|
-
"workflowRef": "lyfegame/shortcut/.github/workflows/release-shortcutxl.yml@refs/heads/fix
|
|
11
|
-
"runId": "
|
|
8
|
+
"sourceRef": "refs/heads/pwang724/fix-cli-app-approval-scrolling",
|
|
9
|
+
"sourceCommit": "9cc676833842002c8742057b44e12b6635f5888f",
|
|
10
|
+
"workflowRef": "lyfegame/shortcut/.github/workflows/release-shortcutxl.yml@refs/heads/pwang724/fix-cli-app-approval-scrolling",
|
|
11
|
+
"runId": "32411468790",
|
|
12
12
|
"runnerOs": "Windows",
|
|
13
13
|
"runnerImage": "win25-vs2026",
|
|
14
|
-
"runnerImageVersion": "
|
|
14
|
+
"runnerImageVersion": "20260818.207.1"
|
|
15
15
|
},
|
|
16
16
|
"binaryExtensions": [
|
|
17
17
|
".dll",
|
|
@@ -20,9 +20,25 @@
|
|
|
20
20
|
".xll"
|
|
21
21
|
],
|
|
22
22
|
"files": [
|
|
23
|
+
{
|
|
24
|
+
"path": "xll/ShortcutPowerPoint.dll",
|
|
25
|
+
"sha256": "5c5c7630cd30e36daaf85b944baee2bf84c1cb59c2dde40b05505b8dbf04239b",
|
|
26
|
+
"source": "ShortcutXL native PowerPoint COM add-in build",
|
|
27
|
+
"version": "package",
|
|
28
|
+
"builtBy": "shortcut",
|
|
29
|
+
"verification": "Built by shortcutXL/xll build scripts and hashed in BINARY-INVENTORY.json."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"path": "xll/ShortcutWord.dll",
|
|
33
|
+
"sha256": "2823c3604f6b7a6fdbabd3bedcdf31a66ec1d3dcd51e54284affb64969d8bcc5",
|
|
34
|
+
"source": "ShortcutXL native Word COM add-in build",
|
|
35
|
+
"version": "package",
|
|
36
|
+
"builtBy": "shortcut",
|
|
37
|
+
"verification": "Built by shortcutXL/xll build scripts and hashed in BINARY-INVENTORY.json."
|
|
38
|
+
},
|
|
23
39
|
{
|
|
24
40
|
"path": "xll/ShortcutXL.xll",
|
|
25
|
-
"sha256": "
|
|
41
|
+
"sha256": "b1d14ede58224be66163f924bd2259bfc1c586849743c2b97bb28de77b4072e4",
|
|
26
42
|
"source": "ShortcutXL native XLL build",
|
|
27
43
|
"version": "package",
|
|
28
44
|
"builtBy": "shortcut",
|
|
@@ -534,7 +550,7 @@
|
|
|
534
550
|
},
|
|
535
551
|
{
|
|
536
552
|
"path": "xll/python/Scripts/httpx.exe",
|
|
537
|
-
"sha256": "
|
|
553
|
+
"sha256": "6f8a9f92f6a4069c9563897fac73999dd5b2ca8243f4777913ae4100fb51eae8",
|
|
538
554
|
"source": "httpx console launcher installed into embedded Python",
|
|
539
555
|
"version": "see packaged httpx distribution",
|
|
540
556
|
"builtBy": "third-party",
|
|
@@ -542,7 +558,7 @@
|
|
|
542
558
|
},
|
|
543
559
|
{
|
|
544
560
|
"path": "xll/python/Scripts/idna.exe",
|
|
545
|
-
"sha256": "
|
|
561
|
+
"sha256": "f2222ae2caf7c715f65ed4d7769e0eb047bfd8cdaa0e8bb1298ffd4f9c9f4914",
|
|
546
562
|
"source": "Python package console launcher installed into embedded Python",
|
|
547
563
|
"version": "see owning Python package metadata in site-packages",
|
|
548
564
|
"builtBy": "third-party",
|
|
@@ -550,7 +566,7 @@
|
|
|
550
566
|
},
|
|
551
567
|
{
|
|
552
568
|
"path": "xll/python/Scripts/pip.exe",
|
|
553
|
-
"sha256": "
|
|
569
|
+
"sha256": "f60aaf7555f70c4076f52bf4bb58d6885273fe0dfd8dad13b5fbe6b46daa973b",
|
|
554
570
|
"source": "pip console launcher installed into embedded Python",
|
|
555
571
|
"version": "see packaged pip distribution",
|
|
556
572
|
"builtBy": "third-party",
|
|
@@ -558,7 +574,7 @@
|
|
|
558
574
|
},
|
|
559
575
|
{
|
|
560
576
|
"path": "xll/python/Scripts/pip3.13.exe",
|
|
561
|
-
"sha256": "
|
|
577
|
+
"sha256": "f60aaf7555f70c4076f52bf4bb58d6885273fe0dfd8dad13b5fbe6b46daa973b",
|
|
562
578
|
"source": "pip console launcher installed into embedded Python",
|
|
563
579
|
"version": "see packaged pip distribution",
|
|
564
580
|
"builtBy": "third-party",
|
|
@@ -566,7 +582,7 @@
|
|
|
566
582
|
},
|
|
567
583
|
{
|
|
568
584
|
"path": "xll/python/Scripts/pip3.exe",
|
|
569
|
-
"sha256": "
|
|
585
|
+
"sha256": "f60aaf7555f70c4076f52bf4bb58d6885273fe0dfd8dad13b5fbe6b46daa973b",
|
|
570
586
|
"source": "pip console launcher installed into embedded Python",
|
|
571
587
|
"version": "see packaged pip distribution",
|
|
572
588
|
"builtBy": "third-party",
|
|
@@ -574,7 +590,7 @@
|
|
|
574
590
|
},
|
|
575
591
|
{
|
|
576
592
|
"path": "xll/python/Scripts/pywin32_postinstall.exe",
|
|
577
|
-
"sha256": "
|
|
593
|
+
"sha256": "537ca79bfb736241887ca9017db7583dd6d566255d24f9005b598949ae1059d1",
|
|
578
594
|
"source": "Python package console launcher installed into embedded Python",
|
|
579
595
|
"version": "see owning Python package metadata in site-packages",
|
|
580
596
|
"builtBy": "third-party",
|
|
@@ -582,7 +598,7 @@
|
|
|
582
598
|
},
|
|
583
599
|
{
|
|
584
600
|
"path": "xll/python/Scripts/pywin32_testall.exe",
|
|
585
|
-
"sha256": "
|
|
601
|
+
"sha256": "d0884c20bf24120ac7f100096f597452e5b01470bfdbc77c998fcc69ff58295a",
|
|
586
602
|
"source": "Python package console launcher installed into embedded Python",
|
|
587
603
|
"version": "see owning Python package metadata in site-packages",
|
|
588
604
|
"builtBy": "third-party",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.85]
|
|
4
|
+
|
|
5
|
+
- **Scrollable approval dialogs** - Long approval requests in the native app now remain fully accessible.
|
|
6
|
+
|
|
7
|
+
## [0.3.84]
|
|
8
|
+
|
|
9
|
+
- **UI improvements**
|
|
10
|
+
- **Shared Office approvals** - Excel, Word, and PowerPoint now use one clearly labeled approval setting across the CLI and native app.
|
|
11
|
+
|
|
3
12
|
## [0.3.83]
|
|
4
13
|
|
|
5
14
|
- **More reliable native app chats**
|
package/agent-docs/README.md
CHANGED
|
@@ -317,19 +317,19 @@ shortcut config # Enable/disable package resources
|
|
|
317
317
|
|
|
318
318
|
### Permission Options
|
|
319
319
|
|
|
320
|
-
Shortcut has separate controls for runtime permissions and
|
|
320
|
+
Shortcut has separate controls for runtime permissions and Office permissions. Use the flag that matches the permission boundary you want to bypass for a single session.
|
|
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-
|
|
325
|
+
| `--skip-office-permissions` | Allow headless Excel, Word, and PowerPoint auto-approval for this session |
|
|
326
326
|
|
|
327
|
-
Runtime and
|
|
327
|
+
Runtime and Office approvals are separate. `--skip-runtime-permissions` affects runtime-owned filesystem and shell checks; it does not change Office approvals. `--skip-office-permissions` affects headless Excel, Word, and PowerPoint approval only; it does not bypass runtime filesystem or shell checks.
|
|
328
328
|
|
|
329
|
-
Use both flags when a non-interactive run needs both runtime access and
|
|
329
|
+
Use both flags when a non-interactive run needs both runtime access and Office auto-approval:
|
|
330
330
|
|
|
331
331
|
```bash
|
|
332
|
-
shortcut --skip-runtime-permissions --skip-
|
|
332
|
+
shortcut --skip-runtime-permissions --skip-office-permissions -p "..."
|
|
333
333
|
```
|
|
334
334
|
|
|
335
335
|
In an interactive session, use `/permissions skip-runtime-permissions` to inspect or change the runtime bypass setting.
|
package/binary-provenance.json
CHANGED
|
@@ -8,6 +8,20 @@
|
|
|
8
8
|
"builtBy": "shortcut",
|
|
9
9
|
"verification": "Built by shortcutXL/xll build scripts and hashed in BINARY-INVENTORY.json."
|
|
10
10
|
},
|
|
11
|
+
{
|
|
12
|
+
"pattern": "xll/ShortcutWord.dll",
|
|
13
|
+
"source": "ShortcutXL native Word COM add-in build",
|
|
14
|
+
"version": "package",
|
|
15
|
+
"builtBy": "shortcut",
|
|
16
|
+
"verification": "Built by shortcutXL/xll build scripts and hashed in BINARY-INVENTORY.json."
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"pattern": "xll/ShortcutPowerPoint.dll",
|
|
20
|
+
"source": "ShortcutXL native PowerPoint COM add-in build",
|
|
21
|
+
"version": "package",
|
|
22
|
+
"builtBy": "shortcut",
|
|
23
|
+
"verification": "Built by shortcutXL/xll build scripts and hashed in BINARY-INVENTORY.json."
|
|
24
|
+
},
|
|
11
25
|
{
|
|
12
26
|
"pattern": "xll/python/python*.exe",
|
|
13
27
|
"source": "CPython Windows embeddable runtime launcher",
|
|
@@ -203,6 +203,8 @@ export declare class AgentSession {
|
|
|
203
203
|
private _removeLastErrorGroup;
|
|
204
204
|
/** Internal handler for agent events - shared by subscribe and reconnect */
|
|
205
205
|
private _handleAgentLoopEvent;
|
|
206
|
+
/** Emit one canonical run_agent event when a delivered user message begins execution. */
|
|
207
|
+
private _handleUserMessageExecutionStart;
|
|
206
208
|
/** True when the assistant message indicates the conversation has overflowed the model context. */
|
|
207
209
|
private _checkContextOverflow;
|
|
208
210
|
/** On agent_end, eagerly arm the recovery retry promise before queued event processing runs. */
|
|
@@ -35,7 +35,7 @@ import { formatRuntimePermissionBypassReminder } from './session/permission-cont
|
|
|
35
35
|
import { PersistenceHandler } from './session/persistence-handler.js';
|
|
36
36
|
import { assertNotExtensionCommand, buildMessageContent, normalizeUserContent, tryExtensionCommand } from './session/prompt-pipeline.js';
|
|
37
37
|
import { QueueTracker } from './session/queue-tracker.js';
|
|
38
|
-
import { buildRunAgentMetadata, emitRunAgent, summarizeDeliveredUserContent } from './session/run-agent-observability.js';
|
|
38
|
+
import { buildRunAgentConfigMetadata, buildRunAgentMetadata, emitRunAgent, summarizeDeliveredUserContent } from './session/run-agent-observability.js';
|
|
39
39
|
import { SessionBudgetContinuation } from './session/session-budget-continuation.js';
|
|
40
40
|
import { executeNewSession, executeSwitchSession } from './session/session-lifecycle.js';
|
|
41
41
|
import { getAvailableThinkingLevels, supportsThinking, supportsXhighThinking } from './session/session-models.js';
|
|
@@ -244,6 +244,9 @@ export class AgentSession {
|
|
|
244
244
|
this._recovery.onEvent((event) => this._emit(event));
|
|
245
245
|
this._compaction.onEvent((event) => this._emit(event));
|
|
246
246
|
this._budgetContinuation.onEvent((event) => this._emit(event));
|
|
247
|
+
// The loop invokes this at the authoritative model-request boundary, before
|
|
248
|
+
// mutable session settings can drift from the active turn's frozen config.
|
|
249
|
+
this.agent.onUserMessageExecutionStart = this._handleUserMessageExecutionStart;
|
|
247
250
|
// Always subscribe to agent events for internal handling
|
|
248
251
|
// (session persistence, extensions, auto-compaction, retry logic)
|
|
249
252
|
this._unsubscribeAgent = this.agent.subscribe(this._handleAgentLoopEvent);
|
|
@@ -302,6 +305,39 @@ export class AgentSession {
|
|
|
302
305
|
// Keep queue alive if an event handler fails
|
|
303
306
|
this._agentEventQueue.catch(() => { });
|
|
304
307
|
};
|
|
308
|
+
/** Emit one canonical run_agent event when a delivered user message begins execution. */
|
|
309
|
+
_handleUserMessageExecutionStart = (execution) => {
|
|
310
|
+
const deliveredContent = summarizeDeliveredUserContent(execution.message.content);
|
|
311
|
+
const pendingMetadata = this._pendingImmediateRunAgentMetadata;
|
|
312
|
+
const conversationId = this.sessionManager.getSessionId();
|
|
313
|
+
const userMessageId = typeof execution.message.id === 'string' && execution.message.id.length > 0
|
|
314
|
+
? execution.message.id
|
|
315
|
+
: undefined;
|
|
316
|
+
this._pendingImmediateRunAgentMetadata = undefined;
|
|
317
|
+
emitRunAgent(this._observability, {
|
|
318
|
+
...(pendingMetadata ??
|
|
319
|
+
buildRunAgentMetadata({
|
|
320
|
+
charCount: deliveredContent.charCount,
|
|
321
|
+
imageCount: deliveredContent.imageCount,
|
|
322
|
+
conversationId,
|
|
323
|
+
userMessageId
|
|
324
|
+
})),
|
|
325
|
+
conversationId,
|
|
326
|
+
thread_id: conversationId,
|
|
327
|
+
platform: 'cli',
|
|
328
|
+
...buildRunAgentConfigMetadata({
|
|
329
|
+
modelName: execution.modelName,
|
|
330
|
+
speedMode: execution.speedMode,
|
|
331
|
+
thinkingLevel: execution.thinkingLevel,
|
|
332
|
+
supportsReasoning: execution.supportsReasoning,
|
|
333
|
+
interactionMode: this._currentModeName
|
|
334
|
+
}),
|
|
335
|
+
char_count: deliveredContent.charCount,
|
|
336
|
+
message_length: deliveredContent.charCount,
|
|
337
|
+
image_count: deliveredContent.imageCount,
|
|
338
|
+
...(userMessageId ? { user_message_id: userMessageId, turnId: userMessageId } : {})
|
|
339
|
+
});
|
|
340
|
+
};
|
|
305
341
|
/** True when the assistant message indicates the conversation has overflowed the model context. */
|
|
306
342
|
_checkContextOverflow = (msg) => {
|
|
307
343
|
return isContextOverflow(msg, this.model?.contextWindow ?? 0);
|
|
@@ -351,32 +387,6 @@ export class AgentSession {
|
|
|
351
387
|
async _processAgentLoopEvent(event) {
|
|
352
388
|
// --- Step 1: Queue tracking (sync) ---
|
|
353
389
|
this._queueTracker.handle(event);
|
|
354
|
-
if (event.type === 'message_start' && event.message.role === 'user') {
|
|
355
|
-
const deliveredContent = summarizeDeliveredUserContent(event.message.content);
|
|
356
|
-
const pendingMetadata = this._pendingImmediateRunAgentMetadata;
|
|
357
|
-
const conversationId = this.sessionManager.getSessionId();
|
|
358
|
-
const userMessageId = typeof event.message.id === 'string' && event.message.id.length > 0
|
|
359
|
-
? event.message.id
|
|
360
|
-
: undefined;
|
|
361
|
-
this._pendingImmediateRunAgentMetadata = undefined;
|
|
362
|
-
emitRunAgent(this._observability, {
|
|
363
|
-
...(pendingMetadata ??
|
|
364
|
-
buildRunAgentMetadata({
|
|
365
|
-
charCount: deliveredContent.charCount,
|
|
366
|
-
imageCount: deliveredContent.imageCount,
|
|
367
|
-
conversationId,
|
|
368
|
-
modelName: this.agent.state.model?.id,
|
|
369
|
-
userMessageId
|
|
370
|
-
})),
|
|
371
|
-
conversationId,
|
|
372
|
-
thread_id: conversationId,
|
|
373
|
-
platform: 'cli',
|
|
374
|
-
char_count: deliveredContent.charCount,
|
|
375
|
-
message_length: deliveredContent.charCount,
|
|
376
|
-
image_count: deliveredContent.imageCount,
|
|
377
|
-
...(userMessageId ? { user_message_id: userMessageId, turnId: userMessageId } : {})
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
390
|
// --- Step 2: Extensions (async — must complete before persistence) ---
|
|
381
391
|
// Reset turnIndex on agent_start BEFORE the snapshot so extensions see 0.
|
|
382
392
|
if (event.type === 'agent_start') {
|
|
@@ -606,6 +616,9 @@ export class AgentSession {
|
|
|
606
616
|
*/
|
|
607
617
|
dispose() {
|
|
608
618
|
this._disconnectFromAgent();
|
|
619
|
+
if (this.agent.onUserMessageExecutionStart === this._handleUserMessageExecutionStart) {
|
|
620
|
+
this.agent.onUserMessageExecutionStart = undefined;
|
|
621
|
+
}
|
|
609
622
|
this._summaryEmitter.abort();
|
|
610
623
|
this._eventListeners = [];
|
|
611
624
|
}
|
|
@@ -975,6 +988,11 @@ export class AgentSession {
|
|
|
975
988
|
conversationId: this.sessionManager.getSessionId(),
|
|
976
989
|
workbookDetails,
|
|
977
990
|
modelName: this.agent.state.model?.id,
|
|
991
|
+
speedMode: this.agent.speed ?? 'standard',
|
|
992
|
+
thinkingLevel: this.agent.state.thinkingLevel,
|
|
993
|
+
supportsReasoning: this.agent.state.model
|
|
994
|
+
? Boolean(this.agent.state.model.reasoning)
|
|
995
|
+
: undefined,
|
|
978
996
|
userMessageId
|
|
979
997
|
});
|
|
980
998
|
this._pendingImmediateRunAgentMetadata = promptMetadata;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OfficeApprovalPayload } from '../local/tools/execute-code/approval-payload.js';
|
|
2
2
|
import type { ApprovalGate, BashApprovalData, FileAccessApprovalData, SwitchModeApprovalData } from './types.js';
|
|
3
3
|
/** Approval gates required by the local Shortcut runtime composition root. */
|
|
4
4
|
export interface RuntimeApprovalGates {
|
|
5
5
|
readonly bash: ApprovalGate<BashApprovalData>;
|
|
6
|
-
readonly
|
|
6
|
+
readonly office: ApprovalGate<OfficeApprovalPayload>;
|
|
7
7
|
readonly fileAccess: ApprovalGate<FileAccessApprovalData>;
|
|
8
8
|
readonly switchMode: ApprovalGate<SwitchModeApprovalData>;
|
|
9
9
|
}
|
|
@@ -96,6 +96,12 @@ export interface ExtensionUIDialogOptions {
|
|
|
96
96
|
signal?: AbortSignal;
|
|
97
97
|
/** Timeout in milliseconds. Dialog auto-dismisses with live countdown display. */
|
|
98
98
|
timeout?: number;
|
|
99
|
+
/** Optional host-facing context shown above a confirmation title. */
|
|
100
|
+
eyebrow?: string;
|
|
101
|
+
/** Optional host-facing confirmation action label. */
|
|
102
|
+
confirmLabel?: string;
|
|
103
|
+
/** Optional host-facing cancellation action label. */
|
|
104
|
+
cancelLabel?: string;
|
|
99
105
|
}
|
|
100
106
|
/**
|
|
101
107
|
* UI context for extensions to request interactive UI.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface OfficeApprovalOperation {
|
|
2
2
|
label: string;
|
|
3
3
|
reason: string;
|
|
4
4
|
}
|
|
@@ -6,12 +6,12 @@ export interface ExcelDiffApprovalPayload {
|
|
|
6
6
|
kind: 'diff';
|
|
7
7
|
description: string;
|
|
8
8
|
}
|
|
9
|
-
export interface
|
|
9
|
+
export interface OfficeDangerousApprovalPayload {
|
|
10
10
|
kind: 'dangerous';
|
|
11
11
|
description: string;
|
|
12
12
|
title: string;
|
|
13
13
|
summary: string;
|
|
14
|
-
operations:
|
|
14
|
+
operations: OfficeApprovalOperation[];
|
|
15
15
|
}
|
|
16
|
-
export type
|
|
16
|
+
export type OfficeApprovalPayload = ExcelDiffApprovalPayload | OfficeDangerousApprovalPayload;
|
|
17
17
|
//# sourceMappingURL=approval-payload.d.ts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import { type ApprovalChoice, type ApprovalGate, type ApprovalRequest } from '../../../approvals/types.js';
|
|
13
13
|
import type { ExtensionContext } from '../../../extensions/index.js';
|
|
14
14
|
import type { ExcelHostEndpoint } from '../../../xll/host-registry.js';
|
|
15
|
-
import type {
|
|
15
|
+
import type { OfficeApprovalPayload } from './approval-payload.js';
|
|
16
16
|
import { type DiffPayload } from './diff.js';
|
|
17
17
|
import { type EditModeRetryTiming } from './edit-mode-retry.js';
|
|
18
18
|
export interface ComExecResult {
|
|
@@ -30,11 +30,11 @@ export interface LocalExecResult {
|
|
|
30
30
|
approvalSummaries?: string[];
|
|
31
31
|
}
|
|
32
32
|
export interface ExcelExecApprovalObservability {
|
|
33
|
-
onRequested?: (request: ApprovalRequest<
|
|
34
|
-
onAccepted?: (request: ApprovalRequest<
|
|
35
|
-
onRejected?: (request: ApprovalRequest<
|
|
36
|
-
onReverted?: (request: ApprovalRequest<
|
|
37
|
-
onRevertFailed?: (request: ApprovalRequest<
|
|
33
|
+
onRequested?: (request: ApprovalRequest<OfficeApprovalPayload>) => void;
|
|
34
|
+
onAccepted?: (request: ApprovalRequest<OfficeApprovalPayload>, choice: ApprovalChoice) => void;
|
|
35
|
+
onRejected?: (request: ApprovalRequest<OfficeApprovalPayload>) => void;
|
|
36
|
+
onReverted?: (request: ApprovalRequest<OfficeApprovalPayload>) => void;
|
|
37
|
+
onRevertFailed?: (request: ApprovalRequest<OfficeApprovalPayload>) => void;
|
|
38
38
|
}
|
|
39
39
|
interface ApprovalResolution {
|
|
40
40
|
outcome: ApprovalOutcome;
|
|
@@ -45,7 +45,7 @@ export declare function isComExecResult(v: unknown): v is ComExecResult;
|
|
|
45
45
|
/**
|
|
46
46
|
* Resolve approval for cell changes: show UI if needed, then revert or cleanup.
|
|
47
47
|
*/
|
|
48
|
-
export declare function resolveApproval(result: ComExecResult, approval: ApprovalGate<
|
|
48
|
+
export declare function resolveApproval(result: ComExecResult, approval: ApprovalGate<OfficeApprovalPayload> | undefined, postControl: (body: object) => Promise<Response>, ctx: ExtensionContext, description?: string, observability?: ExcelExecApprovalObservability, priorApprovalSummaries?: string[]): Promise<ApprovalResolution>;
|
|
49
49
|
/**
|
|
50
50
|
* Execute code against the local XLL and run approval.
|
|
51
51
|
*
|
|
@@ -53,7 +53,7 @@ export declare function resolveApproval(result: ComExecResult, approval: Approva
|
|
|
53
53
|
* The selected XLL endpoint is always local to the machine running the agent.
|
|
54
54
|
*/
|
|
55
55
|
export declare function executeComLocally(excelTarget: ExcelHostEndpoint, code: string, options?: {
|
|
56
|
-
approval?: ApprovalGate<
|
|
56
|
+
approval?: ApprovalGate<OfficeApprovalPayload>;
|
|
57
57
|
ctx?: ExtensionContext;
|
|
58
58
|
description?: string;
|
|
59
59
|
signal?: AbortSignal;
|
|
@@ -81,7 +81,7 @@ async function requestAlwaysConfirmApproval(approval, ctx, description, dangerou
|
|
|
81
81
|
isSafe: false,
|
|
82
82
|
isAutoApproved: approval?.isAutoApproved() ?? false,
|
|
83
83
|
alwaysRequireExplicitApproval: true,
|
|
84
|
-
allowHeadlessApproval: ctx?.permissionPolicy?.
|
|
84
|
+
allowHeadlessApproval: ctx?.permissionPolicy?.office.allowHeadlessApproval ?? false
|
|
85
85
|
});
|
|
86
86
|
if (decision !== 'prompt' || !approval || !ctx) {
|
|
87
87
|
observability?.onRejected?.(request);
|
|
@@ -121,7 +121,7 @@ export async function resolveApproval(result, approval, postControl, ctx, descri
|
|
|
121
121
|
isSafe: false,
|
|
122
122
|
isAutoApproved: approval?.isAutoApproved() ?? false,
|
|
123
123
|
alwaysRequireExplicitApproval: false,
|
|
124
|
-
allowHeadlessApproval: ctx.permissionPolicy?.
|
|
124
|
+
allowHeadlessApproval: ctx.permissionPolicy?.office.allowHeadlessApproval ?? false
|
|
125
125
|
});
|
|
126
126
|
if (decision === 'prompt') {
|
|
127
127
|
if (!approval) {
|
|
@@ -266,7 +266,7 @@ export async function executeComLocally(excelTarget, code, options) {
|
|
|
266
266
|
isSafe: analysis.isReadOnly,
|
|
267
267
|
isAutoApproved: approval?.isAutoApproved() ?? false,
|
|
268
268
|
alwaysRequireExplicitApproval: false,
|
|
269
|
-
allowHeadlessApproval: ctx?.permissionPolicy?.
|
|
269
|
+
allowHeadlessApproval: ctx?.permissionPolicy?.office.allowHeadlessApproval ?? false
|
|
270
270
|
});
|
|
271
271
|
if (executionDecision === 'deny') {
|
|
272
272
|
return {
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
import type { ToolDefinition } from '../../../../core/core-types.js';
|
|
9
9
|
import type { ApprovalGate } from '../../../approvals/types.js';
|
|
10
10
|
import type { ExcelTargetResolver } from '../../../xll/excel-target.js';
|
|
11
|
-
import type {
|
|
11
|
+
import type { OfficeApprovalPayload } from './approval-payload.js';
|
|
12
12
|
import { type ComExecResult, type ExcelExecApprovalObservability } from './executor.js';
|
|
13
13
|
declare const schema: import("@sinclair/typebox").TObject<{
|
|
14
14
|
description: import("@sinclair/typebox").TString;
|
|
15
15
|
code: import("@sinclair/typebox").TString;
|
|
16
16
|
}>;
|
|
17
|
-
export declare function createExcelExecTool(resolveTarget: ExcelTargetResolver, approval?: ApprovalGate<
|
|
17
|
+
export declare function createExcelExecTool(resolveTarget: ExcelTargetResolver, approval?: ApprovalGate<OfficeApprovalPayload>, observability?: ExcelExecApprovalObservability): ToolDefinition<typeof schema, ComExecResult>;
|
|
18
18
|
export {};
|
|
19
19
|
//# sourceMappingURL=tool.d.ts.map
|
|
@@ -48,9 +48,9 @@ const schema = Type.Object({
|
|
|
48
48
|
})
|
|
49
49
|
});
|
|
50
50
|
export function createExcelExecTool(resolveTarget, approval, observability) {
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
if (!
|
|
51
|
+
const assertOfficePolicy = (ctx) => {
|
|
52
|
+
const officePolicy = ctx?.permissionPolicy?.office;
|
|
53
|
+
if (!officePolicy || officePolicy.mutationBehavior !== 'deny') {
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
56
|
throw new Error('Spreadsheet execution is denied by the current permission policy.');
|
|
@@ -62,7 +62,7 @@ export function createExcelExecTool(resolveTarget, approval, observability) {
|
|
|
62
62
|
description: TOOL_DESCRIPTION,
|
|
63
63
|
parameters: schema,
|
|
64
64
|
async execute(_toolCallId, { code, description }, signal, _onUpdate, ctx) {
|
|
65
|
-
|
|
65
|
+
assertOfficePolicy(ctx);
|
|
66
66
|
const excelTarget = await resolveTarget();
|
|
67
67
|
const { result, outcome, approvalSummaries } = await executeComLocally(excelTarget, code, {
|
|
68
68
|
approval,
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* This means comments or string literals containing write patterns will
|
|
13
13
|
* trigger approval — that's fine.
|
|
14
14
|
*/
|
|
15
|
-
import type {
|
|
15
|
+
import type { OfficeApprovalOperation } from './approval-payload.js';
|
|
16
16
|
/** Exported for the sync test to verify against Python source. */
|
|
17
17
|
export declare const COM_WRAPPED_API_WRITE_OPS: string[];
|
|
18
18
|
interface CodeAnalysis {
|
|
@@ -20,7 +20,7 @@ interface CodeAnalysis {
|
|
|
20
20
|
/** First matched pattern label (for logging/debugging), or null if read-only. */
|
|
21
21
|
matchedPattern: string | null;
|
|
22
22
|
alwaysRequireApproval: boolean;
|
|
23
|
-
dangerousOperations:
|
|
23
|
+
dangerousOperations: OfficeApprovalOperation[];
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Analyze COM-backed execute_code Python for write operations.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DesktopOfficeApplication } from '../../../xll/office-target.js';
|
|
2
|
+
export interface OfficeExecOperation {
|
|
3
|
+
label: string;
|
|
4
|
+
reason: string;
|
|
5
|
+
}
|
|
6
|
+
export interface OfficeCodeAnalysis {
|
|
7
|
+
isReadOnly: boolean;
|
|
8
|
+
alwaysRequireApproval: boolean;
|
|
9
|
+
matchedPattern: string | null;
|
|
10
|
+
dangerousOperations: OfficeExecOperation[];
|
|
11
|
+
}
|
|
12
|
+
/** Conservatively classify raw Word/PowerPoint COM code before execution. */
|
|
13
|
+
export declare function analyzeOfficeCode(code: string, _application: DesktopOfficeApplication): OfficeCodeAnalysis;
|
|
14
|
+
//# sourceMappingURL=analyzer.d.ts.map
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
const ALWAYS_CONFIRM = [
|
|
2
|
+
{
|
|
3
|
+
label: 'Quit Office application',
|
|
4
|
+
reason: 'This closes the application and can discard unsaved document state.',
|
|
5
|
+
pattern: /\.Quit\s*\(/
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
label: 'Close document or presentation',
|
|
9
|
+
reason: 'This closes an Office file or window and can discard unsaved changes.',
|
|
10
|
+
pattern: /\.Close\s*\(/
|
|
11
|
+
}
|
|
12
|
+
];
|
|
13
|
+
const MUTATION_PATTERNS = [
|
|
14
|
+
/\.\w+(?:\.\w+)*\s*(?:\*\*|\/\/|<<|>>|[+\-*\/%@&|^])?=(?!=)/,
|
|
15
|
+
/\[[^\]]+\]\s*(?:\*\*|\/\/|<<|>>|[+\-*\/%@&|^])?=(?!=)/,
|
|
16
|
+
/\b(?:setattr|delattr|exec|eval)\s*\(/,
|
|
17
|
+
/\.(?:Add|Delete|Insert|InsertAfter|InsertBefore|TypeText|Paste|PasteSpecial)\s*\(/,
|
|
18
|
+
/\.(?:Save|SaveAs|SaveCopyAs|Export|ExportAsFixedFormat|PrintOut)\s*\(/,
|
|
19
|
+
/\.(?:Apply|Activate|Select|Move|Copy|Cut|Duplicate|Reset)\s*\(/
|
|
20
|
+
];
|
|
21
|
+
const READ_ONLY_METHODS = new Set([
|
|
22
|
+
'Item',
|
|
23
|
+
'Range',
|
|
24
|
+
'Cell',
|
|
25
|
+
'Characters',
|
|
26
|
+
'Words',
|
|
27
|
+
'Sentences',
|
|
28
|
+
'Paragraphs',
|
|
29
|
+
'Sections',
|
|
30
|
+
'ComputeStatistics'
|
|
31
|
+
]);
|
|
32
|
+
const SAFE_FUNCTIONS = new Set([
|
|
33
|
+
'print',
|
|
34
|
+
'len',
|
|
35
|
+
'str',
|
|
36
|
+
'int',
|
|
37
|
+
'float',
|
|
38
|
+
'bool',
|
|
39
|
+
'list',
|
|
40
|
+
'dict',
|
|
41
|
+
'tuple',
|
|
42
|
+
'set',
|
|
43
|
+
'range',
|
|
44
|
+
'enumerate',
|
|
45
|
+
'sorted',
|
|
46
|
+
'min',
|
|
47
|
+
'max',
|
|
48
|
+
'sum',
|
|
49
|
+
'any',
|
|
50
|
+
'all',
|
|
51
|
+
'isinstance',
|
|
52
|
+
'type',
|
|
53
|
+
'repr',
|
|
54
|
+
'round'
|
|
55
|
+
]);
|
|
56
|
+
/** Conservatively classify raw Word/PowerPoint COM code before execution. */
|
|
57
|
+
export function analyzeOfficeCode(code, _application) {
|
|
58
|
+
const dangerousOperations = ALWAYS_CONFIRM.filter(({ pattern }) => pattern.test(code)).map(({ label, reason }) => ({ label, reason }));
|
|
59
|
+
if (dangerousOperations.length > 0) {
|
|
60
|
+
return {
|
|
61
|
+
isReadOnly: false,
|
|
62
|
+
alwaysRequireApproval: true,
|
|
63
|
+
matchedPattern: dangerousOperations[0]?.label ?? null,
|
|
64
|
+
dangerousOperations
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
for (const pattern of MUTATION_PATTERNS) {
|
|
68
|
+
if (pattern.test(code)) {
|
|
69
|
+
return {
|
|
70
|
+
isReadOnly: false,
|
|
71
|
+
alwaysRequireApproval: false,
|
|
72
|
+
matchedPattern: pattern.source,
|
|
73
|
+
dangerousOperations: []
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
for (const match of code.matchAll(/\.([A-Za-z_]\w*)\s*\(/g)) {
|
|
78
|
+
const method = match[1];
|
|
79
|
+
if (method && !READ_ONLY_METHODS.has(method)) {
|
|
80
|
+
return {
|
|
81
|
+
isReadOnly: false,
|
|
82
|
+
alwaysRequireApproval: false,
|
|
83
|
+
matchedPattern: `unknown COM method: ${method}`,
|
|
84
|
+
dangerousOperations: []
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
for (const match of code.matchAll(/(?<![.\w])([A-Za-z_]\w*)\s*\(/g)) {
|
|
89
|
+
const fn = match[1];
|
|
90
|
+
if (fn && !SAFE_FUNCTIONS.has(fn)) {
|
|
91
|
+
return {
|
|
92
|
+
isReadOnly: false,
|
|
93
|
+
alwaysRequireApproval: false,
|
|
94
|
+
matchedPattern: `unknown function: ${fn}`,
|
|
95
|
+
dangerousOperations: []
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
isReadOnly: true,
|
|
101
|
+
alwaysRequireApproval: false,
|
|
102
|
+
matchedPattern: null,
|
|
103
|
+
dangerousOperations: []
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=analyzer.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ToolDefinition } from '../../../../core/core-types.js';
|
|
2
|
+
import { type ApprovalGate } from '../../../approvals/types.js';
|
|
3
|
+
import type { DesktopOfficeApplication, OfficeTargetResolver } from '../../../xll/office-target.js';
|
|
4
|
+
import type { OfficeApprovalPayload } from '../execute-code/approval-payload.js';
|
|
5
|
+
export declare const WORD_EXEC_TOOL_SUMMARY = "Execute raw Python against the local Microsoft Word COM application.";
|
|
6
|
+
export declare const POWERPOINT_EXEC_TOOL_SUMMARY = "Execute raw Python against the local Microsoft PowerPoint COM application.";
|
|
7
|
+
export interface OfficeExecResult {
|
|
8
|
+
ok: boolean;
|
|
9
|
+
output?: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
host: {
|
|
12
|
+
application: DesktopOfficeApplication;
|
|
13
|
+
hostId: string;
|
|
14
|
+
pid: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
declare const schema: import("@sinclair/typebox").TObject<{
|
|
18
|
+
description: import("@sinclair/typebox").TString;
|
|
19
|
+
code: import("@sinclair/typebox").TString;
|
|
20
|
+
}>;
|
|
21
|
+
export declare function createOfficeExecTool(application: DesktopOfficeApplication, resolveTarget: OfficeTargetResolver, approval?: ApprovalGate<OfficeApprovalPayload>): ToolDefinition<typeof schema, OfficeExecResult | undefined>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=tool.d.ts.map
|