@oscharko-dev/keiko 0.3.16 → 0.3.17
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/ui/csp-hashes.json +6 -6
- package/dist/ui/static/404.html +1 -1
- package/dist/ui/static/__next.__PAGE__.txt +1 -1
- package/dist/ui/static/__next._full.txt +1 -1
- package/dist/ui/static/__next._head.txt +1 -1
- package/dist/ui/static/__next._index.txt +1 -1
- package/dist/ui/static/__next._tree.txt +1 -1
- package/dist/ui/static/_not-found/__next._full.txt +1 -1
- package/dist/ui/static/_not-found/__next._head.txt +1 -1
- package/dist/ui/static/_not-found/__next._index.txt +1 -1
- package/dist/ui/static/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/ui/static/_not-found/__next._not-found.txt +1 -1
- package/dist/ui/static/_not-found/__next._tree.txt +1 -1
- package/dist/ui/static/_not-found.html +1 -1
- package/dist/ui/static/_not-found.txt +1 -1
- package/dist/ui/static/atlassian-connectors/__next._full.txt +1 -1
- package/dist/ui/static/atlassian-connectors/__next._head.txt +1 -1
- package/dist/ui/static/atlassian-connectors/__next._index.txt +1 -1
- package/dist/ui/static/atlassian-connectors/__next._tree.txt +1 -1
- package/dist/ui/static/atlassian-connectors/__next.atlassian-connectors.__PAGE__.txt +1 -1
- package/dist/ui/static/atlassian-connectors/__next.atlassian-connectors.txt +1 -1
- package/dist/ui/static/atlassian-connectors.html +1 -1
- package/dist/ui/static/atlassian-connectors.txt +1 -1
- package/dist/ui/static/index.html +1 -1
- package/dist/ui/static/index.txt +1 -1
- package/dist/ui/static/launch/__next._full.txt +1 -1
- package/dist/ui/static/launch/__next._head.txt +1 -1
- package/dist/ui/static/launch/__next._index.txt +1 -1
- package/dist/ui/static/launch/__next._tree.txt +1 -1
- package/dist/ui/static/launch/__next.launch.__PAGE__.txt +1 -1
- package/dist/ui/static/launch/__next.launch.txt +1 -1
- package/dist/ui/static/launch.html +1 -1
- package/dist/ui/static/launch.txt +1 -1
- package/dist/ui/static/local-knowledge/__next._full.txt +1 -1
- package/dist/ui/static/local-knowledge/__next._head.txt +1 -1
- package/dist/ui/static/local-knowledge/__next._index.txt +1 -1
- package/dist/ui/static/local-knowledge/__next._tree.txt +1 -1
- package/dist/ui/static/local-knowledge/__next.local-knowledge.__PAGE__.txt +1 -1
- package/dist/ui/static/local-knowledge/__next.local-knowledge.txt +1 -1
- package/dist/ui/static/local-knowledge/capsule/__next._full.txt +1 -1
- package/dist/ui/static/local-knowledge/capsule/__next._head.txt +1 -1
- package/dist/ui/static/local-knowledge/capsule/__next._index.txt +1 -1
- package/dist/ui/static/local-knowledge/capsule/__next._tree.txt +1 -1
- package/dist/ui/static/local-knowledge/capsule/__next.local-knowledge.capsule.__PAGE__.txt +1 -1
- package/dist/ui/static/local-knowledge/capsule/__next.local-knowledge.capsule.txt +1 -1
- package/dist/ui/static/local-knowledge/capsule/__next.local-knowledge.txt +1 -1
- package/dist/ui/static/local-knowledge/capsule.html +1 -1
- package/dist/ui/static/local-knowledge/capsule.txt +1 -1
- package/dist/ui/static/local-knowledge.html +1 -1
- package/dist/ui/static/local-knowledge.txt +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/investigate.d.ts +8 -0
- package/node_modules/@oscharko-dev/keiko-cli/dist/investigate.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/investigate.js +283 -16
- package/node_modules/@oscharko-dev/keiko-cli/dist/support-analyze.d.ts +71 -0
- package/node_modules/@oscharko-dev/keiko-cli/dist/support-analyze.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/support-analyze.js +420 -11
- package/node_modules/@oscharko-dev/keiko-cli/dist/support-export.d.ts +23 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/support-export.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/support-export.js +41 -7
- package/node_modules/@oscharko-dev/keiko-cli/dist/support.d.ts +6 -0
- package/node_modules/@oscharko-dev/keiko-cli/dist/support.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/support.js +289 -13
- package/node_modules/@oscharko-dev/keiko-cli/package.json +13 -13
- package/node_modules/@oscharko-dev/keiko-connectors/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-contracts/dist/index.d.ts +2 -2
- package/node_modules/@oscharko-dev/keiko-contracts/dist/index.js +2 -2
- package/node_modules/@oscharko-dev/keiko-contracts/package.json +1 -1
- package/node_modules/@oscharko-dev/keiko-evaluations/package.json +9 -9
- package/node_modules/@oscharko-dev/keiko-evidence/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-evidence/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-evidence/package.json +4 -4
- package/node_modules/@oscharko-dev/keiko-git/package.json +1 -1
- package/node_modules/@oscharko-dev/keiko-harness/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-harness/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-harness/package.json +6 -6
- package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-local-knowledge/package.json +5 -5
- package/node_modules/@oscharko-dev/keiko-memory-capture/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-capture/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-capture/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/consolidate.d.ts +1 -0
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/consolidate.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/consolidate.js +26 -6
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/index.d.ts +2 -1
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/index.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/index.js +1 -0
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/log-port.d.ts +19 -0
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/log-port.d.ts.map +1 -0
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/log-port.js +112 -0
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/types.d.ts +2 -0
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/types.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-memory-governance/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-governance/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-governance/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-memory-retrieval/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-retrieval/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-retrieval/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-memory-vault/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-vault/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-vault/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/openai-adapter.d.ts +4 -0
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/openai-adapter.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/openai-adapter.js +25 -0
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-model-gateway/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-quality-intelligence/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-sandbox/package.json +2 -2
- package/node_modules/@oscharko-dev/keiko-sdk/package.json +9 -9
- package/node_modules/@oscharko-dev/keiko-security/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-security/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-security/package.json +2 -2
- package/node_modules/@oscharko-dev/keiko-server/dist/atlassian/httpPort.d.ts +1 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/atlassian/httpPort.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/atlassian/httpPort.js +24 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/chat-handlers.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/chat-handlers.js +1 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/coding-app-session/sessionChannel.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/coding-app-session/sessionChannel.js +3 -3
- package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeEventHub.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeEventHub.js +3 -3
- package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeManager.js +19 -4
- package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingSafeActivityProjection.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingSafeActivityProjection.js +23 -3
- package/node_modules/@oscharko-dev/keiko-server/dist/diagnostics-log.d.ts +2 -2
- package/node_modules/@oscharko-dev/keiko-server/dist/diagnostics-log.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/diagnostics-log.js +97 -13
- package/node_modules/@oscharko-dev/keiko-server/dist/gateway-setup.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/gateway-setup.js +8 -3
- package/node_modules/@oscharko-dev/keiko-server/dist/grounded-entailment-stage.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/grounded-entailment-stage.js +7 -5
- package/node_modules/@oscharko-dev/keiko-server/dist/index.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/index.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/index.js +5 -2
- package/node_modules/@oscharko-dev/keiko-server/dist/memory-conflict-advisory.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/memory-conflict-advisory.js +9 -3
- package/node_modules/@oscharko-dev/keiko-server/dist/memory-consolidation-handlers.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/memory-consolidation-handlers.js +56 -19
- package/node_modules/@oscharko-dev/keiko-server/dist/memory-handlers.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/memory-handlers.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/memory-handlers.js +80 -29
- package/node_modules/@oscharko-dev/keiko-server/dist/memory-maintenance-handlers.d.ts +2 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/memory-maintenance-handlers.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/memory-maintenance-handlers.js +18 -2
- package/node_modules/@oscharko-dev/keiko-server/dist/memory-salience.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/memory-salience.js +18 -7
- package/node_modules/@oscharko-dev/keiko-server/dist/observability/server-log.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/observability/server-log.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/observability/server-logger.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/observability/server-logger.js +1 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/process-log-sink.d.ts +11 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/process-log-sink.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/process-log-sink.js +17 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/qualityIntelligence/figmaSnapshotRoutes.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/qualityIntelligence/figmaSnapshotRoutes.js +10 -4
- package/node_modules/@oscharko-dev/keiko-server/dist/sink.d.ts +4 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/sink.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/sink.js +98 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/store/messages.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/store/messages.js +16 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/update-preflight-catalog.d.ts +2 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/update-preflight-catalog.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/update-preflight-catalog.js +17 -2
- package/node_modules/@oscharko-dev/keiko-server/dist/update-preflight-routes.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/update-preflight-routes.js +2 -2
- package/node_modules/@oscharko-dev/keiko-server/dist/voice-realtime.d.ts +4 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/voice-realtime.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/voice-realtime.js +68 -13
- package/node_modules/@oscharko-dev/keiko-server/package.json +21 -21
- package/node_modules/@oscharko-dev/keiko-tools/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-tools/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-tools/package.json +5 -5
- package/node_modules/@oscharko-dev/keiko-verification/package.json +5 -5
- package/node_modules/@oscharko-dev/keiko-workflows/package.json +10 -10
- package/node_modules/@oscharko-dev/keiko-workspace/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-workspace/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-workspace/package.json +3 -3
- package/package.json +26 -25
- package/release-impact.catalog.json +69 -12
- package/vendor/oscharko-dev-keiko-cli-0.3.17.tgz +0 -0
- package/vendor/{oscharko-dev-keiko-connectors-0.3.16.tgz → oscharko-dev-keiko-connectors-0.3.17.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-contracts-0.3.16.tgz → oscharko-dev-keiko-contracts-0.3.17.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-evaluations-0.3.16.tgz → oscharko-dev-keiko-evaluations-0.3.17.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-evidence-0.3.16.tgz → oscharko-dev-keiko-evidence-0.3.17.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-git-0.3.16.tgz → oscharko-dev-keiko-git-0.3.17.tgz} +0 -0
- package/vendor/oscharko-dev-keiko-harness-0.3.17.tgz +0 -0
- package/vendor/{oscharko-dev-keiko-local-knowledge-0.3.16.tgz → oscharko-dev-keiko-local-knowledge-0.3.17.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-memory-capture-0.3.16.tgz → oscharko-dev-keiko-memory-capture-0.3.17.tgz} +0 -0
- package/vendor/oscharko-dev-keiko-memory-consolidation-0.3.17.tgz +0 -0
- package/vendor/{oscharko-dev-keiko-memory-governance-0.3.16.tgz → oscharko-dev-keiko-memory-governance-0.3.17.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-memory-retrieval-0.3.16.tgz → oscharko-dev-keiko-memory-retrieval-0.3.17.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-memory-vault-0.3.16.tgz → oscharko-dev-keiko-memory-vault-0.3.17.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-model-gateway-0.3.16.tgz → oscharko-dev-keiko-model-gateway-0.3.17.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-quality-intelligence-0.3.16.tgz → oscharko-dev-keiko-quality-intelligence-0.3.17.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-sandbox-0.3.16.tgz → oscharko-dev-keiko-sandbox-0.3.17.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-sdk-0.3.16.tgz → oscharko-dev-keiko-sdk-0.3.17.tgz} +0 -0
- package/vendor/oscharko-dev-keiko-security-0.3.17.tgz +0 -0
- package/vendor/oscharko-dev-keiko-server-0.3.17.tgz +0 -0
- package/vendor/{oscharko-dev-keiko-tools-0.3.16.tgz → oscharko-dev-keiko-tools-0.3.17.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-verification-0.3.16.tgz → oscharko-dev-keiko-verification-0.3.17.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-workflows-0.3.16.tgz → oscharko-dev-keiko-workflows-0.3.17.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-workspace-0.3.16.tgz → oscharko-dev-keiko-workspace-0.3.17.tgz} +0 -0
- package/vendor/oscharko-dev-keiko-cli-0.3.16.tgz +0 -0
- package/vendor/oscharko-dev-keiko-harness-0.3.16.tgz +0 -0
- package/vendor/oscharko-dev-keiko-memory-consolidation-0.3.16.tgz +0 -0
- package/vendor/oscharko-dev-keiko-security-0.3.16.tgz +0 -0
- package/vendor/oscharko-dev-keiko-server-0.3.16.tgz +0 -0
- /package/dist/ui/static/_next/static/{nV-Flxo4itfIzasbhujy9 → C3-P-HHUm15MLLjtORoPG}/_buildManifest.js +0 -0
- /package/dist/ui/static/_next/static/{nV-Flxo4itfIzasbhujy9 → C3-P-HHUm15MLLjtORoPG}/_clientMiddlewareManifest.js +0 -0
- /package/dist/ui/static/_next/static/{nV-Flxo4itfIzasbhujy9 → C3-P-HHUm15MLLjtORoPG}/_ssgManifest.js +0 -0
|
@@ -23,6 +23,7 @@ import { MemoryCaptureProjectionReadError, projectMemoryCaptureDecisions, replay
|
|
|
23
23
|
import { refreshMemoryEmbeddingAfterBodyEdit } from "./memory-embedding.js";
|
|
24
24
|
import { readJsonRequestBody } from "./bounded-request-body.js";
|
|
25
25
|
import { processServerLogSink } from "./process-log-sink.js";
|
|
26
|
+
import { emitServerDiagnostic, serverDiagnosticFromError } from "./diagnostics-log.js";
|
|
26
27
|
// ─── Constants ────────────────────────────────────────────────────────────────
|
|
27
28
|
const MAX_MEMORY_BODY_BYTES = 64_000;
|
|
28
29
|
const DEFAULT_REVIEWER_ID = "local-operator";
|
|
@@ -63,6 +64,32 @@ function sanitizeMemoryStatusMutationReason(reason, fallback) {
|
|
|
63
64
|
function governanceErrorBody(err) {
|
|
64
65
|
return errorBody("GOVERNANCE_ERROR", `Governance constraint violated (${err.code}).`);
|
|
65
66
|
}
|
|
67
|
+
// Operator diagnostic for a memory-handler failure that is about to become an opaque 500 (or a
|
|
68
|
+
// 404/409 whose cause is still worth tracing). Mirrors `reportProjectTrustGrantFailure`
|
|
69
|
+
// (store-handlers.ts) and `reportRetentionPolicyFailure` (memory-maintenance-handlers.ts): the raw
|
|
70
|
+
// error stays server-side (`serverDiagnosticFromError` extracts only its content-free class/code),
|
|
71
|
+
// and the SAME `deps.redactor` closure the response body already goes through is reused so the
|
|
72
|
+
// diagnostic can never be less redacted than the client-facing response it accompanies.
|
|
73
|
+
// `RouteContext.correlationId` is optional so existing `RouteContext` test literals keep compiling
|
|
74
|
+
// (routes.ts); every failure-reporting call site below needs a concrete id to key its diagnostic
|
|
75
|
+
// on, so this is the ONE place the `?? randomUUID()` fallback is written — isolating it in its own
|
|
76
|
+
// function (rather than inlining `ctx.correlationId ?? randomUUID()` at each call site) keeps that
|
|
77
|
+
// nullish-coalescing branch out of every handler's own cyclomatic-complexity count.
|
|
78
|
+
function handlerCorrelationId(ctx) {
|
|
79
|
+
return ctx.correlationId ?? randomUUID();
|
|
80
|
+
}
|
|
81
|
+
function reportMemoryHandlerFailure(deps, correlationId, operation, source, error) {
|
|
82
|
+
emitServerDiagnostic(deps.diagnostics, serverDiagnosticFromError({
|
|
83
|
+
correlationId,
|
|
84
|
+
operation,
|
|
85
|
+
source,
|
|
86
|
+
error,
|
|
87
|
+
redact: (message) => {
|
|
88
|
+
const redacted = deps.redactor(message);
|
|
89
|
+
return typeof redacted === "string" ? redacted : "[REDACTED]";
|
|
90
|
+
},
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
66
93
|
function isRecord(value) {
|
|
67
94
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
68
95
|
}
|
|
@@ -466,13 +493,16 @@ export function handleListMemories(ctx, deps) {
|
|
|
466
493
|
return handleLegacyMemories(deps, vault, params);
|
|
467
494
|
}
|
|
468
495
|
catch (err) {
|
|
496
|
+
const correlationId = handlerCorrelationId(ctx);
|
|
469
497
|
if (err instanceof MemoryCaptureProjectionReadError) {
|
|
498
|
+
reportMemoryHandlerFailure(deps, correlationId, "memory.list", "memory-handlers.handleListMemories", err);
|
|
470
499
|
return {
|
|
471
500
|
status: 500,
|
|
472
501
|
body: errorBody("MEMORY_AUDIT_UNAVAILABLE", "Recent memory history is unavailable."),
|
|
473
502
|
};
|
|
474
503
|
}
|
|
475
504
|
if (err instanceof MemoryStorageError) {
|
|
505
|
+
reportMemoryHandlerFailure(deps, correlationId, "memory.list", "memory-handlers.handleListMemories", err);
|
|
476
506
|
return { status: 500, body: errorBody("MEMORY_ERROR", "Failed to list memories.") };
|
|
477
507
|
}
|
|
478
508
|
throw err;
|
|
@@ -537,7 +567,7 @@ export function handleListMemoryTombstones(ctx, deps) {
|
|
|
537
567
|
};
|
|
538
568
|
}
|
|
539
569
|
// ─── Handler: GET /api/memory/review-queue ────────────────────────────────────
|
|
540
|
-
export function handleMemoryReviewQueue(
|
|
570
|
+
export function handleMemoryReviewQueue(ctx, deps) {
|
|
541
571
|
const vault = resolveVault(deps);
|
|
542
572
|
if (isRouteResult(vault))
|
|
543
573
|
return vault;
|
|
@@ -553,6 +583,7 @@ export function handleMemoryReviewQueue(_ctx, deps) {
|
|
|
553
583
|
}
|
|
554
584
|
catch (err) {
|
|
555
585
|
if (err instanceof MemoryStorageError) {
|
|
586
|
+
reportMemoryHandlerFailure(deps, handlerCorrelationId(ctx), "memory.review-queue", "memory-handlers.handleMemoryReviewQueue", err);
|
|
556
587
|
return { status: 500, body: errorBody("MEMORY_ERROR", "Failed to load review queue.") };
|
|
557
588
|
}
|
|
558
589
|
throw err;
|
|
@@ -576,6 +607,7 @@ export function handleGetMemory(ctx, deps) {
|
|
|
576
607
|
}
|
|
577
608
|
catch (err) {
|
|
578
609
|
if (err instanceof MemoryStorageError) {
|
|
610
|
+
reportMemoryHandlerFailure(deps, handlerCorrelationId(ctx), "memory.get", "memory-handlers.handleGetMemory", err);
|
|
579
611
|
return { status: 500, body: errorBody("MEMORY_ERROR", "Failed to read memory.") };
|
|
580
612
|
}
|
|
581
613
|
throw err;
|
|
@@ -661,6 +693,7 @@ export async function handleEditMemory(ctx, deps) {
|
|
|
661
693
|
}
|
|
662
694
|
catch (err) {
|
|
663
695
|
if (err instanceof MemoryStorageError) {
|
|
696
|
+
reportMemoryHandlerFailure(deps, handlerCorrelationId(ctx), "memory.edit", "memory-handlers.handleEditMemory", err);
|
|
664
697
|
return {
|
|
665
698
|
status: err.code === "not-found" ? 404 : 500,
|
|
666
699
|
body: errorBody("MEMORY_ERROR", "Failed to update memory."),
|
|
@@ -698,6 +731,7 @@ export function handlePinMemory(ctx, deps) {
|
|
|
698
731
|
};
|
|
699
732
|
}
|
|
700
733
|
if (err instanceof MemoryStorageError) {
|
|
734
|
+
reportMemoryHandlerFailure(deps, handlerCorrelationId(ctx), "memory.pin", "memory-handlers.handlePinMemory", err);
|
|
701
735
|
return { status: 500, body: errorBody("MEMORY_ERROR", "Failed to pin memory.") };
|
|
702
736
|
}
|
|
703
737
|
throw err;
|
|
@@ -732,6 +766,7 @@ export function handleUnpinMemory(ctx, deps) {
|
|
|
732
766
|
};
|
|
733
767
|
}
|
|
734
768
|
if (err instanceof MemoryStorageError) {
|
|
769
|
+
reportMemoryHandlerFailure(deps, handlerCorrelationId(ctx), "memory.unpin", "memory-handlers.handleUnpinMemory", err);
|
|
735
770
|
return { status: 500, body: errorBody("MEMORY_ERROR", "Failed to unpin memory.") };
|
|
736
771
|
}
|
|
737
772
|
throw err;
|
|
@@ -771,6 +806,7 @@ export async function handleArchiveMemory(ctx, deps) {
|
|
|
771
806
|
};
|
|
772
807
|
}
|
|
773
808
|
if (err instanceof MemoryStorageError) {
|
|
809
|
+
reportMemoryHandlerFailure(deps, handlerCorrelationId(ctx), "memory.archive", "memory-handlers.handleArchiveMemory", err);
|
|
774
810
|
return { status: 500, body: errorBody("MEMORY_ERROR", "Failed to archive memory.") };
|
|
775
811
|
}
|
|
776
812
|
throw err;
|
|
@@ -956,11 +992,12 @@ function formatForgetBody(memoryIds) {
|
|
|
956
992
|
...(memoryIds.length === 1 ? { memoryId: memoryIds[0] } : {}),
|
|
957
993
|
};
|
|
958
994
|
}
|
|
959
|
-
function memoryMutationErrorBody(err, fallbackMessage) {
|
|
995
|
+
function memoryMutationErrorBody(deps, correlationId, operation, err, fallbackMessage) {
|
|
960
996
|
if (err instanceof GovernanceError) {
|
|
961
997
|
return { status: 400, body: governanceErrorBody(err) };
|
|
962
998
|
}
|
|
963
999
|
if (err instanceof MemoryStorageError) {
|
|
1000
|
+
reportMemoryHandlerFailure(deps, correlationId, operation, "memory-handlers", err);
|
|
964
1001
|
return {
|
|
965
1002
|
status: err.code === "not-found" ? 404 : 500,
|
|
966
1003
|
body: errorBody("MEMORY_ERROR", fallbackMessage),
|
|
@@ -968,12 +1005,13 @@ function memoryMutationErrorBody(err, fallbackMessage) {
|
|
|
968
1005
|
}
|
|
969
1006
|
throw err;
|
|
970
1007
|
}
|
|
971
|
-
function preflightPrivacyCriticalAudit(deps) {
|
|
1008
|
+
function preflightPrivacyCriticalAudit(deps, correlationId) {
|
|
972
1009
|
try {
|
|
973
1010
|
assertMemoryAuditWritable(deps.evidenceStore, Date.now());
|
|
974
1011
|
return undefined;
|
|
975
1012
|
}
|
|
976
|
-
catch {
|
|
1013
|
+
catch (error) {
|
|
1014
|
+
reportMemoryHandlerFailure(deps, correlationId, "memory.audit.preflight", "memory-handlers.preflightPrivacyCriticalAudit", error);
|
|
977
1015
|
return {
|
|
978
1016
|
status: 500,
|
|
979
1017
|
body: errorBody("MEMORY_AUDIT_UNAVAILABLE", "Memory audit evidence is unavailable; destructive memory action was not applied."),
|
|
@@ -994,7 +1032,10 @@ export async function handleForgetMemory(ctx, deps) {
|
|
|
994
1032
|
const input = parseDestructiveInput(body);
|
|
995
1033
|
if (isRouteResult(input))
|
|
996
1034
|
return input;
|
|
997
|
-
|
|
1035
|
+
// Minted once so the preflight check and a later mutation failure report under the SAME id
|
|
1036
|
+
// (ADR-0173 D5 / g12), mirroring handleRunMaintenance's correlationId reuse.
|
|
1037
|
+
const correlationId = handlerCorrelationId(ctx);
|
|
1038
|
+
const auditReady = preflightPrivacyCriticalAudit(deps, correlationId);
|
|
998
1039
|
if (auditReady !== undefined)
|
|
999
1040
|
return auditReady;
|
|
1000
1041
|
try {
|
|
@@ -1004,7 +1045,7 @@ export async function handleForgetMemory(ctx, deps) {
|
|
|
1004
1045
|
return { status: 200, body: formatForgetBody(result.memoryIds) };
|
|
1005
1046
|
}
|
|
1006
1047
|
catch (err) {
|
|
1007
|
-
return memoryMutationErrorBody(err, "Failed to forget memory.");
|
|
1048
|
+
return memoryMutationErrorBody(deps, correlationId, "memory.forget", err, "Failed to forget memory.");
|
|
1008
1049
|
}
|
|
1009
1050
|
}
|
|
1010
1051
|
export async function handleForgetMemories(ctx, deps) {
|
|
@@ -1017,7 +1058,8 @@ export async function handleForgetMemories(ctx, deps) {
|
|
|
1017
1058
|
const input = parseForgetSelectionInput(body);
|
|
1018
1059
|
if (isRouteResult(input))
|
|
1019
1060
|
return input;
|
|
1020
|
-
const
|
|
1061
|
+
const correlationId = handlerCorrelationId(ctx);
|
|
1062
|
+
const auditReady = preflightPrivacyCriticalAudit(deps, correlationId);
|
|
1021
1063
|
if (auditReady !== undefined)
|
|
1022
1064
|
return auditReady;
|
|
1023
1065
|
try {
|
|
@@ -1027,7 +1069,7 @@ export async function handleForgetMemories(ctx, deps) {
|
|
|
1027
1069
|
return { status: 200, body: formatForgetBody(result.memoryIds) };
|
|
1028
1070
|
}
|
|
1029
1071
|
catch (err) {
|
|
1030
|
-
return memoryMutationErrorBody(err, "Failed to forget memories.");
|
|
1072
|
+
return memoryMutationErrorBody(deps, correlationId, "memory.forget.batch", err, "Failed to forget memories.");
|
|
1031
1073
|
}
|
|
1032
1074
|
}
|
|
1033
1075
|
// ─── Handler: DELETE /api/memory/:id ──────────────────────────────────────────
|
|
@@ -1046,7 +1088,8 @@ export async function handleDeleteMemory(ctx, deps) {
|
|
|
1046
1088
|
const input = parseDestructiveInput(body);
|
|
1047
1089
|
if (isRouteResult(input))
|
|
1048
1090
|
return input;
|
|
1049
|
-
const
|
|
1091
|
+
const correlationId = handlerCorrelationId(ctx);
|
|
1092
|
+
const auditReady = preflightPrivacyCriticalAudit(deps, correlationId);
|
|
1050
1093
|
if (auditReady !== undefined)
|
|
1051
1094
|
return auditReady;
|
|
1052
1095
|
try {
|
|
@@ -1064,7 +1107,7 @@ export async function handleDeleteMemory(ctx, deps) {
|
|
|
1064
1107
|
};
|
|
1065
1108
|
}
|
|
1066
1109
|
catch (err) {
|
|
1067
|
-
return memoryMutationErrorBody(err, "Failed to delete memory.");
|
|
1110
|
+
return memoryMutationErrorBody(deps, correlationId, "memory.delete", err, "Failed to delete memory.");
|
|
1068
1111
|
}
|
|
1069
1112
|
}
|
|
1070
1113
|
function uniqueIds(ids) {
|
|
@@ -1222,7 +1265,7 @@ export async function handleResolveMemoryConflict(ctx, deps) {
|
|
|
1222
1265
|
return { status: 200, body: result };
|
|
1223
1266
|
}
|
|
1224
1267
|
catch (err) {
|
|
1225
|
-
return memoryMutationErrorBody(err, "Failed to resolve conflict.");
|
|
1268
|
+
return memoryMutationErrorBody(deps, handlerCorrelationId(ctx), "memory.conflicts.resolve", err, "Failed to resolve conflict.");
|
|
1226
1269
|
}
|
|
1227
1270
|
}
|
|
1228
1271
|
// ─── Handler: POST /api/memory/:id/correct ────────────────────────────────────
|
|
@@ -1306,6 +1349,28 @@ function recordCorrectionProposalAuditIfNeeded(deps, inserted, nowMs, countBefor
|
|
|
1306
1349
|
};
|
|
1307
1350
|
recordMemoryAudit({ evidenceStore: deps.evidenceStore, redactString: (value) => redactString(deps, value) }, event);
|
|
1308
1351
|
}
|
|
1352
|
+
// Split out of `handleCorrectMemory` (w4b, epic #3233) purely to keep the route handler under the
|
|
1353
|
+
// repository's 50-line function cap once its catch block gained `reportMemoryHandlerFailure` — no
|
|
1354
|
+
// behavior change, same statements in the same order.
|
|
1355
|
+
function executeCorrectMemory(vault, deps, existing, input, id) {
|
|
1356
|
+
const nowMs = Date.now();
|
|
1357
|
+
const correctionId = randomUUID();
|
|
1358
|
+
const { proposal, supersession } = buildCorrection({
|
|
1359
|
+
olderMemory: existing,
|
|
1360
|
+
correctedBody: input.correctedBody,
|
|
1361
|
+
context: { reviewerId: reviewerIdForMemoryMutation(deps), nowMs },
|
|
1362
|
+
newProposalId: randomUUID(),
|
|
1363
|
+
newMemoryId: correctionId,
|
|
1364
|
+
});
|
|
1365
|
+
const auditCountBeforeInsert = auditEventCountForDay(deps, nowMs);
|
|
1366
|
+
const inserted = vault.insertMemory(buildCorrectionRecord(proposal, correctionId, nowMs));
|
|
1367
|
+
recordCorrectionProposalAuditIfNeeded(deps, inserted, nowMs, auditCountBeforeInsert);
|
|
1368
|
+
vault.insertEdge(buildEdgeFromSupersession(supersession));
|
|
1369
|
+
return {
|
|
1370
|
+
status: 201,
|
|
1371
|
+
body: { correction: redactMemory(deps, inserted), originalMemoryId: id },
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1309
1374
|
export async function handleCorrectMemory(ctx, deps) {
|
|
1310
1375
|
const vault = resolveVault(deps);
|
|
1311
1376
|
if (isRouteResult(vault))
|
|
@@ -1325,29 +1390,14 @@ export async function handleCorrectMemory(ctx, deps) {
|
|
|
1325
1390
|
if (existing === undefined) {
|
|
1326
1391
|
return { status: 404, body: errorBody("NOT_FOUND", "Memory not found.") };
|
|
1327
1392
|
}
|
|
1328
|
-
|
|
1329
|
-
const correctionId = randomUUID();
|
|
1330
|
-
const { proposal, supersession } = buildCorrection({
|
|
1331
|
-
olderMemory: existing,
|
|
1332
|
-
correctedBody: input.correctedBody,
|
|
1333
|
-
context: { reviewerId: reviewerIdForMemoryMutation(deps), nowMs },
|
|
1334
|
-
newProposalId: randomUUID(),
|
|
1335
|
-
newMemoryId: correctionId,
|
|
1336
|
-
});
|
|
1337
|
-
const auditCountBeforeInsert = auditEventCountForDay(deps, nowMs);
|
|
1338
|
-
const inserted = vault.insertMemory(buildCorrectionRecord(proposal, correctionId, nowMs));
|
|
1339
|
-
recordCorrectionProposalAuditIfNeeded(deps, inserted, nowMs, auditCountBeforeInsert);
|
|
1340
|
-
vault.insertEdge(buildEdgeFromSupersession(supersession));
|
|
1341
|
-
return {
|
|
1342
|
-
status: 201,
|
|
1343
|
-
body: { correction: redactMemory(deps, inserted), originalMemoryId: id },
|
|
1344
|
-
};
|
|
1393
|
+
return executeCorrectMemory(vault, deps, existing, input, id);
|
|
1345
1394
|
}
|
|
1346
1395
|
catch (err) {
|
|
1347
1396
|
if (err instanceof GovernanceError) {
|
|
1348
1397
|
return { status: 400, body: governanceErrorBody(err) };
|
|
1349
1398
|
}
|
|
1350
1399
|
if (err instanceof MemoryStorageError) {
|
|
1400
|
+
reportMemoryHandlerFailure(deps, handlerCorrelationId(ctx), "memory.correct", "memory-handlers.handleCorrectMemory", err);
|
|
1351
1401
|
return { status: 500, body: errorBody("MEMORY_ERROR", "Failed to create correction.") };
|
|
1352
1402
|
}
|
|
1353
1403
|
throw err;
|
|
@@ -1495,7 +1545,7 @@ export async function handleAcceptMemoryProposal(ctx, deps) {
|
|
|
1495
1545
|
return acceptMemoryProposal(vault, deps, id, bodyOverride);
|
|
1496
1546
|
}
|
|
1497
1547
|
catch (err) {
|
|
1498
|
-
return memoryMutationErrorBody(err, "Failed to accept proposal.");
|
|
1548
|
+
return memoryMutationErrorBody(deps, handlerCorrelationId(ctx), "memory.proposals.accept", err, "Failed to accept proposal.");
|
|
1499
1549
|
}
|
|
1500
1550
|
}
|
|
1501
1551
|
// ─── Handler: POST /api/memory/proposals/:id/reject ───────────────────────────
|
|
@@ -1550,6 +1600,7 @@ export async function handleRejectMemoryProposal(ctx, deps) {
|
|
|
1550
1600
|
}
|
|
1551
1601
|
catch (err) {
|
|
1552
1602
|
if (err instanceof MemoryStorageError) {
|
|
1603
|
+
reportMemoryHandlerFailure(deps, handlerCorrelationId(ctx), "memory.proposals.reject", "memory-handlers.handleRejectMemoryProposal", err);
|
|
1553
1604
|
return {
|
|
1554
1605
|
status: err.code === "not-found" ? 404 : 500,
|
|
1555
1606
|
body: errorBody("MEMORY_ERROR", "Failed to reject proposal."),
|
|
@@ -27,6 +27,7 @@ export interface RunMaintenanceOptions {
|
|
|
27
27
|
readonly autonomyMode?: CodingWorkbenchMode;
|
|
28
28
|
readonly decayHalfLifeMultiplierByType?: Partial<Record<MemoryType, number>>;
|
|
29
29
|
readonly retentionPolicy?: MemoryRetentionPolicy;
|
|
30
|
+
readonly correlationId?: string;
|
|
30
31
|
}
|
|
31
32
|
/** Resolves the operator-owned retention policy; no arbitrary deletion defaults are invented. */
|
|
32
33
|
export declare function memoryRetentionPolicy(env: EnvSource): MemoryRetentionPolicy | undefined;
|
|
@@ -45,6 +46,7 @@ export interface MaybeRunAutoMaintenanceOptions {
|
|
|
45
46
|
readonly decayHalfLifeMultiplierByType?: Partial<Record<MemoryType, number>>;
|
|
46
47
|
readonly retentionPolicy?: MemoryRetentionPolicy;
|
|
47
48
|
readonly onFailure?: ((error: unknown) => void) | undefined;
|
|
49
|
+
readonly correlationId?: string;
|
|
48
50
|
}
|
|
49
51
|
export declare function maybeRunAutoMaintenance(vault: MemoryVaultStore, auditSink: MemoryAuditSink | undefined, state: AutoMaintenanceState, options: MaybeRunAutoMaintenanceOptions): MaintenanceResult | null;
|
|
50
52
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-maintenance-handlers.d.ts","sourceRoot":"","sources":["../src/memory-maintenance-handlers.ts"],"names":[],"mappings":"AAmBA,OAAO,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AAK,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAI5D,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAiBD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,gBAAgB,EACvB,SAAS,EAAE,eAAe,GAAG,SAAS,EACtC,KAAK,EAAE,oBAAoB,EAC3B,OAAO,EAAE,8BAA8B,GACtC,iBAAiB,GAAG,IAAI,CAoB1B;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,aAAa,GAAG,eAAe,CAM/E;AAWD,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,aAAa,EACnB,aAAa,GAAE,MAAqB,GACnC,mBAAmB,CAgBrB;AAoBD,MAAM,MAAM,+BAA+B,GACvC;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,GAAG,SAAS,CAAA;CAAE,GACzE;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAA;CAAE,CAAC;AAE3B,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,aAAa,EACnB,aAAa,CAAC,EAAE,MAAM,GACrB,+BAA+B,CAOjC;AAqBD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,GAAG,WAAW,CA4BxF"}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
// rather than crashing the loopback server.
|
|
18
18
|
import { randomUUID } from "node:crypto";
|
|
19
19
|
import { runConsolidation } from "@oscharko-dev/keiko-memory-consolidation";
|
|
20
|
+
import { consolidationLogSinkFor } from "./process-log-sink.js";
|
|
20
21
|
import { planMemoryMaintenance, } from "@oscharko-dev/keiko-memory-governance";
|
|
21
22
|
import { MEMORY_TYPE_DECAY_HALF_LIFE_MULTIPLIERS } from "@oscharko-dev/keiko-contracts";
|
|
22
23
|
import { MemoryStorageError } from "@oscharko-dev/keiko-memory-vault";
|
|
@@ -105,11 +106,17 @@ function applyEdges(vault, edges) {
|
|
|
105
106
|
}
|
|
106
107
|
return created;
|
|
107
108
|
}
|
|
108
|
-
function runConsolidationPass(vault, nowMs, records, counts) {
|
|
109
|
+
function runConsolidationPass(vault, nowMs, records, counts, correlationId) {
|
|
109
110
|
const result = runConsolidation(records, {
|
|
110
111
|
nowMs,
|
|
111
112
|
newEdgeId: () => randomUUID(),
|
|
112
113
|
newReviewItemId: () => randomUUID(),
|
|
114
|
+
// Wires the same process-wide activity log the route/CLI consolidation-job path uses, stamped
|
|
115
|
+
// with this pass's own correlation id, so a `consolidation.summary.fallback` line produced by
|
|
116
|
+
// the maintenance sweep is durable rather than silently unreachable (#2902 w6). This pass has
|
|
117
|
+
// no per-run job id of its own (unlike the scheduled consolidation-job registry), so the
|
|
118
|
+
// caller's request/background-pass correlationId is reused instead of a second identifier.
|
|
119
|
+
logSink: consolidationLogSinkFor(correlationId),
|
|
113
120
|
});
|
|
114
121
|
counts.edgesCreated += applyEdges(vault, result.edgesProposed);
|
|
115
122
|
counts.clustersInspected += result.clustersInspected;
|
|
@@ -257,11 +264,18 @@ function runPromotionPhase(vault, auditSink, nowMs, planPolicy, counts, scopes)
|
|
|
257
264
|
});
|
|
258
265
|
applyPromotions(vault, auditSink, nowMs, promotePlan.promote, recordsById(beforePromote), counts);
|
|
259
266
|
}
|
|
267
|
+
// Split out of `runMemoryMaintenance` solely to keep that function's cyclomatic complexity at the
|
|
268
|
+
// AGENTS.md ceiling: the `??` fallback here is one branch this pass's own control flow does not
|
|
269
|
+
// need to carry.
|
|
270
|
+
function resolveRunCorrelationId(options) {
|
|
271
|
+
return options?.correlationId ?? randomUUID();
|
|
272
|
+
}
|
|
260
273
|
export function runMemoryMaintenance(vault, auditSink, options) {
|
|
261
274
|
// ONE clock for the whole pass: both plan phases and every vault write / audit timestamp use the
|
|
262
275
|
// same nowMs, so selection is consistent within a run and fully replay-stable when nowMs is
|
|
263
276
|
// injected (the deterministic-verification invariant the rest of the stack honours).
|
|
264
277
|
const nowMs = options?.nowMs ?? Date.now();
|
|
278
|
+
const correlationId = resolveRunCorrelationId(options);
|
|
265
279
|
const planPolicy = options?.decayHalfLifeMultiplierByType !== undefined
|
|
266
280
|
? { decayHalfLifeMultiplierByType: options.decayHalfLifeMultiplierByType }
|
|
267
281
|
: {};
|
|
@@ -283,7 +297,7 @@ export function runMemoryMaintenance(vault, auditSink, options) {
|
|
|
283
297
|
.filter((record) => record.status === "accepted" ||
|
|
284
298
|
record.status === "proposed" ||
|
|
285
299
|
record.status === "conflicted");
|
|
286
|
-
runConsolidationPass(vault, nowMs, reviewable, counts);
|
|
300
|
+
runConsolidationPass(vault, nowMs, reviewable, counts, correlationId);
|
|
287
301
|
// Phase 3 — archive / forget on the post-consolidation snapshot. The access stats feed the
|
|
288
302
|
// strength model; confidence itself is never mutated (O-V2).
|
|
289
303
|
const all = vault.listMemoriesAcrossScopes(scopes, { includeExpired: true });
|
|
@@ -342,6 +356,7 @@ export function maybeRunAutoMaintenance(vault, auditSink, state, options) {
|
|
|
342
356
|
try {
|
|
343
357
|
return runMemoryMaintenance(vault, auditSink, {
|
|
344
358
|
nowMs: options.nowMs,
|
|
359
|
+
...(options.correlationId !== undefined ? { correlationId: options.correlationId } : {}),
|
|
345
360
|
...(options.autonomyMode !== undefined ? { autonomyMode: options.autonomyMode } : {}),
|
|
346
361
|
...(options.decayHalfLifeMultiplierByType !== undefined
|
|
347
362
|
? { decayHalfLifeMultiplierByType: options.decayHalfLifeMultiplierByType }
|
|
@@ -438,6 +453,7 @@ export function handleRunMaintenance(ctx, deps) {
|
|
|
438
453
|
if (isRouteResult(retentionPolicy))
|
|
439
454
|
return retentionPolicy;
|
|
440
455
|
const counts = runMemoryMaintenance(vault, memoryMaintenanceAuditSink(deps), {
|
|
456
|
+
correlationId,
|
|
441
457
|
autonomyMode: resolveMaintenanceAutonomyMode(deps, correlationId),
|
|
442
458
|
...(multipliers !== undefined ? { decayHalfLifeMultiplierByType: multipliers } : {}),
|
|
443
459
|
...(retentionPolicy !== undefined ? { retentionPolicy } : {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-salience.d.ts","sourceRoot":"","sources":["../src/memory-salience.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,4BAA4B,EAC5B,oCAAoC,EACrC,MAAM,wCAAwC,CAAC;AAoBhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"memory-salience.d.ts","sourceRoot":"","sources":["../src/memory-salience.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,4BAA4B,EAC5B,oCAAoC,EACrC,MAAM,wCAAwC,CAAC;AAoBhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,kCAAkC,CAAC;AAqa1C,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EACb;QAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAA;KAAE,GAAG,SAAS,CAAC;CAC9F;AAKD,KAAK,sBAAsB,GAAG,oCAAoC,CAAC;AA0CnE,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,gCAAgC,GAAG,SAAS,EACrD,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,sBAAsB,EAC/B,aAAa,EAAE,MAAM,GACpB,IAAI,CA0BN;AAmMD,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,gCAAgC,EACzC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,sBAAkC,EAC3C,aAAa,GAAE,MAAqB,GACnC,OAAO,CAAC,SAAS,4BAA4B,EAAE,CAAC,CAqBlD"}
|
|
@@ -16,7 +16,7 @@ import { conversationMemoryScopes, } from "./memory-conversation-context.js";
|
|
|
16
16
|
import { buildMemoryRecordFromProposal } from "./memory-record-builders.js";
|
|
17
17
|
import { insertSalienceMemoryWithNoveltyGate } from "./memory-embedding.js";
|
|
18
18
|
import { recordMemoryAudit } from "./memory-audit-handler.js";
|
|
19
|
-
import { emitServerDiagnostic, serverDiagnosticFromError } from "./diagnostics-log.js";
|
|
19
|
+
import { emitServerDiagnostic, serverDiagnosticFromError, } from "./diagnostics-log.js";
|
|
20
20
|
import { buildMemoryCaptureDecisionAuditEvent, } from "./memory-capture-projection.js";
|
|
21
21
|
import { isPersistableMemoryCandidate, memoryCaptureAutoAcceptEligible, memoryCapturePolicyForDeps, promoteEligibleMemoryRecord, resolveMemoryCaptureAutonomyMode, SENSITIVE_MEMORY_ACTION_BODY, SENSITIVE_MEMORY_REJECTION_REASON, } from "./memory-capture-policy.js";
|
|
22
22
|
import { exactCaptureSuppressionReason } from "./memory-suppression.js";
|
|
@@ -162,7 +162,12 @@ function salienceSeedFor(deps, modelId) {
|
|
|
162
162
|
// own fallback default) — never minted fresh here — so an informational salience diagnostic joins
|
|
163
163
|
// the SAME trail as that turn's eventual failure diagnostic (`emitSalienceFailureDiagnostic`)
|
|
164
164
|
// instead of reporting under a disconnected, unrelated id.
|
|
165
|
-
|
|
165
|
+
// Issue #3245: `message` is now the fixed closed-vocabulary condition label. Every call site
|
|
166
|
+
// below used to compose a per-invocation detail string (model id, mode, surface, bounded counts —
|
|
167
|
+
// never user/model text, per each site's own "safe diagnostic" comment) directly into `message`;
|
|
168
|
+
// that detail moves to the optional `code` param as a compact machine-readable string instead, so
|
|
169
|
+
// none of it is lost — only relocated to the field this record already has for exactly this shape.
|
|
170
|
+
function emitSalienceDiagnostic(deps, correlationId, source, errorClass, message, code) {
|
|
166
171
|
emitServerDiagnostic(deps.diagnostics, {
|
|
167
172
|
correlationId,
|
|
168
173
|
timestamp: new Date().toISOString(),
|
|
@@ -170,15 +175,21 @@ function emitSalienceDiagnostic(deps, correlationId, source, errorClass, message
|
|
|
170
175
|
source,
|
|
171
176
|
errorClass,
|
|
172
177
|
message,
|
|
178
|
+
...(code === undefined ? {} : { code }),
|
|
173
179
|
});
|
|
174
180
|
}
|
|
175
181
|
function logSalienceDiagnostic(diagnostic, deps, modelId, correlationId) {
|
|
176
182
|
const responseFormatEnabled = salienceResponseFormatFor(deps, modelId) !== undefined;
|
|
177
183
|
const detail = diagnostic.kind === "dropped-model-items"
|
|
178
|
-
? `reason=${diagnostic.reason}
|
|
184
|
+
? `reason=${diagnostic.reason}:count=${String(diagnostic.count)}`
|
|
179
185
|
: `rawItemCount=${String(diagnostic.rawItemCount)}`;
|
|
180
|
-
//
|
|
181
|
-
|
|
186
|
+
// `code` is a colon-joined machine token (no spaces — the same closed shape
|
|
187
|
+
// `memory-conflict-advisory.ts`'s `emitAdvisoryPhaseSummary` uses), bounded again by the writer
|
|
188
|
+
// (`diagnostics-log.ts` drops a `code` outside DIAGNOSTIC_CODE_SHAPE). It carries the
|
|
189
|
+
// response-format bit, the diagnostic kind and counts only — never the model id (this file's
|
|
190
|
+
// convention: a model id is recorded once by `gateway.config.resolved`, and the correlation id
|
|
191
|
+
// joins this record to it), never user text, never model text.
|
|
192
|
+
emitSalienceDiagnostic(deps, correlationId, "memory-salience.logSalienceDiagnostic", "SalienceExtractionDiagnostic", "salience-extraction-diagnostic", `responseFormat=${String(responseFormatEnabled)}:kind=${diagnostic.kind}:${detail}`);
|
|
182
193
|
}
|
|
183
194
|
function emitSalienceFailureDiagnostic(deps, correlationId, operation, source, error) {
|
|
184
195
|
emitServerDiagnostic(deps.diagnostics, serverDiagnosticFromError({
|
|
@@ -295,7 +306,7 @@ function logSalienceCaptureFailure(surface, error, deps, correlationId) {
|
|
|
295
306
|
emitSalienceFailureDiagnostic(deps, correlationId, `memory.salience.capture.${surface}`, "memory-salience.scheduleMemorySalienceCapture", error);
|
|
296
307
|
}
|
|
297
308
|
function logSalienceCaptureDropped(surface, deps, correlationId) {
|
|
298
|
-
emitSalienceDiagnostic(deps, correlationId, "memory-salience.scheduleMemorySalienceCapture", "SalienceCaptureDropped",
|
|
309
|
+
emitSalienceDiagnostic(deps, correlationId, "memory-salience.scheduleMemorySalienceCapture", "SalienceCaptureDropped", "salience-capture-dropped-queue-full", `surface=${surface} pending=${String(pendingSalienceCaptures)}/${String(MAX_PENDING_SALIENCE_CAPTURES)}`);
|
|
299
310
|
}
|
|
300
311
|
export function scheduleMemorySalienceCapture(deps, request, context, modelId, assistantText, surface, correlationId) {
|
|
301
312
|
if (context === undefined || request.memory?.enabled !== true || deps.memoryVault === undefined) {
|
|
@@ -371,7 +382,7 @@ function tallyDisposition(summary, disposition) {
|
|
|
371
382
|
// Content-free capture summary: the effective mode and per-disposition counts only, never bodies or
|
|
372
383
|
// user text. Mirrors the logSalienceDiagnostic diagnostic-sink convention.
|
|
373
384
|
function logSalienceCaptureSummary(mode, summary, deps, correlationId) {
|
|
374
|
-
emitSalienceDiagnostic(deps, correlationId, "memory-salience.captureSalientFromTurn", "SalienceCaptureSummary", `mode=${mode} proposed=${String(summary.proposed)} accepted=${String(summary.accepted)} ` +
|
|
385
|
+
emitSalienceDiagnostic(deps, correlationId, "memory-salience.captureSalientFromTurn", "SalienceCaptureSummary", "salience-capture-summary", `mode=${mode} proposed=${String(summary.proposed)} accepted=${String(summary.accepted)} ` +
|
|
375
386
|
`rejected=${String(summary.rejected)} merged=${String(summary.merged)}`);
|
|
376
387
|
}
|
|
377
388
|
async function persistSalienceActions(deps, vault, outcomes, mode, surface) {
|
|
@@ -3,7 +3,7 @@ export type { ServerLogEnv, ServerLogLevel, ServerLogThreshold } from "./log-lev
|
|
|
3
3
|
export { DEFAULT_SERVER_LOG_LEVEL, SERVER_LOG_LEVELS, SERVER_LOG_LEVEL_ENV, isServerLogLevel, isServerLogThreshold, parseServerLogThreshold, resolveServerLogThreshold, serverLogLevelEnabled, serverLogLevelRank, } from "./log-level.js";
|
|
4
4
|
export { MAX_LOG_ARRAY_LENGTH, MAX_LOG_FIELD_COUNT, MAX_LOG_FIELD_DEPTH, MAX_LOG_STRING_LENGTH, REDACTED_KEY, REDACTED_LENGTH, REDACTED_PATH, REDACTED_PERSONAL, REDACTED_SECRET, REDACTED_SHAPE, DROPPED_DEPTH, DROPPED_LENGTH, closeReasonVocabulary, isDeniedLogFieldName, normalizeLogFieldName, redactLogFields, redactLogLabel, redactLogString, } from "./log-redaction.js";
|
|
5
5
|
export { redactRoutePath } from "./route-template.js";
|
|
6
|
-
export type ServerLogCategory = "http" | "gateway" | "embedding" | "indexing" | "setup" | "search" | "memory" | "security" | "diagnostic" | "process";
|
|
6
|
+
export type ServerLogCategory = "http" | "gateway" | "embedding" | "indexing" | "setup" | "search" | "memory" | "security" | "diagnostic" | "process" | "consolidation";
|
|
7
7
|
export interface ServerLogEvent {
|
|
8
8
|
readonly level?: ServerLogLevel | undefined;
|
|
9
9
|
readonly category: ServerLogCategory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-log.d.ts","sourceRoot":"","sources":["../../src/observability/server-log.ts"],"names":[],"mappings":"AAoDA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGvF,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACvF,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"server-log.d.ts","sourceRoot":"","sources":["../../src/observability/server-log.ts"],"names":[],"mappings":"AAoDA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGvF,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACvF,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAatD,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,SAAS,GACT,WAAW,GACX,UAAU,GACV,OAAO,GACP,QAAQ,GACR,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IAAI,MAAM,MAAM,CAG5C;AAqBD,wBAAgB,eAAe,IAAI,YAAY,CAG9C;AAGD,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAE1D;AAOD,wBAAgB,qBAAqB,IAAI,IAAI,CAM5C;AAID,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ConsolidationLogSink } from "@oscharko-dev/keiko-memory-consolidation";
|
|
1
2
|
import { type ServerLogLevel, type ServerLogSink } from "./observability/index.js";
|
|
2
3
|
export interface ProcessServerLogSink extends ServerLogSink {
|
|
3
4
|
readonly enabled: (level: ServerLogLevel) => boolean;
|
|
@@ -8,4 +9,14 @@ export interface ProcessServerLogSink extends ServerLogSink {
|
|
|
8
9
|
* server.
|
|
9
10
|
*/
|
|
10
11
|
export declare function processServerLogSink(): ProcessServerLogSink;
|
|
12
|
+
/**
|
|
13
|
+
* The `keiko-memory-consolidation` package's log port, stamped with the caller's own
|
|
14
|
+
* correlationId. `ConsolidationLogEvent` carries no jobId/run-id field of its own (see that
|
|
15
|
+
* package's `log-port.ts`) and `ConsolidationOptions` deliberately stays a pure, caller-agnostic
|
|
16
|
+
* options bag — so the composition root injects the correlation id here rather than widening the
|
|
17
|
+
* package's public shape. A `logSummaryFallback` line that already carries its own
|
|
18
|
+
* `correlationId` (none does today, but the port allows one) is left untouched; only an absent one
|
|
19
|
+
* is stamped, so a future producer-set id is never silently overwritten.
|
|
20
|
+
*/
|
|
21
|
+
export declare function consolidationLogSinkFor(correlationId: string): ConsolidationLogSink;
|
|
11
22
|
//# sourceMappingURL=process-log-sink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-log-sink.d.ts","sourceRoot":"","sources":["../src/process-log-sink.ts"],"names":[],"mappings":"AA8BA,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAC;AAKlC,MAAM,WAAW,oBAAqB,SAAQ,aAAa;IACzD,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,OAAO,CAAC;CACtD;AAaD;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,oBAAoB,CAE3D"}
|
|
1
|
+
{"version":3,"file":"process-log-sink.d.ts","sourceRoot":"","sources":["../src/process-log-sink.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAEV,oBAAoB,EACrB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAC;AAKlC,MAAM,WAAW,oBAAqB,SAAQ,aAAa;IACzD,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,OAAO,CAAC;CACtD;AAaD;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,oBAAoB,CAE3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG,oBAAoB,CAOnF"}
|
|
@@ -46,3 +46,20 @@ const PROCESS_SERVER_LOG_SINK = {
|
|
|
46
46
|
export function processServerLogSink() {
|
|
47
47
|
return PROCESS_SERVER_LOG_SINK;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* The `keiko-memory-consolidation` package's log port, stamped with the caller's own
|
|
51
|
+
* correlationId. `ConsolidationLogEvent` carries no jobId/run-id field of its own (see that
|
|
52
|
+
* package's `log-port.ts`) and `ConsolidationOptions` deliberately stays a pure, caller-agnostic
|
|
53
|
+
* options bag — so the composition root injects the correlation id here rather than widening the
|
|
54
|
+
* package's public shape. A `logSummaryFallback` line that already carries its own
|
|
55
|
+
* `correlationId` (none does today, but the port allows one) is left untouched; only an absent one
|
|
56
|
+
* is stamped, so a future producer-set id is never silently overwritten.
|
|
57
|
+
*/
|
|
58
|
+
export function consolidationLogSinkFor(correlationId) {
|
|
59
|
+
const sink = processServerLogSink();
|
|
60
|
+
return {
|
|
61
|
+
write(event) {
|
|
62
|
+
sink.write({ ...event, correlationId: event.correlationId ?? correlationId });
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"figmaSnapshotRoutes.d.ts","sourceRoot":"","sources":["../../src/qualityIntelligence/figmaSnapshotRoutes.ts"],"names":[],"mappings":"AAkDA,OAAO,EAAa,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AACnG,OAAO,
|
|
1
|
+
{"version":3,"file":"figmaSnapshotRoutes.d.ts","sourceRoot":"","sources":["../../src/qualityIntelligence/figmaSnapshotRoutes.ts"],"names":[],"mappings":"AAkDA,OAAO,EAAa,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AACnG,OAAO,EAAoD,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAClG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EASL,KAAK,qBAAqB,EAE1B,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC5B,MAAM,kBAAkB,CAAC;AA+I1B,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,gFAAgF;IAChF,QAAQ,CAAC,UAAU,EAAE,8BAA8B,CAAC;IACpD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,8CAA8C;IAC9C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,0DAA0D;IAC1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EAAE,aAAa,GAAG,WAAW,CA4B3F;AA+DD,wBAAgB,4BAA4B,CAC1C,CAAC,EAAE;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAC1D,CAAC,EAAE;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACzD,MAAM,CAIR;AAiBD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,GAAG,WAAW,CA6B5F;AAID,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,GAAG,WAAW,CA2B3F;AA2DD,wBAAsB,iCAAiC,CACrD,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,WAAW,CAAC,CAuCtB;AAID,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,GAAG,WAAW,CAoC7F;AAID,wBAAgB,oCAAoC,CAClD,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,aAAa,GAClB,WAAW,CA4Bb;AAiCD,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,aAAa,GAClB,cAAc,CAgChB"}
|
package/node_modules/@oscharko-dev/keiko-server/dist/qualityIntelligence/figmaSnapshotRoutes.js
CHANGED
|
@@ -47,8 +47,7 @@ import { randomUUID } from "node:crypto";
|
|
|
47
47
|
import { lstatSync, readdirSync, readFileSync } from "node:fs";
|
|
48
48
|
import { join } from "node:path";
|
|
49
49
|
import { STREAMING } from "../routes.js";
|
|
50
|
-
import { currentGatewayConfig, currentGatewayEgressConfig
|
|
51
|
-
import { redact } from "@oscharko-dev/keiko-security";
|
|
50
|
+
import { currentGatewayConfig, currentGatewayEgressConfig } from "../deps.js";
|
|
52
51
|
import { emitServerDiagnostic } from "../diagnostics-log.js";
|
|
53
52
|
import { appendFigmaConnectorAudit, parseFigmaTarget, deriveFigmaScopeRef, observeFigmaRevoke, EXPECTED_FIGMA_SCOPES, FigmaConnectorError, resolveScopedPaginationLimits, } from "./figma/index.js";
|
|
54
53
|
import { governedSnapshotBuild, figmaTokenStoreFor, } from "./figmaSnapshotOrchestration.js";
|
|
@@ -526,14 +525,21 @@ function figmaRequestTimeoutMsFromEnv(env) {
|
|
|
526
525
|
// FIGMA_INTERNAL — expected coded errors (consent/auth/rate-limit) stay quiet (already audited).
|
|
527
526
|
function logFigmaInternal(stage, err, deps) {
|
|
528
527
|
const name = err instanceof Error ? err.constructor.name : typeof err;
|
|
529
|
-
|
|
528
|
+
// Issue #3245: `redact()` only strips known SECRET shapes (bearer tokens, API keys) out of a
|
|
529
|
+
// string — it passes every other character through unchanged, so `err.message` survived it as
|
|
530
|
+
// free-form provider/filesystem text, exactly the "foreign error/provider/customer text" this
|
|
531
|
+
// record's own contract forbids on `message`. `message` narrowing from `string` to the closed
|
|
532
|
+
// `ServerDiagnosticSummary` union caught this at compile time: the fix drops the raw message
|
|
533
|
+
// entirely rather than relocating it — unlike a bounded count or a machine-readable code, an
|
|
534
|
+
// arbitrary error message has no safe home on a body-free evidence record. `errorClass` (the
|
|
535
|
+
// constructor name, already content-free) is retained as the diagnosable signal.
|
|
530
536
|
emitServerDiagnostic(deps.diagnostics, {
|
|
531
537
|
correlationId: randomUUID(),
|
|
532
538
|
timestamp: new Date().toISOString(),
|
|
533
539
|
operation: "figma.snapshotBuild",
|
|
534
540
|
source: `figmaSnapshotRoutes.logFigmaInternal.${stage}`,
|
|
535
541
|
errorClass: name,
|
|
536
|
-
message:
|
|
542
|
+
message: "figma-internal-error",
|
|
537
543
|
});
|
|
538
544
|
}
|
|
539
545
|
// Map a thrown error from the governed build to a coded route result: a coded connector error maps to
|