memhtml 0.2.5 → 0.4.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 +114 -245
- package/agent/instructions.md +74 -84
- package/dist/{dist-t84Q_98w.mjs → dist-BCsav-EP.mjs} +341 -6
- package/dist/dist-BCsav-EP.mjs.map +1 -0
- package/dist/{dist-Uj47oBRC.mjs → dist-D73gfqLc.mjs} +4087 -370
- package/dist/dist-D73gfqLc.mjs.map +1 -0
- package/dist/dist-DuzGralO.mjs +3 -0
- package/dist/memhtml-mcp.mjs +45 -7
- package/dist/memhtml-mcp.mjs.map +1 -1
- package/dist/memhtml.mjs +64 -11
- package/dist/memhtml.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +180 -8
- package/src/contract.ts +232 -5
- package/state-migrations/S0002_entity_corroboration.sql +55 -0
- package/dist/dist-Dj-MYf9q.mjs +0 -3
- package/dist/dist-Uj47oBRC.mjs.map +0 -1
- package/dist/dist-t84Q_98w.mjs.map +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { A as ConsolidatorUnavailable, B as quoteAppearsIn, C as CandidateEvidence, D as ConsolidatorContractViolation, E as ConsolidationResult, F as MAX_TRANSCRIPTS_PER_RUN, H as ungroundedCommitmentReason, I as credentialsMissingReason, L as decodedTranscriptStrings, M as MAX_GIST_CHARS, N as MAX_QUOTE_CHARS, O as ConsolidatorCredentialsMissing, P as MAX_STATEMENT_CHARS, R as hasConsolidatorCredentials, S as CandidateCommitment, T as ConsolidationPayload, U as ungroundedEvidenceReason, V as toJsonSchema, _ as pinCorpusSnapshot, a as makeConsolidator, b as CONSOLIDATION_KINDS, c as runSecretFrom, d as signRunToken, f as SANDBOX_MOUNTS_ENV, g as mountReadOnlyRoots, h as encodeSandboxMounts, i as guestPathFor, j as MAX_CLAIM_CHARS, k as ConsolidatorRunFailed, l as runVerifierConfig, m as decodeSandboxMounts, n as consolidatorLive, o as RUN_SECRET_ENV, p as SandboxMountInvalid, r as fabricatedQuoteReason, s as mintRunSecret, t as Consolidator, u as sameRunSecret, v as readOnlyRootsProblem, w as CandidateMemory, x as CONSOLIDATION_OUTPUT_JSON_SCHEMA, y as COMMITMENT_ACTORS, z as isConsolidationKind } from "./dist-BCsav-EP.mjs";
|
|
2
|
+
|
|
3
|
+
export { COMMITMENT_ACTORS, CONSOLIDATION_KINDS, CONSOLIDATION_OUTPUT_JSON_SCHEMA, CandidateCommitment, CandidateEvidence, CandidateMemory, ConsolidationPayload, ConsolidationResult, Consolidator, ConsolidatorContractViolation, ConsolidatorCredentialsMissing, ConsolidatorRunFailed, ConsolidatorUnavailable, MAX_CLAIM_CHARS, MAX_GIST_CHARS, MAX_QUOTE_CHARS, MAX_STATEMENT_CHARS, MAX_TRANSCRIPTS_PER_RUN, RUN_SECRET_ENV, SANDBOX_MOUNTS_ENV, SandboxMountInvalid, consolidatorLive, credentialsMissingReason, decodeSandboxMounts, decodedTranscriptStrings, encodeSandboxMounts, fabricatedQuoteReason, guestPathFor, hasConsolidatorCredentials, isConsolidationKind, makeConsolidator, mintRunSecret, mountReadOnlyRoots, pinCorpusSnapshot, quoteAppearsIn, readOnlyRootsProblem, runSecretFrom, runVerifierConfig, sameRunSecret, signRunToken, toJsonSchema, ungroundedCommitmentReason, ungroundedEvidenceReason };
|
package/dist/memhtml-mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { A as
|
|
3
|
-
import {
|
|
2
|
+
import { $ as STATE_DB_PATH, A as IndexRecorder, B as IndexGit, C as ModelClient, D as EmbeddingsLive, E as Embeddings, F as makeRetrieval, G as MIGRATIONS_DIR, H as sanitizeFtsQuery, I as reinforce, J as Store, K as STATE_MIGRATIONS_DIR, L as Indexer, O as EMBED_DIM, P as Retrieval, Q as SLEEP_REPORTS_DIR, R as makeIndexer, T as wrapAsData, U as DatabaseService, V as makeGitPort, W as makeDatabase, X as makeStore, Y as expandRoot, Z as INDEX_DB_PATH, at as makeGit, dt as fenceOpeningOf, ft as REINFORCE_SIGNALS, i as makeSleep, it as Git, j as makeIndexRecorder, k as EMBED_WATERMARK, l as DETECTION_PREFIX, lt as isValidDatetime, pt as frameKeyOf, r as Sleep, ut as closesFence, w as ModelClientLive, y as SLEEP_PHASES, z as readIndexState } from "./dist-D73gfqLc.mjs";
|
|
3
|
+
import { $ as TASK_RELS, Dt as isTaskStatus, Et as WRITABLE_MEMORY_TYPES, G as InvalidMemory, Q as MEMORY_RELS, R as hasConsolidatorCredentials, St as PARA_BUCKETS, Y as StorageFailure, a as makeConsolidator, et as isEdgeRel, mt as normalizePath, q as ModelUnavailable, tt as relClassFor, wt as TASK_STATUSES } from "./dist-BCsav-EP.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { Config, Context, Effect, Layer, Logger, Schema } from "effect";
|
|
6
6
|
import { access, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
@@ -30,7 +30,7 @@ const CONFIG_VARS = [
|
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
name: "MEMHTML_AWS_REGION",
|
|
33
|
-
description: "The Bedrock region for embeddings and the sleep cycle's
|
|
33
|
+
description: "The Bedrock region for embeddings and the sleep cycle's model-calling phases.",
|
|
34
34
|
fallback: "us-east-1"
|
|
35
35
|
},
|
|
36
36
|
{
|
|
@@ -45,7 +45,7 @@ const CONFIG_VARS = [
|
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
name: "MEMHTML_LLM",
|
|
48
|
-
description: "`off` makes
|
|
48
|
+
description: "`off` makes every model-calling sleep phase report `no model bound` and stay `ok`, so a credential-free run is honest rather than red. `entity-resolution` still runs its deterministic normalization and character-overlap passes; the others do nothing.",
|
|
49
49
|
fallback: "on"
|
|
50
50
|
},
|
|
51
51
|
{
|
|
@@ -1406,6 +1406,32 @@ const listMemories = (params) => Effect.gen(function* () {
|
|
|
1406
1406
|
};
|
|
1407
1407
|
});
|
|
1408
1408
|
/**
|
|
1409
|
+
* The `GLOB` pattern that matches a detected task's path, and nothing else.
|
|
1410
|
+
*
|
|
1411
|
+
* **The PATH is the discriminator, and `author` is deliberately not it.** `packages/sleep/src/tasks.ts`
|
|
1412
|
+
* records why the path carries the detection key: it survives `rm index.db && rebuild` with no
|
|
1413
|
+
* projection, it is collision-free by construction, and it costs no new meta in a CLOSED vocabulary.
|
|
1414
|
+
* `files.author` IS a real column and every detected task carries `agent:sleep` in it — but so does
|
|
1415
|
+
* every memory `trace-consolidation` and `arc-synthesis` write, and so would a task an operator opened
|
|
1416
|
+
* while impersonating the cycle. `author = 'agent:sleep'` is therefore necessary and not sufficient,
|
|
1417
|
+
* while the path is both. Adding the author predicate beside this one would look like defense in depth
|
|
1418
|
+
* and would actually be a second, weaker copy of the same test — and it would break the moment a
|
|
1419
|
+
* detector minted under a different author, which is a change the path would survive.
|
|
1420
|
+
*
|
|
1421
|
+
* `GLOB` rather than `LIKE`, and the character class is the reason. `LIKE 'areas/inbox/tasks/det-%'`
|
|
1422
|
+
* would match `det-nothex…` and `detonate-things.html`; the twelve `[0-9a-f]` positions are the same
|
|
1423
|
+
* shape `detectionKeyOf`'s regex asserts, so the two agree about what a detected path IS. Verified
|
|
1424
|
+
* against node:sqlite: the pattern matches a real detected path and an archived one, and rejects a
|
|
1425
|
+
* human `t-…` task, a non-hex stem, a short digest, and `detonate-`.
|
|
1426
|
+
*
|
|
1427
|
+
* The leading `*` covers the ARCHIVE. `archivePathFor` prefixes `archive/<year>/`, so a closed detected
|
|
1428
|
+
* task's path is `archive/2026/areas/inbox/tasks/det-…`, and `--detected --include-archived` has to
|
|
1429
|
+
* reach it or "what did the machine propose and what happened to it" is unanswerable. It also means the
|
|
1430
|
+
* pattern is anchored on the FILENAME rather than on the directory, which is correct: the digest prefix
|
|
1431
|
+
* is the claim, and `placementFor` owns where a task files.
|
|
1432
|
+
*/
|
|
1433
|
+
const DETECTED_TASK_GLOB = `*/${DETECTION_PREFIX}${"[0-9a-f]".repeat(12)}-*.html`;
|
|
1434
|
+
/**
|
|
1409
1435
|
* FTS over session first-prompts and AI titles.
|
|
1410
1436
|
*
|
|
1411
1437
|
* The query goes through the same sanitizer the memory arms use, and it has to. An apostrophe is a
|
|
@@ -2125,6 +2151,12 @@ const COMMANDS = [
|
|
|
2125
2151
|
type: "boolean",
|
|
2126
2152
|
description: "Include finished tasks. `done` archives, so they are otherwise absent.",
|
|
2127
2153
|
default: false
|
|
2154
|
+
},
|
|
2155
|
+
{
|
|
2156
|
+
name: "detected",
|
|
2157
|
+
type: "boolean",
|
|
2158
|
+
description: "Only tasks the sleep cycle detected, never ones opened by hand. The machine's queue: each is a proposal carrying the evidence it was detected from.",
|
|
2159
|
+
default: false
|
|
2128
2160
|
}
|
|
2129
2161
|
],
|
|
2130
2162
|
responseTypes: ["task.list"]
|
|
@@ -2212,7 +2244,13 @@ const COMMANDS = [
|
|
|
2212
2244
|
},
|
|
2213
2245
|
{
|
|
2214
2246
|
name: "sleep run",
|
|
2215
|
-
|
|
2247
|
+
/**
|
|
2248
|
+
* The count is DERIVED from `SLEEP_PHASES`, not typed. Both strings used to spell `15` by hand,
|
|
2249
|
+
* and adding a sixteenth phase left `AGENTS.md` and `memhtml manifest` asserting a number the list
|
|
2250
|
+
* beside them contradicted — visible only because the doc drift gate compares generated bytes, and
|
|
2251
|
+
* only for the one of the two that also prints the names.
|
|
2252
|
+
*/
|
|
2253
|
+
summary: `The nightly curation cycle: ${SLEEP_PHASES.length} phases, each an isolated commit on a review branch.`,
|
|
2216
2254
|
args: [],
|
|
2217
2255
|
flags: [
|
|
2218
2256
|
{
|
|
@@ -2223,7 +2261,7 @@ const COMMANDS = [
|
|
|
2223
2261
|
{
|
|
2224
2262
|
name: "phases",
|
|
2225
2263
|
type: "string",
|
|
2226
|
-
description: `Comma-separated subset. All
|
|
2264
|
+
description: `Comma-separated subset. All ${SLEEP_PHASES.length} by default: ${SLEEP_PHASES.join(", ")}.`
|
|
2227
2265
|
},
|
|
2228
2266
|
{
|
|
2229
2267
|
name: "dry-run",
|
|
@@ -4026,7 +4064,7 @@ const Resources = Layer.mergeAll(FileResource, SleepResource);
|
|
|
4026
4064
|
//#endregion
|
|
4027
4065
|
//#region apps/mcp/src/server.ts
|
|
4028
4066
|
const SERVER_NAME = "memhtml";
|
|
4029
|
-
const SERVER_VERSION = "0.
|
|
4067
|
+
const SERVER_VERSION = "0.4.0";
|
|
4030
4068
|
/**
|
|
4031
4069
|
* The server as one layer: fourteen tools, two resources, over the CLI's own `AppLive`.
|
|
4032
4070
|
*
|