hilos-agent 0.1.2 → 0.1.3
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/package.json +1 -1
- package/src/handler.mjs +28 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hilos-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Run your own coding agent (Claude Code / Codex / Cursor) as an autonomous teammate in a hilos channel. Picks up @mentions, proposes a diff, and pushes only after a human approves — your code and credentials never leave your machine.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/handler.mjs
CHANGED
|
@@ -119,6 +119,31 @@ async function applyDecision({ decision, repoPath, branch, task, cfg, tool, chan
|
|
|
119
119
|
return { status: "timeout", branch };
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Does this mention ask for a code change (→ branch/diff/PR flow), or is it
|
|
124
|
+
* chat (→ a conversational reply)? Greetings and questions are chat even when
|
|
125
|
+
* they mention code; an action verb means work. Keeps casual talk in a
|
|
126
|
+
* repo-linked channel from spawning empty branches.
|
|
127
|
+
*/
|
|
128
|
+
export function looksLikeCodeTask(text) {
|
|
129
|
+
const t = String(text || "")
|
|
130
|
+
.toLowerCase()
|
|
131
|
+
.replace(/@[a-z0-9-]+/g, " ")
|
|
132
|
+
.trim();
|
|
133
|
+
if (!t) return false;
|
|
134
|
+
// Greetings / questions → chat (even if they name code things).
|
|
135
|
+
if (
|
|
136
|
+
/^(hi|hey|hello|yo|sup|gm|thanks|thank you|nice|cool|ok|okay|how|what|why|when|who|where|which|is\b|are\b|do you|does|did|could you (tell|explain|show|describe)|can you (tell|explain|show|describe))/.test(
|
|
137
|
+
t,
|
|
138
|
+
)
|
|
139
|
+
) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
const verb =
|
|
143
|
+
/\b(fix|add|implement|refactor|change|update|create|remove|delete|rename|write|build|bump|migrate|wire|patch|optimi[sz]e|debug|revert|rebase|configure|improve|replace|extract|split|move|generate|scaffold|make|set up|hook up|adjust|tweak)\b/;
|
|
144
|
+
return verb.test(t);
|
|
145
|
+
}
|
|
146
|
+
|
|
122
147
|
/** owner/name from a GitHub remote URL (https or ssh), or null. */
|
|
123
148
|
export function normalizeRemote(url) {
|
|
124
149
|
const m = String(url || "")
|
|
@@ -164,9 +189,9 @@ export async function handleTask({ message, channelId, tool, me }, cfg, depsOver
|
|
|
164
189
|
|
|
165
190
|
const { links = [] } = await tool("get_links", { channelId }).catch(() => ({ links: [] }));
|
|
166
191
|
const repoLink = links.find((l) => l.repo_full_name);
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
192
|
+
// Chat (no repo linked, OR a greeting/question even in a repo channel) →
|
|
193
|
+
// reply via the CLI. Only an actual code request runs the branch/diff/PR flow.
|
|
194
|
+
if (!repoLink || !looksLikeCodeTask(message.body)) {
|
|
170
195
|
await respondConversationally({ message, channelId, tool, me, cfg });
|
|
171
196
|
return { status: "chat" };
|
|
172
197
|
}
|