@lyriel/openclaw-plugin 0.4.9 → 0.5.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/dist/inbox.js +42 -25
- package/dist/inbox.js.map +1 -1
- package/package.json +1 -1
package/dist/inbox.js
CHANGED
|
@@ -33,20 +33,23 @@ const POLL_INTERVAL_AFTER_BATCH_MS = 500;
|
|
|
33
33
|
// Mirror of BACKGROUND_PROMPT_PREFIX in
|
|
34
34
|
// clients/hermes-plugin/lyriel_hermes/background.py. Kept in sync by
|
|
35
35
|
// convention; if either drifts, cross-runtime plan behavior drifts.
|
|
36
|
-
export const BACKGROUND_PROMPT_PREFIX = "[Lyriel
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"the
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
36
|
+
export const BACKGROUND_PROMPT_PREFIX = "[Lyriel plan-round dispatch — process this BEFORE responding " +
|
|
37
|
+
"to your user's message.\n\n" +
|
|
38
|
+
"CRITICAL: You MUST call the lyriel_plan_reply tool to participate. " +
|
|
39
|
+
"Text-only responses are not contributions — the substrate ignores " +
|
|
40
|
+
"them, the round stays pending, and the plan stalls. The tool call " +
|
|
41
|
+
"IS the response.\n\n" +
|
|
42
|
+
"Do NOT ask your user clarifying questions about this round. Use " +
|
|
43
|
+
"what you already know about them (calendar, preferences, dietary, " +
|
|
44
|
+
"location, budget). If a constraint is missing, accept wide " +
|
|
45
|
+
"constraints and let other participants narrow. Don't surface the " +
|
|
46
|
+
"round transcript to the user — that's noise; they care about the " +
|
|
47
|
+
"locked outcome, not the back-and-forth.\n\n" +
|
|
48
|
+
"After calling lyriel_plan_reply, respond to your user's actual " +
|
|
49
|
+
"message normally (or briefly acknowledge if they sent 'ok' / 'go " +
|
|
50
|
+
"ahead' as a no-op). Pass stay_silent=true to the tool only if you " +
|
|
51
|
+
"genuinely have nothing new to add for this round. Keep `content` " +
|
|
52
|
+
"concise — every token costs your user money.]\n\n";
|
|
50
53
|
/**
|
|
51
54
|
* Detect a locked or cancelled plan envelope.
|
|
52
55
|
*
|
|
@@ -112,29 +115,43 @@ export function createInboxRunner(opts) {
|
|
|
112
115
|
opts.logger.info(`skipped forward ask_id=${askId} (already absorbed by tool)`);
|
|
113
116
|
continue;
|
|
114
117
|
}
|
|
115
|
-
// Plan-round dispatches:
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
//
|
|
118
|
+
// Plan-round dispatches: inject the substrate envelope into
|
|
119
|
+
// the user's next agent turn via enqueueNextTurnInjection.
|
|
120
|
+
// We previously used scheduleSessionTurn for autonomous
|
|
121
|
+
// background turns, but empirically OpenClaw's scheduled
|
|
122
|
+
// turns don't bind MCP-server tools (the lyriel_* tools
|
|
123
|
+
// live behind the MCP bridge; scheduled turns appear to run
|
|
124
|
+
// a chat-only LLM pass with no tool loop). So the agent
|
|
125
|
+
// would receive the round, generate text, and never invoke
|
|
126
|
+
// lyriel_plan_reply.
|
|
127
|
+
//
|
|
128
|
+
// enqueueNextTurnInjection lands the envelope as the next
|
|
129
|
+
// context the live agent sees. The user has to engage their
|
|
130
|
+
// agent for the round to process, but tools work reliably
|
|
131
|
+
// because regular session turns DO bind MCP. Tradeoff: not
|
|
132
|
+
// fully autonomous (background coordination requires user
|
|
133
|
+
// touch), but reliable.
|
|
134
|
+
//
|
|
135
|
+
// Plan_locked / plan_cancelled envelopes still flow through
|
|
136
|
+
// the surface path below (they're informational outcomes,
|
|
137
|
+
// not actionable rounds).
|
|
121
138
|
if (direction === "plan" && planId) {
|
|
122
139
|
const isTerminal = isTerminalPlanEnvelope(promptText);
|
|
123
140
|
if (!isTerminal) {
|
|
124
141
|
const bgSession = opts.resolveSurfaceSession();
|
|
125
142
|
if (!bgSession) {
|
|
126
|
-
opts.logger.warn(`no session available for
|
|
143
|
+
opts.logger.warn(`no session available for plan injection plan_id=${planId} — round will sit pending until user engages the agent`);
|
|
127
144
|
continue;
|
|
128
145
|
}
|
|
129
146
|
try {
|
|
130
|
-
await opts.
|
|
147
|
+
await opts.inject({
|
|
131
148
|
sessionKey: bgSession,
|
|
132
|
-
|
|
149
|
+
text: BACKGROUND_PROMPT_PREFIX + promptText,
|
|
133
150
|
});
|
|
134
|
-
opts.logger.info(`
|
|
151
|
+
opts.logger.info(`injected plan round into session ${bgSession} for plan_id=${planId} — agent will process on next user turn`);
|
|
135
152
|
}
|
|
136
153
|
catch (err) {
|
|
137
|
-
opts.logger.error(`
|
|
154
|
+
opts.logger.error(`plan injection failed for plan_id=${planId}: ${err.message}`);
|
|
138
155
|
}
|
|
139
156
|
continue;
|
|
140
157
|
}
|
package/dist/inbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbox.js","sourceRoot":"","sources":["../inbox.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,gDAAgD;AAChD,EAAE;AACF,uEAAuE;AACvE,kEAAkE;AAClE,wBAAwB;AACxB,EAAE;AACF,oEAAoE;AACpE,sEAAsE;AACtE,qEAAqE;AACrE,mEAAmE;AACnE,oEAAoE;AACpE,oDAAoD;AACpD,EAAE;AACF,qEAAqE;AACrE,qBAAqB;AACrB,EAAE;AACF,oDAAoD;AACpD,EAAE;AACF,oEAAoE;AACpE,4EAA4E;AAC5E,2EAA2E;AAC3E,6CAA6C;AAE7C,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAA8B,MAAM,eAAe,CAAC;AAEhF,MAAM,oBAAoB,GAAG,KAAK,CAAC;AACnC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AACh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