@integrity-labs/agt-cli 0.28.357 → 0.28.359

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.
@@ -20,7 +20,7 @@ import {
20
20
  resolveConnectivityProbe,
21
21
  worseConnectivityOutcome,
22
22
  wrapScheduledTaskPrompt
23
- } from "./chunk-LDIKBFDR.js";
23
+ } from "./chunk-FAGXXKWZ.js";
24
24
  import {
25
25
  parsePsRows
26
26
  } from "./chunk-XWVM4KPK.js";
@@ -6308,9 +6308,9 @@ function parseOpencodeModelRef(opencodeModel) {
6308
6308
  return { providerID: opencodeModel.slice(0, slash), id: opencodeModel.slice(slash + 1) };
6309
6309
  }
6310
6310
  function buildOpencodePermission(tools) {
6311
- const denyByDefault = tools?.global_controls?.default_network_policy !== "allow";
6311
+ const denyNetwork = tools?.global_controls?.default_network_policy !== "allow";
6312
6312
  const bash = {
6313
- "*": denyByDefault ? "ask" : "allow",
6313
+ "*": "allow",
6314
6314
  "cat *.env*": "deny",
6315
6315
  "cat *.pem": "deny",
6316
6316
  "cat *.key": "deny",
@@ -6324,7 +6324,7 @@ function buildOpencodePermission(tools) {
6324
6324
  // Agents edit their own workspace freely; cross-dir isolation is enforced
6325
6325
  // by the manager spawning each agent in its own project dir.
6326
6326
  edit: "allow",
6327
- webfetch: denyByDefault ? "ask" : "allow",
6327
+ webfetch: denyNetwork ? "deny" : "allow",
6328
6328
  bash
6329
6329
  };
6330
6330
  }
@@ -6653,6 +6653,13 @@ var HttpOpencodeClient = class _HttpOpencodeClient {
6653
6653
  const out = await this.call("GET", `/api/session/${sessionID}/message`);
6654
6654
  return out.data ?? [];
6655
6655
  }
6656
+ async listSessions() {
6657
+ const out = await this.call("GET", "/api/session");
6658
+ return (out.data ?? []).filter((s) => typeof s.id === "string").map((s) => ({ id: s.id, title: s.title, updated: s.time?.updated, created: s.time?.created }));
6659
+ }
6660
+ async getStructuredMessages(sessionID) {
6661
+ return this.fetchMessages(sessionID);
6662
+ }
6656
6663
  /** The message with the greatest `time.created` (opencode returns newest-first, but don't rely on order). */
6657
6664
  static newestByCreated(messages) {
6658
6665
  let newest;
@@ -6668,6 +6675,72 @@ var HttpOpencodeClient = class _HttpOpencodeClient {
6668
6675
  }
6669
6676
  };
6670
6677
 
6678
+ // ../../packages/core/dist/provisioning/frameworks/opencode/opencode-transcript.js
6679
+ var IDENTITY = (s) => s;
6680
+ var DEFAULT_MAX_PART_CHARS = 4e3;
6681
+ var DEFAULT_MAX_BYTES = 18e3;
6682
+ function emptyOpencodeTranscript(capturedAt) {
6683
+ return {
6684
+ version: 1,
6685
+ sessionId: null,
6686
+ sessionTitle: null,
6687
+ capturedAt,
6688
+ truncated: false,
6689
+ messages: []
6690
+ };
6691
+ }
6692
+ function buildOpencodeTranscript(input) {
6693
+ const redact = input.redact ?? IDENTITY;
6694
+ const maxPartChars = input.maxPartChars ?? DEFAULT_MAX_PART_CHARS;
6695
+ const maxBytes = input.maxBytes ?? DEFAULT_MAX_BYTES;
6696
+ const sorted = [...input.messages].sort((a, b) => (a.time?.created ?? 0) - (b.time?.created ?? 0));
6697
+ const limited = typeof input.maxMessages === "number" ? sorted.slice(-input.maxMessages) : sorted;
6698
+ let messages = limited.map((m) => buildMessage(m, redact, maxPartChars));
6699
+ let truncated = false;
6700
+ const envelopeOverhead = 200;
6701
+ while (messages.length > 0 && Buffer.byteLength(JSON.stringify(messages), "utf8") + envelopeOverhead > maxBytes) {
6702
+ messages = messages.slice(1);
6703
+ truncated = true;
6704
+ }
6705
+ return {
6706
+ version: 1,
6707
+ sessionId: input.sessionId,
6708
+ sessionTitle: input.sessionTitle ?? null,
6709
+ capturedAt: input.capturedAt,
6710
+ truncated,
6711
+ messages
6712
+ };
6713
+ }
6714
+ function buildMessage(m, redact, maxPartChars) {
6715
+ return {
6716
+ id: m.id,
6717
+ role: typeof m.type === "string" ? m.type : "unknown",
6718
+ createdAt: m.time?.created,
6719
+ completedAt: m.time?.completed,
6720
+ finish: m.finish,
6721
+ parts: (m.content ?? []).map((p) => buildPart(p, redact, maxPartChars))
6722
+ };
6723
+ }
6724
+ function clip(raw, redact, maxChars) {
6725
+ const red = redact(raw);
6726
+ return red.length > maxChars ? `${red.slice(0, maxChars)}\u2026 [truncated]` : red;
6727
+ }
6728
+ function buildPart(p, redact, maxPartChars) {
6729
+ if (p.type === "text" || p.type === "reasoning") {
6730
+ return { kind: p.type, text: typeof p.text === "string" ? clip(p.text, redact, maxPartChars) : "" };
6731
+ }
6732
+ if (p.type === "tool") {
6733
+ return {
6734
+ kind: "tool",
6735
+ tool: typeof p.tool === "string" ? p.tool : void 0,
6736
+ status: p.state?.status,
6737
+ // Redact the summary; DROP raw state.input entirely (may carry secrets).
6738
+ title: typeof p.state?.title === "string" ? clip(p.state.title, redact, maxPartChars) : void 0
6739
+ };
6740
+ }
6741
+ return { kind: "other" };
6742
+ }
6743
+
6671
6744
  // ../../packages/core/dist/provisioning/frameworks/opencode/inbound-bridge.js
6672
6745
  var InboundError = class extends Error {
6673
6746
  /** True once `prompt()` has durably admitted the turn. Retry is unsafe. */
@@ -7153,7 +7226,7 @@ function requireHost() {
7153
7226
  }
7154
7227
 
7155
7228
  // src/lib/api-client.ts
7156
- var agtCliVersion = true ? "0.28.357" : "dev";
7229
+ var agtCliVersion = true ? "0.28.359" : "dev";
7157
7230
  var lastConfigHash = null;
7158
7231
  function setConfigHash(hash) {
7159
7232
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -9543,6 +9616,8 @@ export {
9543
9616
  toOpencodeModel,
9544
9617
  parseOpencodeModelRef,
9545
9618
  HttpOpencodeClient,
9619
+ emptyOpencodeTranscript,
9620
+ buildOpencodeTranscript,
9546
9621
  OpencodeInboundBridge,
9547
9622
  readChannelServerEnv,
9548
9623
  setJsonMode,
@@ -9604,4 +9679,4 @@ export {
9604
9679
  managerInstallSystemUnitCommand,
9605
9680
  managerUninstallSystemUnitCommand
9606
9681
  };
9607
- //# sourceMappingURL=chunk-GAWEPU6C.js.map
9682
+ //# sourceMappingURL=chunk-TVFNWNSP.js.map