@integrity-labs/agt-cli 0.9.9 → 0.10.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.
@@ -9,7 +9,7 @@ import {
9
9
  provisionStopHook,
10
10
  requireHost,
11
11
  resolveChannels
12
- } from "../chunk-IT34G2Y2.js";
12
+ } from "../chunk-UWH2MMKY.js";
13
13
  import {
14
14
  findTaskByTemplate,
15
15
  getProjectDir,
@@ -680,11 +680,8 @@ async function ensureFrameworkBinary(frameworkId) {
680
680
  }
681
681
  agentRuntimeAuthenticated = checkClaudeAuth(execFileSync);
682
682
  }
683
- var UPDATE_CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
684
- var selfUpdateChecked = false;
683
+ var UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
685
684
  async function checkAndUpdateCli() {
686
- if (selfUpdateChecked) return;
687
- selfUpdateChecked = true;
688
685
  const cliPath = process.argv[1] ?? "";
689
686
  const isHomebrew = cliPath.includes("/Cellar/") || cliPath.includes("/homebrew/");
690
687
  const isDevMode = cliPath.includes("/src/") || cliPath.includes("tsx");
@@ -1594,10 +1591,11 @@ async function processAgent(agent, agentStates) {
1594
1591
  const fw = agentFrameworkCache.get(agent.code_name) ?? "openclaw";
1595
1592
  if (fw === "claude-code" && isSessionHealthy(agent.code_name)) {
1596
1593
  const names = integrations.map((i) => i.display_name || i.definition_id).join(", ");
1597
- injectMessage(agent.code_name, "system", `Your integrations have been updated. You now have access to: ${names}. Re-read your CLAUDE.md for details.`, {
1594
+ injectMessage(agent.code_name, "system", `Your integrations have been updated. You now have access to: ${names}. Your .env.integrations and CLAUDE.md have been refreshed \u2014 credentials are available immediately via environment variables.`, {
1598
1595
  task_name: "integration-update"
1599
1596
  }, log).catch(() => {
1600
1597
  });
1598
+ log(`[hot-reload] Notified '${agent.code_name}' about integration update: ${names}`);
1601
1599
  }
1602
1600
  const managedIntegrations = integrations.filter((i) => i.auth_type === "managed");
1603
1601
  if (managedIntegrations.length > 0 && frameworkAdapter.writeMcpServer) {
@@ -1639,6 +1637,25 @@ async function processAgent(agent, agentStates) {
1639
1637
  }
1640
1638
  }
1641
1639
  needsGatewayRestart = true;
1640
+ if (managedIntegrations.length > 0 && fw === "claude-code" && isSessionHealthy(agent.code_name)) {
1641
+ const mcpNames = managedIntegrations.map((i) => i.display_name || i.definition_id).join(", ");
1642
+ log(`[hot-reload] MCP servers changed for '${agent.code_name}': ${mcpNames} \u2014 restarting session`);
1643
+ const delivered = await injectMessage(
1644
+ agent.code_name,
1645
+ "system",
1646
+ `New MCP tool servers have been configured: ${mcpNames}. Note: MCP servers require a session restart to connect. Your manager will restart your session shortly.`,
1647
+ { task_name: "mcp-update" },
1648
+ log
1649
+ ).catch(() => false);
1650
+ const delay = delivered ? 8e3 : 3e3;
1651
+ if (!delivered) {
1652
+ log(`[hot-reload] Inject notification unconfirmed for '${agent.code_name}' \u2014 proceeding with shorter delay`);
1653
+ }
1654
+ setTimeout(() => {
1655
+ stopPersistentSession(agent.code_name, log);
1656
+ log(`[hot-reload] Session stopped for '${agent.code_name}' \u2014 will respawn with new MCP servers`);
1657
+ }, delay);
1658
+ }
1642
1659
  }
1643
1660
  const resolvedDefIds = new Set(integrations.map((i) => i.definition_id));
1644
1661
  for (const capId of resolvedDefIds) {
@@ -1655,15 +1672,30 @@ async function processAgent(agent, agentStates) {
1655
1672
  const skillKey = `${agent.agent_id}:${capId}`;
1656
1673
  const prevSkillHash = knownSkillHashes.get(skillKey);
1657
1674
  if (skillHash !== prevSkillHash) {
1675
+ const installedSkillNames = [];
1658
1676
  if (frameworkAdapter.installSkillFiles && capData.skills) {
1659
1677
  for (const skill of capData.skills) {
1660
1678
  if (skill.files.length > 0) {
1661
1679
  frameworkAdapter.installSkillFiles(agent.code_name, skill.id, skill.files);
1680
+ installedSkillNames.push(skill.name || skill.id);
1662
1681
  log(`Installed skill '${skill.id}' for '${agent.code_name}' (${skill.files.length} file(s))`);
1663
1682
  }
1664
1683
  }
1665
1684
  }
1666
1685
  knownSkillHashes.set(skillKey, skillHash);
1686
+ const agentFw2 = agentFrameworkCache.get(agent.code_name) ?? "openclaw";
1687
+ if (agentFw2 === "claude-code" && installedSkillNames.length > 0 && isSessionHealthy(agent.code_name)) {
1688
+ const names = installedSkillNames.join(", ");
1689
+ injectMessage(
1690
+ agent.code_name,
1691
+ "system",
1692
+ `New skills installed: ${names}. These are available immediately \u2014 Claude Code loads skills on demand from .claude/skills/.`,
1693
+ { task_name: "skill-update" },
1694
+ log
1695
+ ).catch(() => {
1696
+ });
1697
+ log(`[hot-reload] Notified '${agent.code_name}' about new skills: ${names}`);
1698
+ }
1667
1699
  }
1668
1700
  const ALLOWED_CLI_PACKAGES = /* @__PURE__ */ new Set([
1669
1701
  "xero-cli",
@@ -3400,6 +3432,15 @@ function generateArtifacts(agent, refreshData, adapter) {
3400
3432
  }
3401
3433
  const resolvedChannels = resolveChannels(agentChannelPolicy, orgChannelPolicy);
3402
3434
  const effectiveChannels = agent.status === "paused" ? [] : resolvedChannels;
3435
+ const tasks = refreshData.scheduled_tasks;
3436
+ const taskTimezones = [...new Set(
3437
+ (tasks ?? []).map((t) => typeof t.timezone === "string" ? t.timezone.trim() : "").filter((tz) => tz.length > 0)
3438
+ )];
3439
+ const teamTimezoneRaw = refreshData.team?.timezone;
3440
+ const teamTimezone = typeof teamTimezoneRaw === "string" && teamTimezoneRaw.trim().length > 0 ? teamTimezoneRaw.trim() : void 0;
3441
+ const agentTimezone = (taskTimezones.length === 1 ? taskTimezones[0] : void 0) ?? teamTimezone ?? "UTC";
3442
+ const orgDefaults = refreshData.model_defaults;
3443
+ const personalitySeed = orgDefaults?.org?.settings?.personality_seed;
3403
3444
  const provisionInput = {
3404
3445
  agent: refreshData.agent,
3405
3446
  charterFrontmatter,
@@ -3409,7 +3450,10 @@ function generateArtifacts(agent, refreshData, adapter) {
3409
3450
  resolvedChannels: effectiveChannels,
3410
3451
  deploymentTarget: "local_docker",
3411
3452
  gatewayPort: 9e3,
3412
- team: refreshData.team ?? void 0
3453
+ team: refreshData.team ?? void 0,
3454
+ timezone: agentTimezone,
3455
+ reportsTo,
3456
+ personalitySeed
3413
3457
  };
3414
3458
  const provisionOutput = provision(provisionInput, adapter.id);
3415
3459
  return provisionOutput.artifacts;