pi-onlyne 0.3.3 → 0.3.4

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
@@ -79,6 +79,8 @@ When a normal user message arrives through Onlyne, pi receives it as a follow-up
79
79
  /onlyne config auto-start
80
80
  ```
81
81
 
82
+ `/onlyne` supports argument completions for `status`, `watch on`, `watch off`, and `config auto-start`.
83
+
82
84
  ## Agent tools
83
85
 
84
86
  ```text
@@ -116,7 +118,7 @@ onlyne_broadcast({
116
118
  { channelId: "telegram" },
117
119
  { channelId: "feishu" }
118
120
  ],
119
- text: "# Release shipped\n\nVersion 0.3.2 is live."
121
+ text: "# Release shipped\n\nVersion 0.3.4 is live."
120
122
  })
121
123
  ```
122
124
 
package/SPEC.md CHANGED
@@ -7,6 +7,7 @@ Pi extension for Onlyne. Onlyne remains a workspace-local IM broker; this extens
7
7
  ## v1 Decisions
8
8
 
9
9
  - Watch is configurable; default manual.
10
+ - `/onlyne` provides argument completions for its supported subcommands.
10
11
  - `watch on` connects only to the workspace-local `.onlyne/run/onlyne.sock`; if unavailable, it tells the user to start `onlyne --workspace <root> run`.
11
12
  - pi-onlyne never owns or launches the daemon. Users handle launchd/systemd/background scripts outside the extension, per workspace.
12
13
  - Inbound events come from Onlyne `subscribe_events`; no polling.
package/dist/index.js CHANGED
@@ -60,25 +60,37 @@ export default function onlyne(pi) {
60
60
  }
61
61
  await reply(inbound.fallbackText || state.lastValidOutput || cfg.outbound.guardedExplicit.noOutputFallbackText);
62
62
  });
63
- pi.registerCommand("onlyne", { description: "Onlyne watch/status/config commands", handler: async (argLine, ctx) => { const [cmd, sub] = argLine.trim().split(/\s+/); try {
64
- if (cmd === "watch" && sub === "on")
65
- ctx.ui.notify(await startWatch(pi), "info");
66
- else if (cmd === "watch" && sub === "off")
67
- ctx.ui.notify(stopWatch(), "info");
68
- else if (cmd === "status")
69
- ctx.ui.notify(`onlyne ${state.watching ? "watching" : "stopped"}; owner=${state.owner}; workspace=${state.workspace?.root ?? "none"}`, "info");
70
- else if (cmd === "config" && sub === "auto-start") {
71
- const cfg = currentConfig();
72
- cfg.watch.autoStart = !cfg.watch.autoStart;
73
- saveConfig(state.cwd, cfg);
74
- ctx.ui.notify(`autoStart=${cfg.watch.autoStart}`, "info");
63
+ pi.registerCommand("onlyne", {
64
+ description: "Onlyne watch/status/config commands",
65
+ getArgumentCompletions: (prefix) => {
66
+ const commands = ["status", "watch on", "watch off", "config auto-start"];
67
+ const p = prefix.trimStart();
68
+ const filtered = commands.filter((c) => c.startsWith(p));
69
+ return filtered.length ? filtered.map((value) => ({ value, label: value })) : null;
70
+ },
71
+ handler: async (argLine, ctx) => {
72
+ const [cmd, sub] = argLine.trim().split(/\s+/);
73
+ try {
74
+ if (cmd === "watch" && sub === "on")
75
+ ctx.ui.notify(await startWatch(pi), "info");
76
+ else if (cmd === "watch" && sub === "off")
77
+ ctx.ui.notify(stopWatch(), "info");
78
+ else if (cmd === "status")
79
+ ctx.ui.notify(`onlyne ${state.watching ? "watching" : "stopped"}; owner=${state.owner}; workspace=${state.workspace?.root ?? "none"}`, "info");
80
+ else if (cmd === "config" && sub === "auto-start") {
81
+ const cfg = currentConfig();
82
+ cfg.watch.autoStart = !cfg.watch.autoStart;
83
+ saveConfig(state.cwd, cfg);
84
+ ctx.ui.notify(`autoStart=${cfg.watch.autoStart}`, "info");
85
+ }
86
+ else
87
+ ctx.ui.notify("usage: /onlyne status | watch on|off | config auto-start", "info");
75
88
  }
76
- else
77
- ctx.ui.notify("usage: /onlyne status | watch on|off | config auto-start", "info");
78
- }
79
- catch (e) {
80
- ctx.ui.notify(e instanceof Error ? e.message : String(e), "error");
81
- } } });
89
+ catch (e) {
90
+ ctx.ui.notify(e instanceof Error ? e.message : String(e), "error");
91
+ }
92
+ },
93
+ });
82
94
  pi.registerTool(defineTool({ name: "onlyne_reply", label: "Onlyne reply", description: "Reply with plain text to the current Onlyne inbound message.", parameters: Type.Object({ text: Type.String() }), executionMode: "parallel", async execute(_id, params) { return textResult(JSON.stringify(await reply(params.text))); } }));
83
95
  pi.registerTool(defineTool({ name: "onlyne_send", label: "Onlyne send", description: "Send Markdown to the channel's configured Onlyne conversation. Set rawText=true only for literal plain text.", parameters: Type.Object({ channelId: Type.String(), text: Type.String(), rawText: Type.Optional(Type.Boolean()) }), executionMode: "parallel", async execute(_id, params) { if (!state.workspace)
84
96
  throw new Error("onlyne workspace not found"); const res = await sendWithRetry(state.workspace.socketPath, params, params.text, currentConfig().outbound.retry.attempts, params.rawText ?? false); return textResult(JSON.stringify(res), res); } }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-onlyne",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Pi extension tools for sending messages through Onlyne.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",