bazilion 0.59.0 → 0.60.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.
Files changed (45) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +180 -37
  4. package/dist/daemon.js.map +1 -1
  5. package/dist/web/client/assets/{AddProviderDialog-CbBtkgU7.js → AddProviderDialog-PK8ZRkVP.js} +1 -1
  6. package/dist/web/client/assets/{AgentTemplateParts-Tx0RJoDa.js → AgentTemplateParts-DXqswWc_.js} +1 -1
  7. package/dist/web/client/assets/{ConfirmDialog-Du8-95Zj.js → ConfirmDialog-C7Id43en.js} +1 -1
  8. package/dist/web/client/assets/{ConnectionsView-Dg9kLuab.js → ConnectionsView-sCcb1DqZ.js} +1 -1
  9. package/dist/web/client/assets/{SkillsParts-TYzEfrVu.js → SkillsParts-ClIFyTi8.js} +1 -1
  10. package/dist/web/client/assets/{SpawnTeamModal-Dr98zpUf.js → SpawnTeamModal-BxRg6e3v.js} +1 -1
  11. package/dist/web/client/assets/{TeamForm-DaH5H-LF.js → TeamForm-e_yDks2o.js} +1 -1
  12. package/dist/web/client/assets/{TeamThread-DmtbrFq1.js → TeamThread-BFz7jkrt.js} +1 -1
  13. package/dist/web/client/assets/{UnsavedChangesGuard-fvP4Xr0R.js → UnsavedChangesGuard-Cgc9WraN.js} +1 -1
  14. package/dist/web/client/assets/{_id--1i1fY0o.js → _id-C24VHwwo.js} +1 -1
  15. package/dist/web/client/assets/{_id-C_s4pMAk.js → _id-DeCenuG4.js} +1 -1
  16. package/dist/web/client/assets/{access-99X0FS-H.js → access-Dh3w6dHo.js} +1 -1
  17. package/dist/web/client/assets/{agents-CDJMwJL1.js → agents-CUQ-DKWA.js} +1 -1
  18. package/dist/web/client/assets/{agents-DVAJFWJI.js → agents-DHTN7twQ.js} +1 -1
  19. package/dist/web/client/assets/{attention-CDzRuQGN.js → attention-pzVO90iq.js} +1 -1
  20. package/dist/web/client/assets/{config-9GESe8FI.js → config-B29EfkVV.js} +1 -1
  21. package/dist/web/client/assets/{index-DkK2xZ2o.js → index-B8Bft71n.js} +3 -3
  22. package/dist/web/client/assets/{login-DUmrDZjN.js → login-CUACsY1J.js} +1 -1
  23. package/dist/web/client/assets/{manage-D6zhY8hA.js → manage-DrwsI5ur.js} +1 -1
  24. package/dist/web/client/assets/{mcp-ByioWHXZ.js → mcp-DFBkafUW.js} +1 -1
  25. package/dist/web/client/assets/{routes-DEMmBJiz.js → routes-DPz6Wrxz.js} +3 -3
  26. package/dist/web/client/assets/{skills-a52e5W9Z.js → skills-B0khtQXg.js} +1 -1
  27. package/dist/web/client/assets/{style-CiyV21dp.js → style-BEcLEdJR.js} +1 -1
  28. package/dist/web/client/assets/{system-wJXOiU47.js → system-DexaXrV1.js} +1 -1
  29. package/dist/web/client/assets/{teams-vRmMRnY_.js → teams-CUgnrqA5.js} +1 -1
  30. package/dist/web/client/assets/{teams-wLJHtFW_.js → teams-DC-abyJ_.js} +1 -1
  31. package/dist/web/client/assets/{telegram-CUsT8ZzL.js → telegram-DlnKiJP1.js} +1 -1
  32. package/dist/web/client/assets/{tools-NMtdwKi0.js → tools-BefW81ig.js} +1 -1
  33. package/dist/web/client/assets/{usage-DiIpfPPk.js → usage-oJ-ACG85.js} +1 -1
  34. package/dist/web/client/assets/{welcome-BWN0jtZP.js → welcome-BzesXAyM.js} +1 -1
  35. package/dist/web/server/assets/{ConnectionsView-CplWLHII.js → ConnectionsView-HoyHjzrZ.js} +2 -2
  36. package/dist/web/server/assets/{TeamThread-BGl5z8_I.js → TeamThread-Be_seq83.js} +1 -1
  37. package/dist/web/server/assets/{_tanstack-start-manifest_v-Be9mOSxg.js → _tanstack-start-manifest_v-CEGe-Ovy.js} +57 -57
  38. package/dist/web/server/assets/{activity-Czfq-5_F.js → activity-Dy1HUqjo.js} +13 -0
  39. package/dist/web/server/assets/{router-BER0FKkT.js → router-CE6lnn8Z.js} +2 -2
  40. package/dist/web/server/assets/{routes-qtTyGHXK.js → routes-B0oBIDOC.js} +1 -1
  41. package/dist/web/server/assets/{routes-DSIwTrHI.js → routes-Ci6C5w_N.js} +4 -4
  42. package/dist/web/server/server.js +2 -2
  43. package/dist/worker.js +153 -10
  44. package/dist/worker.js.map +1 -1
  45. package/package.json +1 -1
@@ -3558,7 +3558,7 @@ var defaultSerovalPlugins = [
3558
3558
  * the dev styles URL for route-scoped CSS collection.
3559
3559
  */
3560
3560
  async function getStartManifest(matchedRoutes) {
3561
- const { tsrStartManifest } = await import("./assets/_tanstack-start-manifest_v-Be9mOSxg.js");
3561
+ const { tsrStartManifest } = await import("./assets/_tanstack-start-manifest_v-CEGe-Ovy.js");
3562
3562
  const startManifest = tsrStartManifest();
3563
3563
  let routes = startManifest.routes;
3564
3564
  routes[rootRouteId];
@@ -5524,7 +5524,7 @@ var getBaseManifest = getProdBaseManifest;
5524
5524
  var createEarlyHintsForRequest = createEarlyHintsCollector;
5525
5525
  async function loadEntries() {
5526
5526
  const [routerEntry, startEntry, pluginAdapters] = await Promise.all([
5527
- import("./assets/router-BER0FKkT.js"),
5527
+ import("./assets/router-CE6lnn8Z.js"),
5528
5528
  import("./assets/start-D4sx5Ovq.js"),
5529
5529
  import("./assets/empty-plugin-adapters-Cq4--YW-.js")
5530
5530
  ]);
package/dist/worker.js CHANGED
@@ -1821,7 +1821,7 @@ function loadPromptSkills(skillsDir, attachedNames) {
1821
1821
  var CONTEXT_FILE_ORDER = ["AGENTS.md", "SOUL.md", "TOOLS.md", "IDENTITY.md"];
1822
1822
  function loadHomeDocuments(agentDir) {
1823
1823
  const root = resolveRealDirectory(agentDir);
1824
- const read = (file) => {
1824
+ const read2 = (file) => {
1825
1825
  try {
1826
1826
  return readRegularFileNoFollow(join3(root, file));
1827
1827
  } catch (error) {
@@ -1830,11 +1830,11 @@ function loadHomeDocuments(agentDir) {
1830
1830
  }
1831
1831
  };
1832
1832
  return {
1833
- "AGENTS.md": read("AGENTS.md"),
1834
- "SOUL.md": read("SOUL.md"),
1835
- "TOOLS.md": read("TOOLS.md"),
1836
- "IDENTITY.md": read("IDENTITY.md"),
1837
- "BOOTSTRAP.md": read("BOOTSTRAP.md")
1833
+ "AGENTS.md": read2("AGENTS.md"),
1834
+ "SOUL.md": read2("SOUL.md"),
1835
+ "TOOLS.md": read2("TOOLS.md"),
1836
+ "IDENTITY.md": read2("IDENTITY.md"),
1837
+ "BOOTSTRAP.md": read2("BOOTSTRAP.md")
1838
1838
  };
1839
1839
  }
1840
1840
  function buildSystemPrompt(agent, options = {}) {
@@ -1986,7 +1986,7 @@ ${reviewedLessons.map((lesson) => `- ${lesson}`).join("\n")}`
1986
1986
  }
1987
1987
  parts.push({
1988
1988
  id: "memory",
1989
- text: "# Memory\n\nYou share a persistent memory backend with every other agent in this team. Use `memory_write` to remember things across sessions, and `memory_search` / `memory_read` / `memory_list` to recall them. This memory is for project knowledge \u2014 codebase notes, decisions, things the user told you about the work. For personal notes about yourself (preferences, persona quirks), use `home_write` on IDENTITY.md instead. Always check memory at the start of a session: another agent in the team may have already learned something useful. **Do NOT send peer messages announcing memory writes \u2014 every agent has access to the same store via `memory_search` and will find your note when they need it.**"
1989
+ text: "# Memory\n\nYou share a persistent memory backend with every other agent in this team. Use `memory_write` to remember things across sessions, and `memory_search` / `memory_read` / `memory_list` to recall them. This memory is for project knowledge \u2014 codebase notes, decisions, things the user told you about the work. For personal notes about yourself (preferences, persona quirks), use `home_write` on IDENTITY.md instead. Always check memory at the start of a session: another agent in the team may have already learned something useful. **Do NOT send peer messages announcing memory writes \u2014 every agent has access to the same store via `memory_search` and will find your note when they need it.**\n\nWhen a conversation grows long, its older messages are replaced by a summary. They stay saved: when the summary leaves out a detail you need, find it with `recall` instead of guessing or asking again."
1990
1990
  });
1991
1991
  return parts;
1992
1992
  }
@@ -3216,6 +3216,143 @@ function messagingTools(host, fromAgentId) {
3216
3216
  ];
3217
3217
  }
3218
3218
 
3219
+ // ../daemon/src/runtime/tools/recall.ts
3220
+ var MAX_WORDS = 8;
3221
+ var MAX_HITS = 12;
3222
+ var READ_COUNT = 5;
3223
+ var MAX_READ = 20;
3224
+ var BUDGET = 2e4;
3225
+ var MIN_SHARE = 2e3;
3226
+ var BEFORE = 60;
3227
+ var AFTER = 200;
3228
+ var NOTHING_SUMMARIZED = "Nothing in this conversation has been summarized: every message is still in your context.";
3229
+ function recallTool(source) {
3230
+ return {
3231
+ def: {
3232
+ name: "recall",
3233
+ description: "Search or read this conversation's older messages that were summarized to make room. When a conversation fills your context, its older messages are replaced by a summary, but they stay saved. When the summary leaves out something you need (an exact value, a link, a file name, the user's own words, what a tool returned), find it here rather than guessing or asking again. Give `query` to list the summarized messages that hold every word, with their numbers; give `from` (a number from a search, or 1 for the start) to read messages in full.",
3234
+ parameters: {
3235
+ type: "object",
3236
+ properties: {
3237
+ query: {
3238
+ type: "string",
3239
+ description: "words that must all appear in a message (case is ignored)"
3240
+ },
3241
+ from: {
3242
+ type: "integer",
3243
+ minimum: 1,
3244
+ description: "the number of the first message to read"
3245
+ },
3246
+ count: {
3247
+ type: "integer",
3248
+ minimum: 1,
3249
+ maximum: MAX_READ,
3250
+ description: `how many messages to read from \`from\` (default ${READ_COUNT}); long messages are cut, less so when you read fewer`
3251
+ }
3252
+ }
3253
+ }
3254
+ },
3255
+ async invoke(args) {
3256
+ const summarized = summarizedMessages(source);
3257
+ if (summarized.length === 0) return NOTHING_SUMMARIZED;
3258
+ if (args.from !== void 0) return read(summarized, Number(args.from), args.count);
3259
+ if (typeof args.query === "string") return search(summarized, args.query);
3260
+ throw new Error("recall: give `query` to search or `from` to read");
3261
+ }
3262
+ };
3263
+ }
3264
+ function summarizedMessages(source) {
3265
+ const { messages, compactions } = conversationHistory(source.branch());
3266
+ const end = compactions.at(-1)?.index ?? 0;
3267
+ return messages.slice(0, end).flatMap((message, index) => {
3268
+ const [shown] = piMessagesToProviderView([message], source.secrets);
3269
+ if (!shown) return [];
3270
+ const at = message.timestamp;
3271
+ const when = typeof at === "number" && Number.isFinite(at) ? ` \xB7 ${new Date(at).toISOString().slice(0, 16).replace("T", " ")} UTC` : "";
3272
+ return [
3273
+ {
3274
+ number: index + 1,
3275
+ heading: `#${index + 1} \xB7 ${speaker(shown)}${when}`,
3276
+ text: redactExactValues(textOf(shown), source.secrets)
3277
+ }
3278
+ ];
3279
+ });
3280
+ }
3281
+ function speaker(message) {
3282
+ if (message.role === "tool") {
3283
+ return `result of ${message.toolName ?? "a tool"}${message.isError ? ", failed" : ""}`;
3284
+ }
3285
+ return message.role;
3286
+ }
3287
+ function textOf(message) {
3288
+ const parts = message.content ? [message.content] : [];
3289
+ for (const call of message.toolCalls ?? []) parts.push(`[called ${call.name} ${call.arguments}]`);
3290
+ const images = message.images?.length ?? 0;
3291
+ if (images > 0) parts.push(`[${images === 1 ? "an image" : `${images} images`}]`);
3292
+ if (message.stopped) parts.push(`[${message.stopped}]`);
3293
+ return parts.join("\n");
3294
+ }
3295
+ function search(summarized, query) {
3296
+ const words = [...new Set(query.toLowerCase().split(/\s+/).filter(Boolean))];
3297
+ if (words.join("").length < 2) throw new Error("recall: search for at least two characters");
3298
+ if (words.length > MAX_WORDS) throw new Error(`recall: search for at most ${MAX_WORDS} words`);
3299
+ const hits = summarized.filter((message) => {
3300
+ const lower = message.text.toLowerCase();
3301
+ return words.every((word) => lower.includes(word));
3302
+ });
3303
+ const of = `of the ${summarized.length} summarized messages`;
3304
+ if (hits.length === 0) {
3305
+ return `None ${of} holds every word of "${query}". Search for fewer or other words, or read from 1.`;
3306
+ }
3307
+ const shown = hits.slice(-MAX_HITS);
3308
+ const lines = shown.map((hit) => `${hit.heading}: ${snippetOf(hit.text, words)}`);
3309
+ const earlier = hits.length - shown.length;
3310
+ return [
3311
+ `${hits.length} ${of} ${hits.length === 1 ? "holds" : "hold"} every word of "${query}"${earlier > 0 ? `; the latest ${shown.length}` : ""}:`,
3312
+ ...lines,
3313
+ ...earlier > 0 ? [`${earlier} earlier ones are not listed: add a word to narrow the search.`] : [],
3314
+ "Read one in full with `from` and its number."
3315
+ ].join("\n");
3316
+ }
3317
+ function snippetOf(text, words) {
3318
+ const flat = text.replace(/\s+/g, " ").trim();
3319
+ const lower = flat.toLowerCase();
3320
+ const at = Math.min(...words.map((word) => lower.indexOf(word)).filter((index) => index >= 0));
3321
+ const start = Math.max(0, at - BEFORE);
3322
+ const end = Math.min(flat.length, at + AFTER);
3323
+ return `${start > 0 ? "\u2026" : ""}${flat.slice(start, end).trim()}${end < flat.length ? "\u2026" : ""}`;
3324
+ }
3325
+ function read(summarized, from, rawCount) {
3326
+ const total = summarized.at(-1)?.number ?? 0;
3327
+ if (!Number.isInteger(from) || from < 1) throw new Error("recall: `from` is a message number");
3328
+ if (from > total) {
3329
+ return `Only messages 1 to ${total} were summarized; the later ones are in your context.`;
3330
+ }
3331
+ const count = rawCount === void 0 ? READ_COUNT : Number(rawCount);
3332
+ if (!Number.isInteger(count) || count < 1 || count > MAX_READ) {
3333
+ throw new Error(`recall: \`count\` is from 1 to ${MAX_READ}`);
3334
+ }
3335
+ const share = Math.max(MIN_SHARE, Math.floor(BUDGET / count));
3336
+ const blocks = [];
3337
+ let used = 0;
3338
+ let next = null;
3339
+ for (const message of summarized) {
3340
+ if (message.number < from) continue;
3341
+ if (blocks.length === count || blocks.length > 0 && used >= BUDGET) {
3342
+ next = message.number;
3343
+ break;
3344
+ }
3345
+ const cut = message.text.length > share;
3346
+ const body = cut ? `${message.text.slice(0, share)}\u2026 [${(message.text.length - share).toLocaleString("en-US")} more characters cut${count > 1 ? "; read this message alone to see more" : ""}]` : message.text;
3347
+ blocks.push(`${message.heading}
3348
+ ${body}`);
3349
+ used += body.length;
3350
+ }
3351
+ const last = next === null ? total : next - 1;
3352
+ const head = `Messages ${from} to ${last} of the ${total} summarized${next === null ? "" : `; read on from ${next}`}:`;
3353
+ return [head, ...blocks].join("\n\n");
3354
+ }
3355
+
3219
3356
  // ../daemon/src/runtime/tools/team.ts
3220
3357
  function agentCreateTool(host) {
3221
3358
  return {
@@ -3947,6 +4084,7 @@ function toPiPart(part) {
3947
4084
  function createBazilionCustomTools(opts) {
3948
4085
  const handlers = [
3949
4086
  ...memoryTools(opts.memory),
4087
+ recallTool(opts.recall),
3950
4088
  ...homeTools(opts.agent.agent.dir),
3951
4089
  bootstrapTool(opts.agent.agent.dir),
3952
4090
  webFetchTool({ env: opts.env }),
@@ -4029,7 +4167,7 @@ async function openPiSession(spec) {
4029
4167
  }
4030
4168
  return { session, redactionSecrets, dispose: () => session.dispose() };
4031
4169
  }
4032
- function turnSurface(opts) {
4170
+ function turnSurface(opts, recall) {
4033
4171
  const { agent, paths, env } = opts;
4034
4172
  const cwd = agent.team.path;
4035
4173
  const promptSkills = loadPromptSkills(paths.skillsDir, agent.skills);
@@ -4044,6 +4182,7 @@ function turnSurface(opts) {
4044
4182
  const customTools = createBazilionCustomTools({
4045
4183
  agent,
4046
4184
  memory: opts.memory,
4185
+ recall,
4047
4186
  messagingHost: opts.messagingHost,
4048
4187
  userMdHost: opts.userMdHost,
4049
4188
  browserHost: opts.browserHost,
@@ -4083,7 +4222,11 @@ async function createBazilionSession(opts) {
4083
4222
  if (!existsSync4(agent.team.path)) mkdirSync4(agent.team.path, { recursive: true });
4084
4223
  mkdirSync4(join8(paths.agentDir(agent.agent.id), "sessions"), { recursive: true });
4085
4224
  const sessionManager = openConversation(agent, paths, opts.conversation);
4086
- const turn = turnSurface(opts);
4225
+ const redactionSecrets = [...new Set(envSecretValues(opts.env).filter(Boolean))];
4226
+ const turn = turnSurface(opts, {
4227
+ branch: () => sessionManager.getBranch(),
4228
+ secrets: redactionSecrets
4229
+ });
4087
4230
  return openPiSession({
4088
4231
  model: {
4089
4232
  providerName,
@@ -4102,7 +4245,7 @@ async function createBazilionSession(opts) {
4102
4245
  })),
4103
4246
  tools: turn.tools,
4104
4247
  hostToolNames: turn.hostToolNames,
4105
- redactionSecrets: [...new Set(envSecretValues(opts.env).filter(Boolean))],
4248
+ redactionSecrets,
4106
4249
  refreshApiKey: opts.refreshApiKey
4107
4250
  });
4108
4251
  }