@drawsy/companion 0.1.30 → 0.1.32

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/README.md CHANGED
@@ -1,78 +1,67 @@
1
- # Drawsy Companion from your terminal
1
+ # Install Drawsy Companion
2
2
 
3
- The CLI runs the same local Companion server without the desktop app. It connects Drawsy to your existing Codex/OpenCode installation. It does not install either engine, sign you in, or change their authentication settings.
3
+ Choose the desktop app unless you specifically want to control Companion from a terminal.
4
4
 
5
- ## Requirements
5
+ ## Desktop app: one line, no Node.js needed
6
6
 
7
- - Windows, macOS, or Linux.
8
- - Node.js 22 or later with npm, installed for your user account.
9
- - The public npm package [@drawsy/companion](https://www.npmjs.com/package/@drawsy/companion).
7
+ Open Terminal on macOS/Linux, or Command Prompt or PowerShell on Windows. The desktop app does not need Node.js, npm, administrator access, or `sudo`.
10
8
 
11
- The package is published under Drawsy's npm account. A public package does not require a paid private npm plan. No paid app signing certificate or Microsoft Store approval is required for this Node.js CLI package; the separate desktop app has its own release requirements.
9
+ macOS (Apple Silicon) or Linux (x64):
12
10
 
13
- ## Install permanently
11
+ ```sh
12
+ curl -fsSL https://raw.githubusercontent.com/DrawsyAI/drawsy-ai-companion/main/scripts/install.sh | sh
13
+ ```
14
14
 
15
- Install the public npm package:
15
+ Windows (64-bit), in Command Prompt or PowerShell:
16
16
 
17
- ```sh
18
- npm install --global --ignore-scripts @drawsy/companion
17
+ ```cmd
18
+ winget install --id 9PD4MGJ9BW4F --source msstore
19
19
  ```
20
20
 
21
- This installs the CLI globally; npx is not needed. npm must be configured so your user account can install global packages; this flow does not request administrator access.
21
+ This installs the Store version. You can also [open the Microsoft Store listing](https://apps.microsoft.com/detail/9PD4MGJ9BW4F). The GitHub release page still includes an unsigned Windows `.exe` and `.zip` for people who specifically need those files; Windows may show a security warning for them.
22
22
 
23
- Once installed, run:
23
+ The macOS/Linux command downloads the latest stable GitHub release, checks its SHA-256 checksum, installs it for your account, and opens Companion. To update the desktop app, close Companion and run the same install command again. To update the Windows Store app, update it through Microsoft Store. Supported builds are Apple Silicon macOS, 64-bit Windows, and x64 Linux.
24
24
 
25
- ```sh
26
- drawsy-companion setup
27
- ```
25
+ The desktop app stays available in the tray/menu bar while it is open. It does not start automatically when you sign in. Closing its window leaves it running in the background; choose **Quit Drawsy Companion** from the tray/menu to stop it.
28
26
 
29
- Running `drawsy-companion` by itself shows the local status without changing startup settings. `setup` starts Companion in the background and enables startup when you sign in. Then open [Drawsy](https://drawsyai.com), the URL allowed by the Companion connection policy. Closing the terminal does not stop the background server.
27
+ ## Terminal CLI: background service and controls
30
28
 
31
- To install and set up in one line:
29
+ Choose this if you want Companion to run without its desktop window and start when you sign in. It requires Node.js 22 or later to remain installed. Use npm, pnpm, or Bun only if you already have it; there is no need to install another package manager.
32
30
 
33
- macOS/Linux:
31
+ macOS/Linux, using npm:
34
32
 
35
33
  ```sh
36
- npm install --global --ignore-scripts @drawsy/companion && drawsy-companion setup
34
+ npm install --global --ignore-scripts @drawsy/companion@latest && drawsy-companion setup
37
35
  ```
38
36
 
39
- Windows PowerShell:
37
+ Windows PowerShell, using npm:
40
38
 
41
39
  ```powershell
42
- npm.cmd install --global --ignore-scripts @drawsy/companion; if ($LASTEXITCODE -eq 0) { drawsy-companion.cmd setup }
40
+ npm.cmd install --global --ignore-scripts @drawsy/companion@latest; if ($LASTEXITCODE -eq 0) { drawsy-companion.cmd setup }
43
41
  ```
44
42
 
45
- The Windows `.cmd` commands avoid requiring a PowerShell script execution policy change.
46
-
47
- ### Optional GitHub tarball source
48
-
49
- If you prefer to install a GitHub release tarball, use its versioned `.tgz` asset. For CLI version 0.1.30:
50
-
51
- ```sh
52
- npm install --global --ignore-scripts https://github.com/DrawsyAI/drawsy-ai-companion/releases/download/cli-v0.1.30/drawsy-companion-0.1.30.tgz
53
- ```
43
+ If you already use a different package manager, run only its command:
54
44
 
55
- The tarball is built by this repository's CLI release workflow and is available after its draft release is published. Use the tarball asset, not the desktop ZIP or AppX.
45
+ - macOS/Linux with pnpm: `pnpm add --global --ignore-scripts @drawsy/companion@latest && drawsy-companion setup`
46
+ - macOS/Linux with Bun: `bun add --global --ignore-scripts @drawsy/companion@latest && drawsy-companion setup`
47
+ - Windows PowerShell with pnpm: `pnpm.cmd add --global --ignore-scripts @drawsy/companion@latest; if ($LASTEXITCODE -eq 0) { drawsy-companion.cmd setup }`
48
+ - Windows PowerShell with Bun: `bun add --global --ignore-scripts @drawsy/companion@latest; if ($LASTEXITCODE -eq 0) { drawsy-companion.cmd setup }`
56
49
 
57
- ## Commands
50
+ `setup` starts Companion in the background and enables it when you sign in. Useful commands:
58
51
 
59
52
  ```sh
60
- drawsy-companion start
61
- drawsy-companion stop
62
53
  drawsy-companion status
63
54
  drawsy-companion logs
64
- drawsy-companion serve
65
- drawsy-companion autostart enable
55
+ drawsy-companion start
56
+ drawsy-companion stop
66
57
  drawsy-companion autostart disable
67
58
  ```
68
59
 
69
- `serve` keeps the server visible in your current terminal. Press Ctrl+C to stop it. `status` reports whether the local server is running. Startup at login uses Windows Task Scheduler, macOS launchd, or Linux's user systemd service; Linux requires a working user systemd session. `start` alone does not enable startup at login.
70
-
71
- The desktop app and CLI use the same local server address. Quit the desktop app before switching to the CLI; an existing server is not silently replaced or stopped.
60
+ On Windows, use `drawsy-companion.cmd` in PowerShell. Desktop app and CLI use the same local server; close the desktop app before starting the CLI. The CLI will not stop or replace another Companion.
72
61
 
73
- ## Update or remove
62
+ ## Updates and removal
74
63
 
75
- The CLI does not update itself. npm distributes the package; Node runs it. To update, stop the running server first. If startup at sign-in is enabled, `autostart disable` also stops it:
64
+ The desktop app and CLI update separately. To update the desktop app, close it and run its installer command again. To update the CLI, disable sign-in startup, stop it, install the latest package with the same package manager, then run setup again. Example for npm:
76
65
 
77
66
  ```sh
78
67
  drawsy-companion autostart disable
@@ -80,9 +69,7 @@ npm install --global --ignore-scripts @drawsy/companion@latest
80
69
  drawsy-companion setup
81
70
  ```
82
71
 
83
- Run `setup` after installation only if you want Companion to start at sign-in. Otherwise, run `drawsy-companion start` when you want it for the current login session. If startup was already disabled, use `drawsy-companion stop` before installing the update instead.
84
-
85
- Before removing the package, disable startup at login, stop Companion, and remove the package:
72
+ To remove the CLI, disable startup and stop it first, then uninstall the package with the same package manager:
86
73
 
87
74
  ```sh
88
75
  drawsy-companion autostart disable
@@ -90,12 +77,12 @@ drawsy-companion stop
90
77
  npm uninstall --global @drawsy/companion
91
78
  ```
92
79
 
93
- This does not uninstall your Codex/OpenCode installation.
94
-
95
- ## Release preparation
80
+ Neither install route installs, updates, or signs in to Codex or OpenCode. Keep using the installation and login flow you already have for those tools.
96
81
 
97
- The first public version, 0.1.28, was built and uploaded by GitHub Actions and approved through npm's staged publication flow. Follow [the npm publishing guide](https://github.com/DrawsyAI/drawsy-ai-companion/blob/main/docs/npm-publishing.md) for GitHub trusted publishing setup. Future public package releases use this repository's **Publish Companion CLI to npm** GitHub workflow. It requires the current `main` commit, rejects a mismatched existing CLI version tag, builds and packages the CLI, and publishes the package with npm provenance. It runs no tests and launches no app or server.
82
+ ## Release sources
98
83
 
99
- The **Build Companion CLI release** GitHub workflow builds and packages a selected commit, runs no tests, and launches no app or server. It uploads the tarball and `CLI-SHA256SUMS` to a draft release named `cli-v` followed by the package version. Review and manually verify the draft before publishing it; existing published releases are never replaced. This GitHub tarball is an optional install source.
84
+ - macOS and Linux desktop installers are built and published to this repository's [GitHub Releases](https://github.com/DrawsyAI/drawsy-ai-companion/releases/latest). The release page also retains the unsigned Windows `.exe` and `.zip` alternate. The Windows Store package is built separately and submitted through Partner Center.
85
+ - The npm CLI is published separately by the repository's **Publish Companion CLI to npm** GitHub workflow. Installing or updating the desktop app does not publish or update the npm package.
86
+ - The CLI release tarball excludes Electron, the desktop window, build dependencies, personal configuration, and credentials.
100
87
 
101
- The package contains the compiled local server, bundled Drawsy skills, and npm runtime dependency declarations. It excludes Electron, the desktop UI, build dependencies, personal configuration, and credentials. npm installs the declared runtime dependencies when installing the tarball.
88
+ For maintainers: desktop releases follow a version tag matching `package.json` (`v` followed by the package version) and are built by the release workflow. npm releases require a package version bump on `main` and a deliberate run of **Publish Companion CLI to npm** in GitHub Actions. The two release routes do not trigger each other.
@@ -331,7 +331,9 @@ export const createDrawsyBridge = (options = {}) => {
331
331
  }
332
332
  }
333
333
  };
334
- const closeSession = (session) => {
334
+ const closeSession = (session, event) => {
335
+ if (event)
336
+ emit(session, event);
335
337
  sessions.delete(session.id);
336
338
  if (session.conversationId &&
337
339
  conversationSessions.get(session.conversationId)?.id === session.id) {
@@ -1767,8 +1769,9 @@ export const createDrawsyBridge = (options = {}) => {
1767
1769
  selections.delete(id);
1768
1770
  }
1769
1771
  for (const session of sessions.values()) {
1770
- if (now - session.touchedAt > 30 * 60 * 1000)
1771
- closeSession(session);
1772
+ if (now - session.touchedAt > 30 * 60 * 1000) {
1773
+ closeSession(session, { type: "session.closed", data: { reason: "idle" } });
1774
+ }
1772
1775
  }
1773
1776
  }, 60_000);
1774
1777
  cleanup.unref();
@@ -774,6 +774,7 @@ export class CodexAppServer {
774
774
  nextId = 1;
775
775
  threadId = null;
776
776
  turnActive = false;
777
+ hasSubmittedTurn = false;
777
778
  activeTurnId = null;
778
779
  activeDrawMode = false;
779
780
  nativeBrowserFailureInterruptSent = false;
@@ -1319,6 +1320,9 @@ export class CodexAppServer {
1319
1320
  this.activeDrawMode = pointerDrawMode;
1320
1321
  this.nativeBrowserFailureInterruptSent = false;
1321
1322
  try {
1323
+ // Once a user turn reaches Codex, never replace a missing rollout with an
1324
+ // empty thread while changing settings.
1325
+ this.hasSubmittedTurn = true;
1322
1326
  const result = (await this.request("turn/start", {
1323
1327
  threadId: this.threadId,
1324
1328
  cwd: this.folderPath,
@@ -1675,12 +1679,27 @@ export class CodexAppServer {
1675
1679
  const previousMetadata = { ...this.agentMetadata };
1676
1680
  const previousControls = this.lastControls;
1677
1681
  if (internetChanged) {
1678
- await this.startAgentThread({
1682
+ const threadOptions = {
1679
1683
  internetEnabled: nextInternet,
1680
1684
  model: selectedModel?.model || this.agentMetadata.model,
1681
1685
  effort: settings.effort || this.agentMetadata.reasoningEffort,
1682
- nativeThreadId: previousThreadId,
1683
- });
1686
+ };
1687
+ try {
1688
+ await this.startAgentThread({
1689
+ ...threadOptions,
1690
+ nativeThreadId: previousThreadId,
1691
+ });
1692
+ }
1693
+ catch (error) {
1694
+ if (!isCodexThreadMissingError(error) ||
1695
+ this.session.nativeThreadId ||
1696
+ this.hasSubmittedTurn) {
1697
+ throw error;
1698
+ }
1699
+ // Codex does not persist a new thread until its first user turn.
1700
+ // Reconfigure this empty thread without trying to resume its rollout.
1701
+ await this.startAgentThread(threadOptions);
1702
+ }
1684
1703
  }
1685
1704
  try {
1686
1705
  await this.request("thread/settings/update", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawsy/companion",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Drawsy's local Companion server and background command-line controls",
@@ -8,7 +8,7 @@ description: Generate semantic Mermaid source and render it through Drawsy Fast
8
8
  Use this skill only for Fast Mode canvas diagram work.
9
9
 
10
10
  - Read the current canvas and call `get_canvas_capabilities`. When present, treat `diagramCode.nativeEditableTypes` and `diagramCode.sourceMaxBytes` as the converter's runtime authority. Choose Mermaid syntax from the request's meaning and actual support; do not use a fixed intent-to-family mapping or prescribe a visual style. Keep the user's facts, supplied numbers, canvas context, and existing visual language intact. Never invent data to force a chart.
11
- - The current converter has editable native handlers for flowchart/graph, packet, architecture, ER, use case, mindmap, tree view, XY chart, pie, radar, and Sankey families. The installed parser may accept more syntax and render it as an image. Check `outputKind` (`editable-vector` or `image-fallback`) and `diagramType`; do not promise that fallback content stays editable. Mermaid's official syntax references follow `https://mermaid.js.org/syntax/<diagram-name>.html`; documentation can describe newer syntax than Drawsy's bundled parser.
11
+ - Discover editable diagram families from the live `diagramCode.nativeEditableTypes` catalog rather than a bundled list, so newly installed converters are available automatically. The installed parser may accept more syntax and render it as an image. Check `outputKind` (`editable-vector` or `image-fallback`) and `diagramType`; do not promise that fallback content stays editable. Mermaid's official syntax references follow `https://mermaid.js.org/syntax/<diagram-name>.html`; documentation can describe newer syntax than Drawsy's bundled parser.
12
12
  - Use `render_diagram_code` to create a whole diagram. Fast Mode still supports normal canvas management: use `apply_canvas_changes` to update existing elements or delete existing elements, including failed or intermediate work you created; never delete unrelated content. Use `create_or_update_connector` and `set_container_label` for existing objects, and image insertion/replacement, canvas capture, and live preview when requested. The runtime checks raw upserts against the live canvas; never use them to create new shapes or diagram structures. The diagram result includes `outputKind`, `diagramType`, `elementCount`, inserted `elementIds`, and `bounds`; use those IDs and bounds to review the inserted group.
13
13
  - Do not use native pointer gestures or another canvas path to bypass the diagram converter when creating a whole diagram. Preserve the user's visual choices when managing existing content.
14
14
  - A syntax correction is for a request that failed conversion: make at most one focused correction and retry with a new `operationId`; reuse an id only to retry the same unchanged request. A post-render correction follows a successful conversion after inspection: read the canvas again, make a focused correction, and set `replaceOperationId` to the prior successful operation id so only that converter-created group is replaced.