@integrity-labs/agt-cli 0.19.1 → 0.19.3

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",
@@ -3828,6 +3850,25 @@ Your job:
3828
3850
  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
3851
  `;
3830
3852
  }
3853
+ function buildPostizMcpEntry(integration) {
3854
+ const rawBaseUrl = integration.config["base_url"];
3855
+ const postizBaseUrl = typeof rawBaseUrl === "string" ? rawBaseUrl.trim() : "";
3856
+ const env2 = {
3857
+ // Raw key, no `Bearer` prefix — Postiz's Authorization header takes
3858
+ // the API key verbatim. The MCP server handles framing.
3859
+ POSTIZ_API_KEY: "${POSTIZ_API_KEY}",
3860
+ PATH: process.env["PATH"] ?? "",
3861
+ HOME: process.env["HOME"] ?? ""
3862
+ };
3863
+ if (postizBaseUrl.length > 0) {
3864
+ env2["POSTIZ_BASE_URL"] = "${POSTIZ_BASE_URL}";
3865
+ }
3866
+ return {
3867
+ command: "npx",
3868
+ args: ["-y", "@antoniolg/postiz-mcp"],
3869
+ env: env2
3870
+ };
3871
+ }
3831
3872
  function buildMcpJson(input) {
3832
3873
  const mcpServers = {};
3833
3874
  const localMcpPath = join4(getHomeDir3(), ".augmented", "_mcp", "index.js");
@@ -3874,6 +3915,10 @@ function buildMcpJson(input) {
3874
3915
  }
3875
3916
  };
3876
3917
  }
3918
+ const postizIntegration = input.integrations?.find((i) => i.definition_id === "postiz");
3919
+ if (postizIntegration) {
3920
+ mcpServers["postiz"] = buildPostizMcpEntry(postizIntegration);
3921
+ }
3877
3922
  for (const integration of input.integrations ?? []) {
3878
3923
  const entry = buildRemoteMcpEntry(integration.definition_id);
3879
3924
  if (entry) {
@@ -3888,7 +3933,6 @@ function buildMcpJson(input) {
3888
3933
  env: {
3889
3934
  AGT_HOST: "${AGT_HOST}",
3890
3935
  AGT_TEAM_SLUG: "${AGT_TEAM_SLUG}",
3891
- AGT_TOKEN: "${AGT_TOKEN}",
3892
3936
  AGT_API_KEY: "${AGT_API_KEY}",
3893
3937
  PATH: process.env["PATH"] ?? "",
3894
3938
  HOME: process.env["HOME"] ?? ""
@@ -4089,8 +4133,13 @@ ${sections}`
4089
4133
  for (const p of profiles) {
4090
4134
  if (!p.api_key)
4091
4135
  continue;
4092
- const envKey = `${p.provider.toUpperCase().replace(/[^A-Z0-9]/g, "_")}_API_KEY`;
4093
- envLines.push(`${envKey}=${p.api_key}`);
4136
+ const providerEnvPrefix = p.provider.toUpperCase().replace(/[^A-Z0-9]/g, "_");
4137
+ envLines.push(`${providerEnvPrefix}_API_KEY=${p.api_key}`);
4138
+ const rawBaseUrl = p.metadata["base_url"];
4139
+ const baseUrl = typeof rawBaseUrl === "string" ? rawBaseUrl.trim() : "";
4140
+ if (baseUrl.length > 0) {
4141
+ envLines.push(`${providerEnvPrefix}_BASE_URL=${baseUrl}`);
4142
+ }
4094
4143
  }
4095
4144
  if (envLines.length > 1) {
4096
4145
  const envPath = join4(agentDir, ".env");
@@ -4392,6 +4441,10 @@ ${sections}`
4392
4441
  }
4393
4442
  });
4394
4443
  }
4444
+ const postizIntegration = integrations.find((i) => i.definition_id === "postiz");
4445
+ if (postizIntegration) {
4446
+ this.writeMcpServer(codeName, "postiz", buildPostizMcpEntry(postizIntegration));
4447
+ }
4395
4448
  for (const integration of integrations) {
4396
4449
  const entry = buildRemoteMcpEntry(integration.definition_id);
4397
4450
  if (entry) {
@@ -4406,7 +4459,6 @@ ${sections}`
4406
4459
  env: {
4407
4460
  AGT_HOST: "${AGT_HOST}",
4408
4461
  AGT_TEAM_SLUG: "${AGT_TEAM_SLUG}",
4409
- AGT_TOKEN: "${AGT_TOKEN}",
4410
4462
  AGT_API_KEY: "${AGT_API_KEY}",
4411
4463
  PATH: process.env["PATH"] ?? "",
4412
4464
  HOME: process.env["HOME"] ?? ""
@@ -7429,7 +7481,7 @@ import { spawn as spawn3 } from "child_process";
7429
7481
  // src/lib/watchdog.ts
7430
7482
  import { readFileSync as readFileSync6, writeFileSync as writeFileSync6, unlinkSync as unlinkSync3, existsSync as existsSync6, mkdirSync as mkdirSync6, openSync, closeSync, chmodSync as chmodSync5 } from "fs";
7431
7483
  import { join as join7 } from "path";
7432
- import { spawn as spawn2 } from "child_process";
7484
+ import { spawn as spawn2, execFileSync } from "child_process";
7433
7485
  var DEFAULT_CONFIG_DIR = join7(process.env["HOME"] ?? "/tmp", ".augmented");
7434
7486
  function getManagerPaths(configDir) {
7435
7487
  return {
@@ -7470,6 +7522,21 @@ function isProcessAlive2(pid) {
7470
7522
  return false;
7471
7523
  }
7472
7524
  }
7525
+ function findOtherManagerPids(pgrepImpl = defaultPgrep, selfPid = process.pid) {
7526
+ let out;
7527
+ try {
7528
+ out = pgrepImpl();
7529
+ } catch {
7530
+ return [];
7531
+ }
7532
+ return out.split("\n").map((line) => parseInt(line.trim(), 10)).filter((pid) => !isNaN(pid) && pid !== selfPid);
7533
+ }
7534
+ function defaultPgrep() {
7535
+ return execFileSync("pgrep", ["-f", "agt manager start"], {
7536
+ encoding: "utf-8",
7537
+ stdio: ["ignore", "pipe", "ignore"]
7538
+ });
7539
+ }
7473
7540
  function readStateFile(configDir) {
7474
7541
  try {
7475
7542
  const raw = readFileSync6(getManagerPaths(configDir).stateFile, "utf-8");
@@ -7494,6 +7561,13 @@ function startWatchdog(opts) {
7494
7561
  removePidFile(configDir);
7495
7562
  removeStateFile(configDir);
7496
7563
  }
7564
+ const others = findOtherManagerPids();
7565
+ if (others.length > 0) {
7566
+ const pidList = others.join(", ");
7567
+ throw new Error(
7568
+ `Manager already running (PID ${pidList}). Use \`agt manager stop\` first.`
7569
+ );
7570
+ }
7497
7571
  if (opts.detached) {
7498
7572
  ensureDir2(configDir);
7499
7573
  const { logFile } = getManagerPaths(configDir);
@@ -7856,7 +7930,7 @@ function resolveStableAgtBin(rawPath) {
7856
7930
  }
7857
7931
  async function managerInstallCommand(opts = {}) {
7858
7932
  const json = isJsonMode();
7859
- const { installSupervisor, supervisorStatus } = await import("./manager-supervisor-PU5YK5QE.js");
7933
+ const { installSupervisor, supervisorStatus } = await import("./manager-supervisor-P63HG5MR.js");
7860
7934
  const intervalSec = parseInt(opts.interval ?? "10", 10);
7861
7935
  if (isNaN(intervalSec) || intervalSec < 5) {
7862
7936
  const msg = "Interval must be at least 5 seconds.";
@@ -7920,7 +7994,7 @@ async function managerInstallCommand(opts = {}) {
7920
7994
  }
7921
7995
  async function managerUninstallCommand() {
7922
7996
  const json = isJsonMode();
7923
- const { uninstallSupervisor } = await import("./manager-supervisor-PU5YK5QE.js");
7997
+ const { uninstallSupervisor } = await import("./manager-supervisor-P63HG5MR.js");
7924
7998
  const result = await uninstallSupervisor();
7925
7999
  if (!result.ok) {
7926
8000
  if (json) jsonOutput({ ok: false, error: result.error });
@@ -7934,6 +8008,80 @@ async function managerUninstallCommand() {
7934
8008
  info(result.details);
7935
8009
  }
7936
8010
  }
8011
+ async function managerInstallSystemUnitCommand(opts = {}) {
8012
+ const json = isJsonMode();
8013
+ const { installSystemUnit, systemUnitStatus } = await import("./manager-supervisor-P63HG5MR.js");
8014
+ const intervalSec = parseInt(opts.interval ?? "10", 10);
8015
+ if (isNaN(intervalSec) || intervalSec < 5) {
8016
+ const msg = "Interval must be at least 5 seconds.";
8017
+ if (json) jsonOutput({ ok: false, error: msg });
8018
+ else error(msg);
8019
+ process.exitCode = 1;
8020
+ return;
8021
+ }
8022
+ const user = opts.user ?? "root";
8023
+ const configDir = opts.configDir ?? (user === "root" ? "/root/.augmented" : join8("/home", user, ".augmented"));
8024
+ const rawAgtBin = process.argv[1];
8025
+ if (!rawAgtBin) {
8026
+ const msg = "Could not resolve the agt binary path from argv. Re-run via the installed `agt` command.";
8027
+ if (json) jsonOutput({ ok: false, error: msg });
8028
+ else error(msg);
8029
+ process.exitCode = 1;
8030
+ return;
8031
+ }
8032
+ const agtBin = resolveStableAgtBin(rawAgtBin);
8033
+ if (process.platform !== "linux") {
8034
+ const msg = `install-system-unit is Linux-only (current platform: ${process.platform}). For local dev on macOS use \`agt manager install\`.`;
8035
+ if (json) jsonOutput({ ok: false, error: msg });
8036
+ else error(msg);
8037
+ process.exitCode = 1;
8038
+ return;
8039
+ }
8040
+ const env2 = {
8041
+ AGT_HOST: getHost(),
8042
+ HOME: user === "root" ? "/root" : `/home/${user}`,
8043
+ USER: user
8044
+ };
8045
+ const apiKey = getApiKey();
8046
+ if (apiKey) env2.AGT_API_KEY = apiKey;
8047
+ for (const k of ["AGT_TEAM", "PATH", "CLAUDE_PATH"]) {
8048
+ const v = process.env[k];
8049
+ if (v != null) env2[k] = v;
8050
+ }
8051
+ const result = await installSystemUnit({ agtBin, intervalSec, configDir, env: env2, user });
8052
+ if (!result.ok) {
8053
+ if (json) jsonOutput({ ok: false, error: result.error });
8054
+ else error(result.error);
8055
+ process.exitCode = 1;
8056
+ return;
8057
+ }
8058
+ const status = systemUnitStatus();
8059
+ if (json) {
8060
+ jsonOutput({ ok: true, status, details: result.details });
8061
+ return;
8062
+ }
8063
+ success("System unit installed.");
8064
+ info(result.details);
8065
+ if (status.kind === "installed" && status.pid != null) {
8066
+ info(`Manager running under systemd \u2014 PID ${status.pid}.`);
8067
+ }
8068
+ }
8069
+ async function managerUninstallSystemUnitCommand() {
8070
+ const json = isJsonMode();
8071
+ const { uninstallSystemUnit } = await import("./manager-supervisor-P63HG5MR.js");
8072
+ const result = await uninstallSystemUnit();
8073
+ if (!result.ok) {
8074
+ if (json) jsonOutput({ ok: false, error: result.error });
8075
+ else error(result.error);
8076
+ process.exitCode = 1;
8077
+ return;
8078
+ }
8079
+ if (json) jsonOutput({ ok: true, details: result.details });
8080
+ else {
8081
+ success("System unit uninstalled.");
8082
+ info(result.details);
8083
+ }
8084
+ }
7937
8085
 
7938
8086
  export {
7939
8087
  wrapScheduledTaskPrompt,
@@ -7998,6 +8146,8 @@ export {
7998
8146
  managerStopCommand,
7999
8147
  managerStatusCommand,
8000
8148
  managerInstallCommand,
8001
- managerUninstallCommand
8149
+ managerUninstallCommand,
8150
+ managerInstallSystemUnitCommand,
8151
+ managerUninstallSystemUnitCommand
8002
8152
  };
8003
- //# sourceMappingURL=chunk-SYJNQ6X4.js.map
8153
+ //# sourceMappingURL=chunk-CZGII2KB.js.map