@jungjaehoon/mama-core 2.4.1 → 4.1.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/db/migrations/099-commitment-revision-graph.sql +2 -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 +1985 -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/commitment-revision-migration.d.ts +4 -0
- package/dist/knowledge/commitment-revision-migration.js +50 -0
- package/dist/knowledge/commitments.d.ts +192 -0
- package/dist/knowledge/commitments.js +386 -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/judgment-edge.d.ts +6 -0
- package/dist/knowledge/judgment-edge.js +22 -0
- package/dist/knowledge/judgments.d.ts +118 -0
- package/dist/knowledge/judgments.js +802 -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 +152 -0
- package/dist/runtime/drivers/claude-cli-wrapper.js +375 -0
- package/dist/runtime/drivers/claude-effort.d.ts +4 -0
- package/dist/runtime/drivers/claude-effort.js +16 -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 +425 -0
- package/dist/runtime/drivers/persistent-cli-process.js +1529 -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
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.listVisibleRawCandidates = listVisibleRawCandidates;
|
|
4
|
-
exports.listVisibleMemoryCandidates = listVisibleMemoryCandidates;
|
|
5
|
-
exports.listVisibleCaseCandidates = listVisibleCaseCandidates;
|
|
6
|
-
exports.listVisibleEdgeCandidates = listVisibleEdgeCandidates;
|
|
7
|
-
exports.listVisibleAgentSituationSources = listVisibleAgentSituationSources;
|
|
8
|
-
const types_js_1 = require("../memory/types.js");
|
|
9
|
-
function placeholders(values) {
|
|
10
|
-
return values.map(() => '?').join(', ');
|
|
11
|
-
}
|
|
12
|
-
function scopeKey(scope) {
|
|
13
|
-
return `${scope.kind}:${scope.id}`;
|
|
14
|
-
}
|
|
15
|
-
function refKey(ref) {
|
|
16
|
-
return `${ref.kind}:${ref.id}`;
|
|
17
|
-
}
|
|
18
|
-
function tableExists(adapter, table) {
|
|
19
|
-
const row = adapter
|
|
20
|
-
.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = ?")
|
|
21
|
-
.get(table);
|
|
22
|
-
return Boolean(row?.name);
|
|
23
|
-
}
|
|
24
|
-
function normalizeLimit(limit) {
|
|
25
|
-
return Math.max(0, Math.min(100, Math.floor(limit)));
|
|
26
|
-
}
|
|
27
|
-
function visibilityEndMs(input) {
|
|
28
|
-
const asOf = input.effective_filters.as_of;
|
|
29
|
-
if (!asOf) {
|
|
30
|
-
return input.range_end_ms;
|
|
31
|
-
}
|
|
32
|
-
const parsed = Date.parse(asOf);
|
|
33
|
-
if (!Number.isFinite(parsed)) {
|
|
34
|
-
throw new Error(`Invalid agent situation as_of: ${asOf}`);
|
|
35
|
-
}
|
|
36
|
-
return Math.min(input.range_end_ms, parsed);
|
|
37
|
-
}
|
|
38
|
-
function parseCaseScopeRefs(row) {
|
|
39
|
-
const caseId = String(row.case_id ?? '<unknown>');
|
|
40
|
-
if (typeof row.scope_refs !== 'string' || row.scope_refs.length === 0) {
|
|
41
|
-
throw new Error(`Invalid case_truth.scope_refs for case ${caseId}: expected a JSON array string.`);
|
|
42
|
-
}
|
|
43
|
-
let parsed;
|
|
44
|
-
try {
|
|
45
|
-
parsed = JSON.parse(row.scope_refs);
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
throw new Error(`Invalid case_truth.scope_refs for case ${caseId}: malformed JSON.`);
|
|
49
|
-
}
|
|
50
|
-
if (!Array.isArray(parsed)) {
|
|
51
|
-
throw new Error(`Invalid case_truth.scope_refs for case ${caseId}: expected a JSON array.`);
|
|
52
|
-
}
|
|
53
|
-
return parsed.map((scope, index) => {
|
|
54
|
-
if (!scope || typeof scope !== 'object') {
|
|
55
|
-
throw new Error(`Invalid case_truth.scope_refs for case ${caseId}: entry ${index} must be an object.`);
|
|
56
|
-
}
|
|
57
|
-
const record = scope;
|
|
58
|
-
if (typeof record.kind !== 'string' ||
|
|
59
|
-
typeof record.id !== 'string' ||
|
|
60
|
-
!types_js_1.MEMORY_SCOPE_KINDS.includes(record.kind)) {
|
|
61
|
-
throw new Error(`Invalid case_truth.scope_refs for case ${caseId}: entry ${index} must include a valid kind and id.`);
|
|
62
|
-
}
|
|
63
|
-
return { kind: record.kind, id: record.id };
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
function isScopeVisible(scope, effective) {
|
|
67
|
-
const visible = new Set(effective.scopes.map(scopeKey));
|
|
68
|
-
return visible.has(scopeKey(scope));
|
|
69
|
-
}
|
|
70
|
-
function caseTimestampMs(row) {
|
|
71
|
-
const caseId = String(row.case_id ?? 'unknown');
|
|
72
|
-
const timestampFields = [
|
|
73
|
-
['last_activity_at', row.last_activity_at],
|
|
74
|
-
['updated_at', row.updated_at],
|
|
75
|
-
['created_at', row.created_at],
|
|
76
|
-
];
|
|
77
|
-
for (const [field, value] of timestampFields) {
|
|
78
|
-
if (value === null || value === undefined || value === '') {
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
if (typeof value !== 'string') {
|
|
82
|
-
throw new Error(`Invalid case_truth timestamp for case ${caseId}: ${field} must be an ISO timestamp string.`);
|
|
83
|
-
}
|
|
84
|
-
if (typeof value === 'string') {
|
|
85
|
-
const parsed = Date.parse(value);
|
|
86
|
-
if (Number.isFinite(parsed)) {
|
|
87
|
-
return parsed;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
throw new Error(`Invalid case_truth timestamp for case ${caseId}: expected last_activity_at, updated_at, or created_at to contain a valid ISO timestamp.`);
|
|
92
|
-
}
|
|
93
|
-
function isOpenQuestion(row) {
|
|
94
|
-
const text = `${String(row.topic ?? '')} ${String(row.decision ?? '')} ${String(row.summary ?? '')}`;
|
|
95
|
-
return row.kind === 'task' || text.includes('?') || /\b(question|decide|answer)\b/i.test(text);
|
|
96
|
-
}
|
|
97
|
-
function listVisibleRawCandidates(adapter, input) {
|
|
98
|
-
if (!tableExists(adapter, 'connector_event_index')) {
|
|
99
|
-
return [];
|
|
100
|
-
}
|
|
101
|
-
const connectors = input.effective_filters.connectors;
|
|
102
|
-
const scopes = input.effective_filters.scopes;
|
|
103
|
-
const projectIds = input.effective_filters.project_refs.map((project) => project.id);
|
|
104
|
-
if (connectors.length === 0 || scopes.length === 0 || projectIds.length === 0) {
|
|
105
|
-
return [];
|
|
106
|
-
}
|
|
107
|
-
const endMs = visibilityEndMs(input);
|
|
108
|
-
const scopeClauses = scopes
|
|
109
|
-
.map(() => '(memory_scope_kind = ? AND memory_scope_id = ?)')
|
|
110
|
-
.join(' OR ');
|
|
111
|
-
const params = [input.effective_filters.tenant_id, ...projectIds, ...connectors];
|
|
112
|
-
for (const scope of scopes) {
|
|
113
|
-
params.push(scope.kind, scope.id);
|
|
114
|
-
}
|
|
115
|
-
params.push(input.range_start_ms, endMs, normalizeLimit(input.limit));
|
|
116
|
-
const rows = adapter
|
|
117
|
-
.prepare(`
|
|
118
|
-
SELECT event_index_id, source_connector, channel, title, content, event_datetime,
|
|
119
|
-
memory_scope_kind, memory_scope_id
|
|
120
|
-
FROM connector_event_index
|
|
121
|
-
WHERE tenant_id = ?
|
|
122
|
-
AND project_id IN (${placeholders(projectIds)})
|
|
123
|
-
AND source_connector IN (${placeholders(connectors)})
|
|
124
|
-
AND (${scopeClauses})
|
|
125
|
-
AND event_datetime BETWEEN ? AND ?
|
|
126
|
-
ORDER BY event_datetime DESC, event_index_id ASC
|
|
127
|
-
LIMIT ?
|
|
128
|
-
`)
|
|
129
|
-
.all(...params);
|
|
130
|
-
return rows.map((row) => ({
|
|
131
|
-
ref: { kind: 'raw', id: String(row.event_index_id) },
|
|
132
|
-
kind: 'raw',
|
|
133
|
-
title: String(row.title ?? 'Untitled raw event'),
|
|
134
|
-
summary: String(row.content ?? '').slice(0, 240),
|
|
135
|
-
content: String(row.content ?? ''),
|
|
136
|
-
timestamp_ms: Number(row.event_datetime),
|
|
137
|
-
connector: String(row.source_connector),
|
|
138
|
-
channel_id: typeof row.channel === 'string' ? row.channel : null,
|
|
139
|
-
scope: typeof row.memory_scope_kind === 'string' && typeof row.memory_scope_id === 'string'
|
|
140
|
-
? { kind: row.memory_scope_kind, id: row.memory_scope_id }
|
|
141
|
-
: null,
|
|
142
|
-
}));
|
|
143
|
-
}
|
|
144
|
-
function listVisibleMemoryCandidates(adapter, input) {
|
|
145
|
-
if (!tableExists(adapter, 'decisions')) {
|
|
146
|
-
return [];
|
|
147
|
-
}
|
|
148
|
-
const scopes = input.effective_filters.scopes;
|
|
149
|
-
if (scopes.length === 0) {
|
|
150
|
-
return [];
|
|
151
|
-
}
|
|
152
|
-
const endMs = visibilityEndMs(input);
|
|
153
|
-
const scopeClauses = scopes.map(() => '(ms.kind = ? AND ms.external_id = ?)').join(' OR ');
|
|
154
|
-
const params = [];
|
|
155
|
-
for (const scope of scopes) {
|
|
156
|
-
params.push(scope.kind, scope.id);
|
|
157
|
-
}
|
|
158
|
-
params.push(input.range_start_ms, endMs, normalizeLimit(input.limit));
|
|
159
|
-
const rows = adapter
|
|
160
|
-
.prepare(`
|
|
161
|
-
SELECT DISTINCT d.id, d.topic, d.decision, d.reasoning, d.kind, d.status, d.summary,
|
|
162
|
-
d.confidence, d.event_datetime, d.created_at, ms.kind AS scope_kind,
|
|
163
|
-
ms.external_id AS scope_id
|
|
164
|
-
FROM decisions d
|
|
165
|
-
JOIN memory_scope_bindings msb ON msb.memory_id = d.id
|
|
166
|
-
JOIN memory_scopes ms ON ms.id = msb.scope_id
|
|
167
|
-
WHERE (${scopeClauses})
|
|
168
|
-
AND COALESCE(d.event_datetime, d.created_at) BETWEEN ? AND ?
|
|
169
|
-
ORDER BY COALESCE(d.event_datetime, d.created_at) DESC, d.id ASC
|
|
170
|
-
LIMIT ?
|
|
171
|
-
`)
|
|
172
|
-
.all(...params);
|
|
173
|
-
return rows.map((row) => ({
|
|
174
|
-
ref: { kind: 'memory', id: String(row.id) },
|
|
175
|
-
kind: 'memory',
|
|
176
|
-
title: String(row.topic ?? row.decision ?? 'Memory'),
|
|
177
|
-
summary: String(row.summary ?? row.decision ?? row.reasoning ?? ''),
|
|
178
|
-
topic: String(row.topic ?? ''),
|
|
179
|
-
timestamp_ms: Number(row.event_datetime ?? row.created_at ?? 0),
|
|
180
|
-
confidence: typeof row.confidence === 'number' ? row.confidence : Number(row.confidence ?? 1),
|
|
181
|
-
status: typeof row.status === 'string' ? row.status : null,
|
|
182
|
-
is_open_question: isOpenQuestion(row),
|
|
183
|
-
has_debate_edge: false,
|
|
184
|
-
scope: typeof row.scope_kind === 'string' && typeof row.scope_id === 'string'
|
|
185
|
-
? { kind: row.scope_kind, id: row.scope_id }
|
|
186
|
-
: null,
|
|
187
|
-
}));
|
|
188
|
-
}
|
|
189
|
-
function listVisibleCaseCandidates(adapter, input) {
|
|
190
|
-
if (!tableExists(adapter, 'case_truth')) {
|
|
191
|
-
return [];
|
|
192
|
-
}
|
|
193
|
-
const endMs = visibilityEndMs(input);
|
|
194
|
-
const rows = adapter
|
|
195
|
-
.prepare(`
|
|
196
|
-
SELECT case_id, title, status, confidence, scope_refs, last_activity_at, updated_at, created_at
|
|
197
|
-
FROM case_truth
|
|
198
|
-
ORDER BY COALESCE(last_activity_at, updated_at, created_at) DESC, case_id ASC
|
|
199
|
-
`)
|
|
200
|
-
.all();
|
|
201
|
-
return rows
|
|
202
|
-
.map((row) => {
|
|
203
|
-
const timestamp = caseTimestampMs(row);
|
|
204
|
-
if (timestamp < input.range_start_ms || timestamp > endMs) {
|
|
205
|
-
return null;
|
|
206
|
-
}
|
|
207
|
-
const visibleScope = parseCaseScopeRefs(row).find((scope) => isScopeVisible(scope, input.effective_filters));
|
|
208
|
-
if (!visibleScope) {
|
|
209
|
-
return null;
|
|
210
|
-
}
|
|
211
|
-
return {
|
|
212
|
-
ref: { kind: 'case', id: String(row.case_id) },
|
|
213
|
-
kind: 'case',
|
|
214
|
-
title: String(row.title ?? 'Case'),
|
|
215
|
-
summary: String(row.status ?? ''),
|
|
216
|
-
timestamp_ms: timestamp,
|
|
217
|
-
confidence: row.confidence === 'low' ? 0.4 : row.confidence === 'medium' ? 0.7 : 1,
|
|
218
|
-
status: typeof row.status === 'string' ? row.status : null,
|
|
219
|
-
scope: visibleScope,
|
|
220
|
-
};
|
|
221
|
-
})
|
|
222
|
-
.filter((row) => Boolean(row))
|
|
223
|
-
.slice(0, normalizeLimit(input.limit));
|
|
224
|
-
}
|
|
225
|
-
function listVisibleEdgeCandidates(adapter, input, visibleRefs) {
|
|
226
|
-
if (!tableExists(adapter, 'twin_edges')) {
|
|
227
|
-
return [];
|
|
228
|
-
}
|
|
229
|
-
const visible = new Set(visibleRefs.map(refKey));
|
|
230
|
-
if (visible.size === 0) {
|
|
231
|
-
return [];
|
|
232
|
-
}
|
|
233
|
-
const uniqueVisibleRefs = [...new Map(visibleRefs.map((ref) => [refKey(ref), ref])).values()];
|
|
234
|
-
const subjectClauses = uniqueVisibleRefs
|
|
235
|
-
.map(() => '(subject_kind = ? AND subject_id = ?)')
|
|
236
|
-
.join(' OR ');
|
|
237
|
-
const objectClauses = uniqueVisibleRefs
|
|
238
|
-
.map(() => '(object_kind = ? AND object_id = ?)')
|
|
239
|
-
.join(' OR ');
|
|
240
|
-
const params = [input.range_start_ms, visibilityEndMs(input)];
|
|
241
|
-
for (const ref of uniqueVisibleRefs) {
|
|
242
|
-
params.push(ref.kind, ref.id);
|
|
243
|
-
}
|
|
244
|
-
for (const ref of uniqueVisibleRefs) {
|
|
245
|
-
params.push(ref.kind, ref.id);
|
|
246
|
-
}
|
|
247
|
-
params.push(normalizeLimit(input.limit));
|
|
248
|
-
const rows = adapter
|
|
249
|
-
.prepare(`
|
|
250
|
-
SELECT edge_id, edge_type, subject_kind, subject_id, object_kind, object_id,
|
|
251
|
-
confidence, reason_text, created_at
|
|
252
|
-
FROM twin_edges
|
|
253
|
-
WHERE created_at BETWEEN ? AND ?
|
|
254
|
-
AND (${subjectClauses})
|
|
255
|
-
AND (${objectClauses})
|
|
256
|
-
ORDER BY created_at DESC, edge_id ASC
|
|
257
|
-
LIMIT ?
|
|
258
|
-
`)
|
|
259
|
-
.all(...params);
|
|
260
|
-
return rows
|
|
261
|
-
.map((row) => {
|
|
262
|
-
const subject = {
|
|
263
|
-
kind: String(row.subject_kind),
|
|
264
|
-
id: String(row.subject_id),
|
|
265
|
-
};
|
|
266
|
-
const object = {
|
|
267
|
-
kind: String(row.object_kind),
|
|
268
|
-
id: String(row.object_id),
|
|
269
|
-
};
|
|
270
|
-
if (!visible.has(refKey(subject)) || !visible.has(refKey(object))) {
|
|
271
|
-
return null;
|
|
272
|
-
}
|
|
273
|
-
return {
|
|
274
|
-
ref: { kind: 'edge', id: String(row.edge_id) },
|
|
275
|
-
kind: String(row.edge_type),
|
|
276
|
-
title: String(row.edge_type),
|
|
277
|
-
summary: String(row.reason_text ?? ''),
|
|
278
|
-
timestamp_ms: Number(row.created_at),
|
|
279
|
-
confidence: typeof row.confidence === 'number' ? row.confidence : Number(row.confidence ?? 1),
|
|
280
|
-
status: null,
|
|
281
|
-
subject_ref: subject,
|
|
282
|
-
object_ref: object,
|
|
283
|
-
};
|
|
284
|
-
})
|
|
285
|
-
.filter((row) => Boolean(row))
|
|
286
|
-
.slice(0, normalizeLimit(input.limit));
|
|
287
|
-
}
|
|
288
|
-
function listVisibleAgentSituationSources(adapter, input) {
|
|
289
|
-
const raw = listVisibleRawCandidates(adapter, input);
|
|
290
|
-
const memories = listVisibleMemoryCandidates(adapter, input);
|
|
291
|
-
const cases = listVisibleCaseCandidates(adapter, input);
|
|
292
|
-
const visibleRefs = [
|
|
293
|
-
...raw.map((item) => item.ref),
|
|
294
|
-
...memories.map((item) => item.ref),
|
|
295
|
-
...cases.map((item) => item.ref),
|
|
296
|
-
];
|
|
297
|
-
const edges = listVisibleEdgeCandidates(adapter, input, visibleRefs);
|
|
298
|
-
return { raw, memories, cases, edges };
|
|
299
|
-
}
|
|
300
|
-
//# sourceMappingURL=source-readers.js.map
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import type { MemoryScopeRef } from '../memory/types.js';
|
|
2
|
-
import type { TwinRef } from '../edges/types.js';
|
|
3
|
-
export type SituationFocus = 'decisions' | 'risks' | 'open_questions' | 'cases' | 'raw';
|
|
4
|
-
export type SituationRefKind = TwinRef['kind'] | 'memory';
|
|
5
|
-
export interface SituationRef {
|
|
6
|
-
kind: SituationRefKind;
|
|
7
|
-
id: string;
|
|
8
|
-
}
|
|
9
|
-
export interface SituationProjectRef {
|
|
10
|
-
kind: 'project';
|
|
11
|
-
id: string;
|
|
12
|
-
}
|
|
13
|
-
export interface AgentSituationEffectiveFilters {
|
|
14
|
-
scopes: MemoryScopeRef[];
|
|
15
|
-
connectors: string[];
|
|
16
|
-
project_refs: SituationProjectRef[];
|
|
17
|
-
tenant_id: string;
|
|
18
|
-
as_of?: string | null;
|
|
19
|
-
}
|
|
20
|
-
export interface AgentSituationCacheKeyInput extends AgentSituationEffectiveFilters {
|
|
21
|
-
range_start_ms: number;
|
|
22
|
-
range_end_ms: number;
|
|
23
|
-
focus: SituationFocus[];
|
|
24
|
-
limit: number;
|
|
25
|
-
ranking_policy_version: string;
|
|
26
|
-
}
|
|
27
|
-
export interface AgentSituationCacheKeyResult {
|
|
28
|
-
cacheKey: string;
|
|
29
|
-
canonicalInput: AgentSituationCacheKeyInput;
|
|
30
|
-
canonicalJson: string;
|
|
31
|
-
filtersHash: string;
|
|
32
|
-
scopeHash: string;
|
|
33
|
-
}
|
|
34
|
-
export type SituationCaveatCode = 'connector_stale' | 'some_sources_unavailable' | 'low_confidence_visible_memory' | 'graph_api_unavailable_until_m6' | 'case_visibility_incomplete' | 'no_visible_sources';
|
|
35
|
-
export interface SituationSourceCoverage {
|
|
36
|
-
connector?: string;
|
|
37
|
-
channel_id?: string | null;
|
|
38
|
-
memory_scope?: MemoryScopeRef;
|
|
39
|
-
raw_count: number;
|
|
40
|
-
memory_count: number;
|
|
41
|
-
case_count: number;
|
|
42
|
-
edge_count: number;
|
|
43
|
-
last_seen: string | null;
|
|
44
|
-
stale: boolean;
|
|
45
|
-
}
|
|
46
|
-
export interface SituationBriefing {
|
|
47
|
-
decisions: string[];
|
|
48
|
-
facts: string[];
|
|
49
|
-
open_questions: string[];
|
|
50
|
-
risks: string[];
|
|
51
|
-
}
|
|
52
|
-
export interface SituationRankedItem {
|
|
53
|
-
ref: SituationRef;
|
|
54
|
-
kind: string;
|
|
55
|
-
score: number;
|
|
56
|
-
reasons: string[];
|
|
57
|
-
caveats: string[];
|
|
58
|
-
}
|
|
59
|
-
export interface SituationPendingHumanQuestion {
|
|
60
|
-
memory_id: string;
|
|
61
|
-
title: string;
|
|
62
|
-
summary: string;
|
|
63
|
-
}
|
|
64
|
-
export interface SituationEntityCluster {
|
|
65
|
-
label: string;
|
|
66
|
-
entity_refs: Array<{
|
|
67
|
-
kind: 'entity';
|
|
68
|
-
id: string;
|
|
69
|
-
}>;
|
|
70
|
-
source_refs: Array<{
|
|
71
|
-
kind: 'raw' | 'memory' | 'case';
|
|
72
|
-
id: string;
|
|
73
|
-
}>;
|
|
74
|
-
caveats: string[];
|
|
75
|
-
}
|
|
76
|
-
export interface SituationRecommendedTool {
|
|
77
|
-
tool: 'raw.search' | 'raw.searchAll' | 'raw.window' | 'memory.recall' | 'graph.neighborhood';
|
|
78
|
-
args: Record<string, unknown>;
|
|
79
|
-
reason: string;
|
|
80
|
-
expected_refs: SituationRef[];
|
|
81
|
-
}
|
|
82
|
-
export interface AgentSituationPacket {
|
|
83
|
-
packet_id: string;
|
|
84
|
-
scope: MemoryScopeRef[];
|
|
85
|
-
range_start: string;
|
|
86
|
-
range_end: string;
|
|
87
|
-
generated_at: string;
|
|
88
|
-
freshness: Record<string, unknown>;
|
|
89
|
-
source_coverage: SituationSourceCoverage[];
|
|
90
|
-
briefing: SituationBriefing;
|
|
91
|
-
ranked_items: SituationRankedItem[];
|
|
92
|
-
top_memory_refs: string[];
|
|
93
|
-
pending_human_questions: SituationPendingHumanQuestion[];
|
|
94
|
-
entity_clusters: SituationEntityCluster[];
|
|
95
|
-
recommended_next_tools: SituationRecommendedTool[];
|
|
96
|
-
ranking_policy_version: string;
|
|
97
|
-
ttl_seconds: number;
|
|
98
|
-
generated_from_slice_ids: string[];
|
|
99
|
-
caveats: string[];
|
|
100
|
-
cache: {
|
|
101
|
-
hit: boolean;
|
|
102
|
-
cache_key: string;
|
|
103
|
-
expires_at: string;
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
export interface AgentSituationInput {
|
|
107
|
-
scope: MemoryScopeRef[];
|
|
108
|
-
range_start_ms: number;
|
|
109
|
-
range_end_ms: number;
|
|
110
|
-
focus: SituationFocus[];
|
|
111
|
-
limit: number;
|
|
112
|
-
effective_filters: AgentSituationEffectiveFilters;
|
|
113
|
-
envelope_hash: string;
|
|
114
|
-
agent_id: string;
|
|
115
|
-
model_run_id: string;
|
|
116
|
-
ranking_policy_version?: string;
|
|
117
|
-
refresh?: boolean;
|
|
118
|
-
now_ms?: number;
|
|
119
|
-
}
|
|
120
|
-
export interface AgentSituationPacketRecord {
|
|
121
|
-
packet_id: string;
|
|
122
|
-
cache_key: string;
|
|
123
|
-
scope_json: string;
|
|
124
|
-
scope: MemoryScopeRef[];
|
|
125
|
-
scope_hash: string;
|
|
126
|
-
range_start_ms: number;
|
|
127
|
-
range_end_ms: number;
|
|
128
|
-
focus_json: string;
|
|
129
|
-
focus: SituationFocus[];
|
|
130
|
-
envelope_hash: string;
|
|
131
|
-
envelope_effective_filters_json: string;
|
|
132
|
-
envelope_effective_filters: AgentSituationEffectiveFilters;
|
|
133
|
-
envelope_effective_filters_hash: string;
|
|
134
|
-
ranking_policy_version: string;
|
|
135
|
-
generated_at: number;
|
|
136
|
-
expires_at: number;
|
|
137
|
-
ttl_seconds: number;
|
|
138
|
-
freshness_json: string;
|
|
139
|
-
freshness: Record<string, unknown>;
|
|
140
|
-
source_coverage_json: string;
|
|
141
|
-
source_coverage: SituationSourceCoverage[];
|
|
142
|
-
briefing_json: string;
|
|
143
|
-
briefing: SituationBriefing;
|
|
144
|
-
ranked_items_json: string;
|
|
145
|
-
ranked_items: SituationRankedItem[];
|
|
146
|
-
top_memory_refs_json: string;
|
|
147
|
-
top_memory_refs: string[];
|
|
148
|
-
pending_human_questions_json: string;
|
|
149
|
-
pending_human_questions: SituationPendingHumanQuestion[];
|
|
150
|
-
entity_clusters_json: string;
|
|
151
|
-
entity_clusters: SituationEntityCluster[];
|
|
152
|
-
recommended_next_tools_json: string;
|
|
153
|
-
recommended_next_tools: SituationRecommendedTool[];
|
|
154
|
-
generated_from_slice_ids_json: string;
|
|
155
|
-
generated_from_slice_ids: string[];
|
|
156
|
-
caveats_json: string;
|
|
157
|
-
caveats: string[];
|
|
158
|
-
agent_id: string;
|
|
159
|
-
model_run_id: string;
|
|
160
|
-
input_snapshot_ref: string;
|
|
161
|
-
source_refs_json: string;
|
|
162
|
-
source_refs: SituationRef[];
|
|
163
|
-
tenant_id: string;
|
|
164
|
-
project_id: string;
|
|
165
|
-
memory_scope_kind: MemoryScopeRef['kind'];
|
|
166
|
-
memory_scope_id: string;
|
|
167
|
-
created_at: number;
|
|
168
|
-
}
|
|
169
|
-
export interface AgentSituationLease {
|
|
170
|
-
cache_key: string;
|
|
171
|
-
ranking_policy_version: string;
|
|
172
|
-
lease_owner: string;
|
|
173
|
-
lease_expires_at: number;
|
|
174
|
-
created_at: number;
|
|
175
|
-
}
|
|
176
|
-
export interface AgentSituationCandidate {
|
|
177
|
-
ref: SituationRef;
|
|
178
|
-
kind: string;
|
|
179
|
-
title: string;
|
|
180
|
-
summary: string;
|
|
181
|
-
timestamp_ms: number;
|
|
182
|
-
confidence?: number | null;
|
|
183
|
-
status?: string | null;
|
|
184
|
-
is_open_question?: boolean;
|
|
185
|
-
has_debate_edge?: boolean;
|
|
186
|
-
connector?: string | null;
|
|
187
|
-
channel_id?: string | null;
|
|
188
|
-
scope?: MemoryScopeRef | null;
|
|
189
|
-
}
|
|
190
|
-
export interface SituationScore {
|
|
191
|
-
score: number;
|
|
192
|
-
reasons: string[];
|
|
193
|
-
caveats: string[];
|
|
194
|
-
}
|
|
195
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { DatabaseAdapter as DBManagerAdapter } from '../db-manager.js';
|
|
2
|
-
export type AdapterLike = Pick<DBManagerAdapter, 'prepare' | 'transaction'>;
|
|
3
|
-
export interface WikiPageIndexRecord {
|
|
4
|
-
id: number;
|
|
5
|
-
source_locator: string;
|
|
6
|
-
page_type: 'entity' | 'lesson' | 'synthesis' | 'process' | 'case';
|
|
7
|
-
title: string;
|
|
8
|
-
content: string;
|
|
9
|
-
case_id: string | null;
|
|
10
|
-
source_ids: string[];
|
|
11
|
-
entity_refs: string[];
|
|
12
|
-
confidence: 'high' | 'medium' | 'low' | null;
|
|
13
|
-
compiled_at: string;
|
|
14
|
-
created_at: string;
|
|
15
|
-
updated_at: string;
|
|
16
|
-
}
|
|
17
|
-
export interface WikiPageSearchHit {
|
|
18
|
-
record: WikiPageIndexRecord;
|
|
19
|
-
rank: number;
|
|
20
|
-
raw_score: number;
|
|
21
|
-
}
|
|
22
|
-
export interface UpsertWikiPageIndexInput {
|
|
23
|
-
source_locator: string;
|
|
24
|
-
page_type: WikiPageIndexRecord['page_type'];
|
|
25
|
-
title: string;
|
|
26
|
-
content: string;
|
|
27
|
-
case_id?: string | null;
|
|
28
|
-
source_ids: string[];
|
|
29
|
-
entity_refs: string[];
|
|
30
|
-
confidence: WikiPageIndexRecord['confidence'];
|
|
31
|
-
compiled_at: string;
|
|
32
|
-
embedding?: Float32Array | null;
|
|
33
|
-
embedding_model?: string;
|
|
34
|
-
}
|
|
35
|
-
export declare function ftsSearchWikiPages(adapter: AdapterLike, query: string, limit: number): WikiPageSearchHit[];
|
|
36
|
-
export declare function vectorSearchWikiPages(adapter: AdapterLike, queryEmbedding: Float32Array, limit: number): WikiPageSearchHit[];
|
|
37
|
-
//# sourceMappingURL=wiki-page-index.d.ts.map
|