agentlife 2.6.2 → 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 +47 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1230,6 +1230,34 @@ The platform provides two storage systems. Do NOT use OpenClaw memory files (mem
1230
1230
  - Workspace files for state
1231
1231
  - Session history as knowledge
1232
1232
  `;
1233
+ var DISMISS_ALTERNATIVES_GUIDANCE = `### Crafting Dismiss Alternatives
1234
+
1235
+ The user is dismissing this widget. You have ~30s to push an \`input\` surface with 2-3 contextual options before the platform completes the dismiss.
1236
+
1237
+ **Rules:**
1238
+ - Each option is an ACTION the user would want, not a feedback label.
1239
+ - Derive from this widget's goal and context — offer options only YOU could offer given what you know about this domain.
1240
+ - Common types: adjust scope (broader/narrower), change timing (more/less frequent), shift focus (different angle of the same domain), reschedule (try later at a specific time).
1241
+ - 2-3 options maximum. More = decision fatigue.
1242
+ - "Remove it" is always last. Use \`action=choice\` so it renders as a numbered list.
1243
+ - surfaceId: \`dismiss-alt-{parent-surfaceId}\`. Goal: reference the parent. Followup: ~1m so the flow doesn't stall if the user walks away.
1244
+
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.`;
1233
1261
  var ORCHESTRATOR_AGENTS_MD = `# AgentLife Orchestrator
1234
1262
 
1235
1263
  You are a message router. You never answer questions, perform tasks, push widgets, or produce content.
@@ -6535,17 +6563,26 @@ function registerPromptStateHook(api, state2) {
6535
6563
  return;
6536
6564
  const dashboardState = buildDashboardStateContext(state2, agentId);
6537
6565
  const isOnboardingTurn = sessionKey === ONBOARDING_SESSION_KEY && isOnboarding(state2, api.runtime);
6538
- const appendSystemContext = isOnboardingTurn ? dashboardState ? `${ONBOARDING_PLAYBOOK}
6539
-
6540
- ${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;
6541
6577
  if (!appendSystemContext) {
6542
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);
6543
6579
  return;
6544
6580
  }
6581
+ const tag = reactive ? "reactive+" : "";
6545
6582
  if (isOnboardingTurn) {
6546
- 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);
6547
6584
  } else {
6548
- 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);
6549
6586
  }
6550
6587
  return { appendSystemContext };
6551
6588
  });
@@ -7152,6 +7189,9 @@ function registerSurfacesGateway(api, state2) {
7152
7189
  const goalSnippet = view.goal ? ` goal="${view.goal}"` : "";
7153
7190
  const reasonSnippet = reason ? ` reason="${reason}"` : "";
7154
7191
  const sessionKey = buildAgentSessionKey(agentId2);
7192
+ state2.pendingReactiveGuidance.set(sessionKey, `${DISMISS_ALTERNATIVES_GUIDANCE}
7193
+
7194
+ ${INPUT_SURFACE_DISPATCH}`);
7155
7195
  const message = `[system:dismiss-requested] surfaceId=${surfaceId}${goalSnippet}${reasonSnippet}`;
7156
7196
  state2.runCommand([
7157
7197
  "openclaw",
@@ -8522,7 +8562,8 @@ function register(api) {
8522
8562
  requestHeartbeatNow: null,
8523
8563
  disabled: false,
8524
8564
  channelState: { lastInboundAt: null },
8525
- internalModel: resolveInternalModel(api)
8565
+ internalModel: resolveInternalModel(api),
8566
+ pendingReactiveGuidance: new Map
8526
8567
  };
8527
8568
  currentState = state2;
8528
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.2",
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",