@integrity-labs/agt-cli 0.19.2 → 0.19.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.
@@ -450,6 +450,28 @@ var INTEGRATION_REGISTRY = [
450
450
  docs_url: "https://docs.granola.ai/docs/api/mcp",
451
451
  beta: true
452
452
  },
453
+ {
454
+ id: "postiz",
455
+ name: "Postiz",
456
+ category: "social",
457
+ description: "Open-source social-media scheduling and publishing \u2014 schedule posts, list connected platforms, and upload media. Self-hosted-aware (defaults to Postiz Cloud at https://api.postiz.com).",
458
+ // Postiz also supports OAuth2 ('pos_'-prefixed tokens) but the public docs
459
+ // for the authorize/token URL shape are sparse — wired API-key-first; the
460
+ // OAuth path lands as a follow-up once we've confirmed the flow against
461
+ // a live instance.
462
+ supported_auth_types: ["api_key"],
463
+ capabilities: [
464
+ { id: "postiz:list", name: "List Posts & Platforms", description: "List connected social platforms (GET /integrations) and previously scheduled posts", access: "read" },
465
+ { id: "postiz:publish", name: "Publish Posts", description: "Create and schedule posts across the connected platforms (POST /posts)", access: "write" },
466
+ { id: "postiz:upload", name: "Upload Media", description: "Upload images and video for use in posts (POST /upload)", access: "write" }
467
+ ],
468
+ docs_url: "https://docs.postiz.com/public-api/introduction",
469
+ // Beta until we've verified the npx-based community MCP server
470
+ // (antoniolg/postiz-mcp) end-to-end against a real Postiz instance.
471
+ // The 30-req/hr public API rate limit also wants real-world
472
+ // validation before we drop the beta flag.
473
+ beta: true
474
+ },
453
475
  {
454
476
  id: "qmd",
455
477
  name: "QMD Memory Search",
@@ -2727,6 +2749,36 @@ ${lines.join("\n")}
2727
2749
 
2728
2750
  Check \`.claude/skills/\` for detailed usage instructions for each integration.
2729
2751
 
2752
+ `;
2753
+ }
2754
+ function buildSkillAuthoringSection() {
2755
+ return `## Skill authoring
2756
+
2757
+ When the user asks you to **create**, **update**, or **author** a skill,
2758
+ you MUST use the Augmented MCP tools \u2014 never write to
2759
+ \`.claude/skills/<name>/SKILL.md\` yourself with \`Write\`/\`Edit\`.
2760
+
2761
+ - **\`mcp__augmented__skill_create\`** \u2014 author a brand-new skill
2762
+ - **\`mcp__augmented__skill_update\`** \u2014 modify an existing skill
2763
+ - **\`mcp__augmented__skill_read\`** \u2014 pull a skill's current contents
2764
+ before editing
2765
+ - **\`mcp__augmented__skill_list\`** \u2014 discover what skills exist for
2766
+ this team
2767
+ - **\`mcp__augmented__skill_improve\`** \u2014 propose targeted edits
2768
+
2769
+ Why this matters: skills authored via the MCP land in the team-scoped
2770
+ \`skill_definitions\` registry, so every agent on the team picks them
2771
+ up on next refresh, the manager re-provisions them on the agent's host,
2772
+ and operators see them in the webapp's pending-skills queue for review.
2773
+ Files written to local \`.claude/skills/\` get wiped the next time the
2774
+ manager rebuilds the provision tree, never reach other agents, and
2775
+ bypass the operator-review workflow entirely.
2776
+
2777
+ If your charter doesn't authorise team-scope skill writes
2778
+ (\`charter.tools.skills.write_team\` is false), the MCP call will be
2779
+ refused server-side \u2014 surface that error to the user rather than
2780
+ falling back to a local-disk write.
2781
+
2730
2782
  `;
2731
2783
  }
2732
2784
  function buildPersonalitySection(seed) {
@@ -2813,6 +2865,7 @@ function generateClaudeMd(input) {
2813
2865
  const memorySection = buildMemorySection(hasQmd);
2814
2866
  const integrationsSection = buildIntegrationsSection(integrations);
2815
2867
  const knowledgeSection = buildKnowledgeSection2(knowledge);
2868
+ const skillAuthoringSection = buildSkillAuthoringSection();
2816
2869
  const personalitySection = buildPersonalitySection(personalitySeed);
2817
2870
  const reportsToSection = buildReportsToSection2(reportsTo);
2818
2871
  const teamSection = buildTeamSection(teamMembers);
@@ -2960,7 +3013,7 @@ first to load your recent board state. This gives you context about completed an
2960
3013
  in-progress items so you can answer accurately.
2961
3014
 
2962
3015
  ${memorySection}
2963
- ${reportsToSection}${teamSection}${peopleSection}${integrationsSection}${knowledgeSection}## Dashboards
3016
+ ${reportsToSection}${teamSection}${peopleSection}${integrationsSection}${knowledgeSection}${skillAuthoringSection}## Dashboards
2964
3017
 
2965
3018
  You can publish your own dashboards inside the Augmented console. They are
2966
3019
  **first-class platform artifacts** \u2014 KPI tiles, charts, refresh-on-demand \u2014
@@ -3828,6 +3881,25 @@ Your job:
3828
3881
  Do NOT post intermediate progress updates unless the work spans 5+ minutes \u2014 keep noise low. The parent already sent a single-line acknowledgement before dispatching you.
3829
3882
  `;
3830
3883
  }
3884
+ function buildPostizMcpEntry(integration) {
3885
+ const rawBaseUrl = integration.config["base_url"];
3886
+ const postizBaseUrl = typeof rawBaseUrl === "string" ? rawBaseUrl.trim() : "";
3887
+ const env2 = {
3888
+ // Raw key, no `Bearer` prefix — Postiz's Authorization header takes
3889
+ // the API key verbatim. The MCP server handles framing.
3890
+ POSTIZ_API_KEY: "${POSTIZ_API_KEY}",
3891
+ PATH: process.env["PATH"] ?? "",
3892
+ HOME: process.env["HOME"] ?? ""
3893
+ };
3894
+ if (postizBaseUrl.length > 0) {
3895
+ env2["POSTIZ_BASE_URL"] = "${POSTIZ_BASE_URL}";
3896
+ }
3897
+ return {
3898
+ command: "npx",
3899
+ args: ["-y", "@antoniolg/postiz-mcp"],
3900
+ env: env2
3901
+ };
3902
+ }
3831
3903
  function buildMcpJson(input) {
3832
3904
  const mcpServers = {};
3833
3905
  const localMcpPath = join4(getHomeDir3(), ".augmented", "_mcp", "index.js");
@@ -3874,6 +3946,10 @@ function buildMcpJson(input) {
3874
3946
  }
3875
3947
  };
3876
3948
  }
3949
+ const postizIntegration = input.integrations?.find((i) => i.definition_id === "postiz");
3950
+ if (postizIntegration) {
3951
+ mcpServers["postiz"] = buildPostizMcpEntry(postizIntegration);
3952
+ }
3877
3953
  for (const integration of input.integrations ?? []) {
3878
3954
  const entry = buildRemoteMcpEntry(integration.definition_id);
3879
3955
  if (entry) {
@@ -4088,8 +4164,13 @@ ${sections}`
4088
4164
  for (const p of profiles) {
4089
4165
  if (!p.api_key)
4090
4166
  continue;
4091
- const envKey = `${p.provider.toUpperCase().replace(/[^A-Z0-9]/g, "_")}_API_KEY`;
4092
- envLines.push(`${envKey}=${p.api_key}`);
4167
+ const providerEnvPrefix = p.provider.toUpperCase().replace(/[^A-Z0-9]/g, "_");
4168
+ envLines.push(`${providerEnvPrefix}_API_KEY=${p.api_key}`);
4169
+ const rawBaseUrl = p.metadata["base_url"];
4170
+ const baseUrl = typeof rawBaseUrl === "string" ? rawBaseUrl.trim() : "";
4171
+ if (baseUrl.length > 0) {
4172
+ envLines.push(`${providerEnvPrefix}_BASE_URL=${baseUrl}`);
4173
+ }
4093
4174
  }
4094
4175
  if (envLines.length > 1) {
4095
4176
  const envPath = join4(agentDir, ".env");
@@ -4391,6 +4472,10 @@ ${sections}`
4391
4472
  }
4392
4473
  });
4393
4474
  }
4475
+ const postizIntegration = integrations.find((i) => i.definition_id === "postiz");
4476
+ if (postizIntegration) {
4477
+ this.writeMcpServer(codeName, "postiz", buildPostizMcpEntry(postizIntegration));
4478
+ }
4394
4479
  for (const integration of integrations) {
4395
4480
  const entry = buildRemoteMcpEntry(integration.definition_id);
4396
4481
  if (entry) {
@@ -7427,7 +7512,7 @@ import { spawn as spawn3 } from "child_process";
7427
7512
  // src/lib/watchdog.ts
7428
7513
  import { readFileSync as readFileSync6, writeFileSync as writeFileSync6, unlinkSync as unlinkSync3, existsSync as existsSync6, mkdirSync as mkdirSync6, openSync, closeSync, chmodSync as chmodSync5 } from "fs";
7429
7514
  import { join as join7 } from "path";
7430
- import { spawn as spawn2 } from "child_process";
7515
+ import { spawn as spawn2, execFileSync } from "child_process";
7431
7516
  var DEFAULT_CONFIG_DIR = join7(process.env["HOME"] ?? "/tmp", ".augmented");
7432
7517
  function getManagerPaths(configDir) {
7433
7518
  return {
@@ -7468,6 +7553,21 @@ function isProcessAlive2(pid) {
7468
7553
  return false;
7469
7554
  }
7470
7555
  }
7556
+ function findOtherManagerPids(pgrepImpl = defaultPgrep, selfPid = process.pid) {
7557
+ let out;
7558
+ try {
7559
+ out = pgrepImpl();
7560
+ } catch {
7561
+ return [];
7562
+ }
7563
+ return out.split("\n").map((line) => parseInt(line.trim(), 10)).filter((pid) => !isNaN(pid) && pid !== selfPid);
7564
+ }
7565
+ function defaultPgrep() {
7566
+ return execFileSync("pgrep", ["-f", "agt manager start"], {
7567
+ encoding: "utf-8",
7568
+ stdio: ["ignore", "pipe", "ignore"]
7569
+ });
7570
+ }
7471
7571
  function readStateFile(configDir) {
7472
7572
  try {
7473
7573
  const raw = readFileSync6(getManagerPaths(configDir).stateFile, "utf-8");
@@ -7492,6 +7592,13 @@ function startWatchdog(opts) {
7492
7592
  removePidFile(configDir);
7493
7593
  removeStateFile(configDir);
7494
7594
  }
7595
+ const others = findOtherManagerPids();
7596
+ if (others.length > 0) {
7597
+ const pidList = others.join(", ");
7598
+ throw new Error(
7599
+ `Manager already running (PID ${pidList}). Use \`agt manager stop\` first.`
7600
+ );
7601
+ }
7495
7602
  if (opts.detached) {
7496
7603
  ensureDir2(configDir);
7497
7604
  const { logFile } = getManagerPaths(configDir);
@@ -7854,7 +7961,7 @@ function resolveStableAgtBin(rawPath) {
7854
7961
  }
7855
7962
  async function managerInstallCommand(opts = {}) {
7856
7963
  const json = isJsonMode();
7857
- const { installSupervisor, supervisorStatus } = await import("./manager-supervisor-PU5YK5QE.js");
7964
+ const { installSupervisor, supervisorStatus } = await import("./manager-supervisor-P63HG5MR.js");
7858
7965
  const intervalSec = parseInt(opts.interval ?? "10", 10);
7859
7966
  if (isNaN(intervalSec) || intervalSec < 5) {
7860
7967
  const msg = "Interval must be at least 5 seconds.";
@@ -7918,7 +8025,7 @@ async function managerInstallCommand(opts = {}) {
7918
8025
  }
7919
8026
  async function managerUninstallCommand() {
7920
8027
  const json = isJsonMode();
7921
- const { uninstallSupervisor } = await import("./manager-supervisor-PU5YK5QE.js");
8028
+ const { uninstallSupervisor } = await import("./manager-supervisor-P63HG5MR.js");
7922
8029
  const result = await uninstallSupervisor();
7923
8030
  if (!result.ok) {
7924
8031
  if (json) jsonOutput({ ok: false, error: result.error });
@@ -7932,6 +8039,80 @@ async function managerUninstallCommand() {
7932
8039
  info(result.details);
7933
8040
  }
7934
8041
  }
8042
+ async function managerInstallSystemUnitCommand(opts = {}) {
8043
+ const json = isJsonMode();
8044
+ const { installSystemUnit, systemUnitStatus } = await import("./manager-supervisor-P63HG5MR.js");
8045
+ const intervalSec = parseInt(opts.interval ?? "10", 10);
8046
+ if (isNaN(intervalSec) || intervalSec < 5) {
8047
+ const msg = "Interval must be at least 5 seconds.";
8048
+ if (json) jsonOutput({ ok: false, error: msg });
8049
+ else error(msg);
8050
+ process.exitCode = 1;
8051
+ return;
8052
+ }
8053
+ const user = opts.user ?? "root";
8054
+ const configDir = opts.configDir ?? (user === "root" ? "/root/.augmented" : join8("/home", user, ".augmented"));
8055
+ const rawAgtBin = process.argv[1];
8056
+ if (!rawAgtBin) {
8057
+ const msg = "Could not resolve the agt binary path from argv. Re-run via the installed `agt` command.";
8058
+ if (json) jsonOutput({ ok: false, error: msg });
8059
+ else error(msg);
8060
+ process.exitCode = 1;
8061
+ return;
8062
+ }
8063
+ const agtBin = resolveStableAgtBin(rawAgtBin);
8064
+ if (process.platform !== "linux") {
8065
+ const msg = `install-system-unit is Linux-only (current platform: ${process.platform}). For local dev on macOS use \`agt manager install\`.`;
8066
+ if (json) jsonOutput({ ok: false, error: msg });
8067
+ else error(msg);
8068
+ process.exitCode = 1;
8069
+ return;
8070
+ }
8071
+ const env2 = {
8072
+ AGT_HOST: getHost(),
8073
+ HOME: user === "root" ? "/root" : `/home/${user}`,
8074
+ USER: user
8075
+ };
8076
+ const apiKey = getApiKey();
8077
+ if (apiKey) env2.AGT_API_KEY = apiKey;
8078
+ for (const k of ["AGT_TEAM", "PATH", "CLAUDE_PATH"]) {
8079
+ const v = process.env[k];
8080
+ if (v != null) env2[k] = v;
8081
+ }
8082
+ const result = await installSystemUnit({ agtBin, intervalSec, configDir, env: env2, user });
8083
+ if (!result.ok) {
8084
+ if (json) jsonOutput({ ok: false, error: result.error });
8085
+ else error(result.error);
8086
+ process.exitCode = 1;
8087
+ return;
8088
+ }
8089
+ const status = systemUnitStatus();
8090
+ if (json) {
8091
+ jsonOutput({ ok: true, status, details: result.details });
8092
+ return;
8093
+ }
8094
+ success("System unit installed.");
8095
+ info(result.details);
8096
+ if (status.kind === "installed" && status.pid != null) {
8097
+ info(`Manager running under systemd \u2014 PID ${status.pid}.`);
8098
+ }
8099
+ }
8100
+ async function managerUninstallSystemUnitCommand() {
8101
+ const json = isJsonMode();
8102
+ const { uninstallSystemUnit } = await import("./manager-supervisor-P63HG5MR.js");
8103
+ const result = await uninstallSystemUnit();
8104
+ if (!result.ok) {
8105
+ if (json) jsonOutput({ ok: false, error: result.error });
8106
+ else error(result.error);
8107
+ process.exitCode = 1;
8108
+ return;
8109
+ }
8110
+ if (json) jsonOutput({ ok: true, details: result.details });
8111
+ else {
8112
+ success("System unit uninstalled.");
8113
+ info(result.details);
8114
+ }
8115
+ }
7935
8116
 
7936
8117
  export {
7937
8118
  wrapScheduledTaskPrompt,
@@ -7996,6 +8177,8 @@ export {
7996
8177
  managerStopCommand,
7997
8178
  managerStatusCommand,
7998
8179
  managerInstallCommand,
7999
- managerUninstallCommand
8180
+ managerUninstallCommand,
8181
+ managerInstallSystemUnitCommand,
8182
+ managerUninstallSystemUnitCommand
8000
8183
  };
8001
- //# sourceMappingURL=chunk-BEIZXSG4.js.map
8184
+ //# sourceMappingURL=chunk-MC3SMG4A.js.map