agentlife 2.6.3 → 2.6.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.
Files changed (2) hide show
  1. package/dist/index.js +34 -8
  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.
@@ -6548,17 +6563,26 @@ function registerPromptStateHook(api, state2) {
6548
6563
  return;
6549
6564
  const dashboardState = buildDashboardStateContext(state2, agentId);
6550
6565
  const isOnboardingTurn = sessionKey === ONBOARDING_SESSION_KEY && isOnboarding(state2, api.runtime);
6551
- const appendSystemContext = isOnboardingTurn ? dashboardState ? `${ONBOARDING_PLAYBOOK}
6552
-
6553
- ${dashboardState}` : ONBOARDING_PLAYBOOK : dashboardState;
6566
+ const reactive = state2.pendingReactiveGuidance.get(sessionKey);
6567
+ if (reactive)
6568
+ state2.pendingReactiveGuidance.delete(sessionKey);
6569
+ const parts = [
6570
+ isOnboardingTurn ? ONBOARDING_PLAYBOOK : null,
6571
+ reactive ?? null,
6572
+ dashboardState
6573
+ ].filter((x) => !!x);
6574
+ const appendSystemContext = parts.length ? parts.join(`
6575
+
6576
+ `) : null;
6554
6577
  if (!appendSystemContext) {
6555
6578
  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
6579
  return;
6557
6580
  }
6581
+ const tag = reactive ? "reactive+" : "";
6558
6582
  if (isOnboardingTurn) {
6559
- console.log("[agentlife:prompt-state] onboarding session — injecting %d chars (playbook + dashboard)", appendSystemContext.length);
6583
+ console.log("[agentlife:prompt-state] onboarding session — injecting %d chars (%splaybook + dashboard)", appendSystemContext.length, tag);
6560
6584
  } else {
6561
- console.log("[agentlife:prompt-state] agentId=%s injecting %d chars dashboard state", agentId ?? "NONE", appendSystemContext.length);
6585
+ console.log("[agentlife:prompt-state] agentId=%s injecting %d chars %sdashboard state", agentId ?? "NONE", appendSystemContext.length, tag);
6562
6586
  }
6563
6587
  return { appendSystemContext };
6564
6588
  });
@@ -7165,9 +7189,10 @@ function registerSurfacesGateway(api, state2) {
7165
7189
  const goalSnippet = view.goal ? ` goal="${view.goal}"` : "";
7166
7190
  const reasonSnippet = reason ? ` reason="${reason}"` : "";
7167
7191
  const sessionKey = buildAgentSessionKey(agentId2);
7168
- const message = `${DISMISS_ALTERNATIVES_GUIDANCE}
7192
+ state2.pendingReactiveGuidance.set(sessionKey, `${DISMISS_ALTERNATIVES_GUIDANCE}
7169
7193
 
7170
- ` + `[system:dismiss-requested] surfaceId=${surfaceId}${goalSnippet}${reasonSnippet}`;
7194
+ ${INPUT_SURFACE_DISPATCH}`);
7195
+ const message = `[system:dismiss-requested] surfaceId=${surfaceId}${goalSnippet}${reasonSnippet}`;
7171
7196
  state2.runCommand([
7172
7197
  "openclaw",
7173
7198
  "gateway",
@@ -8537,7 +8562,8 @@ function register(api) {
8537
8562
  requestHeartbeatNow: null,
8538
8563
  disabled: false,
8539
8564
  channelState: { lastInboundAt: null },
8540
- internalModel: resolveInternalModel(api)
8565
+ internalModel: resolveInternalModel(api),
8566
+ pendingReactiveGuidance: new Map
8541
8567
  };
8542
8568
  currentState = state2;
8543
8569
  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.4",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "bun build index.ts --outfile dist/index.js --target node --external openclaw/plugin-sdk",