@integrity-labs/agt-cli 0.28.1096 → 0.28.1097

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.
package/dist/bin/agt.js CHANGED
@@ -40,12 +40,12 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-WFKQVAYW.js";
43
+ } from "../chunk-3RGBEI34.js";
44
44
  import {
45
45
  getProjectDir,
46
46
  isSessionResumeDisabled,
47
47
  readDirectChatSessionState
48
- } from "../chunk-CRVS3GGR.js";
48
+ } from "../chunk-EGVRUVOF.js";
49
49
  import {
50
50
  AnchorSessionClient,
51
51
  CHANNEL_REGISTRY,
@@ -79,7 +79,7 @@ import {
79
79
  serializeManifestForSlackCli,
80
80
  sessionFileExists,
81
81
  sessionTranscriptDir
82
- } from "../chunk-DH3QU73N.js";
82
+ } from "../chunk-I7XCW4G6.js";
83
83
  import "../chunk-OCMJ5E6J.js";
84
84
  import "../chunk-XWVM4KPK.js";
85
85
  import "../chunk-EL5MWGGH.js";
@@ -5474,7 +5474,7 @@ import { execFileSync, execSync } from "child_process";
5474
5474
  import { existsSync as existsSync11, realpathSync as realpathSync2 } from "fs";
5475
5475
  import chalk18 from "chalk";
5476
5476
  import ora16 from "ora";
5477
- var cliVersion = true ? "0.28.1096" : "dev";
5477
+ var cliVersion = true ? "0.28.1097" : "dev";
5478
5478
  async function fetchLatestVersion() {
5479
5479
  const host2 = getHost();
5480
5480
  if (!host2) return null;
@@ -6734,7 +6734,7 @@ function handleError(err) {
6734
6734
  }
6735
6735
 
6736
6736
  // src/bin/agt.ts
6737
- var cliVersion2 = true ? "0.28.1096" : "dev";
6737
+ var cliVersion2 = true ? "0.28.1097" : "dev";
6738
6738
  var program = new Command();
6739
6739
  program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
6740
6740
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -16,7 +16,7 @@ import {
16
16
  parseEnvFileEntries,
17
17
  parseEnvIntegrations,
18
18
  shellQuote
19
- } from "./chunk-CRVS3GGR.js";
19
+ } from "./chunk-EGVRUVOF.js";
20
20
  import {
21
21
  BIND_FAILURE_QUARANTINE_THRESHOLD,
22
22
  INTEGRATIONS_SECTION_END,
@@ -79,7 +79,7 @@ import {
79
79
  sessionTranscriptDir,
80
80
  worseConnectivityOutcome,
81
81
  wrapScheduledTaskPrompt
82
- } from "./chunk-DH3QU73N.js";
82
+ } from "./chunk-I7XCW4G6.js";
83
83
  import {
84
84
  classifyUnanswerablePane,
85
85
  isConsumerTermsDialogVisible,
@@ -7122,7 +7122,7 @@ function exchangeFailureKind(err) {
7122
7122
  }
7123
7123
 
7124
7124
  // src/lib/api-client.ts
7125
- var agtCliVersion = true ? "0.28.1096" : "dev";
7125
+ var agtCliVersion = true ? "0.28.1097" : "dev";
7126
7126
  var lastConfigHash = null;
7127
7127
  function setConfigHash(hash) {
7128
7128
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -12095,4 +12095,4 @@ export {
12095
12095
  managerInstallSystemUnitCommand,
12096
12096
  managerUninstallSystemUnitCommand
12097
12097
  };
12098
- //# sourceMappingURL=chunk-WFKQVAYW.js.map
12098
+ //# sourceMappingURL=chunk-3RGBEI34.js.map
@@ -24,7 +24,7 @@ import {
24
24
  rotateDailySession,
25
25
  sessionFileExists,
26
26
  todayLocalIso
27
- } from "./chunk-DH3QU73N.js";
27
+ } from "./chunk-I7XCW4G6.js";
28
28
  import {
29
29
  classifyUnanswerablePane,
30
30
  findUsageLimitResetHint,
@@ -6113,4 +6113,4 @@ export {
6113
6113
  stopAllSessionsAndWait,
6114
6114
  getProjectDir
6115
6115
  };
6116
- //# sourceMappingURL=chunk-CRVS3GGR.js.map
6116
+ //# sourceMappingURL=chunk-EGVRUVOF.js.map
@@ -9000,8 +9000,8 @@ var integration_metadata_v1_default = {
9000
9000
  },
9001
9001
  auth_encoding: {
9002
9002
  type: "string",
9003
- enum: ["basic_username", "raw"],
9004
- description: "How the credential is encoded into Authorization (ENG-10524). `basic_username` sends it as the HTTP Basic username with an empty password (`Authorization: Basic base64(<credential>:)`), Sportsyear's API-key form. `raw` sends the credential itself as the header value with no scheme word (`Authorization: <credential>`), AppsFlyer OneLink's form (CS-1918). Omit for `<auth_scheme> <credential>`. Must not be combined with `auth_scheme`."
9003
+ enum: ["basic_username", "basic_pair", "raw"],
9004
+ description: "How the credential is encoded into Authorization (ENG-10524). `basic_username` sends it as the HTTP Basic username with an empty password (`Authorization: Basic base64(<credential>:)`), Sportsyear's API-key form. `basic_pair` splits the credential on its first `:` and sends `Authorization: Basic base64(<username>:<password>)`, Projectworks' API-account form (CS-1980). `raw` sends the credential itself as the header value with no scheme word (`Authorization: <credential>`), AppsFlyer OneLink's form (CS-1918). Omit for `<auth_scheme> <credential>`. Must not be combined with `auth_scheme`."
9005
9005
  },
9006
9006
  runtime_scopes: {
9007
9007
  type: "object",
@@ -9226,6 +9226,25 @@ function basicUsernameAuthorization(credential) {
9226
9226
  binary += String.fromCharCode(b);
9227
9227
  return `Basic ${btoa(binary)}`;
9228
9228
  }
9229
+ function basicPairAuthorization(credential) {
9230
+ const colon = credential.indexOf(":");
9231
+ if (colon === -1) {
9232
+ throw new TemplateError('credential for basic_pair auth must be "<username>:<password>"');
9233
+ }
9234
+ const username = credential.slice(0, colon);
9235
+ const password = credential.slice(colon + 1);
9236
+ if (username.trim() === "" || password.trim() === "") {
9237
+ throw new TemplateError("credential for basic_pair auth has an empty username or password");
9238
+ }
9239
+ if (!isValidHeaderValue(username) || !isValidHeaderValue(password)) {
9240
+ throw new TemplateError("credential for basic_pair auth contains control characters");
9241
+ }
9242
+ const bytes = new TextEncoder().encode(`${username}:${password}`);
9243
+ let binary = "";
9244
+ for (const b of bytes)
9245
+ binary += String.fromCharCode(b);
9246
+ return `Basic ${btoa(binary)}`;
9247
+ }
9229
9248
  function isValidHeaderValue(value) {
9230
9249
  return !/[\x00-\x1f\x7f]/.test(value);
9231
9250
  }
@@ -11994,6 +12013,11 @@ var HTTP_PROBE_PROVIDERS = /* @__PURE__ */ new Set([
11994
12013
  // otherwise surface as empty compliance reports rather than a failed write.
11995
12014
  // Routes to `probeMitti` against `GET /scheduling/v1/feed/schedules?limit=1`.
11996
12015
  "mitti",
12016
+ // CS-1980: Projectworks, added with the integration for the same reason as
12017
+ // Mitti. It is read-only, so a deleted API account or a rotated secret would
12018
+ // otherwise surface as empty project reports rather than a failed write.
12019
+ // Routes to `probeProjectworks` against `GET /api/v1/Projects?pageSize=1`.
12020
+ "projectworks",
11997
12021
  // CS-1863: Storrito, added with the integration. A deleted API credential
11998
12022
  // answers with a redirect to the login page rather than a 401, so without a
11999
12023
  // probe a dead token would surface only as failed story posts.
@@ -12528,6 +12552,54 @@ async function probeMitti(creds, fetchImpl) {
12528
12552
  return networkOutcome(err, String(token));
12529
12553
  }
12530
12554
  }
12555
+ async function probeProjectworks(creds, fetchImpl) {
12556
+ const pair = creds.api_key ?? creds.access_token;
12557
+ if (!pair)
12558
+ return { status: "down", message: "No Projectworks credential present" };
12559
+ let authorization;
12560
+ try {
12561
+ authorization = basicPairAuthorization(String(pair));
12562
+ } catch {
12563
+ return {
12564
+ status: "down",
12565
+ message: "Projectworks credential needs both the consumer key and the consumer secret - re-enter them from Admin > Integration > API Accounts"
12566
+ };
12567
+ }
12568
+ try {
12569
+ const res = await timedFetch(fetchImpl, "https://api.projectworksapp.com/api/v1/Projects?pageSize=1", {
12570
+ headers: { Authorization: authorization, Accept: "application/json" }
12571
+ });
12572
+ if (res.status === 403) {
12573
+ return {
12574
+ status: "degraded",
12575
+ cause: "auth_rejected",
12576
+ message: "Projectworks denied access (403) - the API account is valid but lacks permission to read projects; check its permissions under Admin > Integration > API Accounts"
12577
+ };
12578
+ }
12579
+ if (!res.ok) {
12580
+ const message = res.status === 401 ? "Projectworks rejected the API account (401) - wrong consumer key or secret, or the API account was deleted" : res.status === 429 ? rateLimitMessage("Projectworks", res.status) : `Projectworks API returned ${res.status}`;
12581
+ return { status: statusForHttp(res.status), cause: causeForHttp(res.status), message };
12582
+ }
12583
+ let body = null;
12584
+ try {
12585
+ body = await res.json();
12586
+ } catch {
12587
+ body = null;
12588
+ }
12589
+ if (!Array.isArray(body)) {
12590
+ return { status: "down", message: "Projectworks returned 200 without a project list - not a Projectworks API response" };
12591
+ }
12592
+ return { status: "ok", message: "Connected to Projectworks" };
12593
+ } catch (err) {
12594
+ const raw = String(pair);
12595
+ const secretHalf = raw.slice(raw.indexOf(":") + 1);
12596
+ const outcome = networkOutcome(err, raw);
12597
+ return outcome.message === void 0 ? outcome : {
12598
+ ...outcome,
12599
+ message: redactSecret(redactSecret(outcome.message, secretHalf), authorization.slice("Basic ".length))
12600
+ };
12601
+ }
12602
+ }
12531
12603
  async function probeStorrito(creds, fetchImpl, config) {
12532
12604
  const token = creds.api_key ?? creds.access_token;
12533
12605
  if (!token)
@@ -12649,6 +12721,8 @@ async function probeHttpProvider(definitionId, credentials, fetchImpl = fetch, c
12649
12721
  return probeInstantly(credentials, fetchImpl);
12650
12722
  case "mitti":
12651
12723
  return probeMitti(credentials, fetchImpl);
12724
+ case "projectworks":
12725
+ return probeProjectworks(credentials, fetchImpl);
12652
12726
  case "google-workspace":
12653
12727
  return probeBearerJson("https://www.googleapis.com/oauth2/v2/userinfo", credentials, fetchImpl, (body) => {
12654
12728
  const info = body;
@@ -16445,4 +16519,4 @@ export {
16445
16519
  peekCurrentSession,
16446
16520
  readDailySessionPin
16447
16521
  };
16448
- //# sourceMappingURL=chunk-DH3QU73N.js.map
16522
+ //# sourceMappingURL=chunk-I7XCW4G6.js.map