@scotthuang/agent-knock-knock 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.
- package/CHANGELOG.md +104 -0
- package/LICENSE +21 -0
- package/README.md +397 -0
- package/dist/src/acpx-output.d.ts +18 -0
- package/dist/src/acpx-output.js +223 -0
- package/dist/src/acpx-output.js.map +1 -0
- package/dist/src/bootstrap.d.ts +8 -0
- package/dist/src/bootstrap.js +45 -0
- package/dist/src/bootstrap.js.map +1 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +2364 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/executors.d.ts +101 -0
- package/dist/src/executors.js +118 -0
- package/dist/src/executors.js.map +1 -0
- package/dist/src/openclaw-plugin.d.ts +7 -0
- package/dist/src/openclaw-plugin.js +916 -0
- package/dist/src/openclaw-plugin.js.map +1 -0
- package/dist/src/protocol.d.ts +96 -0
- package/dist/src/protocol.js +329 -0
- package/dist/src/protocol.js.map +1 -0
- package/dist/src/runtime-log.d.ts +37 -0
- package/dist/src/runtime-log.js +149 -0
- package/dist/src/runtime-log.js.map +1 -0
- package/dist/src/store.d.ts +35 -0
- package/dist/src/store.js +121 -0
- package/dist/src/store.js.map +1 -0
- package/dist/src/transcript.d.ts +24 -0
- package/dist/src/transcript.js +88 -0
- package/dist/src/transcript.js.map +1 -0
- package/openclaw.plugin.json +150 -0
- package/package.json +63 -0
- package/templates/openclaw-skills/agent-knock-knock/SKILL.md +181 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { extractJsonObject } from "./protocol.js";
|
|
2
|
+
export function normalizeAcpxOutput({ conversationId, from, to, round, output, now = new Date() }) {
|
|
3
|
+
const events = [];
|
|
4
|
+
const lines = String(output ?? "").split(/\r?\n/);
|
|
5
|
+
for (const line of lines) {
|
|
6
|
+
const text = line.trim();
|
|
7
|
+
if (!text) {
|
|
8
|
+
continue;
|
|
9
|
+
}
|
|
10
|
+
const jsonEvent = normalizeJsonLine({ conversationId, from, to, round, text, now });
|
|
11
|
+
if (jsonEvent) {
|
|
12
|
+
events.push(jsonEvent);
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
const textEvent = normalizeTextLine({ conversationId, from, to, round, text, now });
|
|
16
|
+
if (textEvent) {
|
|
17
|
+
events.push(textEvent);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return events;
|
|
21
|
+
}
|
|
22
|
+
function normalizeJsonLine({ conversationId, from, to, round, text, now }) {
|
|
23
|
+
let parsed;
|
|
24
|
+
try {
|
|
25
|
+
parsed = extractJsonObject(text);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
if (parsed.type && parsed.from && parsed.to && "body" in parsed) {
|
|
31
|
+
const event = {
|
|
32
|
+
event: "message",
|
|
33
|
+
conversationId,
|
|
34
|
+
round,
|
|
35
|
+
now,
|
|
36
|
+
type: parsed.type,
|
|
37
|
+
requires_response: parsed.requires_response,
|
|
38
|
+
body: typeof parsed.body === "string" ? parsed.body : JSON.stringify(parsed.body),
|
|
39
|
+
source: "normalized_acpx",
|
|
40
|
+
raw: parsed
|
|
41
|
+
};
|
|
42
|
+
return baseEvent({
|
|
43
|
+
...event,
|
|
44
|
+
...optionalStringField("from", parsed.from),
|
|
45
|
+
...optionalStringField("to", parsed.to)
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const eventName = eventNameFromJson(parsed);
|
|
49
|
+
if (!eventName) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return baseEvent({
|
|
53
|
+
event: eventName,
|
|
54
|
+
conversationId,
|
|
55
|
+
from: stringOrUndefined(parsed.from) ?? from,
|
|
56
|
+
to: stringOrUndefined(parsed.to) ?? to,
|
|
57
|
+
round: numberOrUndefined(parsed.round) ?? round,
|
|
58
|
+
now,
|
|
59
|
+
status: parsed.status,
|
|
60
|
+
tool_name: parsed.tool_name ?? parsed.tool ?? parsed.name,
|
|
61
|
+
permission: parsed.permission ?? parsed.permission_name,
|
|
62
|
+
body: parsed.body ?? parsed.message ?? parsed.text,
|
|
63
|
+
source: "normalized_acpx",
|
|
64
|
+
raw: parsed
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function normalizeTextLine({ conversationId, from, to, round, text, now }) {
|
|
68
|
+
const lower = text.toLowerCase();
|
|
69
|
+
if (isPermissionRequest(lower)) {
|
|
70
|
+
return baseEvent({
|
|
71
|
+
event: "permission_request",
|
|
72
|
+
conversationId,
|
|
73
|
+
from,
|
|
74
|
+
to,
|
|
75
|
+
round,
|
|
76
|
+
now,
|
|
77
|
+
source: "normalized_acpx",
|
|
78
|
+
body: text
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
const toolStarted = matchToolStarted(text);
|
|
82
|
+
if (toolStarted) {
|
|
83
|
+
return baseEvent({
|
|
84
|
+
event: "tool_call_started",
|
|
85
|
+
conversationId,
|
|
86
|
+
from,
|
|
87
|
+
to,
|
|
88
|
+
round,
|
|
89
|
+
now,
|
|
90
|
+
tool_name: toolStarted,
|
|
91
|
+
source: "normalized_acpx",
|
|
92
|
+
body: text
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
const toolFinished = matchToolFinished(text);
|
|
96
|
+
if (toolFinished) {
|
|
97
|
+
return baseEvent({
|
|
98
|
+
event: "tool_call_finished",
|
|
99
|
+
conversationId,
|
|
100
|
+
from,
|
|
101
|
+
to,
|
|
102
|
+
round,
|
|
103
|
+
now,
|
|
104
|
+
tool_name: toolFinished,
|
|
105
|
+
source: "normalized_acpx",
|
|
106
|
+
body: text
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (isAgentStatus(lower)) {
|
|
110
|
+
return baseEvent({
|
|
111
|
+
event: "agent_status",
|
|
112
|
+
conversationId,
|
|
113
|
+
from,
|
|
114
|
+
to,
|
|
115
|
+
round,
|
|
116
|
+
now,
|
|
117
|
+
status: statusFromText(lower),
|
|
118
|
+
source: "normalized_acpx",
|
|
119
|
+
body: text
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
function eventNameFromJson(parsed) {
|
|
125
|
+
const value = String(parsed.event ?? parsed.kind ?? "").toLowerCase();
|
|
126
|
+
if (["tool_call_started", "tool_call_finished", "permission_request", "agent_status"].includes(value)) {
|
|
127
|
+
return value;
|
|
128
|
+
}
|
|
129
|
+
if (value === "tool_call" && parsed.status === "started") {
|
|
130
|
+
return "tool_call_started";
|
|
131
|
+
}
|
|
132
|
+
if (value === "tool_call" && ["finished", "completed", "done"].includes(String(parsed.status))) {
|
|
133
|
+
return "tool_call_finished";
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
function isPermissionRequest(lower) {
|
|
138
|
+
return lower.includes("permission") && (lower.includes("request") ||
|
|
139
|
+
lower.includes("requires") ||
|
|
140
|
+
lower.includes("approve") ||
|
|
141
|
+
lower.includes("allow"));
|
|
142
|
+
}
|
|
143
|
+
function matchToolStarted(text) {
|
|
144
|
+
const patterns = [
|
|
145
|
+
/tool(?: call)? (?:started|starting):?\s*([A-Za-z0-9_.:-]+)/i,
|
|
146
|
+
/(?:running|started|starting) tool:?\s*([A-Za-z0-9_.:-]+)/i,
|
|
147
|
+
/tool_use(?:\.start)?:?\s*([A-Za-z0-9_.:-]+)/i
|
|
148
|
+
];
|
|
149
|
+
return firstMatch(text, patterns);
|
|
150
|
+
}
|
|
151
|
+
function matchToolFinished(text) {
|
|
152
|
+
const patterns = [
|
|
153
|
+
/tool(?: call)? (?:finished|completed|succeeded|failed):?\s*([A-Za-z0-9_.:-]+)/i,
|
|
154
|
+
/(?:finished|completed|succeeded|failed) tool:?\s*([A-Za-z0-9_.:-]+)/i,
|
|
155
|
+
/tool_use(?:\.finish|\.end)?:?\s*([A-Za-z0-9_.:-]+)/i
|
|
156
|
+
];
|
|
157
|
+
return firstMatch(text, patterns);
|
|
158
|
+
}
|
|
159
|
+
function firstMatch(text, patterns) {
|
|
160
|
+
for (const pattern of patterns) {
|
|
161
|
+
const match = text.match(pattern);
|
|
162
|
+
if (match?.[1]) {
|
|
163
|
+
return match[1];
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
function isAgentStatus(lower) {
|
|
169
|
+
return lower.includes("session") ||
|
|
170
|
+
lower.includes("agent") ||
|
|
171
|
+
lower.includes("thinking") ||
|
|
172
|
+
lower.includes("queued") ||
|
|
173
|
+
lower.includes("running") ||
|
|
174
|
+
lower.includes("completed") ||
|
|
175
|
+
lower.includes("failed") ||
|
|
176
|
+
lower.includes("timed out") ||
|
|
177
|
+
lower.includes("timeout");
|
|
178
|
+
}
|
|
179
|
+
function statusFromText(lower) {
|
|
180
|
+
if (lower.includes("timed out") || lower.includes("timeout")) {
|
|
181
|
+
return "timeout";
|
|
182
|
+
}
|
|
183
|
+
if (lower.includes("failed") || lower.includes("error")) {
|
|
184
|
+
return "failed";
|
|
185
|
+
}
|
|
186
|
+
if (lower.includes("completed") || lower.includes("done") || lower.includes("finished")) {
|
|
187
|
+
return "completed";
|
|
188
|
+
}
|
|
189
|
+
if (lower.includes("queued")) {
|
|
190
|
+
return "queued";
|
|
191
|
+
}
|
|
192
|
+
if (lower.includes("thinking")) {
|
|
193
|
+
return "thinking";
|
|
194
|
+
}
|
|
195
|
+
if (lower.includes("running")) {
|
|
196
|
+
return "running";
|
|
197
|
+
}
|
|
198
|
+
return "status";
|
|
199
|
+
}
|
|
200
|
+
function baseEvent({ event, conversationId, from, to, round, now, ...rest }) {
|
|
201
|
+
return dropUndefined({
|
|
202
|
+
ts: now.toISOString(),
|
|
203
|
+
conversation_id: conversationId,
|
|
204
|
+
event,
|
|
205
|
+
from,
|
|
206
|
+
to,
|
|
207
|
+
round,
|
|
208
|
+
...dropUndefined(rest)
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
function dropUndefined(value) {
|
|
212
|
+
return Object.fromEntries(Object.entries(value).filter(([, entryValue]) => entryValue !== undefined));
|
|
213
|
+
}
|
|
214
|
+
function stringOrUndefined(value) {
|
|
215
|
+
return typeof value === "string" ? value : undefined;
|
|
216
|
+
}
|
|
217
|
+
function numberOrUndefined(value) {
|
|
218
|
+
return typeof value === "number" ? value : undefined;
|
|
219
|
+
}
|
|
220
|
+
function optionalStringField(key, value) {
|
|
221
|
+
return typeof value === "string" ? { [key]: value } : {};
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=acpx-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acpx-output.js","sourceRoot":"","sources":["../../src/acpx-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGlD,MAAM,UAAU,mBAAmB,CAAC,EAClC,cAAc,EACd,IAAI,EACJ,EAAE,EACF,KAAK,EACL,MAAM,EACN,GAAG,GAAG,IAAI,IAAI,EAAE,EAQjB;IACC,MAAM,MAAM,GAA0B,EAAE,CAAC;IACzC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAElD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACzB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,SAAS;QACX,CAAC;QAED,MAAM,SAAS,GAAG,iBAAiB,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;QACpF,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACvB,SAAS;QACX,CAAC;QAED,MAAM,SAAS,GAAG,iBAAiB,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,EAA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EASR;IACC,OAAO,aAAa,CAAC;QACnB,EAAE,EAAE,GAAG,CAAC,WAAW,EAAE;QACrB,eAAe,EAAE,cAAc;QAC/B,KAAK;QACL,IAAI;QACJ,EAAE;QACF,KAAK;QACL,GAAG,aAAa,CAAC,IAAI,CAAC;KACvB,CAAwB,CAAC;AAC5B,CAAC;AAED,SAAS,aAAa,CAAC,KAA8B;IACnD,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,EAAE,EAAE,CAAC,UAAU,KAAK,SAAS,CAAC,CAC3E,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC;AAED,SAAS,mBAAmB,CAAC,GAAW,EAAE,KAAc;IACtD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface BootstrapPromptOptions {
|
|
2
|
+
callbackCommand: string;
|
|
3
|
+
executorName?: string;
|
|
4
|
+
softLimit?: number;
|
|
5
|
+
hardLimit?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function claudeBootstrapPrompt(options: Omit<BootstrapPromptOptions, "executorName">): string;
|
|
8
|
+
export declare function executorBootstrapPrompt({ callbackCommand, executorName, softLimit, hardLimit }: BootstrapPromptOptions): string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export function claudeBootstrapPrompt(options) {
|
|
2
|
+
return executorBootstrapPrompt({
|
|
3
|
+
executorName: "Claude Code",
|
|
4
|
+
...options
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
export function executorBootstrapPrompt({ callbackCommand, executorName = "the coding agent", softLimit = 50, hardLimit = 100 }) {
|
|
8
|
+
return `You are ${executorName}, the autonomous engineering implementation agent managed by OpenClaw.
|
|
9
|
+
|
|
10
|
+
OpenClaw owns product direction, requirements interpretation, acceptance criteria, and delivery tradeoffs. Treat OpenClaw as the product manager and final product decision maker.
|
|
11
|
+
|
|
12
|
+
You own engineering execution. You may directly read and edit files, run commands, fix tests, and complete the assigned development task.
|
|
13
|
+
|
|
14
|
+
Use the fewest response-requiring rounds possible. Decide ordinary implementation details yourself when they do not affect product behavior, scope, user experience, acceptance criteria, or delivery risk.
|
|
15
|
+
|
|
16
|
+
Send question or blocked messages when:
|
|
17
|
+
- requirements are ambiguous or conflict
|
|
18
|
+
- product behavior, UX, scope, or acceptance criteria need interpretation
|
|
19
|
+
- an engineering problem requires a product compromise, degraded behavior, narrower scope, workaround, or changed delivery standard
|
|
20
|
+
- architecture, risk, permission, dependency, or environment decisions affect the final product
|
|
21
|
+
- you cannot continue without OpenClaw's decision
|
|
22
|
+
|
|
23
|
+
After OpenClaw answers, implement according to OpenClaw's product decision even if there are multiple engineering alternatives.
|
|
24
|
+
|
|
25
|
+
Progress reports must use type=progress and requires_response=false.
|
|
26
|
+
|
|
27
|
+
When complete, send type=done with:
|
|
28
|
+
- what changed
|
|
29
|
+
- how it was verified
|
|
30
|
+
- any remaining issues
|
|
31
|
+
|
|
32
|
+
Response budget:
|
|
33
|
+
- soft limit: ${softLimit}
|
|
34
|
+
- hard limit: ${hardLimit}
|
|
35
|
+
- after 30 response rounds, converge and choose the shortest completion path
|
|
36
|
+
- after 40 response rounds, finish, degrade, or provide a failure reason within 10 response rounds
|
|
37
|
+
|
|
38
|
+
Send messages back to OpenClaw by executing this command with a single structured JSON message as the final argument:
|
|
39
|
+
|
|
40
|
+
${callbackCommand}
|
|
41
|
+
|
|
42
|
+
Replace <structured-message-json> with one shell-quoted JSON object. If the JSON contains single quotes, escape them using standard shell quoting before executing the command.
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/bootstrap.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,qBAAqB,CAAC,OAAqD;IACzF,OAAO,uBAAuB,CAAC;QAC7B,YAAY,EAAE,aAAa;QAC3B,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,EAAE,eAAe,EAAE,YAAY,GAAG,kBAAkB,EAAE,SAAS,GAAG,EAAE,EAAE,SAAS,GAAG,GAAG,EAA0B;IACrJ,OAAO,WAAW,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;gBAyBhB,SAAS;gBACT,SAAS;;;;;;EAMvB,eAAe;;;CAGhB,CAAC;AACF,CAAC"}
|