@integrity-labs/agt-cli 0.28.520 → 0.28.522

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,7 +40,7 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-LK3VJYFU.js";
43
+ } from "../chunk-WIQCLSZY.js";
44
44
  import {
45
45
  AnchorSessionClient,
46
46
  CHANNEL_REGISTRY,
@@ -71,7 +71,7 @@ import {
71
71
  requiredMcpWildcard,
72
72
  resolveChannels,
73
73
  serializeManifestForSlackCli
74
- } from "../chunk-XH3O62OZ.js";
74
+ } from "../chunk-4GTDD2I5.js";
75
75
  import "../chunk-XWVM4KPK.js";
76
76
 
77
77
  // src/bin/agt.ts
@@ -4834,7 +4834,7 @@ import { execFileSync, execSync } from "child_process";
4834
4834
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4835
4835
  import chalk18 from "chalk";
4836
4836
  import ora16 from "ora";
4837
- var cliVersion = true ? "0.28.520" : "dev";
4837
+ var cliVersion = true ? "0.28.522" : "dev";
4838
4838
  async function fetchLatestVersion() {
4839
4839
  const host2 = getHost();
4840
4840
  if (!host2) return null;
@@ -6006,7 +6006,7 @@ function handleError(err) {
6006
6006
  }
6007
6007
 
6008
6008
  // src/bin/agt.ts
6009
- var cliVersion2 = true ? "0.28.520" : "dev";
6009
+ var cliVersion2 = true ? "0.28.522" : "dev";
6010
6010
  var program = new Command();
6011
6011
  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");
6012
6012
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -4400,6 +4400,11 @@ var MARKUP_BRIDGE_SCRIPT = `<script>(function(){
4400
4400
  var commentEnabled = false; // armed when the viewer may comment (ENG-6847 right-click)
4401
4401
  var editing = null; // the element currently in edit mode
4402
4402
  var bar = null; // the Save/Cancel toolbar
4403
+ // ENG-8477: the viewer has explicitly turned editing ON from the shell. Only
4404
+ // then does the bridge look underneath the artefact's own overlays. See the
4405
+ // long note on the window-capture click handler for why this is a mode and
4406
+ // not just always-on.
4407
+ var editMode = false;
4403
4408
 
4404
4409
  // Element-child indices from <body> down to el. Counts ELEMENT children only
4405
4410
  // (children, not childNodes), matching how the server walks source_html; our
@@ -4454,6 +4459,55 @@ var MARKUP_BRIDGE_SCRIPT = `<script>(function(){
4454
4459
  return null;
4455
4460
  }catch(e){ return null; }
4456
4461
  }
4462
+ // ENG-8477: the topmost element under the pointer that we could actually edit,
4463
+ // looking THROUGH anything the artefact has laid over its own content.
4464
+ //
4465
+ // elementsFromPoint returns the full hit stack, front to back. We walk it from
4466
+ // the front and take the first genuinely editable element, skipping our own
4467
+ // injected UI. An artefact overlay is skipped for free: it is an empty div, so
4468
+ // editable() rejects it on the text check and we keep walking.
4469
+ //
4470
+ // Returns null when there is nothing editable under the pointer at all, which
4471
+ // is the signal to leave the click completely alone.
4472
+ function editableAtPoint(x,y){
4473
+ var stack;
4474
+ try{ stack=document.elementsFromPoint(x,y)||[]; }catch(e){ return null; }
4475
+ for(var i=0;i<stack.length;i++){
4476
+ var el=stack[i];
4477
+ if(!el || el.nodeType!==1) continue;
4478
+ if(el.closest && el.closest('[data-al-noedit]')) continue; // our toolbar, not content
4479
+ if(editable(el)||inlineOnlyEditable(el)) return el;
4480
+ }
4481
+ return null;
4482
+ }
4483
+ // The caret probe (caretRangeFromPoint) reports on the TOPMOST element at the
4484
+ // point, so an overlay swallows it exactly as it swallows the click - it hands
4485
+ // back the overlay div, not the text underneath. Neutralise everything stacked
4486
+ // above the target for the length of the probe, then put it back. The restore
4487
+ // is in a finally and runs before the browser can paint, so nothing flickers
4488
+ // and no artefact state is left modified.
4489
+ // This re-queries elementsFromPoint rather than reusing the caller's stack, so
4490
+ // target is NOT guaranteed to still be in it. Find target's index first and
4491
+ // mute only the prefix in front of it: a not-found target must fall back to the
4492
+ // plain probe, because muting the whole stack would neutralise target and its
4493
+ // ancestors too - a wider style mutation than intended, for a probe whose
4494
+ // result the caller then rejects anyway.
4495
+ function textNodeAtPointThrough(x,y,target){
4496
+ var stack;
4497
+ try{ stack=document.elementsFromPoint(x,y)||[]; }catch(e){ return textNodeAtPoint(x,y); }
4498
+ var cut=-1, i;
4499
+ for(i=0;i<stack.length;i++){ if(stack[i]===target){ cut=i; break; } }
4500
+ if(cut<0) return textNodeAtPoint(x,y);
4501
+ var muted=[];
4502
+ for(i=0;i<cut;i++){
4503
+ muted.push([stack[i], stack[i].style ? stack[i].style.pointerEvents : '']);
4504
+ try{ stack[i].style.pointerEvents='none'; }catch(e){}
4505
+ }
4506
+ try{ return textNodeAtPoint(x,y); }
4507
+ finally{
4508
+ for(i=0;i<muted.length;i++){ try{ muted[i][0].style.pointerEvents=muted[i][1]||''; }catch(e){} }
4509
+ }
4510
+ }
4457
4511
  // Index of a text node among its parent's child TEXT nodes, in order - the same
4458
4512
  // counting the server uses to re-locate it in source_html (ENG-6856).
4459
4513
  function textIndexOf(container, tn){
@@ -4563,6 +4617,105 @@ var MARKUP_BRIDGE_SCRIPT = `<script>(function(){
4563
4617
  e.preventDefault(); e.stopPropagation(); startEditTextNode(tn, el);
4564
4618
  }
4565
4619
  }, true);
4620
+ // ENG-8477: reach content the artefact covers with its OWN overlay.
4621
+ //
4622
+ // A deck built from the canonical template lays two full-viewport click zones
4623
+ // over its slides (.clickzone, position:fixed, z-index:40) to page forward and
4624
+ // back. The template's own comment says it plainly: "the click zones sit above
4625
+ // slide content by design, so any interactive element inside a slide needs
4626
+ // position:relative + a higher z-index to stay clickable". Slide TEXT is not an
4627
+ // interactive element and never gets one.
4628
+ //
4629
+ // So every click a viewer aimed at a paragraph landed on #zone-prev/#zone-next.
4630
+ // The handler above read e.target, got an empty div, editable() rejected it on
4631
+ // the text check, and no editor opened - while the zone's own handler paged the
4632
+ // deck. A single-page artefact has no zones and the identical bridge works
4633
+ // perfectly on it, which is precisely why editing "works in web page formats
4634
+ // but not decks". Verified on real published content, not just the template.
4635
+ //
4636
+ // Why a MODE rather than always-on. One press cannot mean both "page the deck"
4637
+ // and "edit this text". The zones are the deck's primary navigation, so
4638
+ // silently stealing clicks from them would trade one broken gesture for
4639
+ // another. The shell gives an armed viewer an explicit Edit-text toggle; until
4640
+ // they turn it on, every line below is inert and the artefact behaves exactly
4641
+ // as it does today. Anonymous viewers never arm at all.
4642
+ //
4643
+ // Why window + capture. Same phase argument as ENG-8500: the artefact's script
4644
+ // is appended before the bridge, so registration order cannot be won, but the
4645
+ // capture path runs window -> document -> ... -> target and therefore beats a
4646
+ // handler bound to the zone itself no matter when it was registered.
4647
+ // stopImmediatePropagation then keeps the deck from also paging.
4648
+ //
4649
+ // Deliberately general: nothing here knows about .clickzone or any class name.
4650
+ // It fixes any artefact that covers its own content.
4651
+ window.addEventListener('click', function(e){
4652
+ if(!editEnabled || !editMode || editing) return;
4653
+ var sel=document.getSelection(); if(sel && String(sel).trim()) return; // selection => comment flow
4654
+ var t=e.target;
4655
+ // Our own toolbar (Save/Cancel) must keep its clicks.
4656
+ if(t && t.closest && t.closest('[data-al-noedit]')) return;
4657
+ // Already directly on editable content: the document-level handler above
4658
+ // covers it, and duplicating the work here would start the edit twice.
4659
+ if(editable(t)||inlineOnlyEditable(t)) return;
4660
+ var el=editableAtPoint(e.clientX, e.clientY);
4661
+ // Nothing editable under the pointer - leave the click completely alone so
4662
+ // click-to-page still works while the viewer is moving between slides.
4663
+ if(!el) return;
4664
+ // Suppress ONLY once an edit is actually starting. Suppressing up front left
4665
+ // the inline-only fallback below as a dead click: no editor opened AND the
4666
+ // deck could not page, because the event was already stopped.
4667
+ if(editable(el)){ e.preventDefault(); e.stopImmediatePropagation(); startEdit(el); return; }
4668
+ var tn=textNodeAtPointThrough(e.clientX, e.clientY, el);
4669
+ if(tn && tn.parentElement===el && (tn.nodeValue||'').trim()){
4670
+ e.preventDefault(); e.stopImmediatePropagation(); startEditTextNode(tn, el); return;
4671
+ }
4672
+ // An inline-only container whose exact text run we could not resolve (no
4673
+ // caret API, or the point fell between runs). Editing the whole container
4674
+ // would flatten its nested markup, so leave the click to the artefact and
4675
+ // let it page as it normally would.
4676
+ }, true);
4677
+ // ENG-8477: the same deck template pulls focus back to the document on every
4678
+ // pointer press, to keep its arrow keys working when the iframe loses focus:
4679
+ //
4680
+ // function grabFocus(){ try{ window.focus(); document.body.focus(); }catch(e){} }
4681
+ // addEventListener('pointerdown', grabFocus);
4682
+ //
4683
+ // A bare addEventListener at artefact top level is window + bubble phase, so a
4684
+ // window CAPTURE listener still gets there first. Without this guard, clicking
4685
+ // into an open editor to place the caret hands focus straight to <body> and the
4686
+ // viewer cannot type - a second, independent breaker that would have survived
4687
+ // the overlay fix on its own.
4688
+ //
4689
+ // Scoped as tightly as it can be: only while an edit is open, and only for a
4690
+ // press that lands inside the editor. A press anywhere else is the viewer
4691
+ // leaving, and the artefact keeps it.
4692
+ window.addEventListener('pointerdown', function(e){
4693
+ if(!editing) return;
4694
+ var t=e.target;
4695
+ if(t!==editing && !(editing.contains && t && t.nodeType && editing.contains(t))) return;
4696
+ e.stopImmediatePropagation();
4697
+ }, true);
4698
+ // ENG-8477: the hover affordance has the same blind spot as the click did -
4699
+ // mouseover reports the overlay, so a viewer in edit mode would get no cue that
4700
+ // slide text can be edited at all. Probing the stack on every mousemove would
4701
+ // be wasteful, so this only runs in edit mode, only when the direct target is
4702
+ // not already editable (that case the mouseover handler above still covers),
4703
+ // and no more than once per ~80ms.
4704
+ var hoverProbeAt=0, hoverEl=null;
4705
+ function clearDeepHover(){
4706
+ if(hoverEl && hoverEl!==editing && hoverEl.__alHover){ try{ hoverEl.style.outline=''; }catch(e){} hoverEl.__alHover=0; }
4707
+ hoverEl=null;
4708
+ }
4709
+ document.addEventListener('mousemove', function(e){
4710
+ if(!editEnabled || !editMode || editing){ clearDeepHover(); return; }
4711
+ var t=e.target;
4712
+ if(editable(t)||inlineOnlyEditable(t)){ clearDeepHover(); return; }
4713
+ var now=Date.now(); if(now-hoverProbeAt<80) return; hoverProbeAt=now;
4714
+ var el=editableAtPoint(e.clientX, e.clientY);
4715
+ if(el===hoverEl) return;
4716
+ clearDeepHover();
4717
+ if(el){ try{ el.style.outline=el.style.outline||'1px dashed rgba(110,231,183,.6)'; }catch(e){} el.__alHover=1; hoverEl=el; }
4718
+ });
4566
4719
  // ENG-8500: while the inline editor is focused, the artefact's OWN keyboard
4567
4720
  // handlers must not see the keystroke.
4568
4721
  //
@@ -4654,6 +4807,13 @@ var MARKUP_BRIDGE_SCRIPT = `<script>(function(){
4654
4807
  var d=e.data; if(!d || d['${MARKUP_CONTROL_MARKER}']!==true) return;
4655
4808
  if(d.type==='enable-edit'){ editEnabled=true; }
4656
4809
  else if(d.type==='enable-comment'){ commentEnabled=true; }
4810
+ // ENG-8477: the viewer toggled Edit text in the shell. Turning it OFF must
4811
+ // also close anything open and drop the hover cue, or the artefact is left
4812
+ // wearing our outlines with no way to clear them.
4813
+ else if(d.type==='set-edit-mode'){
4814
+ editMode = !!d.on;
4815
+ if(!editMode){ if(editing) endEdit(false); clearDeepHover(); }
4816
+ }
4657
4817
  else if(d.type==='edit-result'){
4658
4818
  if(d.ok){ /* republish hot-swaps the iframe; nothing to do */ }
4659
4819
  else { /* leave the (now non-editable) text; the published version is the source of truth */ }
@@ -5296,7 +5456,17 @@ var HTTP_PROBE_PROVIDERS = /* @__PURE__ */ new Set([
5296
5456
  // became both the likeliest failure AND an invisible one. This entry is what
5297
5457
  // routes it to the real `api.vercel.com/v2/user` probe — `probeVercel` is
5298
5458
  // unreachable without it.
5299
- "vercel"
5459
+ "vercel",
5460
+ // ENG-8502: Higgsfield, for exactly the reasons given for Vercel above.
5461
+ // ENG-8440 made it a customer-supplied api_key but left it out of this set,
5462
+ // so it fell through to `builtin` and reported `unverified` having contacted
5463
+ // nothing. The consequence was worse than an uninformative chip: nothing
5464
+ // promotes an install off `status='configured'` without a real verdict, and
5465
+ // the console renders `configured` as "not connected" — so scout's WORKING
5466
+ // install (121 motion presets fetched through the broker) told the customer
5467
+ // it had never connected. Routes to `probeHiggsfield`: `Authorization: Key`
5468
+ // against the free, read-only `/v1/motions`.
5469
+ "higgsfield"
5300
5470
  // ENG-6100: GitHub is deliberately NOT here. This set drives the ASYNC
5301
5471
  // connectivity monitor's routing, where github (source_type='native')
5302
5472
  // stays host-side (cli_command — `gh`, the credential the agent actually
@@ -5980,11 +6150,20 @@ async function probeComposioMcpToolCall(config, fetchImpl = fetch) {
5980
6150
 
5981
6151
  // ../../packages/core/dist/integrations/connectivity-http-probes.js
5982
6152
  var PROBE_TIMEOUT_MS2 = 1e4;
6153
+ var NULL_BODY_STATUSES = /* @__PURE__ */ new Set([101, 204, 205, 304]);
5983
6154
  async function timedFetch2(fetchImpl, url, init) {
5984
6155
  const controller = new AbortController();
5985
6156
  const timer = setTimeout(() => controller.abort(), PROBE_TIMEOUT_MS2);
5986
6157
  try {
5987
- return await fetchImpl(url, { ...init, signal: controller.signal });
6158
+ const res = await fetchImpl(url, { ...init, signal: controller.signal });
6159
+ if (NULL_BODY_STATUSES.has(res.status))
6160
+ return res;
6161
+ const body = await res.text();
6162
+ return new Response(body, {
6163
+ status: res.status,
6164
+ statusText: res.statusText,
6165
+ headers: res.headers
6166
+ });
5988
6167
  } finally {
5989
6168
  clearTimeout(timer);
5990
6169
  }
@@ -6094,6 +6273,43 @@ async function probeVercel(creds, fetchImpl) {
6094
6273
  return networkOutcome(err, String(token ?? ""));
6095
6274
  }
6096
6275
  }
6276
+ async function probeHiggsfield(creds, fetchImpl) {
6277
+ const token = creds.api_key ?? creds.access_token;
6278
+ if (!token)
6279
+ return { status: "down", message: "No Higgsfield credential present" };
6280
+ if (!token.includes(":")) {
6281
+ return {
6282
+ status: "down",
6283
+ message: "Higgsfield credential is not in KEY_ID:KEY_SECRET form \u2014 re-paste it from cloud.higgsfield.ai/api-keys"
6284
+ };
6285
+ }
6286
+ try {
6287
+ const res = await timedFetch2(fetchImpl, "https://platform.higgsfield.ai/v1/motions", {
6288
+ headers: { Authorization: `Key ${token}` }
6289
+ });
6290
+ if (!res.ok) {
6291
+ if (res.status === 429) {
6292
+ return { status: "transient_error", message: "Higgsfield rate limit (429) \u2014 not a credential failure" };
6293
+ }
6294
+ const body = await res.text().catch(() => "");
6295
+ if (res.status === 403 && /credit/i.test(body)) {
6296
+ return {
6297
+ status: "degraded",
6298
+ message: "Higgsfield authenticated, but the account is out of credits \u2014 generation will fail"
6299
+ };
6300
+ }
6301
+ const message = res.status === 401 || res.status === 403 ? `Higgsfield rejected the key pair (${res.status}) \u2014 invalid or revoked API key` : `Higgsfield API returned ${res.status}`;
6302
+ return { status: statusForHttp(res.status), message };
6303
+ }
6304
+ const motions = await res.json();
6305
+ if (!Array.isArray(motions) || motions.length === 0) {
6306
+ return { status: "down", message: "Higgsfield returned no motion presets for this key" };
6307
+ }
6308
+ return { status: "ok", message: `Higgsfield reachable \u2014 ${motions.length} motion presets` };
6309
+ } catch (err) {
6310
+ return networkOutcome(err, String(token ?? ""));
6311
+ }
6312
+ }
6097
6313
  async function probeHttpProvider(definitionId, credentials, fetchImpl = fetch) {
6098
6314
  switch (definitionId) {
6099
6315
  case "linear":
@@ -6102,6 +6318,8 @@ async function probeHttpProvider(definitionId, credentials, fetchImpl = fetch) {
6102
6318
  return probeBuffer(credentials, fetchImpl);
6103
6319
  case "vercel":
6104
6320
  return probeVercel(credentials, fetchImpl);
6321
+ case "higgsfield":
6322
+ return probeHiggsfield(credentials, fetchImpl);
6105
6323
  case "google-workspace":
6106
6324
  return probeBearerJson("https://www.googleapis.com/oauth2/v2/userinfo", credentials, fetchImpl, (body) => {
6107
6325
  const info = body;
@@ -15112,4 +15330,4 @@ export {
15112
15330
  stopAllSessionsAndWait,
15113
15331
  getProjectDir
15114
15332
  };
15115
- //# sourceMappingURL=chunk-XH3O62OZ.js.map
15333
+ //# sourceMappingURL=chunk-4GTDD2I5.js.map