@darkhunt-security/endpoint-codex 0.9.18 → 0.9.21

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "darkhunt-guard",
3
- "version": "0.9.18",
3
+ "version": "0.9.21",
4
4
  "hooks": "./hooks/hooks.json",
5
5
  "description": "Darkhunt endpoint plugin for Codex CLI \u2014 full session trace capture and PreToolUse guardrails.",
6
6
  "author": {
@@ -18330,7 +18330,7 @@ function capPayload(value, limit = PAYLOAD_LIMIT) {
18330
18330
  function capText(text, limit = PAYLOAD_LIMIT) {
18331
18331
  return capPayload(text, limit);
18332
18332
  }
18333
- var TOOL_SUMMARY_LIMIT = 2e3;
18333
+ var TOOL_SUMMARY_LIMIT = 1e5;
18334
18334
  function summarize(output) {
18335
18335
  const text = typeof output === "string" ? output : JSON.stringify(output ?? null);
18336
18336
  if (text.length <= TOOL_SUMMARY_LIMIT)
@@ -18528,7 +18528,7 @@ var SessionEmitter = class {
18528
18528
  });
18529
18529
  this.toolSpans.delete(record.toolCallId);
18530
18530
  }
18531
- this.pendingToolResults.push(summarize(record.output));
18531
+ this.pendingToolResults.push(summarize(record.outputText ?? record.output));
18532
18532
  break;
18533
18533
  }
18534
18534
  case "compaction":
@@ -22403,6 +22403,31 @@ function textOf(content) {
22403
22403
  const parts = content.map((b) => b && typeof b === "object" ? str(b["text"]) : void 0).filter((t) => !!t);
22404
22404
  return parts.length > 0 ? parts.join("\n") : void 0;
22405
22405
  }
22406
+ function attachmentsOf(content, base) {
22407
+ if (!Array.isArray(content))
22408
+ return [];
22409
+ const out = [];
22410
+ for (const [i, block] of content.entries()) {
22411
+ if (!block || typeof block !== "object")
22412
+ continue;
22413
+ const bag = block;
22414
+ if (bag["type"] !== "input_image")
22415
+ continue;
22416
+ const url = str(bag["image_url"]);
22417
+ const comma = url?.startsWith("data:") ? url.indexOf(",") : -1;
22418
+ const header = url !== void 0 && comma > 0 ? url.slice(5, comma).split(";") : [];
22419
+ const mediaType = header[0] || void 0;
22420
+ const bytes = url !== void 0 && header.at(-1) === "base64" ? Math.floor((url.length - comma - 1) * 3 / 4) : void 0;
22421
+ out.push({
22422
+ ...base,
22423
+ uuid: `${base.uuid}:image:${i}`,
22424
+ kind: "attachment",
22425
+ ...bytes !== void 0 ? { bytes } : {},
22426
+ ...mediaType !== void 0 ? { mediaType } : {}
22427
+ });
22428
+ }
22429
+ return out;
22430
+ }
22406
22431
  var CODEX_APPROVAL_MODES = {
22407
22432
  never: "auto",
22408
22433
  "on-request": "ask"
@@ -22730,7 +22755,10 @@ var codexTranscript = {
22730
22755
  return [];
22731
22756
  switch (str(payload["role"])) {
22732
22757
  case "user":
22733
- return [{ ...base, kind: "user_message", text }];
22758
+ return [
22759
+ ...attachmentsOf(payload["content"], base),
22760
+ { ...base, kind: "user_message", text }
22761
+ ];
22734
22762
  case "assistant":
22735
22763
  return [{ ...base, kind: "assistant_message", text }];
22736
22764
  default:
@@ -18316,7 +18316,7 @@ function capPayload(value, limit = PAYLOAD_LIMIT) {
18316
18316
  function capText(text, limit = PAYLOAD_LIMIT) {
18317
18317
  return capPayload(text, limit);
18318
18318
  }
18319
- var TOOL_SUMMARY_LIMIT = 2e3;
18319
+ var TOOL_SUMMARY_LIMIT = 1e5;
18320
18320
  function summarize(output) {
18321
18321
  const text = typeof output === "string" ? output : JSON.stringify(output ?? null);
18322
18322
  if (text.length <= TOOL_SUMMARY_LIMIT)
@@ -18514,7 +18514,7 @@ var SessionEmitter = class {
18514
18514
  });
18515
18515
  this.toolSpans.delete(record.toolCallId);
18516
18516
  }
18517
- this.pendingToolResults.push(summarize(record.output));
18517
+ this.pendingToolResults.push(summarize(record.outputText ?? record.output));
18518
18518
  break;
18519
18519
  }
18520
18520
  case "compaction":
@@ -22213,6 +22213,31 @@ function textOf(content) {
22213
22213
  const parts = content.map((b) => b && typeof b === "object" ? str(b["text"]) : void 0).filter((t) => !!t);
22214
22214
  return parts.length > 0 ? parts.join("\n") : void 0;
22215
22215
  }
22216
+ function attachmentsOf(content, base) {
22217
+ if (!Array.isArray(content))
22218
+ return [];
22219
+ const out = [];
22220
+ for (const [i, block] of content.entries()) {
22221
+ if (!block || typeof block !== "object")
22222
+ continue;
22223
+ const bag = block;
22224
+ if (bag["type"] !== "input_image")
22225
+ continue;
22226
+ const url = str(bag["image_url"]);
22227
+ const comma = url?.startsWith("data:") ? url.indexOf(",") : -1;
22228
+ const header = url !== void 0 && comma > 0 ? url.slice(5, comma).split(";") : [];
22229
+ const mediaType = header[0] || void 0;
22230
+ const bytes = url !== void 0 && header.at(-1) === "base64" ? Math.floor((url.length - comma - 1) * 3 / 4) : void 0;
22231
+ out.push({
22232
+ ...base,
22233
+ uuid: `${base.uuid}:image:${i}`,
22234
+ kind: "attachment",
22235
+ ...bytes !== void 0 ? { bytes } : {},
22236
+ ...mediaType !== void 0 ? { mediaType } : {}
22237
+ });
22238
+ }
22239
+ return out;
22240
+ }
22216
22241
  var CODEX_APPROVAL_MODES = {
22217
22242
  never: "auto",
22218
22243
  "on-request": "ask"
@@ -22540,7 +22565,10 @@ var codexTranscript = {
22540
22565
  return [];
22541
22566
  switch (str(payload["role"])) {
22542
22567
  case "user":
22543
- return [{ ...base, kind: "user_message", text }];
22568
+ return [
22569
+ ...attachmentsOf(payload["content"], base),
22570
+ { ...base, kind: "user_message", text }
22571
+ ];
22544
22572
  case "assistant":
22545
22573
  return [{ ...base, kind: "assistant_message", text }];
22546
22574
  default:
@@ -1312,6 +1312,31 @@ function textOf(content) {
1312
1312
  const parts = content.map((b) => b && typeof b === "object" ? str(b["text"]) : void 0).filter((t) => !!t);
1313
1313
  return parts.length > 0 ? parts.join("\n") : void 0;
1314
1314
  }
1315
+ function attachmentsOf(content, base) {
1316
+ if (!Array.isArray(content))
1317
+ return [];
1318
+ const out = [];
1319
+ for (const [i, block] of content.entries()) {
1320
+ if (!block || typeof block !== "object")
1321
+ continue;
1322
+ const bag = block;
1323
+ if (bag["type"] !== "input_image")
1324
+ continue;
1325
+ const url = str(bag["image_url"]);
1326
+ const comma = url?.startsWith("data:") ? url.indexOf(",") : -1;
1327
+ const header = url !== void 0 && comma > 0 ? url.slice(5, comma).split(";") : [];
1328
+ const mediaType = header[0] || void 0;
1329
+ const bytes = url !== void 0 && header.at(-1) === "base64" ? Math.floor((url.length - comma - 1) * 3 / 4) : void 0;
1330
+ out.push({
1331
+ ...base,
1332
+ uuid: `${base.uuid}:image:${i}`,
1333
+ kind: "attachment",
1334
+ ...bytes !== void 0 ? { bytes } : {},
1335
+ ...mediaType !== void 0 ? { mediaType } : {}
1336
+ });
1337
+ }
1338
+ return out;
1339
+ }
1315
1340
  var CODEX_APPROVAL_MODES = {
1316
1341
  never: "auto",
1317
1342
  "on-request": "ask"
@@ -1639,7 +1664,10 @@ var codexTranscript = {
1639
1664
  return [];
1640
1665
  switch (str(payload["role"])) {
1641
1666
  case "user":
1642
- return [{ ...base, kind: "user_message", text }];
1667
+ return [
1668
+ ...attachmentsOf(payload["content"], base),
1669
+ { ...base, kind: "user_message", text }
1670
+ ];
1643
1671
  case "assistant":
1644
1672
  return [{ ...base, kind: "assistant_message", text }];
1645
1673
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darkhunt-security/endpoint-codex",
3
- "version": "0.9.18",
3
+ "version": "0.9.21",
4
4
  "type": "module",
5
5
  "description": "Darkhunt endpoint adapter for Codex CLI: hook codec, rollout transcript mapper, plugin manifest.",
6
6
  "bin": {