@jungjaehoon/mama-core 2.4.1 → 4.0.0
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/README.md +76 -239
- package/db/migrations/030-case-first-memory-substrate.sql +13 -98
- package/db/migrations/034-add-connector-event-scope-columns.sql +9 -13
- package/db/migrations/039-add-connector-event-operator-ingest-seq.sql +9 -95
- package/db/migrations/062-refresh-connector-event-sequences.sql +9 -113
- package/db/migrations/063-refresh-legacy-connector-event-updates.sql +9 -32
- package/db/migrations/067-add-connector-event-source-entity-id.sql +9 -13
- package/db/migrations/069-create-registry-nodes.sql +52 -0
- package/db/migrations/070-record-identity.sql +35 -0
- package/db/migrations/071-service-operation-origins.sql +187 -0
- package/db/migrations/072-observation-versions.sql +29 -0
- package/db/migrations/073-registry-corrections.sql +45 -0
- package/db/migrations/074-work-graph-ref-kinds.sql +39 -0
- package/db/migrations/075-agent-judgments.sql +58 -0
- package/db/migrations/076-scoped-checkpoint-bindings.sql +15 -0
- package/db/migrations/077-legacy-record-kind.sql +6 -0
- package/db/migrations/078-source-ingest-commands.sql +18 -0
- package/db/migrations/079-twin-edge-relations.sql +43 -0
- package/db/migrations/080-restore-duration-days.sql +7 -0
- package/db/migrations/081-mailbox.sql +61 -0
- package/db/migrations/082-commitments-row-id.sql +12 -0
- package/db/migrations/083-observation-is-the-evidence.sql +49 -0
- package/db/migrations/084-scope-kind-is-not-the-cores-to-list.sql +34 -0
- package/db/migrations/085-a-migration-has-a-source.sql +37 -0
- package/db/migrations/086-the-mailbox-is-generic.sql +110 -0
- package/db/migrations/087-mailbox-payload.sql +5 -0
- package/db/migrations/088-native-input-journal.sql +14 -0
- package/db/migrations/089-native-turn-receipt-lookup.sql +3 -0
- package/db/migrations/090-model-run-native-inputs.sql +29 -0
- package/db/migrations/091-native-turn-results.sql +11 -0
- package/db/migrations/092-restore-decision-fts.sql +34 -0
- package/db/migrations/093-native-turn-primary-kind.sql +14 -0
- package/db/migrations/094-commitment-run-provenance.sql +9 -0
- package/db/migrations/095-model-run-native-input-identity.sql +39 -0
- package/db/migrations/096-drop-connector-event-index-fts.sql +9 -0
- package/db/migrations/097-native-input-json-validity.sql +37 -0
- package/db/migrations/098-workflow-memory-kind.sql +105 -0
- package/dist/action-contracts.d.ts +212 -0
- package/dist/action-contracts.js +10 -0
- package/dist/api/catalog.d.ts +118 -0
- package/dist/api/catalog.js +1756 -0
- package/dist/api/dispatch.d.ts +76 -0
- package/dist/api/dispatch.js +372 -0
- package/dist/canonicalize.d.ts +2 -2
- package/dist/canonicalize.js +3 -3
- package/dist/client/client.d.ts +33 -0
- package/dist/client/client.js +123 -0
- package/dist/client/ipc.d.ts +81 -0
- package/dist/client/ipc.js +314 -0
- package/dist/db-adapter/base-adapter.d.ts +6 -66
- package/dist/db-adapter/base-adapter.js +6 -6
- package/dist/db-adapter/index.d.ts +5 -5
- package/dist/db-adapter/index.js +2 -5
- package/dist/db-adapter/node-sqlite-adapter.d.ts +85 -15
- package/dist/db-adapter/node-sqlite-adapter.js +1968 -570
- package/dist/db-manager.d.ts +53 -97
- package/dist/db-manager.js +121 -603
- package/dist/embedding/embedder.d.ts +132 -0
- package/dist/embedding/embedder.js +299 -0
- package/dist/identity/principal-repository.d.ts +2 -2
- package/dist/index.d.ts +43 -58
- package/dist/index.js +97 -145
- package/dist/{context-compile/channel-grant.d.ts → knowledge/access.d.ts} +12 -17
- package/dist/knowledge/access.js +663 -0
- package/dist/knowledge/case-errors.d.ts +31 -0
- package/dist/knowledge/case-errors.js +40 -0
- package/dist/{cases/search-rollup.d.ts → knowledge/case-search-rollup.d.ts} +5 -4
- package/dist/{cases/search-rollup.js → knowledge/case-search-rollup.js} +6 -8
- package/dist/{cases/store.d.ts → knowledge/case-store.d.ts} +3 -6
- package/dist/{cases/store.js → knowledge/case-store.js} +7 -42
- package/dist/{cases/timeline-range.d.ts → knowledge/case-timeline-range.d.ts} +3 -3
- package/dist/{cases/timeline-range.js → knowledge/case-timeline-range.js} +47 -25
- package/dist/{cases/types.d.ts → knowledge/case-types.d.ts} +8 -2
- package/dist/{cases/types.js → knowledge/case-types.js} +1 -1
- package/dist/knowledge/commitments.d.ts +188 -0
- package/dist/knowledge/commitments.js +370 -0
- package/dist/knowledge/decision-edges.d.ts +70 -0
- package/dist/knowledge/decision-edges.js +123 -0
- package/dist/{agent-graph/types.d.ts → knowledge/graph-query.d.ts} +80 -70
- package/dist/knowledge/graph-query.js +1585 -0
- package/dist/knowledge/identity.d.ts +16 -0
- package/dist/knowledge/identity.js +22 -0
- package/dist/knowledge/index.d.ts +47 -0
- package/dist/knowledge/index.js +90 -0
- package/dist/knowledge/judgments.d.ts +118 -0
- package/dist/knowledge/judgments.js +808 -0
- package/dist/knowledge/observations.d.ts +160 -0
- package/dist/knowledge/observations.js +449 -0
- package/dist/knowledge/question-type.d.ts +34 -0
- package/dist/knowledge/question-type.js +70 -0
- package/dist/{search → knowledge}/ranker-features.js +1 -1
- package/dist/{search → knowledge}/search-quality.d.ts +0 -1
- package/dist/knowledge/search.d.ts +38 -0
- package/dist/knowledge/search.js +91 -0
- package/dist/knowledge/source-ingest.d.ts +65 -0
- package/dist/knowledge/source-ingest.js +174 -0
- package/dist/{edges/types.d.ts → knowledge/twin-edge-types.d.ts} +31 -4
- package/dist/{edges/types.js → knowledge/twin-edge-types.js} +13 -2
- package/dist/knowledge/work-dates.d.ts +49 -0
- package/dist/knowledge/work-dates.js +120 -0
- package/dist/mama-api.d.ts +114 -778
- package/dist/mama-api.js +313 -2461
- package/dist/memory/api.d.ts +264 -24
- package/dist/memory/api.js +1633 -843
- package/dist/memory/bootstrap-builder.d.ts +2 -1
- package/dist/memory/bootstrap-builder.js +5 -5
- package/dist/memory/channel-summary-state-store.d.ts +3 -2
- package/dist/memory/channel-summary-state-store.js +53 -51
- package/dist/memory/channel-summary-store.d.ts +5 -3
- package/dist/memory/channel-summary-store.js +3 -8
- package/dist/memory/dashboard-read.d.ts +46 -0
- package/dist/memory/dashboard-read.js +94 -0
- package/dist/memory/event-store.d.ts +3 -3
- package/dist/memory/event-store.js +3 -10
- package/dist/memory/finding-store.d.ts +3 -2
- package/dist/memory/finding-store.js +2 -7
- package/dist/memory/graph-read.d.ts +52 -0
- package/dist/memory/graph-read.js +130 -0
- package/dist/memory/judgment-types.d.ts +394 -0
- package/dist/memory/judgment-types.js +16 -0
- package/dist/memory/provenance-audit.d.ts +5 -2
- package/dist/memory/provenance-audit.js +8 -14
- package/dist/memory/provenance-live.d.ts +141 -0
- package/dist/memory/provenance-live.js +409 -0
- package/dist/memory/provenance-query.d.ts +5 -4
- package/dist/memory/provenance-query.js +21 -29
- package/dist/memory/provenance-resolver.d.ts +191 -0
- package/dist/memory/provenance-resolver.js +155 -0
- package/dist/memory/provenance.d.ts +1 -11
- package/dist/memory/provenance.js +2 -33
- package/dist/memory/recall-sanitize.d.ts +55 -0
- package/dist/memory/recall-sanitize.js +144 -0
- package/dist/memory/secret-filter.d.ts +32 -0
- package/dist/memory/secret-filter.js +126 -0
- package/dist/memory/truth-store.d.ts +2 -1
- package/dist/memory/truth-store.js +1 -4
- package/dist/memory/types.d.ts +74 -24
- package/dist/memory/types.js +75 -5
- package/dist/memory/write-adapters.d.ts +98 -0
- package/dist/memory/write-adapters.js +242 -0
- package/dist/operations/owner-action-effects.d.ts +53 -0
- package/dist/operations/owner-action-effects.js +96 -0
- package/dist/provenance/source-ref.d.ts +1 -1
- package/dist/provenance/source-ref.js +0 -2
- package/dist/registry/corrections.d.ts +31 -0
- package/dist/registry/corrections.js +332 -0
- package/dist/registry/record-identity.d.ts +49 -0
- package/dist/registry/record-identity.js +133 -0
- package/dist/registry/store.d.ts +101 -0
- package/dist/registry/store.js +395 -0
- package/dist/registry/types.d.ts +28 -0
- package/dist/registry/types.js +5 -0
- package/dist/relevance-scorer.js +2 -2
- package/dist/runtime/agent-event-bus.d.ts +50 -0
- package/dist/runtime/agent-event-bus.js +101 -0
- package/dist/runtime/drivers/claude-cli-wrapper.d.ts +155 -0
- package/dist/runtime/drivers/claude-cli-wrapper.js +392 -0
- package/dist/runtime/drivers/cli-arg-redaction.d.ts +2 -0
- package/dist/runtime/drivers/cli-arg-redaction.js +18 -0
- package/dist/runtime/drivers/cli-secret-redaction.d.ts +17 -0
- package/dist/runtime/drivers/cli-secret-redaction.js +126 -0
- package/dist/runtime/drivers/codex-app-server-process.d.ts +277 -0
- package/dist/runtime/drivers/codex-app-server-process.js +2342 -0
- package/dist/runtime/drivers/codex-auxiliary-tools.d.ts +17 -0
- package/dist/runtime/drivers/codex-auxiliary-tools.js +267 -0
- package/dist/runtime/drivers/codex-home.d.ts +20 -0
- package/dist/runtime/drivers/codex-home.js +674 -0
- package/dist/runtime/drivers/codex-thread-registry.d.ts +63 -0
- package/dist/runtime/drivers/codex-thread-registry.js +433 -0
- package/dist/runtime/drivers/persistent-cli-adapter.d.ts +160 -0
- package/dist/runtime/drivers/persistent-cli-adapter.js +396 -0
- package/dist/runtime/drivers/persistent-cli-process.d.ts +424 -0
- package/dist/runtime/drivers/persistent-cli-process.js +1543 -0
- package/dist/runtime/drivers/types.d.ts +456 -0
- package/dist/runtime/drivers/types.js +110 -0
- package/dist/runtime/mailbox.d.ts +223 -0
- package/dist/runtime/mailbox.js +582 -0
- package/dist/runtime/model-run-store.d.ts +28 -0
- package/dist/{model-runs/store.js → runtime/model-run-store.js} +81 -41
- package/dist/{model-runs/types.d.ts → runtime/model-run-types.d.ts} +33 -4
- package/dist/{model-runs/types.js → runtime/model-run-types.js} +1 -1
- package/dist/runtime/native-effect-observer.d.ts +22 -0
- package/dist/runtime/native-effect-observer.js +103 -0
- package/dist/runtime/native-input-journal.d.ts +46 -0
- package/dist/runtime/native-input-journal.js +308 -0
- package/dist/runtime/native-prompt.d.ts +118 -0
- package/dist/runtime/native-prompt.js +496 -0
- package/dist/runtime/native-session.d.ts +10 -0
- package/dist/{agent-graph/index.js → runtime/native-session.js} +9 -6
- package/dist/runtime/native-tool-trace-observer.d.ts +5 -0
- package/dist/runtime/native-tool-trace-observer.js +65 -0
- package/dist/runtime/native-turn.d.ts +272 -0
- package/dist/runtime/native-turn.js +1041 -0
- package/dist/runtime/operations.d.ts +236 -0
- package/dist/runtime/operations.js +565 -0
- package/dist/runtime/post-tool-handler.d.ts +74 -0
- package/dist/runtime/post-tool-handler.js +137 -0
- package/dist/runtime/prompt-layers.d.ts +126 -0
- package/dist/runtime/prompt-layers.js +239 -0
- package/dist/runtime/runtime-process.d.ts +102 -0
- package/dist/runtime/runtime-process.js +206 -0
- package/dist/runtime/runtime.d.ts +278 -0
- package/dist/runtime/runtime.js +563 -0
- package/dist/runtime/session-pool.d.ts +176 -0
- package/dist/runtime/session-pool.js +369 -0
- package/dist/runtime/stimulus-payload.d.ts +5 -0
- package/dist/runtime/stimulus-payload.js +50 -0
- package/dist/runtime/subagent-bridge.d.ts +24 -0
- package/dist/{agent-graph/types.js → runtime/subagent-bridge.js} +1 -1
- package/dist/runtime/text-completion.d.ts +22 -0
- package/dist/{agent-situation/types.js → runtime/text-completion.js} +1 -1
- package/dist/runtime/token-estimator.d.ts +25 -0
- package/dist/runtime/token-estimator.js +75 -0
- package/dist/runtime/tool-trace-store.d.ts +22 -0
- package/dist/{model-runs → runtime}/tool-trace-store.js +46 -27
- package/dist/runtime/trace-summary.d.ts +5 -0
- package/dist/runtime/trace-summary.js +74 -0
- package/dist/runtime/turn-text.d.ts +23 -0
- package/dist/runtime/turn-text.js +41 -0
- package/dist/storage/database.d.ts +67 -0
- package/dist/storage/database.js +158 -0
- package/package.json +20 -34
- package/dist/agent-graph/alias-write.d.ts +0 -3
- package/dist/agent-graph/alias-write.js +0 -234
- package/dist/agent-graph/entity-resolve.d.ts +0 -3
- package/dist/agent-graph/entity-resolve.js +0 -271
- package/dist/agent-graph/errors.d.ts +0 -4
- package/dist/agent-graph/errors.js +0 -11
- package/dist/agent-graph/graph-query.d.ts +0 -5
- package/dist/agent-graph/graph-query.js +0 -360
- package/dist/agent-graph/index.d.ts +0 -6
- package/dist/agent-situation/builder.d.ts +0 -8
- package/dist/agent-situation/builder.js +0 -239
- package/dist/agent-situation/cache-key.d.ts +0 -4
- package/dist/agent-situation/cache-key.js +0 -64
- package/dist/agent-situation/index.d.ts +0 -7
- package/dist/agent-situation/index.js +0 -28
- package/dist/agent-situation/packet-store.d.ts +0 -27
- package/dist/agent-situation/packet-store.js +0 -228
- package/dist/agent-situation/ranking-policy.d.ts +0 -18
- package/dist/agent-situation/ranking-policy.js +0 -75
- package/dist/agent-situation/source-readers.d.ts +0 -52
- package/dist/agent-situation/source-readers.js +0 -300
- package/dist/agent-situation/types.d.ts +0 -195
- package/dist/cases/wiki-page-index.d.ts +0 -37
- package/dist/cases/wiki-page-index.js +0 -201
- package/dist/config-loader.d.ts +0 -68
- package/dist/config-loader.js +0 -239
- package/dist/connectors/event-index.d.ts +0 -24
- package/dist/connectors/event-index.js +0 -245
- package/dist/connectors/raw-query.d.ts +0 -40
- package/dist/connectors/raw-query.js +0 -412
- package/dist/connectors/types.d.ts +0 -117
- package/dist/connectors/types.js +0 -3
- package/dist/context-compile/boundary-defaults.d.ts +0 -12
- package/dist/context-compile/boundary-defaults.js +0 -105
- package/dist/context-compile/channel-grant.js +0 -66
- package/dist/context-compile/compiler-policy.d.ts +0 -39
- package/dist/context-compile/compiler-policy.js +0 -147
- package/dist/context-compile/compiler.d.ts +0 -18
- package/dist/context-compile/compiler.js +0 -404
- package/dist/context-compile/index.d.ts +0 -10
- package/dist/context-compile/index.js +0 -26
- package/dist/context-compile/packet-store.d.ts +0 -8
- package/dist/context-compile/packet-store.js +0 -239
- package/dist/context-compile/ref.d.ts +0 -7
- package/dist/context-compile/ref.js +0 -102
- package/dist/context-compile/source-readers.d.ts +0 -70
- package/dist/context-compile/source-readers.js +0 -840
- package/dist/context-compile/types.d.ts +0 -155
- package/dist/context-compile/types.js +0 -11
- package/dist/context-compile/visibility.d.ts +0 -21
- package/dist/context-compile/visibility.js +0 -224
- package/dist/decision-tracker.d.ts +0 -206
- package/dist/decision-tracker.js +0 -481
- package/dist/edges/ref-validation.d.ts +0 -7
- package/dist/edges/ref-validation.js +0 -321
- package/dist/edges/store.d.ts +0 -8
- package/dist/edges/store.js +0 -129
- package/dist/embedding-client.d.ts +0 -28
- package/dist/embedding-client.js +0 -53
- package/dist/embedding-server/index.d.ts +0 -67
- package/dist/embedding-server/index.js +0 -405
- package/dist/embedding-server/mobile/auth.d.ts +0 -44
- package/dist/embedding-server/mobile/auth.js +0 -150
- package/dist/embedding-server/mobile/daemon.d.ts +0 -129
- package/dist/embedding-server/mobile/daemon.js +0 -313
- package/dist/embedding-server/mobile/output-parser.d.ts +0 -115
- package/dist/embedding-server/mobile/output-parser.js +0 -241
- package/dist/embedding-server/mobile/session-api.d.ts +0 -57
- package/dist/embedding-server/mobile/session-api.js +0 -261
- package/dist/embedding-server/mobile/session-manager.d.ts +0 -138
- package/dist/embedding-server/mobile/session-manager.js +0 -378
- package/dist/embedding-server/mobile/websocket-handler.d.ts +0 -137
- package/dist/embedding-server/mobile/websocket-handler.js +0 -486
- package/dist/embeddings.d.ts +0 -68
- package/dist/embeddings.js +0 -244
- package/dist/entities/audit-metrics.d.ts +0 -68
- package/dist/entities/audit-metrics.js +0 -124
- package/dist/entities/candidate-generator.d.ts +0 -8
- package/dist/entities/candidate-generator.js +0 -24
- package/dist/entities/entity-linked-decision-counts.d.ts +0 -2
- package/dist/entities/entity-linked-decision-counts.js +0 -29
- package/dist/entities/entity-list.d.ts +0 -22
- package/dist/entities/entity-list.js +0 -3
- package/dist/entities/entity-orphan-list.d.ts +0 -17
- package/dist/entities/entity-orphan-list.js +0 -3
- package/dist/entities/entity-search.d.ts +0 -20
- package/dist/entities/entity-search.js +0 -3
- package/dist/entities/errors.d.ts +0 -55
- package/dist/entities/errors.js +0 -100
- package/dist/entities/lineage-store.d.ts +0 -28
- package/dist/entities/lineage-store.js +0 -204
- package/dist/entities/normalization.d.ts +0 -14
- package/dist/entities/normalization.js +0 -63
- package/dist/entities/policy-store.d.ts +0 -8
- package/dist/entities/policy-store.js +0 -75
- package/dist/entities/policy-types.d.ts +0 -72
- package/dist/entities/policy-types.js +0 -59
- package/dist/entities/projection.d.ts +0 -8
- package/dist/entities/projection.js +0 -82
- package/dist/entities/provenance-query.d.ts +0 -32
- package/dist/entities/provenance-query.js +0 -3
- package/dist/entities/read-identity.d.ts +0 -31
- package/dist/entities/read-identity.js +0 -264
- package/dist/entities/recall-bridge.d.ts +0 -5
- package/dist/entities/recall-bridge.js +0 -171
- package/dist/entities/resolution-engine.d.ts +0 -8
- package/dist/entities/resolution-engine.js +0 -3
- package/dist/entities/rollback-preview.d.ts +0 -35
- package/dist/entities/rollback-preview.js +0 -3
- package/dist/entities/source-locator.d.ts +0 -3
- package/dist/entities/source-locator.js +0 -32
- package/dist/entities/store.d.ts +0 -69
- package/dist/entities/store.js +0 -544
- package/dist/entities/types.d.ts +0 -166
- package/dist/entities/types.js +0 -30
- package/dist/memory/extraction-prompt.d.ts +0 -4
- package/dist/memory/extraction-prompt.js +0 -89
- package/dist/memory/scope-backfill.d.ts +0 -14
- package/dist/memory/scope-backfill.js +0 -3
- package/dist/memory/scope-store.d.ts +0 -4
- package/dist/memory/scope-store.js +0 -9
- package/dist/memory-store.d.ts +0 -87
- package/dist/memory-store.js +0 -78
- package/dist/model-runs/store.d.ts +0 -13
- package/dist/model-runs/tool-trace-store.d.ts +0 -8
- package/dist/notification-manager.d.ts +0 -7
- package/dist/notification-manager.js +0 -12
- package/dist/outcome-tracker.d.ts +0 -151
- package/dist/outcome-tracker.js +0 -271
- package/dist/query-intent.d.ts +0 -23
- package/dist/query-intent.js +0 -114
- package/dist/runtime/trusted-provenance.d.ts +0 -3
- package/dist/runtime/trusted-provenance.js +0 -6
- package/dist/search/question-type.d.ts +0 -5
- package/dist/search/question-type.js +0 -41
- package/dist/test-utils.d.ts +0 -80
- package/dist/test-utils.js +0 -218
- package/dist/tier-validator.d.ts +0 -43
- package/dist/tier-validator.js +0 -159
- package/dist/time-formatter.d.ts +0 -25
- package/dist/time-formatter.js +0 -93
- /package/dist/{search → knowledge}/feedback-store.d.ts +0 -0
- /package/dist/{search → knowledge}/feedback-store.js +0 -0
- /package/dist/{search → knowledge}/ranker-features.d.ts +0 -0
- /package/dist/{search → knowledge}/ranker-rescore.d.ts +0 -0
- /package/dist/{search → knowledge}/ranker-rescore.js +0 -0
- /package/dist/{search → knowledge}/ranker-trainer.d.ts +0 -0
- /package/dist/{search → knowledge}/ranker-trainer.js +0 -0
- /package/dist/{search → knowledge}/search-quality.js +0 -0
package/dist/mama-api.d.ts
CHANGED
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
* @version 1.3
|
|
18
18
|
* @date 2025-11-26
|
|
19
19
|
*/
|
|
20
|
-
import {
|
|
20
|
+
import { type CheckpointRow, type ListDecisionsOptions, type SearchCandidate, type SuggestFunctionOptions, type UpdateOutcomeParams } from './memory/api.js';
|
|
21
|
+
import { DecisionRecord, type DatabaseInstance } from './db-manager.js';
|
|
21
22
|
import { SemanticEdges } from './decision-formatter.js';
|
|
22
|
-
import { saveMemory
|
|
23
|
-
import { createAuditFinding, listOpenAuditFindings } from './memory/finding-store.js';
|
|
24
|
-
import { listMemoryEventsForMemory, listRecentMemoryEvents } from './memory/event-store.js';
|
|
25
|
-
import
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import { type SearchHitDiagnostics, type SearchQualityOptions } from './search/search-quality.js';
|
|
23
|
+
import { saveMemory as saveMemoryInAdapter, recallMemory as recallMemoryInAdapter, buildProfile as buildProfileInAdapter, ingestMemory as ingestMemoryInAdapter, ingestConversation as ingestConversationInAdapter, evolveMemory, buildMemoryBootstrap as buildMemoryBootstrapInAdapter, createAuditAck, recordMemoryAudit as recordMemoryAuditInAdapter, upsertChannelSummary as upsertChannelSummaryInAdapter, getChannelSummary as getChannelSummaryInAdapter } from './memory/api.js';
|
|
24
|
+
import { createAuditFinding as createAuditFindingInAdapter, listOpenAuditFindings as listOpenAuditFindingsInAdapter } from './memory/finding-store.js';
|
|
25
|
+
import { listMemoryEventsForMemory as listMemoryEventsForMemoryInAdapter, listRecentMemoryEvents as listRecentMemoryEventsInAdapter } from './memory/event-store.js';
|
|
26
|
+
import { getMemoryProvenance as getMemoryProvenanceInAdapter, listMemoriesByEnvelopeHash as listMemoriesByEnvelopeHashInAdapter, listMemoriesByGatewayCallId as listMemoriesByGatewayCallIdInAdapter, listMemoriesByModelRunId as listMemoriesByModelRunIdInAdapter } from './memory/provenance-query.js';
|
|
27
|
+
import { beginModelRun as beginModelRunInAdapter, commitModelRun as commitModelRunInAdapter, failModelRun as failModelRunInAdapter, getModelRun as getModelRunInAdapter, listModelRunNativeInputs as listModelRunNativeInputsInAdapter } from './runtime/model-run-store.js';
|
|
28
|
+
import { appendToolTrace as appendToolTraceInAdapter, listToolTracesForRun as listToolTracesForRunInAdapter, listToolTraces as listToolTracesInAdapter, readToolTrace as readToolTraceInAdapter } from './runtime/tool-trace-store.js';
|
|
29
|
+
import { type SearchHitDiagnostics } from './knowledge/search-quality.js';
|
|
30
30
|
/**
|
|
31
31
|
* Parameters for mama.save()
|
|
32
32
|
*/
|
|
@@ -42,23 +42,16 @@ interface SaveParams {
|
|
|
42
42
|
trust_context?: Record<string, unknown> | null;
|
|
43
43
|
is_static?: number;
|
|
44
44
|
scopes?: Array<{
|
|
45
|
-
kind:
|
|
45
|
+
kind: string;
|
|
46
46
|
id: string;
|
|
47
47
|
}>;
|
|
48
|
+
item?: string | null;
|
|
49
|
+
actors?: Array<{
|
|
50
|
+
person: string;
|
|
51
|
+
role: string;
|
|
52
|
+
}>;
|
|
48
53
|
/** ISO 8601 date string for when the event actually occurred (e.g. "2023-01-15") */
|
|
49
54
|
event_date?: string | null;
|
|
50
|
-
timelineEvent?: {
|
|
51
|
-
id?: string;
|
|
52
|
-
entity_id?: string;
|
|
53
|
-
event_type: string;
|
|
54
|
-
role?: string | null;
|
|
55
|
-
valid_from?: number | null;
|
|
56
|
-
valid_to?: number | null;
|
|
57
|
-
observed_at?: number | null;
|
|
58
|
-
source_ref?: string | null;
|
|
59
|
-
summary: string;
|
|
60
|
-
details?: string | null;
|
|
61
|
-
};
|
|
62
55
|
}
|
|
63
56
|
/**
|
|
64
57
|
* Similar decision result from search
|
|
@@ -129,10 +122,7 @@ interface SaveResult {
|
|
|
129
122
|
success: boolean;
|
|
130
123
|
id: string;
|
|
131
124
|
saved_decision_id?: string;
|
|
132
|
-
timeline_event_id?: string | null;
|
|
133
|
-
timeline_event_ids?: string[];
|
|
134
125
|
similar_decisions?: SimilarDecision[];
|
|
135
|
-
warning?: string;
|
|
136
126
|
collaboration_hint?: string;
|
|
137
127
|
reasoning_graph?: ReasoningGraphInfo;
|
|
138
128
|
error?: string;
|
|
@@ -235,174 +225,6 @@ export interface DBLinkStatsResult {
|
|
|
235
225
|
unique_decisions: number;
|
|
236
226
|
relationship_breakdown: string;
|
|
237
227
|
}
|
|
238
|
-
/**
|
|
239
|
-
* Deletion target for auto-generated links
|
|
240
|
-
*/
|
|
241
|
-
interface DeletionTarget {
|
|
242
|
-
from_id: string;
|
|
243
|
-
to_id: string;
|
|
244
|
-
relationship: string;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Post cleanup report structure
|
|
248
|
-
*/
|
|
249
|
-
export interface PostCleanupReport {
|
|
250
|
-
orphaned_decisions: number;
|
|
251
|
-
duplicate_links: number;
|
|
252
|
-
invalid_references: number;
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Quality report options
|
|
256
|
-
*/
|
|
257
|
-
interface QualityReportOptions {
|
|
258
|
-
format?: 'json' | 'markdown' | null;
|
|
259
|
-
period?: '24h' | '7d' | '30d' | null;
|
|
260
|
-
thresholds?: QualityThresholds | null;
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Quality thresholds
|
|
264
|
-
*/
|
|
265
|
-
interface QualityThresholds {
|
|
266
|
-
minSuccessRate?: number;
|
|
267
|
-
maxLatencyMs?: number;
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Deprecate auto-links result
|
|
271
|
-
*/
|
|
272
|
-
interface DeprecateAutoLinksResult {
|
|
273
|
-
dryRun: boolean;
|
|
274
|
-
deprecated: number;
|
|
275
|
-
protected: number;
|
|
276
|
-
total: number;
|
|
277
|
-
autoLinkRatio: string;
|
|
278
|
-
links: Array<{
|
|
279
|
-
from_id: string;
|
|
280
|
-
to_id: string;
|
|
281
|
-
relationship: string;
|
|
282
|
-
reason?: string;
|
|
283
|
-
created_at?: number | string;
|
|
284
|
-
}>;
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Scan auto-links result
|
|
288
|
-
*/
|
|
289
|
-
interface ScanAutoLinksResult {
|
|
290
|
-
total_links: number;
|
|
291
|
-
auto_links: number;
|
|
292
|
-
protected_links: number;
|
|
293
|
-
deletion_targets: number;
|
|
294
|
-
deletion_target_list: DeletionTarget[];
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Create link backup result
|
|
298
|
-
*/
|
|
299
|
-
interface CreateLinkBackupResult {
|
|
300
|
-
backup_file: string;
|
|
301
|
-
manifest_file: string;
|
|
302
|
-
checksum: string;
|
|
303
|
-
link_count: number;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Restore link backup result
|
|
307
|
-
*/
|
|
308
|
-
interface RestoreLinkBackupResult {
|
|
309
|
-
total_links: number;
|
|
310
|
-
restored: number;
|
|
311
|
-
failed: number;
|
|
312
|
-
backup_file: string;
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Verify backup exists result
|
|
316
|
-
*/
|
|
317
|
-
interface VerifyBackupResult {
|
|
318
|
-
backup_file: string;
|
|
319
|
-
age_hours: number;
|
|
320
|
-
link_count: number;
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* Delete auto-links result (dry run mode)
|
|
324
|
-
*/
|
|
325
|
-
interface DeleteAutoLinksDryRunResult {
|
|
326
|
-
dry_run: true;
|
|
327
|
-
would_delete: number;
|
|
328
|
-
deleted: 0;
|
|
329
|
-
backup_file: string;
|
|
330
|
-
large_deletion_warning: boolean;
|
|
331
|
-
warning_message: string | null;
|
|
332
|
-
sample_links: Array<{
|
|
333
|
-
from_id: string;
|
|
334
|
-
to_id: string;
|
|
335
|
-
relationship: string;
|
|
336
|
-
}>;
|
|
337
|
-
message: string;
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* Delete auto-links error entry
|
|
341
|
-
*/
|
|
342
|
-
type DeleteAutoLinksError = {
|
|
343
|
-
link: string;
|
|
344
|
-
error: string;
|
|
345
|
-
} | {
|
|
346
|
-
batch_index: number;
|
|
347
|
-
batch_size: number;
|
|
348
|
-
error: string;
|
|
349
|
-
};
|
|
350
|
-
/**
|
|
351
|
-
* Delete auto-links result (execute mode)
|
|
352
|
-
*/
|
|
353
|
-
interface DeleteAutoLinksExecuteResult {
|
|
354
|
-
dry_run: false;
|
|
355
|
-
deleted: number;
|
|
356
|
-
failed: number;
|
|
357
|
-
total_targets: number;
|
|
358
|
-
batches_processed: number;
|
|
359
|
-
backup_file: string;
|
|
360
|
-
errors: DeleteAutoLinksError[];
|
|
361
|
-
success_rate: number;
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Delete auto-links result (empty case)
|
|
365
|
-
*/
|
|
366
|
-
interface DeleteAutoLinksEmptyResult {
|
|
367
|
-
dry_run: boolean;
|
|
368
|
-
deleted: 0;
|
|
369
|
-
failed: 0;
|
|
370
|
-
total_targets: 0;
|
|
371
|
-
backup_file: string;
|
|
372
|
-
message: string;
|
|
373
|
-
}
|
|
374
|
-
/**
|
|
375
|
-
* Delete auto-links union type
|
|
376
|
-
*/
|
|
377
|
-
type DeleteAutoLinksResult = DeleteAutoLinksDryRunResult | DeleteAutoLinksExecuteResult | DeleteAutoLinksEmptyResult;
|
|
378
|
-
/**
|
|
379
|
-
* Quality recommendation
|
|
380
|
-
*/
|
|
381
|
-
export interface QualityRecommendation {
|
|
382
|
-
category: string;
|
|
383
|
-
severity: string;
|
|
384
|
-
message: string;
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* Quality report structure
|
|
388
|
-
*/
|
|
389
|
-
export interface QualityReport {
|
|
390
|
-
successRate: {
|
|
391
|
-
period: string;
|
|
392
|
-
total: number;
|
|
393
|
-
success: number;
|
|
394
|
-
failure: number;
|
|
395
|
-
successRate: string;
|
|
396
|
-
meetsTarget: boolean;
|
|
397
|
-
};
|
|
398
|
-
latency?: {
|
|
399
|
-
avgMs: number;
|
|
400
|
-
p50Ms: number;
|
|
401
|
-
p95Ms: number;
|
|
402
|
-
maxMs: number;
|
|
403
|
-
meetsTarget: boolean;
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
228
|
/**
|
|
407
229
|
* Recall decisions by topic
|
|
408
230
|
*
|
|
@@ -467,570 +289,45 @@ interface RecallGraphResult {
|
|
|
467
289
|
};
|
|
468
290
|
};
|
|
469
291
|
}
|
|
470
|
-
declare function recall(topic: string, options?: RecallOptions): Promise<string | RecallGraphResult>;
|
|
471
|
-
/**
|
|
472
|
-
* Update outcome of a decision
|
|
473
|
-
*
|
|
474
|
-
* Track whether a decision succeeded, failed, or partially worked
|
|
475
|
-
* AC: Evolutionary Decision Memory - Learn from outcomes
|
|
476
|
-
*
|
|
477
|
-
* @param {string} decisionId - Decision ID to update
|
|
478
|
-
* @param {Object} outcome - Outcome details
|
|
479
|
-
* @param {string} outcome.outcome - 'SUCCESS', 'FAILED', or 'PARTIAL'
|
|
480
|
-
* @param {string} [outcome.failure_reason] - Reason for failure (if FAILED)
|
|
481
|
-
* @param {string} [outcome.limitation] - Limitation description (if PARTIAL)
|
|
482
|
-
* @returns {Promise<void>}
|
|
483
|
-
*
|
|
484
|
-
* @example
|
|
485
|
-
* await mama.updateOutcome('decision_auth_strategy_123456_abc', {
|
|
486
|
-
* outcome: 'FAILED',
|
|
487
|
-
* failure_reason: 'Missing token expiration handling'
|
|
488
|
-
* });
|
|
489
|
-
*/
|
|
490
|
-
interface UpdateOutcomeParams {
|
|
491
|
-
outcome: string;
|
|
492
|
-
failure_reason?: string | null;
|
|
493
|
-
limitation?: string | null;
|
|
494
|
-
}
|
|
495
|
-
declare function updateOutcome(decisionId: string, { outcome, failure_reason, limitation }: UpdateOutcomeParams): Promise<void>;
|
|
496
|
-
/**
|
|
497
|
-
* Expand search results with graph context (Phase 1 - Graph-Enhanced Retrieval)
|
|
498
|
-
*
|
|
499
|
-
* For each candidate decision:
|
|
500
|
-
* 1. Add supersedes chain (evolution history)
|
|
501
|
-
* 2. Add semantic edges (refines, contradicts)
|
|
502
|
-
* 3. Deduplicate by ID
|
|
503
|
-
* 4. Re-rank by relevance (primary candidates ranked higher)
|
|
504
|
-
*
|
|
505
|
-
* @param {Array} candidates - Initial search results from vector/keyword search
|
|
506
|
-
* @returns {Promise<Array>} Graph-enhanced results with evolution context
|
|
507
|
-
*/
|
|
508
|
-
interface SearchCandidate {
|
|
509
|
-
id: string;
|
|
510
|
-
topic: string;
|
|
511
|
-
decision: string;
|
|
512
|
-
reasoning?: string | null;
|
|
513
|
-
confidence?: number;
|
|
514
|
-
similarity?: number;
|
|
515
|
-
created_at?: number | string;
|
|
516
|
-
graph_source?: string;
|
|
517
|
-
graph_rank?: number;
|
|
518
|
-
related_to?: string | null;
|
|
519
|
-
edge_reason?: string | null;
|
|
520
|
-
recency_score?: number;
|
|
521
|
-
recency_age_days?: number;
|
|
522
|
-
final_score?: number;
|
|
523
|
-
outcome?: string | null;
|
|
524
|
-
failure_reason?: string | null;
|
|
525
|
-
is_static?: number;
|
|
526
|
-
}
|
|
527
|
-
declare function expandWithGraph(candidates: SearchCandidate[]): Promise<SearchCandidate[]>;
|
|
528
|
-
/**
|
|
529
|
-
* Suggest relevant decisions based on user question
|
|
530
|
-
*
|
|
531
|
-
* DEFAULT: Returns JSON object with search results (LLM-first design)
|
|
532
|
-
* OPTIONAL: Returns Markdown string if format='markdown' (for human display)
|
|
533
|
-
*
|
|
534
|
-
* Simplified: Direct vector search without LLM intent analysis
|
|
535
|
-
* Works with short queries, long questions, Korean/English
|
|
536
|
-
*
|
|
537
|
-
* @param {string} userQuestion - User's question or intent
|
|
538
|
-
* @param {Object} options - Search options
|
|
539
|
-
* @param {string} [options.format='json'] - Output format: 'json' (default) or 'markdown'
|
|
540
|
-
* @param {number} [options.limit=5] - Max results to return
|
|
541
|
-
* @param {number} [options.threshold=0.6] - Minimum similarity (adaptive by query length)
|
|
542
|
-
* @param {boolean} [options.useReranking=false] - Use LLM re-ranking (optional, slower)
|
|
543
|
-
* @returns {Promise<Object|string|null>} Search results as JSON or Markdown, null if no results
|
|
544
|
-
*
|
|
545
|
-
* @example
|
|
546
|
-
* // LLM usage (default)
|
|
547
|
-
* const data = await mama.suggest('Why did we choose JWT?');
|
|
548
|
-
* // → { query, results: [...], meta: {...} }
|
|
549
|
-
*
|
|
550
|
-
* // Human display
|
|
551
|
-
* const markdown = await mama.suggest('mesh optimization', { format: 'markdown' });
|
|
552
|
-
* // → "💡 MAMA found 3 related topics:\n1. ..."
|
|
553
|
-
*/
|
|
554
|
-
interface SuggestFunctionOptions extends SearchQualityOptions {
|
|
555
|
-
format?: 'json' | 'markdown';
|
|
556
|
-
limit?: number;
|
|
557
|
-
useReranking?: boolean;
|
|
558
|
-
/** Phase 3 Task 33: apply learned offline ranker rescoring. */
|
|
559
|
-
rerankWithLearned?: boolean;
|
|
560
|
-
recencyWeight?: number;
|
|
561
|
-
recencyScale?: number;
|
|
562
|
-
recencyDecay?: number;
|
|
563
|
-
scopes?: Array<{
|
|
564
|
-
kind: 'global' | 'user' | 'channel' | 'project';
|
|
565
|
-
id: string;
|
|
566
|
-
}>;
|
|
567
|
-
}
|
|
568
292
|
declare function save(params: SaveParams): Promise<SaveResult>;
|
|
569
|
-
declare function saveWithTrustedProvenance(params: SaveParams, options: TrustedMemoryWriteOptions): Promise<SaveResult>;
|
|
570
|
-
/**
|
|
571
|
-
* Annotate suggest results with topic currency. MAMA semantics treat topic
|
|
572
|
-
* reuse as supersession, so a result row is stale when the DB holds a newer
|
|
573
|
-
* decision row for the same topic - even when its status column still says
|
|
574
|
-
* 'active' (historical chains predate status maintenance). Surfacing
|
|
575
|
-
* `superseded_by_newer` lets consumers (and LLMs) tell current truth from
|
|
576
|
-
* superseded history; delta-bench measured 80% -> 92.5% answer accuracy when
|
|
577
|
-
* the current row is explicitly marked.
|
|
578
|
-
*/
|
|
579
|
-
declare function annotateTopicCurrency<T extends {
|
|
580
|
-
id?: unknown;
|
|
581
|
-
topic?: unknown;
|
|
582
|
-
}>(rows: T[], scopes?: Array<{
|
|
583
|
-
kind: string;
|
|
584
|
-
id: string;
|
|
585
|
-
}>): Array<T & {
|
|
586
|
-
superseded_by_newer?: boolean;
|
|
587
|
-
}>;
|
|
588
293
|
declare function suggest(userQuestion: string, options?: SuggestFunctionOptions): Promise<any>;
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
* DEFAULT: Returns JSON array with recent decisions (LLM-first design)
|
|
593
|
-
* OPTIONAL: Returns Markdown string if format='markdown' (for human display)
|
|
594
|
-
*
|
|
595
|
-
* @param {Object} [options] - Options
|
|
596
|
-
* @param {number} [options.limit=10] - Max results
|
|
597
|
-
* @param {string} [options.format='json'] - Output format
|
|
598
|
-
* @returns {Promise<Array|string>} Recent decisions
|
|
599
|
-
*/
|
|
600
|
-
interface ListDecisionsOptions {
|
|
601
|
-
limit?: number;
|
|
602
|
-
format?: 'json' | 'markdown';
|
|
603
|
-
scopes?: Array<{
|
|
604
|
-
kind: 'global' | 'user' | 'channel' | 'project';
|
|
605
|
-
id: string;
|
|
606
|
-
}>;
|
|
607
|
-
}
|
|
294
|
+
declare function recall(topic: string, options?: RecallOptions): Promise<string | RecallGraphResult>;
|
|
295
|
+
declare function expandWithGraph(candidates: SearchCandidate[]): Promise<SearchCandidate[]>;
|
|
296
|
+
declare function updateOutcome(decisionId: string, outcome: UpdateOutcomeParams): Promise<void>;
|
|
608
297
|
declare function listDecisions(options?: ListDecisionsOptions): Promise<DecisionRecord[] | string>;
|
|
609
|
-
/**
|
|
610
|
-
* Save current session checkpoint (New Feature: Session Continuity)
|
|
611
|
-
*
|
|
612
|
-
* @param {string} summary - Summary of current session state
|
|
613
|
-
* @param {Array<string>} openFiles - List of currently open files
|
|
614
|
-
* @param {string} nextSteps - Next steps to be taken
|
|
615
|
-
* @returns {Promise<number>} Checkpoint ID
|
|
616
|
-
*/
|
|
617
298
|
declare function saveCheckpoint(summary: string, openFiles?: string[], nextSteps?: string, recentConversation?: any[]): Promise<number | bigint>;
|
|
618
|
-
/**
|
|
619
|
-
* Load latest active checkpoint (New Feature: Session Continuity)
|
|
620
|
-
*
|
|
621
|
-
* @returns {Promise<Object|null>} Latest checkpoint or null
|
|
622
|
-
*/
|
|
623
|
-
interface ConversationMessage {
|
|
624
|
-
role: string;
|
|
625
|
-
content: string | Array<{
|
|
626
|
-
type: string;
|
|
627
|
-
text?: string;
|
|
628
|
-
[key: string]: unknown;
|
|
629
|
-
}>;
|
|
630
|
-
}
|
|
631
|
-
interface CheckpointRow {
|
|
632
|
-
id?: number;
|
|
633
|
-
timestamp?: number;
|
|
634
|
-
summary?: string;
|
|
635
|
-
open_files?: string | string[];
|
|
636
|
-
next_steps?: string;
|
|
637
|
-
recent_conversation?: string | ConversationMessage[];
|
|
638
|
-
status?: string;
|
|
639
|
-
}
|
|
640
299
|
declare function loadCheckpoint(): Promise<CheckpointRow | null>;
|
|
641
|
-
/**
|
|
642
|
-
* List recent checkpoints (New Feature: Session Continuity)
|
|
643
|
-
*
|
|
644
|
-
* @param {number} limit - Max number of checkpoints to return
|
|
645
|
-
* @returns {Promise<Array>} Recent checkpoints
|
|
646
|
-
*/
|
|
647
300
|
declare function listCheckpoints(limit?: number): Promise<CheckpointRow[]>;
|
|
648
301
|
/**
|
|
649
|
-
*
|
|
650
|
-
*
|
|
651
|
-
*
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
declare function
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
* @param {string} relationship - Link relationship type
|
|
679
|
-
* @returns {Promise<void>}
|
|
680
|
-
*/
|
|
681
|
-
declare function approveLink(from_id: string, to_id: string, relationship: string): Promise<void>;
|
|
682
|
-
/**
|
|
683
|
-
* Reject a proposed link (Epic 3 - Story 3.1)
|
|
684
|
-
*
|
|
685
|
-
* User rejects a pending link, removing it from the database.
|
|
686
|
-
*
|
|
687
|
-
* @param {string} from_id - Source decision ID
|
|
688
|
-
* @param {string} to_id - Target decision ID
|
|
689
|
-
* @param {string} relationship - Link relationship type
|
|
690
|
-
* @param {string} [reason] - Optional reason for rejection
|
|
691
|
-
* @returns {Promise<void>}
|
|
692
|
-
*/
|
|
693
|
-
declare function rejectLink(from_id: string, to_id: string, relationship: string, reason?: string): Promise<void>;
|
|
694
|
-
/**
|
|
695
|
-
* Get pending links awaiting approval (Epic 3 - Story 3.1)
|
|
696
|
-
*
|
|
697
|
-
* Returns all links that need user approval.
|
|
698
|
-
*
|
|
699
|
-
* @param {Object} [options] - Query options
|
|
700
|
-
* @param {string} [options.from_id] - Filter by source decision
|
|
701
|
-
* @param {string} [options.to_id] - Filter by target decision
|
|
702
|
-
* @returns {Promise<Array>} Pending links with decision details
|
|
703
|
-
*/
|
|
704
|
-
interface GetPendingLinksOptions {
|
|
705
|
-
from_id?: string;
|
|
706
|
-
to_id?: string;
|
|
707
|
-
}
|
|
708
|
-
declare function getPendingLinks(options?: GetPendingLinksOptions): Promise<any[]>;
|
|
709
|
-
/**
|
|
710
|
-
* Deprecate auto-generated links (Epic 3 - Story 3.3)
|
|
711
|
-
*
|
|
712
|
-
* Identifies and removes v0 auto-generated links that lack explicit approval context.
|
|
713
|
-
* Protected links (with decision_id or created_by='llm') are preserved.
|
|
714
|
-
*
|
|
715
|
-
* @param {Object} [options] - Deprecation options
|
|
716
|
-
* @param {boolean} [options.dryRun=true] - If true, only report without deleting
|
|
717
|
-
* @returns {Promise<Object>} Report with counts and deprecated links
|
|
718
|
-
*/
|
|
719
|
-
interface DeprecateAutoLinksOptions {
|
|
720
|
-
dryRun?: boolean;
|
|
721
|
-
}
|
|
722
|
-
interface EdgeLink {
|
|
723
|
-
from_id: string;
|
|
724
|
-
to_id: string;
|
|
725
|
-
relationship: string;
|
|
726
|
-
reason?: string;
|
|
727
|
-
created_at?: number | string;
|
|
728
|
-
}
|
|
729
|
-
declare function deprecateAutoLinks(options?: DeprecateAutoLinksOptions): Promise<DeprecateAutoLinksResult>;
|
|
730
|
-
/**
|
|
731
|
-
* Scan and identify auto-generated links for cleanup (Epic 5 - Story 5.1)
|
|
732
|
-
*
|
|
733
|
-
* Identifies auto-generated links lacking proper approval metadata.
|
|
734
|
-
* Separates deletion targets from protected links.
|
|
735
|
-
*
|
|
736
|
-
* Identification criteria:
|
|
737
|
-
* - approved_by_user = 0 OR (created_by IS NULL AND decision_id IS NULL)
|
|
738
|
-
*
|
|
739
|
-
* Protected (excluded from deletion):
|
|
740
|
-
* - approved_by_user = 1 AND (decision_id IS NOT NULL OR evidence IS NOT NULL)
|
|
741
|
-
*
|
|
742
|
-
* @returns {Object} Scan results with counts and link details
|
|
743
|
-
*/
|
|
744
|
-
declare function scanAutoLinks(): ScanAutoLinksResult;
|
|
745
|
-
/**
|
|
746
|
-
* Create backup of links before cleanup (Epic 5 - Story 5.1)
|
|
747
|
-
*
|
|
748
|
-
* Backs up deletion target links with full metadata to JSON file.
|
|
749
|
-
* Generates SHA-256 checksum for data integrity verification.
|
|
750
|
-
* Creates backup manifest with timestamp and metadata.
|
|
751
|
-
*
|
|
752
|
-
* @param {Array} targetLinks - Links to back up
|
|
753
|
-
* @returns {Object} Backup result with file paths and checksum
|
|
754
|
-
*/
|
|
755
|
-
declare function createLinkBackup(targetLinks: EdgeLink[]): CreateLinkBackupResult;
|
|
756
|
-
/**
|
|
757
|
-
* Generate pre-cleanup report with risk assessment (Epic 5 - Story 5.1)
|
|
758
|
-
*
|
|
759
|
-
* Creates comprehensive report with statistics, risk level, and samples.
|
|
760
|
-
* Risk assessment based on deletion ratio:
|
|
761
|
-
* - HIGH: > 50% deletion
|
|
762
|
-
* - MEDIUM: 30-50% deletion
|
|
763
|
-
* - LOW: < 30% deletion
|
|
764
|
-
*
|
|
765
|
-
* @returns {Object} Report data with markdown output and file path
|
|
766
|
-
*/
|
|
767
|
-
declare function generatePreCleanupReport(): {
|
|
768
|
-
report: {
|
|
769
|
-
generated_at: string;
|
|
770
|
-
statistics: {
|
|
771
|
-
total_links: number;
|
|
772
|
-
auto_links: number;
|
|
773
|
-
protected_links: number;
|
|
774
|
-
deletion_targets: number;
|
|
775
|
-
deletion_ratio: string;
|
|
776
|
-
};
|
|
777
|
-
risk_assessment: {
|
|
778
|
-
level: string;
|
|
779
|
-
message: string;
|
|
780
|
-
};
|
|
781
|
-
deletion_target_samples: {
|
|
782
|
-
from_id: any;
|
|
783
|
-
to_id: any;
|
|
784
|
-
relationship: any;
|
|
785
|
-
reason: any;
|
|
786
|
-
created_by: any;
|
|
787
|
-
approved_by_user: any;
|
|
788
|
-
}[];
|
|
789
|
-
};
|
|
790
|
-
report_file: string;
|
|
791
|
-
markdown: string;
|
|
792
|
-
};
|
|
793
|
-
/**
|
|
794
|
-
* Restore links from backup file (Epic 5 - Story 5.1)
|
|
795
|
-
*
|
|
796
|
-
* Restores previously backed-up links to the database.
|
|
797
|
-
* Verifies checksum before restoration to ensure data integrity.
|
|
798
|
-
* Reports number of restored and failed links.
|
|
799
|
-
*
|
|
800
|
-
* @param {string} backupFile - Path to backup file
|
|
801
|
-
* @returns {Object} Restoration result with counts
|
|
802
|
-
*/
|
|
803
|
-
declare function restoreLinkBackup(backupFile: string): RestoreLinkBackupResult;
|
|
804
|
-
/**
|
|
805
|
-
* Verify backup file exists and is recent (Epic 5 - Story 5.2)
|
|
806
|
-
*
|
|
807
|
-
* Checks for backup files in backup directory and verifies they are recent enough.
|
|
808
|
-
* Required as safety check before executing link deletion.
|
|
809
|
-
*
|
|
810
|
-
* @param {number} maxAgeHours - Maximum age of backup in hours (default: 24)
|
|
811
|
-
* @returns {Object} Backup verification result with latest backup info
|
|
812
|
-
*/
|
|
813
|
-
declare function verifyBackupExists(maxAgeHours?: number): VerifyBackupResult;
|
|
814
|
-
/**
|
|
815
|
-
* Delete auto-generated links with batch processing (Epic 5 - Story 5.2)
|
|
816
|
-
*
|
|
817
|
-
* Executes batch deletion of auto-generated links with transaction support.
|
|
818
|
-
* Requires recent backup (within 24 hours) before execution.
|
|
819
|
-
* Logs all deletions to audit trail.
|
|
820
|
-
*
|
|
821
|
-
* Safety features:
|
|
822
|
-
* - Backup verification before deletion
|
|
823
|
-
* - Batch processing with transaction support
|
|
824
|
-
* - Dry-run mode for simulation
|
|
825
|
-
* - Large deletion warning (> 1000 links)
|
|
826
|
-
*
|
|
827
|
-
* @param {number} batchSize - Number of links to delete per batch (default: 100)
|
|
828
|
-
* @param {boolean} dryRun - If true, simulate deletion without actual changes (default: true)
|
|
829
|
-
* @returns {Object} Deletion result with counts and backup info
|
|
830
|
-
*/
|
|
831
|
-
declare function deleteAutoLinks(batchSize?: number, dryRun?: boolean): DeleteAutoLinksResult;
|
|
832
|
-
/**
|
|
833
|
-
* Validate cleanup result and generate post-cleanup report (Epic 5 - Story 5.2)
|
|
834
|
-
*
|
|
835
|
-
* Re-scans for remaining auto-generated links and evaluates cleanup success.
|
|
836
|
-
* Generates comprehensive report with statistics and recommendations.
|
|
837
|
-
*
|
|
838
|
-
* Success criteria:
|
|
839
|
-
* - SUCCESS: Remaining auto links < 5%
|
|
840
|
-
* - PARTIAL: Remaining auto links 5-10%
|
|
841
|
-
* - FAILED: Remaining auto links > 10%
|
|
842
|
-
*
|
|
843
|
-
* @returns {Object} Validation result with report and file path
|
|
844
|
-
*/
|
|
845
|
-
declare function validateCleanupResult(): {
|
|
846
|
-
status: string;
|
|
847
|
-
total_links_before: number;
|
|
848
|
-
auto_links_remaining: number;
|
|
849
|
-
remaining_ratio: number;
|
|
850
|
-
protected_links: number;
|
|
851
|
-
report: {
|
|
852
|
-
validated_at: string;
|
|
853
|
-
status: string;
|
|
854
|
-
message: string;
|
|
855
|
-
statistics: {
|
|
856
|
-
total_links: number;
|
|
857
|
-
remaining_auto_links: number;
|
|
858
|
-
remaining_ratio: string;
|
|
859
|
-
protected_links: number;
|
|
860
|
-
deletion_targets: number;
|
|
861
|
-
};
|
|
862
|
-
recommendation: string;
|
|
863
|
-
};
|
|
864
|
-
report_file: string;
|
|
865
|
-
markdown: string;
|
|
866
|
-
};
|
|
867
|
-
/**
|
|
868
|
-
* Calculate coverage metrics (Epic 4 - Story 4.1)
|
|
869
|
-
*
|
|
870
|
-
* Measures narrative coverage (% of decisions with narrative fields)
|
|
871
|
-
* and link coverage (% of decisions with at least one link).
|
|
872
|
-
*
|
|
873
|
-
* @returns {Object} Coverage metrics
|
|
874
|
-
*/
|
|
875
|
-
declare function calculateCoverage(): {
|
|
876
|
-
narrativeCoverage: string;
|
|
877
|
-
linkCoverage: string;
|
|
878
|
-
totalDecisions: number;
|
|
879
|
-
completeNarratives: number;
|
|
880
|
-
decisionsWithLinks: number;
|
|
881
|
-
};
|
|
882
|
-
/**
|
|
883
|
-
* Log restart attempt (Epic 4 - Story 4.2)
|
|
884
|
-
*
|
|
885
|
-
* Records restart attempt with success/failure status, latency, and mode.
|
|
886
|
-
* Replaces in-memory restart-metrics.js with SQLite-backed storage.
|
|
887
|
-
*
|
|
888
|
-
* @param {string} sessionId - Session identifier
|
|
889
|
-
* @param {string} status - 'success' or 'failure'
|
|
890
|
-
* @param {string|null} failureReason - 'NO_CHECKPOINT', 'LOAD_ERROR', 'CONTEXT_INCOMPLETE', or null
|
|
891
|
-
* @param {number} latencyMs - Latency in milliseconds
|
|
892
|
-
* @param {string} mode - 'full' (narrative+links) or 'summary' (summary only)
|
|
893
|
-
* @returns {void}
|
|
894
|
-
*/
|
|
895
|
-
declare function logRestartAttempt(sessionId: string, status: string, failureReason: string | null, latencyMs: number, mode?: string): void;
|
|
896
|
-
/**
|
|
897
|
-
* Calculate restart success rate (Epic 4 - Story 4.2)
|
|
898
|
-
*
|
|
899
|
-
* Calculates success rate over a given period (24h, 7d, 30d).
|
|
900
|
-
*
|
|
901
|
-
* @param {string} period - '24h', '7d', or '30d'
|
|
902
|
-
* @returns {Object} Success rate metrics
|
|
903
|
-
*/
|
|
904
|
-
declare function calculateRestartSuccessRate(period?: '24h' | '7d' | '30d'): {
|
|
905
|
-
period: "24h" | "7d" | "30d";
|
|
906
|
-
total: number;
|
|
907
|
-
success: number;
|
|
908
|
-
failure: number;
|
|
909
|
-
successRate: string;
|
|
910
|
-
meetsTarget: boolean;
|
|
911
|
-
};
|
|
912
|
-
/**
|
|
913
|
-
* Calculate restart latency percentiles (Epic 4 - Story 4.2)
|
|
914
|
-
*
|
|
915
|
-
* Calculates p50, p95, p99 latencies for successful restarts.
|
|
916
|
-
* Optionally filters by mode (full/summary).
|
|
917
|
-
*
|
|
918
|
-
* @param {string} period - '24h', '7d', or '30d'
|
|
919
|
-
* @param {string|null} mode - 'full', 'summary', or null (all modes)
|
|
920
|
-
* @returns {Object} Latency percentile metrics
|
|
921
|
-
*/
|
|
922
|
-
declare function calculateRestartLatency(period?: '24h' | '7d' | '30d', mode?: string | null): {
|
|
923
|
-
p50: number;
|
|
924
|
-
p95: number;
|
|
925
|
-
p99: number;
|
|
926
|
-
count: number;
|
|
927
|
-
mode: string;
|
|
928
|
-
};
|
|
929
|
-
/**
|
|
930
|
-
* Get restart metrics (Epic 4 - Story 4.2)
|
|
931
|
-
*
|
|
932
|
-
* Combines success rate and latency metrics for a given period.
|
|
933
|
-
*
|
|
934
|
-
* @param {string} period - '24h', '7d', or '30d'
|
|
935
|
-
* @param {boolean} includeLatency - Whether to include latency percentiles
|
|
936
|
-
* @returns {Object} Combined restart metrics
|
|
937
|
-
*/
|
|
938
|
-
declare function getRestartMetrics(period?: '24h' | '7d' | '30d', includeLatency?: boolean): {
|
|
939
|
-
successRate: ReturnType<typeof calculateRestartSuccessRate>;
|
|
940
|
-
latency?: {
|
|
941
|
-
full: ReturnType<typeof calculateRestartLatency>;
|
|
942
|
-
summary: ReturnType<typeof calculateRestartLatency>;
|
|
943
|
-
};
|
|
944
|
-
};
|
|
945
|
-
/**
|
|
946
|
-
* Calculate quality metrics (Epic 4 - Story 4.1)
|
|
947
|
-
*
|
|
948
|
-
* Measures narrative quality (field completeness per layer)
|
|
949
|
-
* and link quality (rich reason ratio, approved link ratio).
|
|
950
|
-
*
|
|
951
|
-
* @returns {Object} Quality metrics
|
|
952
|
-
*/
|
|
953
|
-
declare function calculateQuality(): {
|
|
954
|
-
narrativeQuality: {
|
|
955
|
-
evidence: string;
|
|
956
|
-
alternatives: string;
|
|
957
|
-
risks: string;
|
|
958
|
-
};
|
|
959
|
-
linkQuality: {
|
|
960
|
-
richReasonRatio: string;
|
|
961
|
-
approvedRatio: string;
|
|
962
|
-
totalLinks: number;
|
|
963
|
-
richLinks: number;
|
|
964
|
-
approvedLinks: number;
|
|
965
|
-
};
|
|
966
|
-
};
|
|
967
|
-
/**
|
|
968
|
-
* Generate quality report with recommendations (Epic 4 - Story 4.1 + 4.2)
|
|
969
|
-
*
|
|
970
|
-
* Generates a comprehensive quality report with coverage, quality metrics,
|
|
971
|
-
* restart metrics, and recommendations for improvement.
|
|
972
|
-
*
|
|
973
|
-
* @param {Object} options - Report options
|
|
974
|
-
* @param {string} [options.format='json'] - Output format: 'json' or 'markdown'
|
|
975
|
-
* @param {string} [options.period='7d'] - Period for restart metrics: '24h', '7d', or '30d'
|
|
976
|
-
* @param {Object} [options.thresholds] - Custom thresholds
|
|
977
|
-
* @param {number} [options.thresholds.narrativeCoverage=0.8] - Narrative coverage threshold (0-1)
|
|
978
|
-
* @param {number} [options.thresholds.linkCoverage=0.7] - Link coverage threshold (0-1)
|
|
979
|
-
* @param {number} [options.thresholds.richReasonRatio=0.7] - Rich reason ratio threshold (0-1)
|
|
980
|
-
* @param {number} [options.thresholds.restartSuccessRate=0.95] - Restart success rate threshold (0-1)
|
|
981
|
-
* @param {number} [options.thresholds.restartLatencyP95Full=2500] - Full mode p95 latency threshold (ms)
|
|
982
|
-
* @param {number} [options.thresholds.restartLatencyP95Summary=1000] - Summary mode p95 latency threshold (ms)
|
|
983
|
-
* @returns {Object|string} Quality report as JSON or Markdown
|
|
984
|
-
*/
|
|
985
|
-
declare function generateQualityReport(options?: QualityReportOptions): string | {
|
|
986
|
-
generated_at: string;
|
|
987
|
-
period: "24h" | "7d" | "30d" | null;
|
|
988
|
-
coverage: {
|
|
989
|
-
narrativeCoverage: string;
|
|
990
|
-
linkCoverage: string;
|
|
991
|
-
totalDecisions: number;
|
|
992
|
-
completeNarratives: number;
|
|
993
|
-
decisionsWithLinks: number;
|
|
994
|
-
};
|
|
995
|
-
quality: {
|
|
996
|
-
narrativeQuality: {
|
|
997
|
-
evidence: string;
|
|
998
|
-
alternatives: string;
|
|
999
|
-
risks: string;
|
|
1000
|
-
};
|
|
1001
|
-
linkQuality: {
|
|
1002
|
-
richReasonRatio: string;
|
|
1003
|
-
approvedRatio: string;
|
|
1004
|
-
totalLinks: number;
|
|
1005
|
-
richLinks: number;
|
|
1006
|
-
approvedLinks: number;
|
|
1007
|
-
};
|
|
1008
|
-
};
|
|
1009
|
-
restart: {
|
|
1010
|
-
successRate: ReturnType<typeof calculateRestartSuccessRate>;
|
|
1011
|
-
latency?: {
|
|
1012
|
-
full: ReturnType<typeof calculateRestartLatency>;
|
|
1013
|
-
summary: ReturnType<typeof calculateRestartLatency>;
|
|
1014
|
-
};
|
|
1015
|
-
};
|
|
1016
|
-
thresholds: {
|
|
1017
|
-
minSuccessRate?: number;
|
|
1018
|
-
maxLatencyMs?: number;
|
|
1019
|
-
narrativeCoverage: number;
|
|
1020
|
-
linkCoverage: number;
|
|
1021
|
-
richReasonRatio: number;
|
|
1022
|
-
restartSuccessRate: number;
|
|
1023
|
-
restartLatencyP95Full: number;
|
|
1024
|
-
restartLatencyP95Summary: number;
|
|
1025
|
-
};
|
|
1026
|
-
recommendations: {
|
|
1027
|
-
type: string;
|
|
1028
|
-
message: string;
|
|
1029
|
-
target: string;
|
|
1030
|
-
current: string;
|
|
1031
|
-
}[];
|
|
1032
|
-
format: "json" | "markdown" | null;
|
|
1033
|
-
};
|
|
302
|
+
* Public write boundary for audit findings. The store writer takes the adapter
|
|
303
|
+
* from its caller; this edge resolves the ambient adapter so the
|
|
304
|
+
* MAMAApiInterface signature stays (input) => Promise<string>.
|
|
305
|
+
*/
|
|
306
|
+
declare function createAuditFinding(input: Parameters<typeof createAuditFindingInAdapter>[1]): Promise<string>;
|
|
307
|
+
declare function upsertChannelSummary(input: Parameters<typeof upsertChannelSummaryInAdapter>[1]): Promise<void>;
|
|
308
|
+
declare function getChannelSummary(channelKey: string): Promise<Awaited<ReturnType<typeof getChannelSummaryInAdapter>>>;
|
|
309
|
+
declare function listOpenAuditFindings(): Promise<Awaited<ReturnType<typeof listOpenAuditFindingsInAdapter>>>;
|
|
310
|
+
declare function listMemoryEventsForMemory(memoryId: string): Promise<Awaited<ReturnType<typeof listMemoryEventsForMemoryInAdapter>>>;
|
|
311
|
+
declare function listRecentMemoryEvents(limit?: number): Promise<Awaited<ReturnType<typeof listRecentMemoryEventsInAdapter>>>;
|
|
312
|
+
declare function getMemoryProvenance(memoryId: string, options?: Parameters<typeof getMemoryProvenanceInAdapter>[2]): Promise<Awaited<ReturnType<typeof getMemoryProvenanceInAdapter>>>;
|
|
313
|
+
declare function listMemoriesByEnvelopeHash(envelopeHash: string, options?: Parameters<typeof listMemoriesByEnvelopeHashInAdapter>[2]): Promise<Awaited<ReturnType<typeof listMemoriesByEnvelopeHashInAdapter>>>;
|
|
314
|
+
declare function listMemoriesByGatewayCallId(gatewayCallId: string, options?: Parameters<typeof listMemoriesByGatewayCallIdInAdapter>[2]): Promise<Awaited<ReturnType<typeof listMemoriesByGatewayCallIdInAdapter>>>;
|
|
315
|
+
declare function listMemoriesByModelRunId(modelRunId: string, options?: Parameters<typeof listMemoriesByModelRunIdInAdapter>[2]): Promise<Awaited<ReturnType<typeof listMemoriesByModelRunIdInAdapter>>>;
|
|
316
|
+
declare function saveMemory(input: Parameters<typeof saveMemoryInAdapter>[1]): Promise<Awaited<ReturnType<typeof saveMemoryInAdapter>>>;
|
|
317
|
+
declare function recallMemory(query: string, options?: Parameters<typeof recallMemoryInAdapter>[2]): Promise<Awaited<ReturnType<typeof recallMemoryInAdapter>>>;
|
|
318
|
+
declare function buildProfile(scopes: Parameters<typeof buildProfileInAdapter>[1]): Promise<Awaited<ReturnType<typeof buildProfileInAdapter>>>;
|
|
319
|
+
declare function ingestMemory(input: Parameters<typeof ingestMemoryInAdapter>[1]): Promise<Awaited<ReturnType<typeof ingestMemoryInAdapter>>>;
|
|
320
|
+
declare function ingestConversation(input: Parameters<typeof ingestConversationInAdapter>[1]): Promise<Awaited<ReturnType<typeof ingestConversationInAdapter>>>;
|
|
321
|
+
declare function buildMemoryBootstrap(params: Parameters<typeof buildMemoryBootstrapInAdapter>[1]): Promise<Awaited<ReturnType<typeof buildMemoryBootstrapInAdapter>>>;
|
|
322
|
+
declare function recordMemoryAudit(input: Parameters<typeof recordMemoryAuditInAdapter>[1]): Promise<Awaited<ReturnType<typeof recordMemoryAuditInAdapter>>>;
|
|
323
|
+
declare function beginModelRun(input: Parameters<typeof beginModelRunInAdapter>[1]): Promise<Awaited<ReturnType<typeof beginModelRunInAdapter>>>;
|
|
324
|
+
declare function commitModelRun(modelRunId: string, summary?: string, tokenCount?: number): Promise<Awaited<ReturnType<typeof commitModelRunInAdapter>>>;
|
|
325
|
+
declare function failModelRun(modelRunId: string, errorSummary: string, tokenCount?: number): Promise<Awaited<ReturnType<typeof failModelRunInAdapter>>>;
|
|
326
|
+
declare function getModelRun(modelRunId: string): Promise<Awaited<ReturnType<typeof getModelRunInAdapter>>>;
|
|
327
|
+
declare function appendToolTrace(input: Parameters<typeof appendToolTraceInAdapter>[1]): Promise<Awaited<ReturnType<typeof appendToolTraceInAdapter>>>;
|
|
328
|
+
declare function listToolTracesForRun(modelRunId: string): Promise<Awaited<ReturnType<typeof listToolTracesForRunInAdapter>>>;
|
|
329
|
+
declare function listToolTraces(input: Parameters<typeof listToolTracesInAdapter>[1]): Promise<Awaited<ReturnType<typeof listToolTracesInAdapter>>>;
|
|
330
|
+
declare function readToolTrace(traceId: string, scope: Parameters<typeof readToolTraceInAdapter>[2]): Promise<Awaited<ReturnType<typeof readToolTraceInAdapter>>>;
|
|
1034
331
|
/**
|
|
1035
332
|
* MAMA Public API
|
|
1036
333
|
*
|
|
@@ -1043,21 +340,83 @@ declare function generateQualityReport(options?: QualityReportOptions): string |
|
|
|
1043
340
|
* 3. Claude-First Design - Claude decides what to save
|
|
1044
341
|
* 4. Non-Intrusive - Silent failures for helpers (suggest)
|
|
1045
342
|
*/
|
|
343
|
+
/**
|
|
344
|
+
* Instance-bound MAMA API factory.
|
|
345
|
+
*
|
|
346
|
+
* Same member surface as the ambient `mama` object, but every call reads and
|
|
347
|
+
* writes through the adapter the owner hands in — no module-global handle is
|
|
348
|
+
* consulted. Products that own their database lifetime (openDatabase) bind
|
|
349
|
+
* once at boot and pass this object down; the ambient `mama` export remains
|
|
350
|
+
* the compatibility boundary for callers without an instance.
|
|
351
|
+
*/
|
|
352
|
+
export declare function createMamaApi(adapter: DatabaseInstance): {
|
|
353
|
+
save: (params: SaveParams) => Promise<SaveResult>;
|
|
354
|
+
suggest: (userQuestion: string, options?: SuggestFunctionOptions) => Promise<any>;
|
|
355
|
+
saveMemory: (input: Parameters<typeof saveMemoryInAdapter>[1]) => Promise<{
|
|
356
|
+
success: boolean;
|
|
357
|
+
id: string;
|
|
358
|
+
saved_decision_id?: string;
|
|
359
|
+
}>;
|
|
360
|
+
recallMemory: (query: Parameters<typeof recallMemoryInAdapter>[1], options?: Parameters<typeof recallMemoryInAdapter>[2]) => Promise<import("./index.js").RecallBundle>;
|
|
361
|
+
list: (options?: ListDecisionsOptions) => Promise<string | DecisionRecord[]>;
|
|
362
|
+
listDecisions: (options?: ListDecisionsOptions) => Promise<string | DecisionRecord[]>;
|
|
363
|
+
listCheckpoints: (limit?: number) => Promise<CheckpointRow[]>;
|
|
364
|
+
updateOutcome: (decisionId: string, outcome: UpdateOutcomeParams) => Promise<void>;
|
|
365
|
+
buildProfile: (scopes: Parameters<typeof buildProfileInAdapter>[1]) => Promise<import("./index.js").ProfileSnapshot>;
|
|
366
|
+
ingestMemory: (input: Parameters<typeof ingestMemoryInAdapter>[1]) => Promise<{
|
|
367
|
+
success: boolean;
|
|
368
|
+
id: string;
|
|
369
|
+
}>;
|
|
370
|
+
ingestConversation: (input: Parameters<typeof ingestConversationInAdapter>[1]) => Promise<import("./index.js").IngestConversationResult>;
|
|
371
|
+
evolveMemory: (input: Parameters<typeof evolveMemory>[0]) => Promise<import("./memory/evolution-engine.js").EvolutionResult>;
|
|
372
|
+
buildMemoryBootstrap: (params: Parameters<typeof buildMemoryBootstrapInAdapter>[1]) => Promise<import("./memory/types.js").MemoryAgentBootstrap>;
|
|
373
|
+
createAuditAck: (input: Parameters<typeof createAuditAck>[0]) => import("./memory/types.js").MemoryAuditAck;
|
|
374
|
+
recordMemoryAudit: (input: Parameters<typeof recordMemoryAuditInAdapter>[1]) => Promise<{
|
|
375
|
+
eventIds: string[];
|
|
376
|
+
findingIds: string[];
|
|
377
|
+
state: import("./memory/types.js").ChannelSummaryStateRecord;
|
|
378
|
+
}>;
|
|
379
|
+
upsertChannelSummary: (input: Parameters<typeof upsertChannelSummaryInAdapter>[1]) => void;
|
|
380
|
+
getChannelSummary: (channelKey: Parameters<typeof getChannelSummaryInAdapter>[1]) => Promise<import("./memory/types.js").ChannelSummaryRecord | null>;
|
|
381
|
+
listAuditFindings: () => Promise<import("./index.js").AuditFindingRecord[]>;
|
|
382
|
+
listOpenAuditFindings: () => Promise<import("./index.js").AuditFindingRecord[]>;
|
|
383
|
+
createAuditFinding: (input: Parameters<typeof createAuditFindingInAdapter>[1]) => string;
|
|
384
|
+
getMemoryProvenance: (memoryId: Parameters<typeof getMemoryProvenanceInAdapter>[1], options?: Parameters<typeof getMemoryProvenanceInAdapter>[2]) => Promise<import("./index.js").MemoryProvenanceRecord | null>;
|
|
385
|
+
listMemoriesByEnvelopeHash: (envelopeHash: Parameters<typeof listMemoriesByEnvelopeHashInAdapter>[1], options?: Parameters<typeof listMemoriesByEnvelopeHashInAdapter>[2]) => Promise<import("./index.js").MemoryProvenanceRecord[]>;
|
|
386
|
+
listMemoriesByGatewayCallId: (gatewayCallId: Parameters<typeof listMemoriesByGatewayCallIdInAdapter>[1], options?: Parameters<typeof listMemoriesByGatewayCallIdInAdapter>[2]) => Promise<import("./index.js").MemoryProvenanceRecord[]>;
|
|
387
|
+
listMemoriesByModelRunId: (modelRunId: Parameters<typeof listMemoriesByModelRunIdInAdapter>[1], options?: Parameters<typeof listMemoriesByModelRunIdInAdapter>[2]) => Promise<import("./index.js").MemoryProvenanceRecord[]>;
|
|
388
|
+
listMemoryEventsForMemory: (memoryId: Parameters<typeof listMemoryEventsForMemoryInAdapter>[1]) => Promise<import("./memory/types.js").MemoryEventRecord[]>;
|
|
389
|
+
listRecentMemoryEvents: (limit?: Parameters<typeof listRecentMemoryEventsInAdapter>[1]) => Promise<import("./memory/types.js").MemoryEventRecord[]>;
|
|
390
|
+
beginModelRun: (input: Parameters<typeof beginModelRunInAdapter>[1]) => import("./index.js").ModelRunRecord;
|
|
391
|
+
commitModelRun: (modelRunId: Parameters<typeof commitModelRunInAdapter>[1], summary?: Parameters<typeof commitModelRunInAdapter>[2], tokenCount?: Parameters<typeof commitModelRunInAdapter>[3]) => import("./index.js").ModelRunRecord;
|
|
392
|
+
failModelRun: (modelRunId: Parameters<typeof failModelRunInAdapter>[1], errorSummary: Parameters<typeof failModelRunInAdapter>[2], tokenCount?: Parameters<typeof failModelRunInAdapter>[3]) => import("./index.js").ModelRunRecord;
|
|
393
|
+
getModelRun: (modelRunId: Parameters<typeof getModelRunInAdapter>[1]) => import("./index.js").ModelRunRecord | null;
|
|
394
|
+
listModelRunNativeInputs: (modelRunId: Parameters<typeof listModelRunNativeInputsInAdapter>[1], principalId: Parameters<typeof listModelRunNativeInputsInAdapter>[2], options?: Parameters<typeof listModelRunNativeInputsInAdapter>[3]) => Promise<{
|
|
395
|
+
items: import("./runtime/model-run-store.js").ModelRunNativeInput[];
|
|
396
|
+
nextCursor: number | null;
|
|
397
|
+
runStatus: import("./index.js").ModelRunStatus;
|
|
398
|
+
}>;
|
|
399
|
+
appendToolTrace: (input: Parameters<typeof appendToolTraceInAdapter>[1]) => Promise<import("./index.js").ToolTraceRecord>;
|
|
400
|
+
listToolTracesForRun: (modelRunId: Parameters<typeof listToolTracesForRunInAdapter>[1]) => Promise<import("./index.js").ToolTraceRecord[]>;
|
|
401
|
+
listToolTraces: (input: Parameters<typeof listToolTracesInAdapter>[1]) => Promise<import("./index.js").ToolTracePage>;
|
|
402
|
+
readToolTrace: (traceId: Parameters<typeof readToolTraceInAdapter>[1], scope: Parameters<typeof readToolTraceInAdapter>[2]) => Promise<import("./index.js").ToolTraceRecord | null>;
|
|
403
|
+
saveCheckpoint: (summary: string, openFiles?: string[], nextSteps?: string, recentConversation?: any[]) => Promise<number | bigint>;
|
|
404
|
+
loadCheckpoint: () => Promise<CheckpointRow | null>;
|
|
405
|
+
recall: (topic: string, options?: RecallOptions) => Promise<string | RecallGraphResult>;
|
|
406
|
+
expandWithGraph: (candidates: SearchCandidate[]) => Promise<SearchCandidate[]>;
|
|
407
|
+
};
|
|
408
|
+
export type MamaApi = ReturnType<typeof createMamaApi>;
|
|
1046
409
|
declare const mama: {
|
|
1047
410
|
save: typeof save;
|
|
1048
|
-
saveWithTrustedProvenance: typeof saveWithTrustedProvenance;
|
|
1049
411
|
suggest: typeof suggest;
|
|
1050
412
|
saveMemory: typeof saveMemory;
|
|
1051
|
-
saveMemoryWithTrustedProvenance: typeof saveMemoryWithTrustedProvenance;
|
|
1052
413
|
recallMemory: typeof recallMemory;
|
|
1053
414
|
list: typeof listDecisions;
|
|
1054
415
|
listCheckpoints: typeof listCheckpoints;
|
|
1055
416
|
updateOutcome: typeof updateOutcome;
|
|
1056
417
|
buildProfile: typeof buildProfile;
|
|
1057
418
|
ingestMemory: typeof ingestMemory;
|
|
1058
|
-
ingestWithTrustedProvenance: typeof ingestWithTrustedProvenance;
|
|
1059
419
|
ingestConversation: typeof ingestConversation;
|
|
1060
|
-
ingestConversationWithTrustedProvenance: typeof ingestConversationWithTrustedProvenance;
|
|
1061
420
|
evolveMemory: typeof evolveMemory;
|
|
1062
421
|
buildMemoryBootstrap: typeof buildMemoryBootstrap;
|
|
1063
422
|
createAuditAck: typeof createAuditAck;
|
|
@@ -1074,13 +433,9 @@ declare const mama: {
|
|
|
1074
433
|
listMemoryEventsForMemory: typeof listMemoryEventsForMemory;
|
|
1075
434
|
listRecentMemoryEvents: typeof listRecentMemoryEvents;
|
|
1076
435
|
beginModelRun: typeof beginModelRun;
|
|
1077
|
-
beginModelRunInAdapter: typeof beginModelRunInAdapter;
|
|
1078
436
|
commitModelRun: typeof commitModelRun;
|
|
1079
|
-
commitModelRunInAdapter: typeof commitModelRunInAdapter;
|
|
1080
437
|
failModelRun: typeof failModelRun;
|
|
1081
|
-
failModelRunInAdapter: typeof failModelRunInAdapter;
|
|
1082
438
|
getModelRun: typeof getModelRun;
|
|
1083
|
-
getModelRunInAdapter: typeof getModelRunInAdapter;
|
|
1084
439
|
appendToolTrace: typeof appendToolTrace;
|
|
1085
440
|
listToolTracesForRun: typeof listToolTracesForRun;
|
|
1086
441
|
listToolTraces: typeof listToolTraces;
|
|
@@ -1088,27 +443,8 @@ declare const mama: {
|
|
|
1088
443
|
saveCheckpoint: typeof saveCheckpoint;
|
|
1089
444
|
loadCheckpoint: typeof loadCheckpoint;
|
|
1090
445
|
recall: typeof recall;
|
|
1091
|
-
proposeLink: typeof proposeLink;
|
|
1092
|
-
approveLink: typeof approveLink;
|
|
1093
|
-
rejectLink: typeof rejectLink;
|
|
1094
|
-
getPendingLinks: typeof getPendingLinks;
|
|
1095
|
-
deprecateAutoLinks: typeof deprecateAutoLinks;
|
|
1096
|
-
calculateCoverage: typeof calculateCoverage;
|
|
1097
|
-
calculateQuality: typeof calculateQuality;
|
|
1098
|
-
generateQualityReport: typeof generateQualityReport;
|
|
1099
|
-
logRestartAttempt: typeof logRestartAttempt;
|
|
1100
|
-
calculateRestartSuccessRate: typeof calculateRestartSuccessRate;
|
|
1101
|
-
calculateRestartLatency: typeof calculateRestartLatency;
|
|
1102
|
-
getRestartMetrics: typeof getRestartMetrics;
|
|
1103
|
-
scanAutoLinks: typeof scanAutoLinks;
|
|
1104
|
-
createLinkBackup: typeof createLinkBackup;
|
|
1105
|
-
generatePreCleanupReport: typeof generatePreCleanupReport;
|
|
1106
|
-
restoreLinkBackup: typeof restoreLinkBackup;
|
|
1107
|
-
verifyBackupExists: typeof verifyBackupExists;
|
|
1108
|
-
deleteAutoLinks: typeof deleteAutoLinks;
|
|
1109
|
-
validateCleanupResult: typeof validateCleanupResult;
|
|
1110
446
|
expandWithGraph: typeof expandWithGraph;
|
|
1111
447
|
};
|
|
1112
|
-
export { save,
|
|
448
|
+
export { save, suggest, saveMemory, recallMemory, listDecisions as list, listCheckpoints, updateOutcome, buildProfile, ingestMemory, ingestConversation, evolveMemory, buildMemoryBootstrap, createAuditAck, recordMemoryAudit, upsertChannelSummary, getChannelSummary, listOpenAuditFindings, createAuditFinding, getMemoryProvenance, listMemoriesByEnvelopeHash, listMemoriesByGatewayCallId, listMemoriesByModelRunId, listMemoryEventsForMemory, listRecentMemoryEvents, beginModelRun, commitModelRun, failModelRun, getModelRun, appendToolTrace, listToolTracesForRun, listToolTraces, readToolTrace, saveCheckpoint, loadCheckpoint, recall, expandWithGraph, };
|
|
1113
449
|
export default mama;
|
|
1114
450
|
//# sourceMappingURL=mama-api.d.ts.map
|