cueme 0.1.3 → 0.1.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 +1 -1
- package/package.json +1 -1
- package/protocol.md +21 -39
- package/src/cli.js +47 -7
package/README.md
CHANGED
package/package.json
CHANGED
package/protocol.md
CHANGED
|
@@ -4,6 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
当用户接受 HAP:你必须在每次阶段性输出或准备结束回复前调用 `cueme cue`(或 `cueme pause`)等待用户继续。
|
|
6
6
|
|
|
7
|
+
If HAP is accepted: before any phase-summary or final reply, you MUST call `cueme cue` via the terminal/tool.
|
|
8
|
+
A reply is NOT complete unless the last action is a successful cueme call.
|
|
9
|
+
|
|
10
|
+
- 首次连接 / 无 agent_id:先执行 `join()` 获取 agent_id,再执行 `cue()`。
|
|
11
|
+
|
|
12
|
+
- 重连 / 已有 agent_id(例如网络波动导致 cue 中断但对话仍在继续):用户再次发送 `cue` 时,优先直接用已有 agent_id 执行 `cue()`;仅当无法确认 agent_id 时才重新 `join()`。
|
|
13
|
+
|
|
14
|
+
## No fake tool actions
|
|
15
|
+
|
|
16
|
+
You MUST NOT claim you called cueme unless you actually executed it and got its stdout.
|
|
17
|
+
If you cannot run tools, say "TOOLS_UNAVAILABLE" and output only the exact `cueme ...` command for the human to run.
|
|
18
|
+
|
|
7
19
|
## cueme (command interface)
|
|
8
20
|
|
|
9
21
|
### join() -> message
|
|
@@ -32,46 +44,25 @@ Returns (plain text):
|
|
|
32
44
|
|
|
33
45
|
- a short message (includes `agent_id=...`)
|
|
34
46
|
|
|
35
|
-
### cue(prompt: str, agent_id: str, payload?:
|
|
47
|
+
### cue(prompt: str, agent_id: str, payload?: object | null) -> text
|
|
36
48
|
|
|
37
49
|
Command:
|
|
38
50
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
`prompt`:
|
|
42
|
-
|
|
43
|
-
- Pass a prompt string as the positional `prompt` argument.
|
|
44
|
-
- If `-` is used, instructions are read from stdin.
|
|
51
|
+
`cueme cue <agent_id> -`
|
|
45
52
|
|
|
46
|
-
|
|
53
|
+
stdin JSON envelope:
|
|
54
|
+
{
|
|
55
|
+
"prompt": NonEmptyString, // REQUIRED, must be non-empty after trim
|
|
56
|
+
"payload"?: object | null // OPTIONAL, may be omitted or null
|
|
57
|
+
}
|
|
47
58
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Examples (stdin):
|
|
51
|
-
|
|
52
|
-
- `bash/zsh` (here-doc)
|
|
53
|
-
|
|
54
|
-
`cueme cue <agent_id> - <<'EOF'
|
|
55
|
-
<your prompt here>
|
|
56
|
-
EOF`
|
|
57
|
-
|
|
58
|
-
- `PowerShell` (here-string)
|
|
59
|
-
|
|
60
|
-
`$prompt = @'
|
|
61
|
-
<your prompt here>
|
|
62
|
-
'@
|
|
63
|
-
$prompt | cueme cue <agent_id> -`
|
|
59
|
+
Tip: when you need clearer structured interaction, prefer `payload` (choice/confirm/form) over encoding structure in `prompt`. bash/zsh use heredoc; PowerShell use here-string and pipe the JSON into `cueme cue <agent_id> -`.
|
|
64
60
|
|
|
65
61
|
Returns:
|
|
66
62
|
|
|
67
63
|
- plain text (stdout)
|
|
68
64
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
- Optional structured request, encoded as a JSON string.
|
|
72
|
-
- `cueme` does not validate payload; it passes it through.
|
|
73
|
-
|
|
74
|
-
Payload protocol (JSON string):
|
|
65
|
+
Payload protocol (payload object):
|
|
75
66
|
|
|
76
67
|
- required: {"type": "choice" | "confirm" | "form"}
|
|
77
68
|
- choice: {"type":"choice","options":["...",...],"allow_multiple":false}
|
|
@@ -99,12 +90,3 @@ Command:
|
|
|
99
90
|
Returns:
|
|
100
91
|
|
|
101
92
|
- plain text (stdout)
|
|
102
|
-
|
|
103
|
-
### Terminal
|
|
104
|
-
Terminal is non-interactive: MUST NOT rely on live local TTY input. Waiting for remote responses is OK (e.g., cueme cue/pause).
|
|
105
|
-
|
|
106
|
-
### Tool Use Instructions
|
|
107
|
-
IMPORTANT: When you need to perform actions like reading files, running commands,
|
|
108
|
-
or searching, you MUST use the available tools. Do NOT just describe what you would do -
|
|
109
|
-
actually call the tools to do it. Never respond with suggestions like 'check X' or
|
|
110
|
-
'look at Y' without actually using tools to perform those actions.
|
package/src/cli.js
CHANGED
|
@@ -58,10 +58,13 @@ async function main() {
|
|
|
58
58
|
'Usage:',
|
|
59
59
|
' cueme join <agent_runtime>',
|
|
60
60
|
' cueme recall <hints>',
|
|
61
|
-
' cueme cue <agent_id>
|
|
61
|
+
' cueme cue <agent_id> -',
|
|
62
62
|
' cueme pause <agent_id> [prompt|-]',
|
|
63
63
|
' cueme migrate',
|
|
64
64
|
'',
|
|
65
|
+
'Cue stdin JSON envelope:',
|
|
66
|
+
' {"prompt":"...","payload":{...}}',
|
|
67
|
+
'',
|
|
65
68
|
'Output:',
|
|
66
69
|
' - join/recall/cue/pause: plain text (stdout)',
|
|
67
70
|
].join('\n') + '\n'
|
|
@@ -108,16 +111,53 @@ async function main() {
|
|
|
108
111
|
process.exitCode = 2;
|
|
109
112
|
return;
|
|
110
113
|
}
|
|
114
|
+
|
|
115
|
+
if (parsed.payload != null) {
|
|
116
|
+
process.stderr.write('error: --payload is not supported for cue. Use stdin JSON envelope.\n');
|
|
117
|
+
process.exitCode = 2;
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
111
121
|
parsed.agent_id = String(agentId);
|
|
112
122
|
|
|
113
123
|
const promptPos = pos[1];
|
|
114
|
-
if (promptPos
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
124
|
+
if (promptPos !== '-') {
|
|
125
|
+
process.stderr.write('error: cue requires stdin JSON. Usage: cueme cue <agent_id> -\n');
|
|
126
|
+
process.exitCode = 2;
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (pos.length > 2) {
|
|
131
|
+
process.stderr.write('error: cue only accepts <agent_id> - and stdin JSON.\n');
|
|
132
|
+
process.exitCode = 2;
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const raw = await readAllStdin();
|
|
137
|
+
let env;
|
|
138
|
+
try {
|
|
139
|
+
env = JSON.parse(raw);
|
|
140
|
+
} catch {
|
|
141
|
+
process.stderr.write('error: stdin must be valid JSON (envelope: {"prompt": "...", "payload": {...}})\n');
|
|
142
|
+
process.exitCode = 2;
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (!env || typeof env !== 'object') {
|
|
147
|
+
process.stderr.write('error: stdin JSON must be an object\n');
|
|
148
|
+
process.exitCode = 2;
|
|
149
|
+
return;
|
|
120
150
|
}
|
|
151
|
+
|
|
152
|
+
const prompt = typeof env.prompt === 'string' ? env.prompt : '';
|
|
153
|
+
if (!prompt.trim()) {
|
|
154
|
+
process.stderr.write('error: stdin JSON must include non-empty string field "prompt"\n');
|
|
155
|
+
process.exitCode = 2;
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
parsed.prompt = prompt;
|
|
160
|
+
parsed.payload = env.payload == null ? null : JSON.stringify(env.payload);
|
|
121
161
|
}
|
|
122
162
|
|
|
123
163
|
if (sub === 'pause') {
|