agent-office 0.4.1 → 0.4.2
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 +6 -0
- package/dist/cli.js +26 -0
- package/dist/server/routes.js +11 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -207,6 +207,12 @@ agent-office worker set-status --clear <token>
|
|
|
207
207
|
# Send a message to one or more recipients
|
|
208
208
|
agent-office worker send-message --name Alice --name Bob --body "Status update: PR is ready" <token>
|
|
209
209
|
|
|
210
|
+
# If your message body contains $ characters, escape them to avoid shell variable expansion
|
|
211
|
+
agent-office worker send-message --name Alice --body "Cost is \$50" <token>
|
|
212
|
+
|
|
213
|
+
# > Warning: always escape $ in --body when using double quotes in bash, or use single quotes.
|
|
214
|
+
# > Unescaped $ will be silently expanded by the shell before the message is sent.
|
|
215
|
+
|
|
210
216
|
# Cron job management
|
|
211
217
|
agent-office worker cron list <token>
|
|
212
218
|
agent-office worker cron create --name "daily-report" --schedule "0 9 * * *" --message "Send daily status" <token>
|
package/dist/cli.js
CHANGED
|
@@ -102,6 +102,23 @@ workerCmd
|
|
|
102
102
|
.argument("<token>", "Agent token in the format <agent_code>@<server-url>")
|
|
103
103
|
.requiredOption("--name <name>", "Recipient name (can be specified multiple times)", (val, prev) => [...prev, val], [])
|
|
104
104
|
.requiredOption("--body <body>", "Message body")
|
|
105
|
+
.addHelpText("after", `
|
|
106
|
+
Examples:
|
|
107
|
+
agent-office worker send-message --name Alice --body "PR is ready" <token>
|
|
108
|
+
agent-office worker send-message --name Alice --name Bob --body "Hello" <token>
|
|
109
|
+
|
|
110
|
+
# Message body containing $: escape with \\ or use single quotes
|
|
111
|
+
agent-office worker send-message --name Alice --body "Cost is \\$50" <token>
|
|
112
|
+
agent-office worker send-message --name Alice --body 'Cost is $50' <token>
|
|
113
|
+
|
|
114
|
+
Warning:
|
|
115
|
+
The shell processes --body before the CLI receives it. Be mindful of bash
|
|
116
|
+
special characters in your message body:
|
|
117
|
+
$var, \${x} variable expansion → escape as \\$ or use single quotes
|
|
118
|
+
\`cmd\`, $(x) command substitution → escape backticks or use single quotes
|
|
119
|
+
!, \\\\, " history/escape chars → escape or use single quotes
|
|
120
|
+
The safest option is always single quotes: --body 'your message here'
|
|
121
|
+
(single quotes prevent all shell interpretation)`)
|
|
105
122
|
.action(async (token, options) => {
|
|
106
123
|
const { sendMessage } = await import("./commands/worker.js");
|
|
107
124
|
await sendMessage(token, options.name, options.body);
|
|
@@ -127,6 +144,15 @@ cronCmd
|
|
|
127
144
|
.requiredOption("--message <message>", "Action to perform when job fires")
|
|
128
145
|
.requiredOption("--respond-to <respondTo>", "Who to respond to when done")
|
|
129
146
|
.option("--timezone <timezone>", "IANA timezone (e.g., 'America/New_York')")
|
|
147
|
+
.addHelpText("after", `
|
|
148
|
+
Warning:
|
|
149
|
+
The shell processes --message and --respond-to before the CLI receives them.
|
|
150
|
+
Be mindful of bash special characters in these values:
|
|
151
|
+
$var, \${x} variable expansion → escape as \\$ or use single quotes
|
|
152
|
+
\`cmd\`, $(x) command substitution → escape backticks or use single quotes
|
|
153
|
+
!, \\\\, " history/escape chars → escape or use single quotes
|
|
154
|
+
The safest option is always single quotes: --message 'your message here'
|
|
155
|
+
(single quotes prevent all shell interpretation)`)
|
|
130
156
|
.action(async (token, options) => {
|
|
131
157
|
const { createCron } = await import("./commands/worker.js");
|
|
132
158
|
await createCron(token, options);
|
package/dist/server/routes.js
CHANGED
|
@@ -69,6 +69,17 @@ export function generateSystemPrompt(name, status, humanName, humanDescription,
|
|
|
69
69
|
` --body "Your message here" \\`,
|
|
70
70
|
` ${token}`,
|
|
71
71
|
``,
|
|
72
|
+
` If your message contains $ characters, escape them to avoid shell`,
|
|
73
|
+
` variable expansion (bash expands unescaped $ before the CLI sees it):`,
|
|
74
|
+
` agent-office worker send-message \\`,
|
|
75
|
+
` --name alice \\`,
|
|
76
|
+
` --body "The total cost is \\$42" \\`,
|
|
77
|
+
` ${token}`,
|
|
78
|
+
``,
|
|
79
|
+
` ⚠ Always escape $ in --body when using double quotes in bash,`,
|
|
80
|
+
` or switch to single quotes. Unescaped $ will be silently`,
|
|
81
|
+
` expanded by the shell and your message will be garbled.`,
|
|
82
|
+
``,
|
|
72
83
|
` Manage scheduled tasks (optional)`,
|
|
73
84
|
` agent-office worker cron \\`,
|
|
74
85
|
` ${token}`,
|