agentlife 2.4.3 → 2.4.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 +11 -96
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1110,11 +1110,13 @@ Triggered when the orchestrator routes a "create X agent" / "track Y for me" / n
1110
1110
  - \`USER.md\` — domain-specific user facts (name, timezone, language + domain knowledge). Read the user's other USER.md files for identity; don't invent.
1111
1111
  - \`HEARTBEAT.md\` — periodic check instructions, or empty placeholder \`# Keep empty to skip\`.
1112
1112
  4. **Register the agent via \`exec\`**:
1113
- \`exec openclaw gateway call agentlife.createAgent --params '{"id":"{agentId}","name":"{Name}","model":"{model}","workspace":"/abs/path","description":"one sentence","tools":{"profile":"full"},"identity":{"name":"{Name}","emoji":"{emoji}"}}'\`
1113
+ \`exec openclaw gateway call agentlife.createAgent --params '{"id":"{agentId}","name":"{Name}","model":"{model}","workspace":"/abs/path","description":"one sentence","tools":{"allow":["*","agentlife_push"]},"identity":{"name":"{Name}","emoji":"{emoji}"}}'\`
1114
1114
  - Description drives the orchestrator's routing — make it specific (domains, actions, data types).
1115
- - \`tools: {profile:"full"}\` for agents needing exec/web/write. \`{allow:["agentlife_push"]}\` for widget-only agents.
1116
- - The plugin deterministically renders a \`{agentId}-intro\` widget the moment \`agentlife.createAgent\` returns — you do not push one yourself.
1117
- 5. **Hand off**: \`delete {domain}-building\`, then emit \`done\`.
1115
+ - \`tools: {allow:["*","agentlife_push"]}\` for agents needing exec/web/write + widget push. \`{allow:["agentlife_push"]}\` for widget-only agents. Never use \`profile:"full"\` with \`alsoAllow\` — OpenClaw's policy pipeline strips plugin tools through the intersection.
1116
+ 5. **Hand off in ONE final turn, all in this order, before \`done\`:**
1117
+ a. Push ONE actionable first widget for the newly-created agent under a surfaceId you own (\`{agentId}-today\`, \`{agentId}-start\`, similar). It must invite the FIRST user interaction — an input prompt, a starter metric with a CTA, a question the user can answer right now. NEVER an identity/confirmation card ("Agent ready", "Welcome to X"). The plugin no longer pushes a placeholder intro widget; this first push IS the dashboard's anchor for the new agent.
1118
+ b. \`delete {domain}-building\` — the loading widget from step 1.
1119
+ c. Emit \`done\`.
1118
1120
 
1119
1121
  ## Writing AGENTS.md (for the specialist you create)
1120
1122
 
@@ -2747,91 +2749,13 @@ function snapshotOnboarding(state, runtime) {
2747
2749
  }
2748
2750
 
2749
2751
  // render-widgets.ts
2750
- function recentActivityCount(state, agentId, sinceMs) {
2751
- if (!state.historyDb)
2752
- return 0;
2753
- try {
2754
- const row = state.historyDb.prepare("SELECT COUNT(*) as c FROM activity_log WHERE agentId = ? AND ts > ?").get(agentId, sinceMs);
2755
- return row?.c ?? 0;
2756
- } catch {
2757
- return 0;
2758
- }
2759
- }
2760
- function pendingFollowupCount(state, agentId) {
2761
- if (!state.historyDb)
2762
- return 0;
2763
- try {
2764
- const row = state.historyDb.prepare("SELECT COUNT(*) as c FROM followups WHERE agentId = ? AND status = 'pending'").get(agentId);
2765
- return row?.c ?? 0;
2766
- } catch {
2767
- return 0;
2768
- }
2769
- }
2770
- function sanitizeDslString(s) {
2771
- return s.replace(/"/g, "'").replace(/[\r\n]+/g, " ").slice(0, 120);
2772
- }
2773
- function composeAgentIntroDsl(opts) {
2774
- const surfaceId = `${opts.agentId}-intro`;
2775
- const title = `${opts.emoji} ${opts.name}`;
2776
- const desc = sanitizeDslString(opts.description || `Your ${opts.name} agent, ready to track and act.`);
2777
- const activeBadge = opts.activityCount > 0 ? "Active" : "Ready";
2778
- const activeColor = opts.activityCount > 0 ? "#10B981" : "#6366F1";
2779
- return [
2780
- `surface ${surfaceId} size=m`,
2781
- ` card`,
2782
- ` column`,
2783
- ` text "${sanitizeDslString(title)}" h3`,
2784
- ` text "${desc}" body`,
2785
- ` divider`,
2786
- ` row distribute=spaceBetween`,
2787
- ` metric "Actions (7d)" "${opts.activityCount}"`,
2788
- ` metric "Upcoming" "${opts.followupCount}"`,
2789
- ` badge "${activeBadge}" color=${activeColor} outlined`,
2790
- `goal: ${opts.name} — track progress toward user's first real outcome`,
2791
- `followup: +24h "Check if the user interacted with the ${opts.name} agent. If yes, summarize progress. If not, push a gentle prompt relevant to the domain."`,
2792
- `context: {"agentId":"${opts.agentId}","domain":"${opts.agentId}","phase":"intro","autoRendered":true}`
2793
- ].join(`
2794
- `);
2795
- }
2796
- function agentEmoji(runtime, agentId) {
2797
- const cfg = runtime.config.loadConfig();
2798
- const list = cfg?.agents?.list ?? [];
2799
- const found = list.find((a) => a?.id === agentId);
2800
- return found?.identity?.emoji ?? "\uD83C\uDFAF";
2801
- }
2802
- function renderAgentWidget(state, runtime, agentId, log) {
2803
- if (!userAgentIds(runtime).includes(agentId))
2804
- return;
2805
- const entry = state.agentRegistry.get(agentId);
2806
- if (!entry) {
2807
- log(`[render-widgets] ${agentId}: no registry entry, skipping`);
2808
- return;
2809
- }
2810
- const sevenDaysAgo = Date.now() - 7 * 24 * 60 * 60 * 1000;
2811
- const dsl = composeAgentIntroDsl({
2812
- agentId,
2813
- name: entry.name,
2814
- description: entry.description ?? "",
2815
- emoji: agentEmoji(runtime, agentId),
2816
- activityCount: recentActivityCount(state, agentId, sevenDaysAgo),
2817
- followupCount: pendingFollowupCount(state, agentId)
2818
- });
2819
- pluginPushSurface(state, { agentId, dsl });
2820
- log(`[render-widgets] rendered ${agentId}-intro`);
2821
- }
2822
2752
  function renderAllAgentWidgets(state, runtime, log) {
2823
2753
  if (isOnboarding(state, runtime)) {
2824
2754
  log("[render-widgets] onboarding active — rendering welcome widget");
2825
2755
  renderWelcomeWidget(state, log);
2826
2756
  return;
2827
2757
  }
2828
- for (const id of userAgentIds(runtime)) {
2829
- try {
2830
- renderAgentWidget(state, runtime, id, log);
2831
- } catch (e) {
2832
- log(`[render-widgets] ${id} render failed: ${e?.message ?? e}`);
2833
- }
2834
- }
2758
+ log("[render-widgets] onboarding complete — no plugin-pushed widgets; specialists own their surfaces");
2835
2759
  }
2836
2760
  var WELCOME_SURFACE_ID = "welcome";
2837
2761
  var WELCOME_INPUT_SURFACE_ID = "welcome-input";
@@ -2851,12 +2775,12 @@ Each turn:
2851
2775
  - updated \`context: {"phase":"welcome","turn":N+1,"answers":[...]}\`
2852
2776
  - goal + followup unchanged
2853
2777
  Respond \`done\`.
2854
- 3. Enough → create the generalist:
2778
+ 3. Enough → create the generalist and hand off the dashboard:
2855
2779
  - Workspace under \`$HOME/.openclaw/workspace-{id}\` (id = slugified short name or "me")
2856
2780
  - \`AGENTS.md\` — generalist scope covering mentioned domains; Data Schema must include a \`domain TEXT NOT NULL\` column on every user-data table so future split by domain is trivial; add self-evolution clause ("when activity_log rows for one domain exceed a natural threshold, push a split-suggest widget")
2857
2781
  - \`SOUL.md\`, \`IDENTITY.md\`, \`USER.md\` (user's own words), \`HEARTBEAT.md\` (empty)
2858
- - \`exec openclaw gateway call agentlife.createAgent --params '{...}'\` with \`tools: {profile:"full"}\`. Plugin auto-deletes welcome + welcome-input and renders {id}-intro — do NOT push an intro.
2859
- - Respond \`done\`.
2782
+ - \`exec openclaw gateway call agentlife.createAgent --params '{...}'\` with \`tools: {allow: ["*", "agentlife_push"]}\`. Plugin auto-deletes welcome + welcome-input on success.
2783
+ - **Final step, same turn, before \`done\`:** push ONE actionable first widget for the newly-created agent — an input prompt ("Log your first meal", "Enter today's weight"), a starter metric, or an inviting CTA that owns a surfaceId like \`{id}-today\` / \`{id}-start\`. This is what the user sees when onboarding ends; it MUST invite interaction, not just announce existence. Then delete your \`{domain}-building\` loading widget. Then emit \`done\`.
2860
2784
  `;
2861
2785
  function renderWelcomeWidget(state, log) {
2862
2786
  const welcomeDsl = [
@@ -2898,14 +2822,6 @@ function deleteWelcomeWidget(state, log) {
2898
2822
  log(`[render-widgets] deleted ${id}`);
2899
2823
  }
2900
2824
  }
2901
- if (state.runCommand) {
2902
- const deleteParams = JSON.stringify({ key: ONBOARDING_SESSION_KEY, deleteTranscript: true });
2903
- state.runCommand(["openclaw", "gateway", "call", "sessions.delete", "--params", deleteParams], { timeoutMs: 1e4 }).then(() => {
2904
- log(`[render-widgets] deleted onboarding session`);
2905
- }).catch((e) => {
2906
- console.log("[agentlife] onboarding session delete skipped: %s", e?.message);
2907
- });
2908
- }
2909
2825
  }
2910
2826
 
2911
2827
  // services/surfaces-init.ts
@@ -6256,10 +6172,9 @@ function registerAgentGateway(api, state2) {
6256
6172
  configFields.push("identity");
6257
6173
  if (!existing && userAgentIds(api.runtime).includes(id)) {
6258
6174
  try {
6259
- renderAgentWidget(state2, api.runtime, id, console.log);
6260
6175
  deleteWelcomeWidget(state2, console.log);
6261
6176
  } catch (e) {
6262
- console.warn("[agentlife] renderAgentWidget failed for %s: %s", id, e?.message);
6177
+ console.warn("[agentlife] deleteWelcomeWidget failed for %s: %s", id, e?.message);
6263
6178
  }
6264
6179
  }
6265
6180
  respond(true, { status, id, name, model, workspace, description, ...configFields.length ? { configFields } : {} });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentlife",
3
- "version": "2.4.3",
3
+ "version": "2.4.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",