@gajae-code/utils 0.12.0 → 0.12.1

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.
@@ -135,6 +135,8 @@ export declare function getModelDbPath(agentDir?: string): string;
135
135
  export declare function getSessionsDir(agentDir?: string): string;
136
136
  /** Get the content-addressed blob store directory (~/.gjc/agent/blobs). */
137
137
  export declare function getBlobsDir(agentDir?: string): string;
138
+ /** Get the resident-text cache root for a profile agent directory. */
139
+ export declare function getResidentCacheRootDir(profileAgentDir: string): string;
138
140
  /** Get the custom themes directory (~/.gjc/agent/themes). */
139
141
  export declare function getCustomThemesDir(agentDir?: string): string;
140
142
  /** Get the tools directory (~/.gjc/agent/tools). */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@gajae-code/utils",
4
- "version": "0.12.0",
4
+ "version": "0.12.1",
5
5
  "description": "Shared utilities for pi packages",
6
6
  "homepage": "https://gajae-code.com",
7
7
  "author": "Yeachan-Heo",
@@ -31,7 +31,7 @@
31
31
  "fmt": "biome format --write ."
32
32
  },
33
33
  "dependencies": {
34
- "@gajae-code/natives": "0.12.0",
34
+ "@gajae-code/natives": "0.12.1",
35
35
  "beautiful-mermaid": "^1.1.3",
36
36
  "handlebars": "^4.7.9",
37
37
  "winston": "^3.19.0",
package/src/dirs.ts CHANGED
@@ -546,6 +546,11 @@ export function getBlobsDir(agentDir?: string): string {
546
546
  return dirs.agentSubdir(agentDir, "blobs", "data");
547
547
  }
548
548
 
549
+ /** Get the resident-text cache root for a profile agent directory. */
550
+ export function getResidentCacheRootDir(profileAgentDir: string): string {
551
+ return dirs.agentSubdir(profileAgentDir, "resident-cache", "cache");
552
+ }
553
+
549
554
  /** Get the custom themes directory (~/.gjc/agent/themes). */
550
555
  export function getCustomThemesDir(agentDir?: string): string {
551
556
  return dirs.agentSubdir(agentDir, "themes");
package/src/postmortem.ts CHANGED
@@ -229,11 +229,21 @@ function redactCrashSecrets(text: string): string {
229
229
  redacted = redacted.replace(/\b(?:Bearer|Basic|Token)\s+[A-Za-z0-9._~+/=-]{8,}/gi, "«redacted-auth»");
230
230
  redacted = redacted.replace(/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, "«redacted-jwt»");
231
231
  redacted = redacted.replace(/\bsk-[A-Za-z0-9_-]{8,}\b/g, "«redacted-api-key»");
232
+ // `gh[opsur]_` covers the classic PAT/OAuth/server/user/refresh prefixes;
233
+ // fine-grained PATs use an entirely different `github_pat_` prefix and would
234
+ // otherwise survive into a log the module keeps indefinitely.
232
235
  redacted = redacted.replace(/\bgh[opsur]_[A-Za-z0-9]{16,}\b/g, "«redacted-github-token»");
236
+ redacted = redacted.replace(/\bgithub_pat_[A-Za-z0-9_]{20,}\b/g, "«redacted-github-token»");
233
237
  redacted = redacted.replace(/\bxox[baprs]-[A-Za-z0-9-]{8,}\b/g, "«redacted-slack-token»");
234
- redacted = redacted.replace(/\bAKIA[0-9A-Z]{16}\b/g, "«redacted-aws-key»");
238
+ // AKIA is the long-term access key id; ASIA is the temporary/STS one, which is
239
+ // the shape that actually shows up in a crashed request. The id alone is not
240
+ // the credential: an STS payload carries `SecretAccessKey` and `SessionToken`
241
+ // alongside it, so the labeled-value rule below must name both. `secret_key`
242
+ // does not match `SecretAccessKey` (the canonical field has `Access` in the
243
+ // middle), and `access_token` does not match `SessionToken`.
244
+ redacted = redacted.replace(/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g, "«redacted-aws-key»");
235
245
  redacted = redacted.replace(
236
- /(["']?(?:api[_-]?key|apikey|access[_-]?token|refresh[_-]?token|id[_-]?token|client[_-]?secret|secret[_-]?key|password|passwd|authorization)["']?\s*[=:]\s*["']?)[^\s"',;}\]]{8,}/gi,
246
+ /(?<![A-Za-z0-9_])(["']?(?:api[_-]?key|apikey|access[_-]?token|refresh[_-]?token|id[_-]?token|session[_-]?token|client[_-]?secret|secret[_-]?key|secret[_-]?access[_-]?key|password|passwd|authorization)["']?\s*[=:]\s*["']?)[^\s"',;}\]]{8,}/gi,
237
247
  "$1«redacted»",
238
248
  );
239
249
  return redacted;