agentlife 2.6.3 → 2.6.5

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.
Files changed (2) hide show
  1. package/dist/index.js +35 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1243,6 +1243,21 @@ The user is dismissing this widget. You have ~30s to push an \`input\` surface w
1243
1243
  - surfaceId: \`dismiss-alt-{parent-surfaceId}\`. Goal: reference the parent. Followup: ~1m so the flow doesn't stall if the user walks away.
1244
1244
 
1245
1245
  If the user picks an alternative → act on it; the dismiss is cancelled. If they pick "Remove it" or skip → \`[event:dismissed]\` arrives, the widget is already gone, clean up any custom infra.`;
1246
+ var INPUT_SURFACE_DISPATCH = `### Input Surface — Button Shapes & Dispatch
1247
+
1248
+ **Only these \`action=\` values work inside an \`input\` surface:**
1249
+ - \`action=choice\` or \`action=select\` → numbered single-select list (one tap fires).
1250
+ - \`action=toggle\`, \`action=check\`, \`action=multichoice\` → checkbox multi-select (one tap of send dispatches all picks).
1251
+
1252
+ Any other \`action=\` name renders as a plain button and breaks the input-bar UX → QUALITY ERROR.
1253
+
1254
+ Custom action names (\`action=approve\`, \`action=investigate\`, etc.) are for **regular dashboard widgets** only, not input surfaces.
1255
+
1256
+ **Dispatch format:**
1257
+ - Single-select: \`[action:choice] label=<label>\` (one tap fires).
1258
+ - Multi-select: \`[action:toggle] label=<A>; <B>; <C>\` (labels joined with \`; \` — user picks checkboxes, then one tap of send dispatches all selections). Your handler splits \`label\` on \`"; "\` to recover individual selections.
1259
+
1260
+ **Free-text:** the native input bar is always available. Declare \`textfield placeholder="..."\` to customize the placeholder. Platform auto-numbers choice buttons — don't add numbers to labels.`;
1246
1261
  var ORCHESTRATOR_AGENTS_MD = `# AgentLife Orchestrator
1247
1262
 
1248
1263
  You are a message router. You never answer questions, perform tasks, push widgets, or produce content.
@@ -6019,12 +6034,7 @@ Setup code: ${setupCode}
6019
6034
  var SKIP_GUIDANCE_AGENTS = new Set(["agentlife"]);
6020
6035
  var SKIP_AGENTS_MD_INJECTION = new Set(["agentlife", "agentlife-builder", "quick", "supervisor"]);
6021
6036
  function registerBootstrapHook(api, state2) {
6022
- api.registerService({
6023
- id: "agentlife-bootstrap-hook",
6024
- start: () => {
6025
- registerBootstrapHookImpl(api, state2);
6026
- }
6027
- });
6037
+ registerBootstrapHookImpl(api, state2);
6028
6038
  }
6029
6039
  function registerBootstrapHookImpl(api, state2) {
6030
6040
  api.registerHook("agent:bootstrap", (event) => {
@@ -6548,17 +6558,26 @@ function registerPromptStateHook(api, state2) {
6548
6558
  return;
6549
6559
  const dashboardState = buildDashboardStateContext(state2, agentId);
6550
6560
  const isOnboardingTurn = sessionKey === ONBOARDING_SESSION_KEY && isOnboarding(state2, api.runtime);
6551
- const appendSystemContext = isOnboardingTurn ? dashboardState ? `${ONBOARDING_PLAYBOOK}
6552
-
6553
- ${dashboardState}` : ONBOARDING_PLAYBOOK : dashboardState;
6561
+ const reactive = state2.pendingReactiveGuidance.get(sessionKey);
6562
+ if (reactive)
6563
+ state2.pendingReactiveGuidance.delete(sessionKey);
6564
+ const parts = [
6565
+ isOnboardingTurn ? ONBOARDING_PLAYBOOK : null,
6566
+ reactive ?? null,
6567
+ dashboardState
6568
+ ].filter((x) => !!x);
6569
+ const appendSystemContext = parts.length ? parts.join(`
6570
+
6571
+ `) : null;
6554
6572
  if (!appendSystemContext) {
6555
6573
  console.log("[agentlife:prompt-state] agentId=%s — no context to inject (index=%d, transient=%d)", agentId ?? "NONE", state2.surfaceIndex?.count() ?? 0, state2.transientSurfaces?.size() ?? 0);
6556
6574
  return;
6557
6575
  }
6576
+ const tag = reactive ? "reactive+" : "";
6558
6577
  if (isOnboardingTurn) {
6559
- console.log("[agentlife:prompt-state] onboarding session — injecting %d chars (playbook + dashboard)", appendSystemContext.length);
6578
+ console.log("[agentlife:prompt-state] onboarding session — injecting %d chars (%splaybook + dashboard)", appendSystemContext.length, tag);
6560
6579
  } else {
6561
- console.log("[agentlife:prompt-state] agentId=%s injecting %d chars dashboard state", agentId ?? "NONE", appendSystemContext.length);
6580
+ console.log("[agentlife:prompt-state] agentId=%s injecting %d chars %sdashboard state", agentId ?? "NONE", appendSystemContext.length, tag);
6562
6581
  }
6563
6582
  return { appendSystemContext };
6564
6583
  });
@@ -7165,9 +7184,10 @@ function registerSurfacesGateway(api, state2) {
7165
7184
  const goalSnippet = view.goal ? ` goal="${view.goal}"` : "";
7166
7185
  const reasonSnippet = reason ? ` reason="${reason}"` : "";
7167
7186
  const sessionKey = buildAgentSessionKey(agentId2);
7168
- const message = `${DISMISS_ALTERNATIVES_GUIDANCE}
7187
+ state2.pendingReactiveGuidance.set(sessionKey, `${DISMISS_ALTERNATIVES_GUIDANCE}
7169
7188
 
7170
- ` + `[system:dismiss-requested] surfaceId=${surfaceId}${goalSnippet}${reasonSnippet}`;
7189
+ ${INPUT_SURFACE_DISPATCH}`);
7190
+ const message = `[system:dismiss-requested] surfaceId=${surfaceId}${goalSnippet}${reasonSnippet}`;
7171
7191
  state2.runCommand([
7172
7192
  "openclaw",
7173
7193
  "gateway",
@@ -8537,7 +8557,8 @@ function register(api) {
8537
8557
  requestHeartbeatNow: null,
8538
8558
  disabled: false,
8539
8559
  channelState: { lastInboundAt: null },
8540
- internalModel: resolveInternalModel(api)
8560
+ internalModel: resolveInternalModel(api),
8561
+ pendingReactiveGuidance: new Map
8541
8562
  };
8542
8563
  currentState = state2;
8543
8564
  api.registerChannel({ plugin: createAgentlifeChannel(state2.channelState) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentlife",
3
- "version": "2.6.3",
3
+ "version": "2.6.5",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "bun build index.ts --outfile dist/index.js --target node --external openclaw/plugin-sdk",