agent-companion 0.1.0

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.
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ import process from "node:process";
3
+
4
+ const args = process.argv.slice(2);
5
+ const options = parseOptions(args);
6
+
7
+ const sessionId = options.session;
8
+ const prompt = options.prompt;
9
+ const priority = options.priority || "MEDIUM";
10
+ const bridge = options.bridge || process.env.AGENT_BRIDGE_URL || "http://localhost:8787";
11
+
12
+ if (!sessionId || !prompt) {
13
+ console.log("Usage: node scripts/add-pending.mjs --session <id> --prompt \"message\" [--priority HIGH|MEDIUM|LOW]");
14
+ process.exit(1);
15
+ }
16
+
17
+ const response = await fetch(`${bridge}/api/pending/add`, {
18
+ method: "POST",
19
+ headers: {
20
+ "Content-Type": "application/json"
21
+ },
22
+ body: JSON.stringify({ sessionId, prompt, priority, requestedAt: Date.now() })
23
+ });
24
+
25
+ if (!response.ok) {
26
+ console.error(await response.text());
27
+ process.exit(1);
28
+ }
29
+
30
+ console.log(`Pending input pushed for session ${sessionId}`);
31
+
32
+ function parseOptions(values) {
33
+ const out = {};
34
+
35
+ for (let i = 0; i < values.length; i += 1) {
36
+ const current = values[i];
37
+ if (!current.startsWith("--")) continue;
38
+
39
+ const key = current.slice(2);
40
+ const next = values[i + 1];
41
+ if (!next || next.startsWith("--")) {
42
+ out[key] = "true";
43
+ continue;
44
+ }
45
+
46
+ out[key] = next;
47
+ i += 1;
48
+ }
49
+
50
+ return out;
51
+ }