@agentproto/memory 0.0.0 → 0.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 -1
- package/dist/index.d.ts +319 -6
- package/dist/index.mjs +640 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts","../src/schema.ts","../src/types.ts","../src/validate.ts","../src/define-memory.ts","../src/markdown.ts","../src/lifecycle.ts","../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAGO,IAAM,qBAAA,GAAN,cAAoC,KAAA,CAAM;AAAA;AAAA,EAEtC,MAAA;AAAA;AAAA,EAEA,KAAA;AAAA,EAET,WAAA,CAAY,QAAgB,MAAA,EAAgC;AAC1D,IAAA,KAAA;AAAA,MACE,GAAG,MAAM,CAAA,EAAA,EAAK,OACX,GAAA,CAAI,CAAC,MAAM,CAAA,EAAG,CAAA,CAAE,IAAA,IAAQ,YAAY,KAAK,CAAA,CAAE,OAAO,EAAE,CAAA,CACpD,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA,KACf;AACA,IAAA,IAAA,CAAK,IAAA,GAAO,uBAAA;AACZ,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,KAAA,GAAQ,MAAA,CAAO,CAAC,CAAA,EAAG,IAAA,IAAQ,EAAA;AAAA,EAClC;AACF;AAGO,IAAM,gBAAA,GAAN,cAA+B,KAAA,CAAM;AAAA,EAC1C,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,CAAA,sBAAA,EAAyB,OAAO,CAAA,CAAE,CAAA;AACxC,IAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AAAA,EACd;AACF;ACHO,IAAM,uBAAA,GAA0B,EAAE,MAAA,CAAO,EAAE,UAAU,CAAA,CAAE,OAAA,CAAQ,WAAW,CAAA,CAA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AAA,GAAe","file":"index.mjs","sourcesContent":["import type { MemoryIssue } from \"./types.js\"\n\n/** Thrown by `defineMemory` and `renderMemory` on an invalid item. */\nexport class MemoryValidationError extends Error {\n /** Every error found, each naming its field path. */\n readonly issues: readonly MemoryIssue[]\n /** Path of the first offending field (`\"\"` for the whole document). */\n readonly field: string\n\n constructor(prefix: string, issues: readonly MemoryIssue[]) {\n super(\n `${prefix}: ${issues\n .map((i) => `${i.path || \"(document)\"}: ${i.message}`)\n .join(\"; \")}`,\n )\n this.name = \"MemoryValidationError\"\n this.issues = issues\n this.field = issues[0]?.path ?? \"\"\n }\n}\n\n/** Thrown by `parseMemory` when the markdown has no readable frontmatter. */\nexport class MemoryParseError extends Error {\n constructor(message: string) {\n super(`parseMemory (AIP-72): ${message}`)\n this.name = \"MemoryParseError\"\n }\n}\n","/**\n * AIP-72 memory/v1 frontmatter zod schema.\n *\n * Codegen output of `scripts/scaffold-aip.mjs --aip 72 --slug memory\n * --doctype MEMORY --schema-only --inline-refs` over\n * `specs/resources/aip-72/draft/MEMORY.schema.json`. Do not edit the code\n * below by hand: change the JSON draft, then regenerate.\n * `scripts/check-spec-drift.mjs` fails CI when the code drifts from the\n * draft (it does not compare this comment).\n *\n * Only `validate.ts` imports this schema. `validateMemory` runs it, and\n * `defineMemory` (`define-memory.ts`) and `renderMemory` (`markdown.ts`)\n * validate through `validateMemory`. `index.ts` re-exports it.\n *\n * What the codegen cannot express also lives in `validate.ts`: the\n * root `anyOf` (canonical fields or the legacy id/name/type trio), the\n * `$defs.lifetime` if/then rules (`until` needs `at`, `while` needs\n * `anchor`), the unknown-key check on the root and `lifetime` objects\n * (zod 4 drops it inside the `.and(...)` intersections below), and the\n * AIP-72 conformance rules that apply to a single document.\n */\n\nimport { z } from \"zod\"\n\nexport const memoryFrontmatterSchema = z.object({ \"schema\": z.literal(\"memory/v1\").describe(\"Discriminator for a memory/v1 document. Optional only to tolerate legacy items written before this doctype existed; a canonical memory/v1 document MUST set it, and when present it MUST equal 'memory/v1'.\").optional(), \"slug\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\")).min(2).max(96).describe(\"Stable kebab-case identifier (AIP-10 convention). Used as the item's path stem and cross-reference target.\").optional(), \"kind\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*$\")).min(2).max(32).describe(\"Item kind (AIP-10 convention). Common values are the memory types: 'user', 'feedback', 'project', 'reference'.\").optional(), \"title\": z.string().min(1).max(200).describe(\"Human-readable title (AIP-10 convention).\").optional(), \"updated_at\": z.string().datetime({ offset: true }).describe(\"ISO 8601 timestamp of the last content write (AIP-10 convention). A writer MUST set it when it creates the item and when it changes any field other than `status`; a status-only lifecycle rewrite (to `superseded` or `archived`) MAY leave it unchanged.\").optional(), \"id\": z.string().min(1).describe(\"Item identifier (e.g. 'mem_qc8f407g'). Legacy alias for the AIP-10 path stem; when the base fields are omitted it takes part in identifying the item.\").optional(), \"name\": z.string().min(1).max(1000).describe(\"Slugified name, distinct from `title`. Kept as a separate field so a legacy item round-trips without loss.\").optional(), \"type\": z.enum([\"user\",\"feedback\",\"project\",\"reference\"]).describe(\"Memory type. The closed type set from the memory contract; `kind` is the AIP-10-aligned spelling of the same notion.\").optional(), \"description\": z.string().max(4000).describe(\"One-line human-readable summary, independent of the body.\").optional(), \"tags\": z.array(z.string().min(1)).describe(\"Free-form labels. Scope anchors are carried here in their formatted form (e.g. 'global', 'project:fhcm', 'agent:assistant', 'pr:agentproto/ts#1858').\").default([] as never), \"polarity\": z.enum([\"do\",\"dont\"]).describe(\"Feedback polarity. Present only on items of type 'feedback'.\").optional(), \"lifetime\": z.object({ \"kind\": z.enum([\"durable\",\"until\",\"while\",\"session\"]).describe(\"Lifetime kind. 'durable' never expires; 'until' expires at `at`; 'while' lasts as long as `anchor` holds; 'session' lasts for the session.\"), \"at\": z.string().datetime({ offset: true }).describe(\"Expiry timestamp for kind 'until'.\").optional(), \"anchor\": z.object({ \"kind\": z.enum([\"global\",\"project\",\"task\",\"session\",\"pr\",\"contact\",\"agent\"]).describe(\"Anchor kind. 'agent' extends the conversation-contract set for per-agent anchoring.\"), \"slug\": z.string().min(1).describe(\"Anchor target slug (project, contact, agent).\").optional(), \"id\": z.string().min(1).describe(\"Anchor target id (task, session).\").optional(), \"repo\": z.string().min(1).describe(\"Repository 'owner/name' for a pr anchor.\").optional(), \"number\": z.number().int().gte(1).describe(\"Pull-request number for a pr anchor.\").optional() }).strict().describe(\"Governing anchor for kind 'while'.\").optional() }).strict().and(z.intersection(z.any(), z.any())).describe(\"How long the item stays valid. Typical values are { kind: 'durable' } or { kind: 'while', anchor: { … } }.\").optional(), \"status\": z.enum([\"active\",\"superseded\",\"archived\"]).describe(\"Lifecycle status. A writer creates an item 'active'. 'superseded' means a newer item replaces it; 'archived' means it is retired without a replacement (decayed, or its anchor no longer resolves). Both are terminal: an item is marked, never erased. Absent means 'active'.\").optional(), \"created\": z.string().datetime({ offset: true }).describe(\"Creation timestamp.\").optional(), \"written\": z.string().datetime({ offset: true }).describe(\"Last-write timestamp. Mirrors the AIP-10 `updated_at`.\").optional(), \"decidedBy\": z.object({ \"rule\": z.string().min(1).describe(\"Classifier rule that produced the item (e.g. 'lens-confident', 'brain-memory-file').\").optional(), \"source\": z.string().min(1).describe(\"Where the deciding rule came from (e.g. 'builtin').\").optional() }).strict().describe(\"Which classifier/rule decided the item's shape and status.\").optional(), \"provenance\": z.object({ \"source\": z.string().min(1).describe(\"Provenance source class (e.g. 'brain-transcript', 'brain-memory-file', 'converse', 'task-close', 'recall-gap').\").optional(), \"sessionId\": z.string().min(1).describe(\"Session the claim was observed in. Omitted, never empty, when the source has no session.\").optional(), \"ref\": z.string().min(1).describe(\"Opaque reference into the source (message uuid, file path, ...). Omitted, never empty, when the source has none.\").optional(), \"quote\": z.string().describe(\"Verbatim quote backing the claim.\").optional(), \"at\": z.string().datetime({ offset: true }).describe(\"When the claim was observed.\").optional(), \"extractorVersion\": z.string().min(1).describe(\"Identifier and version of the extractor that produced the claim (e.g. 'lens@3'), so a reader can tell items from different extractor generations apart.\").optional() }).strict().describe(\"Origin of the item's claims.\").optional(), \"evidence\": z.object({ \"sourceKind\": z.string().min(1).describe(\"Kind of source the evidence came from (e.g. 'brain-transcript', 'brain-memory-file').\").optional(), \"trust\": z.string().min(1).describe(\"Trust class of the source (e.g. 'jeremy', 'internal').\").optional(), \"explicitness\": z.string().min(1).describe(\"Whether the claim was stated outright or inferred (e.g. 'implicit', 'explicit').\").optional(), \"corroborations\": z.number().int().gte(0).describe(\"Number of independent corroborating observations.\").optional(), \"contradictsActive\": z.boolean().describe(\"True when this item contradicts an active item.\").optional(), \"impact\": z.string().min(1).describe(\"Impact class of the item (e.g. 'low', 'high').\").optional(), \"lifetime\": z.object({ \"kind\": z.enum([\"durable\",\"until\",\"while\",\"session\"]).describe(\"Lifetime kind. 'durable' never expires; 'until' expires at `at`; 'while' lasts as long as `anchor` holds; 'session' lasts for the session.\"), \"at\": z.string().datetime({ offset: true }).describe(\"Expiry timestamp for kind 'until'.\").optional(), \"anchor\": z.object({ \"kind\": z.enum([\"global\",\"project\",\"task\",\"session\",\"pr\",\"contact\",\"agent\"]).describe(\"Anchor kind. 'agent' extends the conversation-contract set for per-agent anchoring.\"), \"slug\": z.string().min(1).describe(\"Anchor target slug (project, contact, agent).\").optional(), \"id\": z.string().min(1).describe(\"Anchor target id (task, session).\").optional(), \"repo\": z.string().min(1).describe(\"Repository 'owner/name' for a pr anchor.\").optional(), \"number\": z.number().int().gte(1).describe(\"Pull-request number for a pr anchor.\").optional() }).strict().describe(\"Governing anchor for kind 'while'.\").optional() }).strict().and(z.intersection(z.any(), z.any())).describe(\"Lifetime as computed for the evidence pass.\").optional(), \"anchorsResolved\": z.array(z.string().min(1)).describe(\"Resolved anchor labels in their formatted form (e.g. 'global', 'project:fhcm', 'pr:agentproto/ts#1858', 'session:sess_…').\").default([] as never), \"ageHours\": z.number().describe(\"Age of the evidence in hours (may be fractional or negative relative to the write clock).\").optional(), \"flags\": z.array(z.string().min(1)).describe(\"Machine-stable flags raised during the evidence pass.\").default([] as never) }).strict().describe(\"Trust/impact accounting captured at write time.\").optional(), \"capture\": z.object({ \"mode\": z.enum([\"live\",\"batch\"]).describe(\"How the item was captured: 'live' during the session it describes, 'batch' by a later pass over stored transcripts or files.\").optional(), \"producer\": z.string().min(1).describe(\"Who or what captured the item (e.g. a clerk lens, a migration, an importer). 'unknown' when the producer did not identify itself.\").optional(), \"capturedAt\": z.string().datetime({ offset: true }).describe(\"ISO 8601 timestamp at which the source was captured or extracted.\").optional() }).strict().describe(\"Who, what and how captured the item, kept apart from `provenance` (where the claim was observed).\").optional(), \"body\": z.string().describe(\"Unrestricted markdown body of the MEMORY.md file. Not constrained by this schema.\").optional() }).strict().and(z.union([z.any(), z.any()])).describe(\"Validates the YAML frontmatter of an AIP-72 memory/v1 item: one small typed assertion (user, feedback, project, reference) about a principal or its work, with a lifecycle. A third doctype in the memory layer: it neither absorbs nor replaces AIP-10 knowledge/v1 entries (curated, shareable wiki pages over immutable sources) nor AIP-11 lesson/v1 (distilled lessons from runs). A memory/v1 item carries the AIP-10 base fields (schema, slug, kind, title, updated_at); the remaining fields are the memory item shape and are OPTIONAL, so a writer that emits only the AIP-10 base fields and a writer that emits the full item both validate against the same schema. The markdown body (the `body` property) is unrestricted text.\")\n\nexport type MemoryFrontmatter = z.infer<typeof memoryFrontmatterSchema>\n","/**\n * AIP-72 memory/v1 document types.\n *\n * Hand-tuned on top of the shape `json-schema-to-typescript` generates\n * from `resources/aip-72/draft/MEMORY.schema.json`: the `$defs` get\n * `Memory*` names, and the document carries its markdown `body` as a\n * required string (the schema's `body` property stands for the text\n * after the closing frontmatter fence).\n */\n\nexport const MEMORY_TYPES = [\"user\", \"feedback\", \"project\", \"reference\"] as const\n/** The closed memory type set (`type`, and `kind` on a memory/v1 item). */\nexport type MemoryType = (typeof MEMORY_TYPES)[number]\n\nexport const MEMORY_STATUSES = [\"active\", \"superseded\", \"archived\"] as const\n/** Lifecycle status. Absent means `active` (AIP-72 rule 9). */\nexport type MemoryStatus = (typeof MEMORY_STATUSES)[number]\n\nexport interface MemoryAnchor {\n kind: \"global\" | \"project\" | \"task\" | \"session\" | \"pr\" | \"contact\" | \"agent\"\n /** Anchor target slug (project, contact, agent). */\n slug?: string\n /** Anchor target id (task, session). */\n id?: string\n /** Repository `owner/name` for a pr anchor. */\n repo?: string\n /** Pull-request number for a pr anchor. */\n number?: number\n}\n\nexport interface MemoryLifetime {\n kind: \"durable\" | \"until\" | \"while\" | \"session\"\n /** Expiry timestamp, REQUIRED for kind `until`. */\n at?: string\n /** Governing anchor, REQUIRED for kind `while`. */\n anchor?: MemoryAnchor\n}\n\nexport interface MemoryDecidedBy {\n rule?: string\n source?: string\n}\n\nexport interface MemoryProvenance {\n source?: string\n /** Omitted, never empty, when the source has no session. */\n sessionId?: string\n /** Omitted, never empty, when the source has none. */\n ref?: string\n quote?: string\n at?: string\n extractorVersion?: string\n}\n\nexport interface MemoryCapture {\n mode?: \"live\" | \"batch\"\n producer?: string\n capturedAt?: string\n}\n\nexport interface MemoryEvidence {\n sourceKind?: string\n trust?: string\n explicitness?: string\n corroborations?: number\n contradictsActive?: boolean\n impact?: string\n lifetime?: MemoryLifetime\n anchorsResolved?: string[]\n ageHours?: number\n flags?: string[]\n}\n\n/**\n * The YAML frontmatter of a memory/v1 item. Every field is optional at\n * the type level: the schema accepts either the canonical AIP-10 base\n * fields (`schema`, `slug`, `kind`, `title`, `updated_at`) or the legacy\n * trio (`id`, `name`, `type`), which `validateMemory` checks.\n */\nexport interface MemoryFrontmatter {\n schema?: \"memory/v1\"\n slug?: string\n kind?: string\n title?: string\n updated_at?: string\n id?: string\n name?: string\n type?: MemoryType\n description?: string\n tags?: string[]\n polarity?: \"do\" | \"dont\"\n lifetime?: MemoryLifetime\n status?: MemoryStatus\n created?: string\n written?: string\n decidedBy?: MemoryDecidedBy\n provenance?: MemoryProvenance\n evidence?: MemoryEvidence\n capture?: MemoryCapture\n}\n\n/** One memory/v1 item: frontmatter fields plus the markdown body. */\nexport interface MemoryDocument extends MemoryFrontmatter {\n body: string\n}\n\n/** `defineMemory` input: `body` may be omitted for an item with no prose. */\nexport type MemoryDefinition = MemoryFrontmatter & { body?: string }\n\n/** The frozen item `defineMemory` returns, with `status` made explicit. */\nexport type MemoryHandle = Readonly<MemoryDocument & { status: MemoryStatus }>\n\n/**\n * One validation finding. `path` is the dot path of the offending field\n * (`provenance.sessionId`, `lifetime.at`, `tags.0`), `\"\"` for the whole\n * document. `rule` is `schema` for a MEMORY.schema.json constraint,\n * `section-2` for the memory/v1 `kind` set, or `rule-<n>` for AIP-72\n * conformance rule n.\n */\nexport interface MemoryIssue {\n path: string\n message: string\n rule: string\n}\n\nexport interface MemoryValidationResult {\n ok: boolean\n errors: MemoryIssue[]\n /** SHOULD-level findings (rule 8). Never make `ok` false. */\n warnings: MemoryIssue[]\n}\n","import { memoryFrontmatterSchema } from \"./schema.js\"\nimport {\n MEMORY_TYPES,\n type MemoryIssue,\n type MemoryValidationResult,\n} from \"./types.js\"\n\nexport interface ValidateMemoryOptions {\n /**\n * Require the canonical fields (`schema`, `slug`, `kind`, `title`,\n * `updated_at`), as rule 1 asks of a writer creating an item. Off by\n * default: a reader MUST accept legacy items (rule 9).\n */\n canonical?: boolean\n}\n\nconst CANONICAL_FIELDS = [\"schema\", \"slug\", \"kind\", \"title\", \"updated_at\"] as const\nconst LEGACY_FIELDS = [\"id\", \"name\", \"type\"] as const\n\n// The codegen wraps the root and `lifetime` objects in `.strict().and(...)`\n// (for the `anyOf` / `allOf` branches), and zod 4 does not report a key\n// unknown to a strict object inside an intersection. Check those two\n// key sets here, read from the generated schema itself.\nconst ROOT_KEYS = Object.keys(memoryFrontmatterSchema.def.left.shape)\nconst LIFETIME_KEYS = Object.keys(\n memoryFrontmatterSchema.def.left.shape.lifetime.unwrap().def.left.shape,\n)\n\n/**\n * Validate one memory/v1 document (frontmatter fields plus `body`).\n *\n * Runs MEMORY.schema.json (through the generated zod, plus the\n * `anyOf` and lifetime `if/then` branches the codegen cannot express)\n * and the AIP-72 conformance rules checkable on a single document:\n * section 2 (`kind` set), rules 1, 2, 4 and 5 as errors, rule 8 as\n * warnings. Rules 6 and 7 compare two versions of an item and belong to\n * the store; `isAllowedStatusTransition` covers rule 7's table.\n */\nexport function validateMemory(\n doc: unknown,\n opts: ValidateMemoryOptions = {},\n): MemoryValidationResult {\n const errors: MemoryIssue[] = []\n const warnings: MemoryIssue[] = []\n if (!isPlainObject(doc)) {\n errors.push({ path: \"\", message: \"must be an object\", rule: \"schema\" })\n return { ok: false, errors, warnings }\n }\n\n const parsed = memoryFrontmatterSchema.safeParse(doc)\n if (!parsed.success) {\n for (const issue of parsed.error.issues) {\n const base = issue.path.map(String)\n if (issue.code === \"unrecognized_keys\") {\n for (const key of issue.keys) {\n errors.push({\n path: [...base, key].join(\".\"),\n message: \"unknown field\",\n rule: \"schema\",\n })\n }\n } else {\n errors.push({ path: base.join(\".\"), message: issue.message, rule: \"schema\" })\n }\n }\n }\n\n checkUnknownKeys(doc, ROOT_KEYS, \"\", errors)\n\n // anyOf: canonical base fields, or the legacy id/name/type trio.\n const missingCanonical = CANONICAL_FIELDS.filter((f) => doc[f] === undefined)\n const hasLegacy = LEGACY_FIELDS.every((f) => doc[f] !== undefined)\n if (missingCanonical.length > 0 && (opts.canonical || !hasLegacy)) {\n for (const field of missingCanonical) {\n errors.push({\n path: field,\n message: opts.canonical\n ? \"required on an item a writer creates\"\n : \"required (or carry the legacy id, name, type trio)\",\n rule: opts.canonical ? \"rule-1\" : \"schema\",\n })\n }\n }\n\n // $defs.lifetime allOf: `until` needs `at`, `while` needs `anchor`.\n checkLifetime(doc.lifetime, \"lifetime\", errors)\n if (isPlainObject(doc.evidence)) {\n checkLifetime(doc.evidence.lifetime, \"evidence.lifetime\", errors)\n }\n\n // Section 2: on a memory/v1 item `kind` is one of the memory types.\n if (\n typeof doc.kind === \"string\" &&\n !(MEMORY_TYPES as readonly string[]).includes(doc.kind)\n ) {\n errors.push({\n path: \"kind\",\n message: `must be one of ${MEMORY_TYPES.join(\", \")}`,\n rule: \"section-2\",\n })\n }\n\n // Rule 2: kind and type agree when both are present.\n if (doc.kind !== undefined && doc.type !== undefined && doc.kind !== doc.type) {\n errors.push({\n path: \"kind\",\n message: `must equal type ('${String(doc.type)}') when both are present`,\n rule: \"rule-2\",\n })\n }\n\n // Rule 4: an optional field with no value is omitted, never empty.\n const { body: _body, ...frontmatter } = doc\n for (const path of emptyValuePaths(frontmatter, [])) {\n if (errors.some((e) => e.path === path)) continue\n errors.push({ path, message: \"empty value: omit the field instead\", rule: \"rule-4\" })\n }\n\n // Rule 5: polarity only on feedback items.\n const type = doc.type ?? doc.kind\n if (doc.polarity !== undefined && type !== \"feedback\") {\n errors.push({\n path: \"polarity\",\n message: \"only allowed on an item whose type is 'feedback'\",\n rule: \"rule-5\",\n })\n }\n\n // Rule 8 (SHOULD): record where and when the claim was observed.\n const provenance = isPlainObject(doc.provenance) ? doc.provenance : {}\n for (const field of [\"source\", \"at\"] as const) {\n if (provenance[field] === undefined) {\n warnings.push({\n path: `provenance.${field}`,\n message: \"should be recorded\",\n rule: \"rule-8\",\n })\n }\n }\n\n return { ok: errors.length === 0, errors, warnings }\n}\n\nfunction checkLifetime(value: unknown, path: string, errors: MemoryIssue[]): void {\n if (!isPlainObject(value)) return\n checkUnknownKeys(value, LIFETIME_KEYS, path, errors)\n if (value.kind === \"until\" && value.at === undefined) {\n errors.push({ path: `${path}.at`, message: \"required when kind is 'until'\", rule: \"schema\" })\n }\n if (value.kind === \"while\" && value.anchor === undefined) {\n errors.push({\n path: `${path}.anchor`,\n message: \"required when kind is 'while'\",\n rule: \"schema\",\n })\n }\n}\n\nfunction checkUnknownKeys(\n value: Record<string, unknown>,\n known: readonly string[],\n path: string,\n errors: MemoryIssue[],\n): void {\n for (const key of Object.keys(value)) {\n const keyPath = path ? `${path}.${key}` : key\n if (known.includes(key) || errors.some((e) => e.path === keyPath)) continue\n errors.push({ path: keyPath, message: \"unknown field\", rule: \"schema\" })\n }\n}\n\n/** Paths of empty strings and empty objects below the document root. */\nfunction emptyValuePaths(value: unknown, path: string[]): string[] {\n if (value === \"\") return [path.join(\".\")]\n if (Array.isArray(value)) {\n return value.flatMap((v, i) => emptyValuePaths(v, [...path, String(i)]))\n }\n if (!isPlainObject(value)) return []\n const entries = Object.entries(value).filter(([, v]) => v !== undefined)\n if (entries.length === 0 && path.length > 0) return [path.join(\".\")]\n return entries.flatMap(([k, v]) => emptyValuePaths(v, [...path, k]))\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n","import { createDoctype } from \"@agentproto/doctype\"\nimport { MemoryValidationError } from \"./errors.js\"\nimport type { MemoryDefinition, MemoryHandle } from \"./types.js\"\nimport { validateMemory } from \"./validate.js\"\n\nconst SLUG_PATTERN = /^[a-z][a-z0-9-]*[a-z0-9]$/\n\nconst constructMemory = createDoctype<MemoryDefinition, MemoryHandle>({\n aip: 72,\n name: \"memory\",\n readIdentity: (def) => def.slug as string,\n idPattern: SLUG_PATTERN,\n // `description` is optional and up to 4000 chars; the schema checks it.\n readDescription: false,\n build(def) {\n return deepFreeze({\n ...structuredClone(def),\n body: def.body ?? \"\",\n status: def.status ?? \"active\",\n }) as MemoryHandle\n },\n})\n\n/**\n * AIP-72 reference implementation of `defineMemory`: the writer path.\n *\n * Validates in canonical mode (rule 1: a writer sets `schema`, `slug`,\n * `kind`, `title`, `updated_at` on every item it creates) and throws a\n * `MemoryValidationError` whose `field` / `issues` name the offending\n * field paths. Only two values are filled in: `status` becomes `active`\n * when absent (section 3: a writer creates an item `active`), and an\n * absent `body` becomes `\"\"`. Nothing else is defaulted; in particular\n * `tags` is not set to `[]`, since rule 4 omits an empty optional field.\n *\n * Built on `createDoctype` for the shared slug check and top-level\n * freeze; the handle is frozen deeply and does not alias the input.\n */\nexport function defineMemory(input: MemoryDefinition): MemoryHandle {\n const result = validateMemory(input, { canonical: true })\n if (!result.ok) {\n throw new MemoryValidationError(\"defineMemory (AIP-72)\", result.errors)\n }\n return constructMemory(input)\n}\n\nfunction deepFreeze<T>(value: T): T {\n if (typeof value === \"object\" && value !== null) {\n for (const v of Object.values(value)) deepFreeze(v)\n Object.freeze(value)\n }\n return value\n}\n","import { parseDocument, stringify } from \"yaml\"\nimport { MemoryParseError, MemoryValidationError } from \"./errors.js\"\nimport type { MemoryDocument } from \"./types.js\"\nimport { validateMemory } from \"./validate.js\"\n\nconst FRONTMATTER_RE = /^---[ \\t]*\\r?\\n(?:([\\s\\S]*?)\\r?\\n)?---[ \\t]*(?:\\r?\\n|$)/\n\n/**\n * Split a MEMORY.md file into its frontmatter fields and `body`.\n *\n * The frontmatter is read as YAML 1.2 core schema, so a date-time stays\n * a string and an unquoted `true`, `null` or `2026` in a string field\n * reaches `validateMemory` as a non-string and fails there (rule 3).\n * This only parses: it does not validate, so a reader can still load an\n * item it will then inspect. The body is free (rule 12): one blank line\n * after the closing fence is the separator, everything after it is kept\n * byte for byte.\n */\nexport function parseMemory(markdown: string): MemoryDocument {\n const text = markdown.startsWith(\"\") ? markdown.slice(1) : markdown\n const match = FRONTMATTER_RE.exec(text)\n if (!match) {\n throw new MemoryParseError(\"missing frontmatter: the file must open with a '---' fence\")\n }\n const yamlDoc = parseDocument(match[1] ?? \"\", { version: \"1.2\", schema: \"core\" })\n if (yamlDoc.errors.length > 0) {\n throw new MemoryParseError(\n `invalid YAML frontmatter: ${yamlDoc.errors.map((e) => e.message).join(\"; \")}`,\n )\n }\n const data: unknown = yamlDoc.toJS()\n if (typeof data !== \"object\" || data === null || Array.isArray(data)) {\n throw new MemoryParseError(\"frontmatter must be a YAML mapping\")\n }\n if (\"body\" in data) {\n throw new MemoryParseError(\"'body' is the markdown after the fence, not a frontmatter key\")\n }\n let body = text.slice(match[0].length)\n if (body.startsWith(\"\\r\\n\")) body = body.slice(2)\n else if (body.startsWith(\"\\n\")) body = body.slice(1)\n return { ...(data as Omit<MemoryDocument, \"body\">), body }\n}\n\n/**\n * Render a memory/v1 document as MEMORY.md. Throws a\n * `MemoryValidationError` if the document does not validate.\n *\n * Every string value is double-quoted, so a YAML 1.1 or 1.2 reader\n * reads it back as a string (rule 3); undefined fields are omitted\n * (rule 4); key order is the document's own, so a status-only rewrite\n * changes only the `status` line (rule 6). `parseMemory(renderMemory(d))`\n * deep-equals `d`.\n */\nexport function renderMemory(doc: MemoryDocument): string {\n const result = validateMemory(doc)\n if (!result.ok) {\n throw new MemoryValidationError(\"renderMemory (AIP-72)\", result.errors)\n }\n const { body, ...frontmatter } = doc\n const yamlText = stringify(frontmatter, {\n version: \"1.2\",\n defaultStringType: \"QUOTE_DOUBLE\",\n defaultKeyType: \"PLAIN\",\n lineWidth: 0,\n })\n return `---\\n${yamlText}---\\n${body ? `\\n${body}` : \"\"}`\n}\n","import type { MemoryFrontmatter, MemoryStatus } from \"./types.js\"\n\n/** The item's status, reading an absent `status` as `active` (rule 9). */\nexport function memoryStatus(doc: Pick<MemoryFrontmatter, \"status\">): MemoryStatus {\n return doc.status ?? \"active\"\n}\n\n/**\n * Rule 7: a writer only moves `status` from `active` (or absent) to\n * `superseded` or `archived`, and never out of either. Rewriting the\n * same status is not a transition and is allowed.\n */\nexport function isAllowedStatusTransition(\n from: MemoryStatus | undefined,\n to: MemoryStatus,\n): boolean {\n const current = from ?? \"active\"\n return current === to || current === \"active\"\n}\n\n/**\n * Whether a reader may present the item as in force at `now`.\n *\n * Rule 10: a `superseded` or `archived` item is not. Rule 11: an\n * `until` lifetime past its `at` is not. A `while` anchor or a\n * `session` lifetime needs context outside the document (does the\n * anchor still hold, which session is current), so this check treats\n * them as holding; the store that has that context narrows further.\n */\nexport function isInForce(\n doc: Pick<MemoryFrontmatter, \"status\" | \"lifetime\">,\n now: Date = new Date(),\n): boolean {\n if (memoryStatus(doc) !== \"active\") return false\n const lifetime = doc.lifetime\n if (lifetime?.kind === \"until\" && lifetime.at !== undefined) {\n return Date.parse(lifetime.at) > now.getTime()\n }\n return true\n}\n","/**\n * @agentproto/memory: AIP-72 memory/v1 reference implementation.\n *\n * One small typed assertion (user, feedback, project, reference) about a\n * principal or its work, with a lifecycle, stored as a markdown file\n * with YAML frontmatter.\n *\n * Spec: https://agentproto.sh/docs/aip-72\n *\n * Authoring paths:\n * - TS: `defineMemory({...})` -> frozen `MemoryHandle` (writer, canonical)\n * - MD: `parseMemory(src)` -> `MemoryDocument`, then `validateMemory(doc)`\n * - out: `renderMemory(doc)` -> MEMORY.md text\n */\n\nexport const SPEC_NAME = \"memory/v1\" as const\nexport const SPEC_VERSION = \"1.0.0-alpha\" as const\n\nexport { defineMemory } from \"./define-memory.js\"\nexport { validateMemory, type ValidateMemoryOptions } from \"./validate.js\"\nexport { parseMemory, renderMemory } from \"./markdown.js\"\nexport { isAllowedStatusTransition, isInForce, memoryStatus } from \"./lifecycle.js\"\nexport { MemoryParseError, MemoryValidationError } from \"./errors.js\"\nexport { memoryFrontmatterSchema } from \"./schema.js\"\nexport {\n MEMORY_STATUSES,\n MEMORY_TYPES,\n type MemoryAnchor,\n type MemoryCapture,\n type MemoryDecidedBy,\n type MemoryDefinition,\n type MemoryDocument,\n type MemoryEvidence,\n type MemoryFrontmatter,\n type MemoryHandle,\n type MemoryIssue,\n type MemoryLifetime,\n type MemoryProvenance,\n type MemoryStatus,\n type MemoryType,\n type MemoryValidationResult,\n} from \"./types.js\"\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/schema.ts","../src/types.ts","../src/validate.ts","../src/define-memory.ts","../src/markdown.ts","../src/lifecycle.ts","../src/node-scope.ts","../src/store.ts","../src/files-store.ts","../src/index.ts"],"names":["id"],"mappings":";;;;;;;;;;;;;;AAGO,IAAM,qBAAA,GAAN,cAAoC,KAAA,CAAM;AAAA;AAAA,EAEtC,MAAA;AAAA;AAAA,EAEA,KAAA;AAAA,EAET,WAAA,CAAY,QAAgB,MAAA,EAAgC;AAC1D,IAAA,KAAA;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AAS,KAAK,CAAC,CAAA,IAAA,CAAM,CAAA;AAC9D,EAAA,MAAM,SAAA,CAAU,GAAA,EAAK,IAAA,EAAM,MAAM,CAAA;AACjC,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,CAAO,KAAK,IAAI,CAAA;AAAA,EACxB,SAAS,GAAA,EAAK;AACZ,IAAA,MAAM,MAAA,CAAO,GAAG,CAAA,CAAE,KAAA,CAAM,MAAM,MAAS,CAAA;AACvC,IAAA,MAAM,GAAA;AAAA,EACR;AACF;AAEA,eAAe,SAAS,IAAA,EAAsC;AAC5D,EAAA,IAAI;AACF,IAAA,OAAO,MAAM,QAAA,CAAS,IAAA,EAAM,MAAM,CAAA;AAAA,EACpC,SAAS,GAAA,EAAK;AACZ,IAAA,IAAI,UAAA,CAAW,GAAG,CAAA,EAAG,OAAO,IAAA;AAC5B,IAAA,MAAM,GAAA;AAAA,EACR;AACF;AAEA,eAAe,QAAQ,IAAA,EAAiC;AACtD,EAAA,IAAI;AACF,IAAA,OAAA,CAAQ,MAAM,OAAA,CAAQ,IAAI,CAAA,EAAG,IAAA,EAAK;AAAA,EACpC,SAAS,GAAA,EAAK;AACZ,IAAA,IAAI,UAAA,CAAW,GAAG,CAAA,EAAG,OAAO,EAAC;AAC7B,IAAA,MAAM,GAAA;AAAA,EACR;AACF;AAEA,SAAS,WAAW,GAAA,EAAuB;AACzC,EAAA,MAAM,OAAQ,GAAA,EAAkC,IAAA;AAChD,EAAA,OAAO,IAAA,KAAS,YAAY,IAAA,KAAS,SAAA;AACvC;;;ACloBO,IAAM,SAAA,GAAY;AAClB,IAAM,YAAA,GAAe","file":"index.mjs","sourcesContent":["import type { MemoryIssue } from \"./types.js\"\n\n/** Thrown by `defineMemory` and `renderMemory` on an invalid item. */\nexport class MemoryValidationError extends Error {\n /** Every error found, each naming its field path. */\n readonly issues: readonly MemoryIssue[]\n /** Path of the first offending field (`\"\"` for the whole document). */\n readonly field: string\n\n constructor(prefix: string, issues: readonly MemoryIssue[]) {\n super(\n `${prefix}: ${issues\n .map((i) => `${i.path || \"(document)\"}: ${i.message}`)\n .join(\"; \")}`,\n )\n this.name = \"MemoryValidationError\"\n this.issues = issues\n this.field = issues[0]?.path ?? \"\"\n }\n}\n\n/** Thrown by `parseMemory` when the markdown has no readable frontmatter. */\nexport class MemoryParseError extends Error {\n constructor(message: string) {\n super(`parseMemory (AIP-72): ${message}`)\n this.name = \"MemoryParseError\"\n }\n}\n","/**\n * AIP-72 memory/v1 frontmatter zod schema.\n *\n * Codegen output of `scripts/scaffold-aip.mjs --aip 72 --slug memory\n * --doctype MEMORY --schema-only --inline-refs` over\n * `specs/resources/aip-72/draft/MEMORY.schema.json`. Do not edit the code\n * below by hand: change the JSON draft, then regenerate.\n * `scripts/check-spec-drift.mjs` fails CI when the code drifts from the\n * draft (it does not compare this comment).\n *\n * Only `validate.ts` imports this schema. `validateMemory` runs it, and\n * `defineMemory` (`define-memory.ts`) and `renderMemory` (`markdown.ts`)\n * validate through `validateMemory`. `index.ts` re-exports it.\n *\n * What the codegen cannot express also lives in `validate.ts`: the\n * root `anyOf` (canonical fields or the legacy id/name/type trio), the\n * `$defs.lifetime` if/then rules (`until` needs `at`, `while` needs\n * `anchor`), the unknown-key check on the root and `lifetime` objects\n * (zod 4 drops it inside the `.and(...)` intersections below), and the\n * AIP-72 conformance rules that apply to a single document.\n */\n\nimport { z } from \"zod\"\n\nexport const memoryFrontmatterSchema = z.object({ \"schema\": z.literal(\"memory/v1\").describe(\"Discriminator for a memory/v1 document. Optional only to tolerate legacy items written before this doctype existed; a canonical memory/v1 document MUST set it, and when present it MUST equal 'memory/v1'.\").optional(), \"slug\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\")).min(2).max(96).describe(\"Stable kebab-case identifier (AIP-10 convention). Used as the item's path stem and cross-reference target.\").optional(), \"kind\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*$\")).min(2).max(32).describe(\"Item kind (AIP-10 convention). Common values are the memory types: 'user', 'feedback', 'project', 'reference'.\").optional(), \"title\": z.string().min(1).max(200).describe(\"Human-readable title (AIP-10 convention).\").optional(), \"updated_at\": z.string().datetime({ offset: true }).describe(\"ISO 8601 timestamp of the last content write (AIP-10 convention). A writer MUST set it when it creates the item and when it changes any field other than `status`; a status-only lifecycle rewrite (to `superseded` or `archived`) MAY leave it unchanged.\").optional(), \"id\": z.string().min(1).describe(\"Item identifier (e.g. 'mem_qc8f407g'). Legacy alias for the AIP-10 path stem; when the base fields are omitted it takes part in identifying the item.\").optional(), \"name\": z.string().min(1).max(1000).describe(\"Slugified name, distinct from `title`. Kept as a separate field so a legacy item round-trips without loss.\").optional(), \"type\": z.enum([\"user\",\"feedback\",\"project\",\"reference\"]).describe(\"Memory type. The closed type set from the memory contract; `kind` is the AIP-10-aligned spelling of the same notion.\").optional(), \"description\": z.string().max(4000).describe(\"One-line human-readable summary, independent of the body.\").optional(), \"tags\": z.array(z.string().min(1)).describe(\"Free-form labels. Scope anchors are carried here in their formatted form (e.g. 'global', 'project:acme', 'agent:assistant', 'pr:acme/app#42'). Two anchors tie an item to an AIP-34 tree and an AIP-9 operator: 'node:<id>' (the AIP-34 node id, e.g. 'node:@acme/agentik') scopes visibility, and 'operator:<id>' (e.g. 'operator:pm-simone') marks ownership and never widens visibility. An item carries at most one of each; the node projection and write rules are in AIP-72 section 10.\").default([] as never), \"polarity\": z.enum([\"do\",\"dont\"]).describe(\"Feedback polarity. Present only on items of type 'feedback'.\").optional(), \"lifetime\": z.object({ \"kind\": z.enum([\"durable\",\"until\",\"while\",\"session\"]).describe(\"Lifetime kind. 'durable' never expires; 'until' expires at `at`; 'while' lasts as long as `anchor` holds; 'session' lasts for the session.\"), \"at\": z.string().datetime({ offset: true }).describe(\"Expiry timestamp for kind 'until'.\").optional(), \"anchor\": z.object({ \"kind\": z.enum([\"global\",\"project\",\"task\",\"session\",\"pr\",\"contact\",\"agent\",\"node\",\"operator\"]).describe(\"Anchor kind. 'agent' extends the conversation-contract set for per-agent anchoring. 'node' names an AIP-34 node and scopes visibility; 'operator' names an AIP-9 operator and marks ownership (AIP-72 section 10).\"), \"slug\": z.string().min(1).describe(\"Anchor target slug (project, contact, agent).\").optional(), \"id\": z.string().min(1).describe(\"Anchor target id (task, session, node, operator). For a node, the AIP-34 id ('@<owner>/<slug>'); for an operator, the operator body of an AIP-54 'operator:' ref ('<slug>' or '<slug>@<workspace>').\").optional(), \"repo\": z.string().min(1).describe(\"Repository 'owner/name' for a pr anchor.\").optional(), \"number\": z.number().int().gte(1).describe(\"Pull-request number for a pr anchor.\").optional() }).strict().describe(\"Governing anchor for kind 'while'.\").optional() }).strict().and(z.intersection(z.any(), z.any())).describe(\"How long the item stays valid. Typical values are { kind: 'durable' } or { kind: 'while', anchor: { … } }.\").optional(), \"status\": z.enum([\"active\",\"superseded\",\"archived\"]).describe(\"Lifecycle status. A writer creates an item 'active'. 'superseded' means a newer item replaces it; 'archived' means it is retired without a replacement (decayed, or its anchor no longer resolves). Both are terminal: an item is marked, never erased. Absent means 'active'.\").optional(), \"created\": z.string().datetime({ offset: true }).describe(\"Creation timestamp.\").optional(), \"written\": z.string().datetime({ offset: true }).describe(\"Last-write timestamp. Mirrors the AIP-10 `updated_at`.\").optional(), \"decidedBy\": z.object({ \"rule\": z.string().min(1).describe(\"Classifier rule that produced the item (e.g. 'classifier-confident', 'memory-file').\").optional(), \"source\": z.string().min(1).describe(\"Where the deciding rule came from (e.g. 'builtin').\").optional() }).strict().describe(\"Which classifier/rule decided the item's shape and status.\").optional(), \"provenance\": z.object({ \"source\": z.string().min(1).describe(\"Provenance source class (e.g. 'transcript', 'memory-file', 'converse', 'task-close', 'recall-gap').\").optional(), \"sessionId\": z.string().min(1).describe(\"Session the claim was observed in. Omitted, never empty, when the source has no session.\").optional(), \"ref\": z.string().min(1).describe(\"Opaque reference into the source (message uuid, file path, ...). Omitted, never empty, when the source has none.\").optional(), \"quote\": z.string().describe(\"Verbatim quote backing the claim.\").optional(), \"at\": z.string().datetime({ offset: true }).describe(\"When the claim was observed.\").optional(), \"extractorVersion\": z.string().min(1).describe(\"Identifier and version of the extractor that produced the claim (e.g. 'extractor@3'), so a reader can tell items from different extractor generations apart.\").optional() }).strict().describe(\"Origin of the item's claims.\").optional(), \"evidence\": z.object({ \"sourceKind\": z.string().min(1).describe(\"Kind of source the evidence came from (e.g. 'transcript', 'memory-file').\").optional(), \"trust\": z.string().min(1).describe(\"Trust class of the source (e.g. 'owner', 'internal').\").optional(), \"explicitness\": z.string().min(1).describe(\"Whether the claim was stated outright or inferred (e.g. 'implicit', 'explicit').\").optional(), \"corroborations\": z.number().int().gte(0).describe(\"Number of independent corroborating observations.\").optional(), \"contradictsActive\": z.boolean().describe(\"True when this item contradicts an active item.\").optional(), \"impact\": z.string().min(1).describe(\"Impact class of the item (e.g. 'low', 'high').\").optional(), \"lifetime\": z.object({ \"kind\": z.enum([\"durable\",\"until\",\"while\",\"session\"]).describe(\"Lifetime kind. 'durable' never expires; 'until' expires at `at`; 'while' lasts as long as `anchor` holds; 'session' lasts for the session.\"), \"at\": z.string().datetime({ offset: true }).describe(\"Expiry timestamp for kind 'until'.\").optional(), \"anchor\": z.object({ \"kind\": z.enum([\"global\",\"project\",\"task\",\"session\",\"pr\",\"contact\",\"agent\",\"node\",\"operator\"]).describe(\"Anchor kind. 'agent' extends the conversation-contract set for per-agent anchoring. 'node' names an AIP-34 node and scopes visibility; 'operator' names an AIP-9 operator and marks ownership (AIP-72 section 10).\"), \"slug\": z.string().min(1).describe(\"Anchor target slug (project, contact, agent).\").optional(), \"id\": z.string().min(1).describe(\"Anchor target id (task, session, node, operator). For a node, the AIP-34 id ('@<owner>/<slug>'); for an operator, the operator body of an AIP-54 'operator:' ref ('<slug>' or '<slug>@<workspace>').\").optional(), \"repo\": z.string().min(1).describe(\"Repository 'owner/name' for a pr anchor.\").optional(), \"number\": z.number().int().gte(1).describe(\"Pull-request number for a pr anchor.\").optional() }).strict().describe(\"Governing anchor for kind 'while'.\").optional() }).strict().and(z.intersection(z.any(), z.any())).describe(\"Lifetime as computed for the evidence pass.\").optional(), \"anchorsResolved\": z.array(z.string().min(1)).describe(\"Resolved anchor labels in their formatted form (e.g. 'global', 'project:acme', 'pr:acme/app#42', 'session:sess_…').\").default([] as never), \"ageHours\": z.number().describe(\"Age of the evidence in hours (may be fractional or negative relative to the write clock).\").optional(), \"flags\": z.array(z.string().min(1)).describe(\"Machine-stable flags raised during the evidence pass.\").default([] as never) }).strict().describe(\"Trust/impact accounting captured at write time.\").optional(), \"capture\": z.object({ \"mode\": z.enum([\"live\",\"batch\"]).describe(\"How the item was captured: 'live' during the session it describes, 'batch' by a later pass over stored transcripts or files.\").optional(), \"producer\": z.string().min(1).describe(\"Who or what captured the item (e.g. a clerk, a migration, an importer). 'unknown' when the producer did not identify itself.\").optional(), \"capturedAt\": z.string().datetime({ offset: true }).describe(\"ISO 8601 timestamp at which the source was captured or extracted.\").optional() }).strict().describe(\"Who, what and how captured the item, kept apart from `provenance` (where the claim was observed).\").optional(), \"body\": z.string().describe(\"Unrestricted markdown body of the MEMORY.md file. Not constrained by this schema.\").optional() }).strict().and(z.union([z.any(), z.any()])).describe(\"Validates the YAML frontmatter of an AIP-72 memory/v1 item: one small typed assertion (user, feedback, project, reference) about a principal or its work, with a lifecycle. A third doctype in the memory layer: it neither absorbs nor replaces AIP-10 knowledge/v1 entries (curated, shareable wiki pages over immutable sources) nor AIP-11 lesson/v1 (distilled lessons from runs). A memory/v1 item carries the AIP-10 base fields (schema, slug, kind, title, updated_at); the remaining fields are the memory item shape and are OPTIONAL, so a writer that emits only the AIP-10 base fields and a writer that emits the full item both validate against the same schema. The markdown body (the `body` property) is unrestricted text.\")\n\nexport type MemoryFrontmatter = z.infer<typeof memoryFrontmatterSchema>\n","/**\n * AIP-72 memory/v1 document types.\n *\n * Hand-tuned on top of the shape `json-schema-to-typescript` generates\n * from `resources/aip-72/draft/MEMORY.schema.json`: the `$defs` get\n * `Memory*` names, and the document carries its markdown `body` as a\n * required string (the schema's `body` property stands for the text\n * after the closing frontmatter fence).\n */\n\nexport const MEMORY_TYPES = [\"user\", \"feedback\", \"project\", \"reference\"] as const\n/** The closed memory type set (`type`, and `kind` on a memory/v1 item). */\nexport type MemoryType = (typeof MEMORY_TYPES)[number]\n\nexport const MEMORY_STATUSES = [\"active\", \"superseded\", \"archived\"] as const\n/** Lifecycle status. Absent means `active` (AIP-72 rule 9). */\nexport type MemoryStatus = (typeof MEMORY_STATUSES)[number]\n\nexport interface MemoryAnchor {\n kind: \"global\" | \"project\" | \"task\" | \"session\" | \"pr\" | \"contact\" | \"agent\" | \"node\" | \"operator\"\n /** Anchor target slug (project, contact, agent). */\n slug?: string\n /**\n * Anchor target id (task, session, node, operator). A node's is its\n * AIP-34 id (`@<owner>/<slug>`), an operator's the body of its AIP-54\n * `operator:` ref (`<slug>` or `<slug>@<workspace>`). Section 10.\n */\n id?: string\n /** Repository `owner/name` for a pr anchor. */\n repo?: string\n /** Pull-request number for a pr anchor. */\n number?: number\n}\n\nexport interface MemoryLifetime {\n kind: \"durable\" | \"until\" | \"while\" | \"session\"\n /** Expiry timestamp, REQUIRED for kind `until`. */\n at?: string\n /** Governing anchor, REQUIRED for kind `while`. */\n anchor?: MemoryAnchor\n}\n\nexport interface MemoryDecidedBy {\n rule?: string\n source?: string\n}\n\nexport interface MemoryProvenance {\n source?: string\n /** Omitted, never empty, when the source has no session. */\n sessionId?: string\n /** Omitted, never empty, when the source has none. */\n ref?: string\n quote?: string\n at?: string\n extractorVersion?: string\n}\n\nexport interface MemoryCapture {\n mode?: \"live\" | \"batch\"\n producer?: string\n capturedAt?: string\n}\n\nexport interface MemoryEvidence {\n sourceKind?: string\n trust?: string\n explicitness?: string\n corroborations?: number\n contradictsActive?: boolean\n impact?: string\n lifetime?: MemoryLifetime\n anchorsResolved?: string[]\n ageHours?: number\n flags?: string[]\n}\n\n/**\n * The YAML frontmatter of a memory/v1 item. Every field is optional at\n * the type level: the schema accepts either the canonical AIP-10 base\n * fields (`schema`, `slug`, `kind`, `title`, `updated_at`) or the legacy\n * trio (`id`, `name`, `type`), which `validateMemory` checks.\n */\nexport interface MemoryFrontmatter {\n schema?: \"memory/v1\"\n slug?: string\n kind?: string\n title?: string\n updated_at?: string\n id?: string\n name?: string\n type?: MemoryType\n description?: string\n tags?: string[]\n polarity?: \"do\" | \"dont\"\n lifetime?: MemoryLifetime\n status?: MemoryStatus\n created?: string\n written?: string\n decidedBy?: MemoryDecidedBy\n provenance?: MemoryProvenance\n evidence?: MemoryEvidence\n capture?: MemoryCapture\n}\n\n/** One memory/v1 item: frontmatter fields plus the markdown body. */\nexport interface MemoryDocument extends MemoryFrontmatter {\n body: string\n}\n\n/** `defineMemory` input: `body` may be omitted for an item with no prose. */\nexport type MemoryDefinition = MemoryFrontmatter & { body?: string }\n\n/** The frozen item `defineMemory` returns, with `status` made explicit. */\nexport type MemoryHandle = Readonly<MemoryDocument & { status: MemoryStatus }>\n\n/**\n * One validation finding. `path` is the dot path of the offending field\n * (`provenance.sessionId`, `lifetime.at`, `tags.0`), `\"\"` for the whole\n * document. `rule` is `schema` for a MEMORY.schema.json constraint,\n * `section-2` for the memory/v1 `kind` set, or `rule-<n>` for AIP-72\n * conformance rule n.\n */\nexport interface MemoryIssue {\n path: string\n message: string\n rule: string\n}\n\nexport interface MemoryValidationResult {\n ok: boolean\n errors: MemoryIssue[]\n /** SHOULD-level findings (rule 8). Never make `ok` false. */\n warnings: MemoryIssue[]\n}\n","import { memoryFrontmatterSchema } from \"./schema.js\"\nimport {\n MEMORY_TYPES,\n type MemoryIssue,\n type MemoryValidationResult,\n} from \"./types.js\"\n\nexport interface ValidateMemoryOptions {\n /**\n * Require the canonical fields (`schema`, `slug`, `kind`, `title`,\n * `updated_at`), as rule 1 asks of a writer creating an item. Off by\n * default: a reader MUST accept legacy items (rule 9).\n */\n canonical?: boolean\n}\n\nconst CANONICAL_FIELDS = [\"schema\", \"slug\", \"kind\", \"title\", \"updated_at\"] as const\nconst LEGACY_FIELDS = [\"id\", \"name\", \"type\"] as const\n\n// The codegen wraps the root and `lifetime` objects in `.strict().and(...)`\n// (for the `anyOf` / `allOf` branches), and zod 4 does not report a key\n// unknown to a strict object inside an intersection. Check those two\n// key sets here, read from the generated schema itself.\nconst ROOT_KEYS = Object.keys(memoryFrontmatterSchema.def.left.shape)\nconst LIFETIME_KEYS = Object.keys(\n memoryFrontmatterSchema.def.left.shape.lifetime.unwrap().def.left.shape,\n)\n\n/**\n * Validate one memory/v1 document (frontmatter fields plus `body`).\n *\n * Runs MEMORY.schema.json (through the generated zod, plus the\n * `anyOf` and lifetime `if/then` branches the codegen cannot express)\n * and the AIP-72 conformance rules checkable on a single document:\n * section 2 (`kind` set), rules 1, 2, 4 and 5 as errors, rule 8 as\n * warnings. Rules 6 and 7 compare two versions of an item and belong to\n * the store; `isAllowedStatusTransition` covers rule 7's table.\n *\n * Defaults: MEMORY.schema.json gives `tags` (and `evidence.anchorsResolved`,\n * `evidence.flags`) `default: []`, and the generated zod carries it. This\n * function only checks: it never returns the parsed data, so the default\n * is never filled in. An item without `tags` stays without `tags` and\n * reads as untagged (the digest treats it as `global`, AIP-72 section 9).\n * An explicit `tags: []` validates: rule 4 rejects empty strings and empty\n * objects, not empty arrays, though a writer omits it (`defineMemory`).\n */\nexport function validateMemory(\n doc: unknown,\n opts: ValidateMemoryOptions = {},\n): MemoryValidationResult {\n const errors: MemoryIssue[] = []\n const warnings: MemoryIssue[] = []\n if (!isPlainObject(doc)) {\n errors.push({ path: \"\", message: \"must be an object\", rule: \"schema\" })\n return { ok: false, errors, warnings }\n }\n\n const parsed = memoryFrontmatterSchema.safeParse(doc)\n if (!parsed.success) {\n for (const issue of parsed.error.issues) {\n const base = issue.path.map(String)\n if (issue.code === \"unrecognized_keys\") {\n for (const key of issue.keys) {\n errors.push({\n path: [...base, key].join(\".\"),\n message: \"unknown field\",\n rule: \"schema\",\n })\n }\n } else {\n errors.push({ path: base.join(\".\"), message: issue.message, rule: \"schema\" })\n }\n }\n }\n\n checkUnknownKeys(doc, ROOT_KEYS, \"\", errors)\n\n // anyOf: canonical base fields, or the legacy id/name/type trio.\n const missingCanonical = CANONICAL_FIELDS.filter((f) => doc[f] === undefined)\n const hasLegacy = LEGACY_FIELDS.every((f) => doc[f] !== undefined)\n if (missingCanonical.length > 0 && (opts.canonical || !hasLegacy)) {\n for (const field of missingCanonical) {\n errors.push({\n path: field,\n message: opts.canonical\n ? \"required on an item a writer creates\"\n : \"required (or carry the legacy id, name, type trio)\",\n rule: opts.canonical ? \"rule-1\" : \"schema\",\n })\n }\n }\n\n // $defs.lifetime allOf: `until` needs `at`, `while` needs `anchor`.\n checkLifetime(doc.lifetime, \"lifetime\", errors)\n if (isPlainObject(doc.evidence)) {\n checkLifetime(doc.evidence.lifetime, \"evidence.lifetime\", errors)\n }\n\n // Section 2: on a memory/v1 item `kind` is one of the memory types.\n if (\n typeof doc.kind === \"string\" &&\n !(MEMORY_TYPES as readonly string[]).includes(doc.kind)\n ) {\n errors.push({\n path: \"kind\",\n message: `must be one of ${MEMORY_TYPES.join(\", \")}`,\n rule: \"section-2\",\n })\n }\n\n // Rule 2: kind and type agree when both are present.\n if (doc.kind !== undefined && doc.type !== undefined && doc.kind !== doc.type) {\n errors.push({\n path: \"kind\",\n message: `must equal type ('${String(doc.type)}') when both are present`,\n rule: \"rule-2\",\n })\n }\n\n // Rule 4: an optional field with no value is omitted, never empty.\n const { body: _body, ...frontmatter } = doc\n for (const path of emptyValuePaths(frontmatter, [])) {\n if (errors.some((e) => e.path === path)) continue\n errors.push({ path, message: \"empty value: omit the field instead\", rule: \"rule-4\" })\n }\n\n // Rule 5: polarity only on feedback items.\n const type = doc.type ?? doc.kind\n if (doc.polarity !== undefined && type !== \"feedback\") {\n errors.push({\n path: \"polarity\",\n message: \"only allowed on an item whose type is 'feedback'\",\n rule: \"rule-5\",\n })\n }\n\n // Rule 8 (SHOULD): record where and when the claim was observed.\n const provenance = isPlainObject(doc.provenance) ? doc.provenance : {}\n for (const field of [\"source\", \"at\"] as const) {\n if (provenance[field] === undefined) {\n warnings.push({\n path: `provenance.${field}`,\n message: \"should be recorded\",\n rule: \"rule-8\",\n })\n }\n }\n\n return { ok: errors.length === 0, errors, warnings }\n}\n\nfunction checkLifetime(value: unknown, path: string, errors: MemoryIssue[]): void {\n if (!isPlainObject(value)) return\n checkUnknownKeys(value, LIFETIME_KEYS, path, errors)\n if (value.kind === \"until\" && value.at === undefined) {\n errors.push({ path: `${path}.at`, message: \"required when kind is 'until'\", rule: \"schema\" })\n }\n if (value.kind === \"while\" && value.anchor === undefined) {\n errors.push({\n path: `${path}.anchor`,\n message: \"required when kind is 'while'\",\n rule: \"schema\",\n })\n }\n}\n\nfunction checkUnknownKeys(\n value: Record<string, unknown>,\n known: readonly string[],\n path: string,\n errors: MemoryIssue[],\n): void {\n for (const key of Object.keys(value)) {\n const keyPath = path ? `${path}.${key}` : key\n if (known.includes(key) || errors.some((e) => e.path === keyPath)) continue\n errors.push({ path: keyPath, message: \"unknown field\", rule: \"schema\" })\n }\n}\n\n/** Paths of empty strings and empty objects below the document root. */\nfunction emptyValuePaths(value: unknown, path: string[]): string[] {\n if (value === \"\") return [path.join(\".\")]\n if (Array.isArray(value)) {\n return value.flatMap((v, i) => emptyValuePaths(v, [...path, String(i)]))\n }\n if (!isPlainObject(value)) return []\n const entries = Object.entries(value).filter(([, v]) => v !== undefined)\n if (entries.length === 0 && path.length > 0) return [path.join(\".\")]\n return entries.flatMap(([k, v]) => emptyValuePaths(v, [...path, k]))\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n","import { createDoctype } from \"@agentproto/doctype\"\nimport { MemoryValidationError } from \"./errors.js\"\nimport type { MemoryDefinition, MemoryHandle } from \"./types.js\"\nimport { validateMemory } from \"./validate.js\"\n\nconst SLUG_PATTERN = /^[a-z][a-z0-9-]*[a-z0-9]$/\n\nconst constructMemory = createDoctype<MemoryDefinition, MemoryHandle>({\n aip: 72,\n name: \"memory\",\n readIdentity: (def) => def.slug as string,\n idPattern: SLUG_PATTERN,\n // `description` is optional and up to 4000 chars; the schema checks it.\n readDescription: false,\n build(def) {\n return deepFreeze({\n ...structuredClone(def),\n body: def.body ?? \"\",\n status: def.status ?? \"active\",\n }) as MemoryHandle\n },\n})\n\n/**\n * AIP-72 reference implementation of `defineMemory`: the writer path.\n *\n * Validates in canonical mode (rule 1: a writer sets `schema`, `slug`,\n * `kind`, `title`, `updated_at` on every item it creates) and throws a\n * `MemoryValidationError` whose `field` / `issues` name the offending\n * field paths. Only two values are filled in: `status` becomes `active`\n * when absent (section 3: a writer creates an item `active`), and an\n * absent `body` becomes `\"\"`. Nothing else is defaulted; in particular\n * `tags` is not set to `[]`, since rule 4 omits an empty optional field.\n *\n * Built on `createDoctype` for the shared slug check and top-level\n * freeze; the handle is frozen deeply and does not alias the input.\n */\nexport function defineMemory(input: MemoryDefinition): MemoryHandle {\n const result = validateMemory(input, { canonical: true })\n if (!result.ok) {\n throw new MemoryValidationError(\"defineMemory (AIP-72)\", result.errors)\n }\n return constructMemory(input)\n}\n\nfunction deepFreeze<T>(value: T): T {\n if (typeof value === \"object\" && value !== null) {\n for (const v of Object.values(value)) deepFreeze(v)\n Object.freeze(value)\n }\n return value\n}\n","import { parseDocument, stringify } from \"yaml\"\nimport { MemoryParseError, MemoryValidationError } from \"./errors.js\"\nimport type { MemoryDocument } from \"./types.js\"\nimport { validateMemory } from \"./validate.js\"\n\nconst FRONTMATTER_RE = /^---[ \\t]*\\r?\\n(?:([\\s\\S]*?)\\r?\\n)?---[ \\t]*(?:\\r?\\n|$)/\n\n/**\n * Split a MEMORY.md file into its frontmatter fields and `body`.\n *\n * The frontmatter is read as YAML 1.2 core schema, so a date-time stays\n * a string and an unquoted `true`, `null` or `2026` in a string field\n * reaches `validateMemory` as a non-string and fails there (rule 3).\n * This only parses: it does not validate, so a reader can still load an\n * item it will then inspect. The body is free (rule 12): one blank line\n * after the closing fence is the separator, everything after it is kept\n * byte for byte.\n */\nexport function parseMemory(markdown: string): MemoryDocument {\n const text = markdown.startsWith(\"\") ? markdown.slice(1) : markdown\n const match = FRONTMATTER_RE.exec(text)\n if (!match) {\n throw new MemoryParseError(\"missing frontmatter: the file must open with a '---' fence\")\n }\n const yamlDoc = parseDocument(match[1] ?? \"\", { version: \"1.2\", schema: \"core\" })\n if (yamlDoc.errors.length > 0) {\n throw new MemoryParseError(\n `invalid YAML frontmatter: ${yamlDoc.errors.map((e) => e.message).join(\"; \")}`,\n )\n }\n const data: unknown = yamlDoc.toJS()\n if (typeof data !== \"object\" || data === null || Array.isArray(data)) {\n throw new MemoryParseError(\"frontmatter must be a YAML mapping\")\n }\n if (\"body\" in data) {\n throw new MemoryParseError(\"'body' is the markdown after the fence, not a frontmatter key\")\n }\n let body = text.slice(match[0].length)\n if (body.startsWith(\"\\r\\n\")) body = body.slice(2)\n else if (body.startsWith(\"\\n\")) body = body.slice(1)\n return { ...(data as Omit<MemoryDocument, \"body\">), body }\n}\n\n/**\n * Render a memory/v1 document as MEMORY.md. Throws a\n * `MemoryValidationError` if the document does not validate.\n *\n * Every string value is double-quoted, so a YAML 1.1 or 1.2 reader\n * reads it back as a string (rule 3); undefined fields are omitted\n * (rule 4); key order is the document's own. So re-rendering a file this\n * function wrote, with only `status` changed, changes only the `status`\n * line (rule 6). That does not hold for a file another writer produced\n * (unquoted strings, other key styles, comments): re-rendering it\n * normalizes every line, which is why the store rewrites the status line\n * in place instead (`setStatusLine`, `files-store.ts`).\n * `parseMemory(renderMemory(d))` deep-equals `d`.\n */\nexport function renderMemory(doc: MemoryDocument): string {\n const result = validateMemory(doc)\n if (!result.ok) {\n throw new MemoryValidationError(\"renderMemory (AIP-72)\", result.errors)\n }\n const { body, ...frontmatter } = doc\n const yamlText = stringify(frontmatter, {\n version: \"1.2\",\n defaultStringType: \"QUOTE_DOUBLE\",\n defaultKeyType: \"PLAIN\",\n lineWidth: 0,\n })\n return `---\\n${yamlText}---\\n${body ? `\\n${body}` : \"\"}`\n}\n","import type { MemoryFrontmatter, MemoryStatus } from \"./types.js\"\n\n/** The item's status, reading an absent `status` as `active` (rule 9). */\nexport function memoryStatus(doc: Pick<MemoryFrontmatter, \"status\">): MemoryStatus {\n return doc.status ?? \"active\"\n}\n\n/**\n * Rule 7: a writer only moves `status` from `active` (or absent) to\n * `superseded` or `archived`, and never out of either. Rewriting the\n * same status is not a transition and is allowed.\n */\nexport function isAllowedStatusTransition(\n from: MemoryStatus | undefined,\n to: MemoryStatus,\n): boolean {\n const current = from ?? \"active\"\n return current === to || current === \"active\"\n}\n\n/**\n * Whether a reader may present the item as in force at `now`.\n *\n * Rule 10: a `superseded` or `archived` item is not. Rule 11: an\n * `until` lifetime past its `at` is not. A `while` anchor or a\n * `session` lifetime needs context outside the document (does the\n * anchor still hold, which session is current), so this check treats\n * them as holding; the store that has that context narrows further.\n */\nexport function isInForce(\n doc: Pick<MemoryFrontmatter, \"status\" | \"lifetime\">,\n now: Date = new Date(),\n): boolean {\n if (memoryStatus(doc) !== \"active\") return false\n const lifetime = doc.lifetime\n if (lifetime?.kind === \"until\" && lifetime.at !== undefined) {\n return Date.parse(lifetime.at) > now.getTime()\n }\n return true\n}\n","import { MemoryValidationError } from \"./errors.js\"\nimport type { MemoryScope } from \"./store.js\"\nimport type { MemoryDocument, MemoryFrontmatter } from \"./types.js\"\n\n/**\n * AIP-72 section 10, as pure functions over a scope the host already\n * computed: the anchor tags, the projection conditions that need no clock\n * and no session anchors (2 node, 4 ownership), and the write defaults and\n * checks of rules 31 to 34. Nothing here reads a tree, a wall or a store.\n */\n\nconst NODE_PREFIX = \"node:\"\nconst OPERATOR_PREFIX = \"operator:\"\n\ntype Tagged = Pick<MemoryFrontmatter, \"tags\">\n\n/** `node:<id>`, `id` being the AIP-34 id of a node (`@<owner>/<slug>`). */\nexport function nodeTag(id: string): string {\n return `${NODE_PREFIX}${id}`\n}\n\n/** `operator:<id>`, `id` being the body of an AIP-54 `operator:` ref. */\nexport function operatorTag(id: string): string {\n return `${OPERATOR_PREFIX}${id}`\n}\n\nfunction idsOf(tags: readonly string[] | undefined, prefix: string): string[] {\n const out: string[] = []\n for (const tag of tags ?? []) {\n if (tag.startsWith(prefix) && tag.length > prefix.length) out.push(tag.slice(prefix.length))\n }\n return out\n}\n\n/** The ids of the item's node anchors (an item carries at most one). */\nexport function nodeAnchorIds(item: Tagged): string[] {\n return idsOf(item.tags, NODE_PREFIX)\n}\n\n/** The ids of the item's operator anchors (an item carries at most one). */\nexport function operatorAnchorIds(item: Tagged): string[] {\n return idsOf(item.tags, OPERATOR_PREFIX)\n}\n\n/** Whether a tag is a node or operator anchor (neither counts as an anchor for section 9). */\nexport function isNodeOrOperatorTag(tag: string): boolean {\n return tag.startsWith(NODE_PREFIX) || tag.startsWith(OPERATOR_PREFIX)\n}\n\nexport interface NodeProjectionOptions {\n /**\n * Operator anchor ids the store's AIP-38 read grants let the session\n * read (condition 4). A grant never extends condition 2.\n */\n grantedOperators?: Iterable<string>\n}\n\n/**\n * Conditions 2 and 4 of the node projection (section 10), the two that\n * read an item's node and operator anchors. Conditions 1 (in force) and 3\n * (the session's flat anchors) stay with the caller, which has the clock\n * and the anchors; the conditions are an intersection.\n *\n * - With a node scope the item must carry a node anchor, and every node\n * anchor it carries must be in `scope.nodes`; an item with none is out.\n * - Without one, an item with a node anchor is out and one with none is\n * judged by the other conditions alone.\n * - An operator anchor needs the session to run that operator, or a grant.\n */\nexport function isInNodeProjection(\n item: Tagged,\n scope: MemoryScope,\n opts: NodeProjectionOptions = {},\n): boolean {\n const nodes = nodeAnchorIds(item)\n if (scope.nodes.length > 0) {\n if (nodes.length === 0) return false\n if (!nodes.every((n) => scope.nodes.includes(n))) return false\n } else if (nodes.length > 0) {\n return false\n }\n const owners = operatorAnchorIds(item)\n if (owners.length === 0) return true\n const granted = new Set(opts.grantedOperators ?? [])\n return owners.every((o) => o === scope.operator || granted.has(o))\n}\n\nexport interface WriteScopeOptions {\n /** Rule 32. Default `\"operator\"`; `\"node\"` adds no operator anchor. */\n owner?: \"operator\" | \"node\"\n /**\n * The item this write replaces or supersedes. A document that names no\n * node anchor keeps the basis's, and a document that names no owner keeps\n * the basis's kind of ownership, so an edit never moves or hands over an\n * item by default (rule 34: nothing promotes an item by itself).\n */\n basis?: Tagged\n /** Rule 33: the host declares trees, so a document with no node anchor is refused. */\n declaresTrees?: boolean\n}\n\nfunction refuse(rule: string, message: string): never {\n throw new MemoryValidationError(\"memory scope (AIP-72 section 10)\", [\n { path: \"tags\", message, rule },\n ])\n}\n\n/**\n * The document a write stores: the node and operator anchors added by\n * default (rules 31 to 33), or a validation error naming `tags`. `scope`\n * absent is a host call (rule 30): nothing is added or confined, but a\n * store whose host declares trees still refuses a document with no node\n * anchor (rule 33).\n */\nexport function applyWriteScope(\n item: MemoryDocument,\n scope: MemoryScope | undefined,\n opts: WriteScopeOptions = {},\n): MemoryDocument {\n const tags = item.tags ?? []\n const nodes = nodeAnchorIds(item)\n const owners = operatorAnchorIds(item)\n if (nodes.length > 1) refuse(\"rule-31\", \"an item carries at most one node anchor\")\n if (owners.length > 1) refuse(\"rule-32\", \"an item carries at most one operator anchor\")\n\n const basisNodes = opts.basis ? nodeAnchorIds(opts.basis) : []\n const basisOwned = opts.basis ? operatorAnchorIds(opts.basis).length > 0 : true\n const add: string[] = []\n\n if (scope === undefined) {\n if (nodes.length === 0 && basisNodes[0] !== undefined) add.push(nodeTag(basisNodes[0]))\n if (nodes.length === 0 && add.length === 0 && opts.declaresTrees) {\n refuse(\"rule-33\", \"a document with no node anchor is refused where the host declares trees\")\n }\n return add.length > 0 ? { ...item, tags: [...tags, ...add] } : item\n }\n\n const inScope = new Set(scope.nodes)\n for (const n of nodes) {\n if (!inScope.has(n)) refuse(\"rule-31\", `node anchor '${n}' is outside the session's node projection`)\n }\n\n if (scope.nodes.length > 0) {\n if (tags.includes(\"global\")) {\n if (nodes.some((n) => n !== scope.tree)) {\n refuse(\"rule-33\", \"a global item carries only the node anchor of the tree root\")\n }\n if (nodes.length === 0) {\n if (scope.tree === undefined || !inScope.has(scope.tree)) {\n refuse(\"rule-33\", \"the tree root is not in the session's node projection, so it cannot write a global item\")\n }\n add.push(nodeTag(scope.tree))\n }\n } else if (nodes.length === 0) {\n add.push(nodeTag(basisNodes[0] ?? (scope.nodes[0] as string)))\n }\n }\n\n for (const o of owners) {\n if (o !== scope.operator) refuse(\"rule-32\", `operator anchor '${o}' is not the session's operator`)\n }\n if (owners.length > 0 && opts.owner === \"node\") {\n refuse(\"rule-32\", \"owner 'node' and an operator anchor contradict each other\")\n }\n if (owners.length === 0 && scope.operator !== undefined) {\n const owner = opts.owner ?? (basisOwned ? \"operator\" : \"node\")\n if (owner === \"operator\") add.push(operatorTag(scope.operator))\n }\n\n return add.length > 0 ? { ...item, tags: [...tags, ...add] } : item\n}\n\n/**\n * Rule 34. A commit that moves an item to another node changes that anchor\n * and nothing else: not the operator anchor, not the other anchors. (That\n * the new node is in `scope.nodes` is `applyWriteScope`'s check; a node above\n * a sealed or hard wall never is, the projection being cut there.)\n */\nexport function assertRetagOnly(before: Tagged, after: Tagged): void {\n const was = nodeAnchorIds(before)[0]\n const now = nodeAnchorIds(after)[0]\n if (was === now) return\n const rest = (item: Tagged) =>\n [...new Set((item.tags ?? []).filter((t) => !t.startsWith(NODE_PREFIX)))].sort().join(\"\\n\")\n if (rest(before) !== rest(after)) {\n refuse(\"rule-34\", \"a re-tag moves the node anchor only: it changes neither the operator anchor nor the other anchors\")\n }\n}\n","import type { MemoryDocument, MemoryStatus, MemoryType } from \"./types.js\"\n\n/**\n * AIP-72 section 8: the memory store port.\n *\n * The shapes below are the ones section 8 fixes, name for name. A store\n * keys items by `id`; `slug`, when present, is a second handle that is\n * unique among active items (rule 14). Writes are compare-and-set on the\n * opaque `revision` (rule 17), and nothing is ever hard deleted (rule 16).\n */\n\n/** One stored item, or one pending proposal. */\nexport interface MemoryRecord {\n item: MemoryDocument\n /** Opaque; changes on every byte change of the stored document. */\n revision: string\n /** Set on a proposal, absent on an item. */\n proposalId?: string\n}\n\n/**\n * AIP-72 section 10. Built by the host from the calling session, never by\n * the store, and handed in on every operation made on a session's behalf.\n * A call with no `scope` is a host call (rule 30).\n */\nexport interface MemoryScope {\n /**\n * The node projection: AIP-34 node ids, nearest first, already cut at a\n * sealed or hard node. Empty: the session has no node scope.\n */\n readonly nodes: readonly string[]\n /** Id of the root node of the session's tree. */\n readonly tree?: string\n /** The operator anchor id, when the session runs an operator. */\n readonly operator?: string\n}\n\nexport interface MemoryFilter {\n type?: MemoryType | readonly MemoryType[]\n status?: MemoryStatus | readonly MemoryStatus[]\n /** Matches at most one active item (rule 14, rule 20 overlap). */\n slug?: string\n /** Match any, e.g. `[\"global\", \"project:acme\"]`. */\n tags?: readonly string[]\n /** Rules 10 and 11, at the store's clock. */\n inForce?: boolean\n /** List proposals instead of items. */\n proposals?: boolean\n /** Section 10: only the items in the scope's node projection. Absent: a host call. */\n scope?: MemoryScope\n}\n\nexport interface MemorySearchHit {\n source: \"memory\" | \"knowledge\"\n /** REQUIRED when `source` is `\"memory\"`. */\n id?: string\n slug?: string\n title: string\n snippet?: string\n score?: number\n /** Provider pointer when `source` is `\"knowledge\"`. */\n ref?: string\n}\n\nexport interface MemoryWriteOptions {\n mode: \"propose\" | \"commit\"\n /** The revision the caller last read (rule 17). */\n ifRevision?: string\n /** The proposal this commit promotes; dropped once the item is written (rule 21). */\n fromProposal?: string\n /** Section 10: the calling session's scope. Absent: a host call. */\n scope?: MemoryScope\n /**\n * Rule 32, on a create. `\"operator\"` (the default) owns the item by the\n * session's operator; `\"node\"` shares it with every operator of the node.\n */\n owner?: \"operator\" | \"node\"\n}\n\nexport interface MemorySearchOptions {\n filter?: MemoryFilter\n limit?: number\n}\n\nexport interface MemoryStore {\n write(item: MemoryDocument, opts: MemoryWriteOptions): Promise<MemoryRecord>\n read(id: string, opts?: { scope?: MemoryScope }): Promise<MemoryRecord | null>\n list(filter?: MemoryFilter): Promise<readonly MemoryRecord[]>\n search(query: string, opts?: MemorySearchOptions): Promise<readonly MemorySearchHit[]>\n supersede(\n oldId: string,\n next: MemoryDocument,\n opts?: { ifRevision?: string; scope?: MemoryScope },\n ): Promise<{ old: MemoryRecord; next: MemoryRecord }>\n archive(id: string, opts?: { ifRevision?: string; scope?: MemoryScope }): Promise<MemoryRecord>\n dismiss(proposalId: string, opts?: { scope?: MemoryScope }): Promise<void>\n}\n\n/** The section 8 port under the `I*` name its knowledge sibling uses. */\nexport type IMemoryStore = MemoryStore\n\nexport type MemoryStoreErrorCode =\n | \"conflict\"\n | \"not-found\"\n | \"invalid-transition\"\n | \"slug-taken\"\n\n/**\n * Base of the store's typed failures. An invalid document is rejected\n * with the document package's `MemoryValidationError` instead, which\n * names the field (rule 13).\n */\nexport class MemoryStoreError extends Error {\n readonly code: MemoryStoreErrorCode\n\n constructor(code: MemoryStoreErrorCode, message: string) {\n super(`memory store (AIP-72): ${message}`)\n this.name = \"MemoryStoreError\"\n this.code = code\n }\n}\n\n/** Rule 17: `ifRevision` missing or stale on a write that needs it. */\nexport class MemoryConflictError extends MemoryStoreError {\n readonly id: string\n /** The revision the caller sent, if any. */\n readonly expected: string | undefined\n /** The revision on disk, `undefined` when the item does not exist. */\n readonly actual: string | undefined\n\n constructor(id: string, expected: string | undefined, actual: string | undefined) {\n super(\n \"conflict\",\n expected === undefined\n ? `'${id}' exists: a write that changes it must carry ifRevision`\n : actual === undefined\n ? `'${id}' does not exist, but ifRevision '${expected}' was given`\n : `'${id}' is at revision '${actual}', not '${expected}'`,\n )\n this.name = \"MemoryConflictError\"\n this.id = id\n this.expected = expected\n this.actual = actual\n }\n}\n\n/** No item (or proposal) with that id. */\nexport class MemoryNotFoundError extends MemoryStoreError {\n readonly id: string\n readonly what: \"item\" | \"proposal\"\n\n constructor(what: \"item\" | \"proposal\", id: string) {\n super(\"not-found\", `no ${what} '${id}'`)\n this.name = \"MemoryNotFoundError\"\n this.id = id\n this.what = what\n }\n}\n\n/** Rules 7 and 15: a status move the store does not allow. */\nexport class MemoryTransitionError extends MemoryStoreError {\n readonly id: string\n readonly from: MemoryStatus\n readonly to: MemoryStatus\n\n constructor(id: string, from: MemoryStatus, to: MemoryStatus, detail?: string) {\n super(\n \"invalid-transition\",\n `'${id}' cannot move from '${from}' to '${to}'${detail ? `: ${detail}` : \"\"}`,\n )\n this.name = \"MemoryTransitionError\"\n this.id = id\n this.from = from\n this.to = to\n }\n}\n\n/** Rule 14: another active item already holds the slug. */\nexport class MemorySlugTakenError extends MemoryStoreError {\n readonly slug: string\n /** The active item holding it. */\n readonly holder: string\n\n constructor(slug: string, holder: string) {\n super(\"slug-taken\", `slug '${slug}' is held by active item '${holder}'`)\n this.name = \"MemorySlugTakenError\"\n this.slug = slug\n this.holder = holder\n }\n}\n","import { createHash, randomBytes } from \"node:crypto\"\nimport { mkdir, readdir, readFile, rename, unlink, writeFile } from \"node:fs/promises\"\nimport { join } from \"node:path\"\nimport { MemoryValidationError } from \"./errors.js\"\nimport { isInForce, memoryStatus } from \"./lifecycle.js\"\nimport { parseMemory, renderMemory } from \"./markdown.js\"\nimport { applyWriteScope, assertRetagOnly, isInNodeProjection } from \"./node-scope.js\"\nimport {\n MemoryConflictError,\n MemoryNotFoundError,\n MemorySlugTakenError,\n MemoryTransitionError,\n type MemoryFilter,\n type MemoryRecord,\n type MemoryScope,\n type MemorySearchHit,\n type MemorySearchOptions,\n type MemoryStore,\n type MemoryWriteOptions,\n} from \"./store.js\"\nimport type { MemoryDocument, MemoryIssue, MemoryStatus } from \"./types.js\"\nimport { validateMemory } from \"./validate.js\"\n\n/**\n * One hit of a knowledge provider, as much of the AIP-10\n * `KnowledgeHit` as the store reads.\n */\nexport interface MemoryKnowledgeHit {\n readonly sourceId: string\n readonly chunkId?: string\n readonly text: string\n readonly score: number\n /** `memoryId` (string) names the memory item the hit was indexed from. */\n readonly metadata?: Readonly<Record<string, unknown>>\n}\n\n/**\n * The slice of an AIP-10 `IKnowledgeProvider` (`@agentproto/knowledge-engine`)\n * the store delegates search to. Declared structurally so this package\n * takes no dependency on the knowledge engine: any `IKnowledgeProvider`\n * fits as is.\n */\nexport interface MemoryKnowledgeProvider {\n query(q: {\n readonly query: string\n readonly topK?: number\n }): Promise<{ readonly hits: readonly MemoryKnowledgeHit[] }>\n}\n\nexport interface FilesMemoryStoreOptions {\n /** The store directory: `items/<type>/<id>.md` and `proposals/<id>.md` below it. */\n root: string\n /**\n * Optional search delegate. Its hits are merged with the built-in\n * keyword match: a hit naming an item of this store is checked against\n * the files (rule 22), anything else comes back as `source: \"knowledge\"`.\n */\n knowledge?: MemoryKnowledgeProvider\n /** The store's clock: `updated_at` on commits, and the in-force check. */\n now?: () => Date\n /**\n * The host declares AIP-34 trees (section 10, rule 33): a host call that\n * creates an item or a proposal with no node anchor is refused. Off: the\n * store behaves as sections 8 and 9 alone.\n */\n declaresTrees?: boolean\n}\n\ninterface StoredItem {\n record: MemoryRecord\n path: string\n text: string\n}\n\nconst SAFE_ID = /^[A-Za-z0-9][A-Za-z0-9_.-]*$/\nconst PROPOSAL_ID = /^[a-f0-9]{64}$/\nconst ID_ALPHABET = \"abcdefghijklmnopqrstuvwxyz0123456789\"\nconst DEFAULT_SEARCH_LIMIT = 20\nconst SNIPPET_CHARS = 160\n\n/**\n * AIP-72 section 8 reference store over a directory:\n *\n * ```\n * <root>/items/<type>/<id>.md one memory/v1 item per file\n * <root>/proposals/<sha256>.md pending proposals, not items\n * ```\n *\n * The files are the source of truth and the store keeps no index.\n * `revision` is the SHA-256 (hex) of the file bytes, a proposal id the\n * SHA-256 of the rendered proposal. Files are written to a temp file\n * then renamed into place. Item files are never deleted: a type change\n * renames the file, supersede and archive rewrite the `status` line\n * only. Mutations through one instance are serialized, so a\n * compare-and-set cannot interleave with another write of the same\n * store object; several processes writing one directory are not\n * coordinated.\n */\nexport class FilesMemoryStore implements MemoryStore {\n readonly #root: string\n readonly #knowledge: MemoryKnowledgeProvider | undefined\n readonly #now: () => Date\n readonly #declaresTrees: boolean\n #tail: Promise<unknown> = Promise.resolve()\n\n constructor(options: FilesMemoryStoreOptions) {\n this.#root = options.root\n this.#knowledge = options.knowledge\n this.#now = options.now ?? (() => new Date())\n this.#declaresTrees = options.declaresTrees ?? false\n }\n\n write(item: MemoryDocument, opts: MemoryWriteOptions): Promise<MemoryRecord> {\n return this.#exclusive(() =>\n opts.mode === \"propose\" ? this.#propose(item, opts) : this.#commit(item, opts),\n )\n }\n\n async read(id: string, opts: { scope?: MemoryScope } = {}): Promise<MemoryRecord | null> {\n const stored = await this.#find(id)\n // Rule 28: outside the projection reads as absent.\n return stored && visible(stored.record, opts.scope) ? stored.record : null\n }\n\n async list(filter: MemoryFilter = {}): Promise<readonly MemoryRecord[]> {\n const stored = filter.proposals ? await this.#allProposals() : await this.#allItems()\n const types = toArray(filter.type)\n const statuses = toArray(filter.status)\n // Section 8: in force by default when neither status nor inForce is\n // given. A proposal is never in force, so the default skips them.\n const inForce =\n filter.inForce ??\n (filter.status === undefined && !filter.proposals ? true : undefined)\n const now = this.#now()\n\n let records = stored\n .map((s) => s.record)\n .filter(({ item }) => {\n if (types && !types.includes(itemType(item) as never)) return false\n if (statuses && !statuses.includes(memoryStatus(item))) return false\n if (filter.slug !== undefined && item.slug !== filter.slug) return false\n if (filter.tags && !filter.tags.some((t) => item.tags?.includes(t))) return false\n // Rule 27, 29: the projection is applied here, before the slug\n // lookup below, and (for `search`) before ranking, snippets and limit.\n if (filter.scope && !isInNodeProjection(item, filter.scope)) return false\n if (inForce !== undefined) {\n const holds = !filter.proposals && isInForce(item, now)\n if (holds !== inForce) return false\n }\n return true\n })\n .sort(byNewest)\n\n // Rule 20: during an interrupted supersede two active items share a\n // slug; a lookup by slug returns the one with the later updated_at.\n if (filter.slug !== undefined && !filter.proposals) {\n const firstActive = records.find((r) => memoryStatus(r.item) === \"active\")\n records = records.filter(\n (r) => memoryStatus(r.item) !== \"active\" || r === firstActive,\n )\n }\n return records\n }\n\n async search(\n query: string,\n opts: MemorySearchOptions = {},\n ): Promise<readonly MemorySearchHit[]> {\n const limit = opts.limit ?? DEFAULT_SEARCH_LIMIT\n const candidates = await this.list(opts.filter)\n const byId = new Map(candidates.map((r) => [r.item.id as string, r]))\n const hits = new Map<string, MemorySearchHit>()\n\n const terms = query.toLowerCase().split(/\\s+/).filter(Boolean)\n for (const record of candidates) {\n const hit = keywordHit(record, terms)\n if (hit) hits.set(record.item.id as string, hit)\n }\n\n const foreign: MemorySearchHit[] = []\n // Rule 29: this store cannot restrict a provider's index to a projection,\n // so a scoped search is not delegated.\n if (this.#knowledge && !opts.filter?.scope) {\n const result = await this.#knowledge.query({ query, topK: limit })\n for (const kh of result.hits) {\n const named = kh.metadata?.memoryId\n const memoryId = typeof named === \"string\" ? named : kh.sourceId\n const record = byId.get(memoryId)\n if (record) {\n const prior = hits.get(memoryId)\n if (prior) prior.score = Math.max(prior.score ?? 0, kh.score)\n else hits.set(memoryId, memoryHit(record, kh.text || undefined, kh.score))\n continue\n }\n // Rule 22: an item of this store that the filter excludes (or no\n // longer in force) is dropped, never relabelled as knowledge.\n if (typeof named === \"string\" || (await this.read(memoryId))) continue\n const title = kh.metadata?.title\n foreign.push(\n compact({\n source: \"knowledge\" as const,\n title: typeof title === \"string\" && title ? title : kh.sourceId,\n snippet: kh.text ? clip(kh.text) : undefined,\n score: kh.score,\n ref: kh.chunkId ? `${kh.sourceId}#${kh.chunkId}` : kh.sourceId,\n }),\n )\n }\n }\n\n return [...hits.values(), ...foreign]\n .sort((a, b) => (b.score ?? 0) - (a.score ?? 0))\n .slice(0, limit)\n }\n\n supersede(\n oldId: string,\n next: MemoryDocument,\n opts: { ifRevision?: string; scope?: MemoryScope } = {},\n ): Promise<{ old: MemoryRecord; next: MemoryRecord }> {\n return this.#exclusive(async () => {\n const old = await this.#mustFind(oldId, opts.scope)\n checkRevision(oldId, opts.ifRevision, old.record.revision)\n const from = memoryStatus(old.record.item)\n if (from !== \"active\") throw new MemoryTransitionError(oldId, from, \"superseded\")\n if (next.id === oldId) {\n throw invalid(\"id\", \"the next item must have a new id (rule 20)\")\n }\n // Rule 20: commit the new item first, then retire the old one.\n const committed = await this.#commit(\n next,\n { mode: \"commit\", ...(opts.scope ? { scope: opts.scope } : {}) },\n oldId,\n old.record.item,\n )\n const retired = await this.#rewriteStatus(old, \"superseded\")\n return { old: retired, next: committed }\n })\n }\n\n archive(id: string, opts: { ifRevision?: string; scope?: MemoryScope } = {}): Promise<MemoryRecord> {\n return this.#exclusive(async () => {\n const stored = await this.#mustFind(id, opts.scope)\n checkRevision(id, opts.ifRevision, stored.record.revision)\n const from = memoryStatus(stored.record.item)\n if (from === \"archived\") return stored.record\n if (from !== \"active\") throw new MemoryTransitionError(id, from, \"archived\")\n return this.#rewriteStatus(stored, \"archived\")\n })\n }\n\n dismiss(proposalId: string, opts: { scope?: MemoryScope } = {}): Promise<void> {\n return this.#exclusive(async () => {\n if (!PROPOSAL_ID.test(proposalId)) throw new MemoryNotFoundError(\"proposal\", proposalId)\n if (opts.scope && !(await this.#proposalVisible(proposalId, opts.scope))) {\n throw new MemoryNotFoundError(\"proposal\", proposalId)\n }\n try {\n await unlink(this.#proposalPath(proposalId))\n } catch (err) {\n if (isNotFound(err)) throw new MemoryNotFoundError(\"proposal\", proposalId)\n throw err\n }\n })\n }\n\n async #propose(item: MemoryDocument, opts: MemoryWriteOptions): Promise<MemoryRecord> {\n const doc = clean(\n applyWriteScope(item, opts.scope, {\n ...(opts.owner ? { owner: opts.owner } : {}),\n declaresTrees: this.#declaresTrees,\n }),\n )\n const result = validateMemory(doc)\n if (!result.ok) {\n throw new MemoryValidationError(\"FilesMemoryStore.write (AIP-72 rule 13)\", result.errors)\n }\n const text = renderMemory(doc)\n const proposalId = sha256(text)\n const path = this.#proposalPath(proposalId)\n const existing = await readText(path)\n if (existing === null) await atomicWrite(path, text)\n return { item: parseMemory(text), revision: proposalId, proposalId }\n }\n\n /**\n * The commit half of `write`, unlocked. `ignoreSlugOf` is the item being\n * superseded, `superseded` its document: the new item inherits its node\n * and ownership when it names none.\n */\n async #commit(\n item: MemoryDocument,\n opts: MemoryWriteOptions,\n ignoreSlugOf?: string,\n superseded?: MemoryDocument,\n ): Promise<MemoryRecord> {\n let doc = clean(item)\n if (opts.fromProposal !== undefined) {\n const known =\n PROPOSAL_ID.test(opts.fromProposal) &&\n (await readText(this.#proposalPath(opts.fromProposal))) !== null &&\n (!opts.scope || (await this.#proposalVisible(opts.fromProposal, opts.scope)))\n if (!known) throw new MemoryNotFoundError(\"proposal\", opts.fromProposal)\n }\n if (doc.id !== undefined && !SAFE_ID.test(doc.id)) {\n throw invalid(\"id\", \"must be a file stem: [A-Za-z0-9] then [A-Za-z0-9_.-]\")\n }\n\n const existing = doc.id === undefined ? null : await this.#find(doc.id)\n // Rules 27, 28: an item outside the projection cannot be changed, and\n // reads as absent.\n if (existing && !visible(existing.record, opts.scope)) {\n throw new MemoryNotFoundError(\"item\", doc.id as string)\n }\n doc = clean(\n applyWriteScope(doc, opts.scope, {\n ...(opts.owner ? { owner: opts.owner } : {}),\n ...(existing || superseded ? { basis: (existing?.record.item ?? superseded) as MemoryDocument } : {}),\n declaresTrees: this.#declaresTrees && !existing,\n }),\n )\n const replaced = existing?.record.item ?? superseded\n if (replaced && opts.scope) assertRetagOnly(replaced, doc)\n const now = this.#now().toISOString()\n let next: MemoryDocument\n\n if (!existing) {\n if (opts.ifRevision !== undefined) {\n throw new MemoryConflictError(doc.id ?? \"(new item)\", opts.ifRevision, undefined)\n }\n const status = memoryStatus(doc)\n if (status !== \"active\") {\n throw new MemoryTransitionError(\n doc.id ?? \"(new item)\",\n \"active\",\n status,\n \"a writer creates an item active (section 3)\",\n )\n }\n next = { ...doc, id: doc.id ?? (await this.#newId()), updated_at: now }\n if (next.written !== undefined) next.written = now\n assertValid(next, true)\n } else {\n const current = existing.record\n const id = doc.id as string\n // Rule 18: equal but for updated_at / written is a no-op.\n if (sameContent(current.item, doc)) {\n await this.#dropProposal(opts.fromProposal)\n return current\n }\n checkRevision(id, opts.ifRevision, current.revision)\n const from = memoryStatus(current.item)\n const to = memoryStatus(doc)\n if (from !== to) {\n throw new MemoryTransitionError(\n id,\n from,\n to,\n from === \"active\" ? \"retire an item through supersede or archive\" : undefined,\n )\n }\n next = { ...doc, updated_at: now }\n if (next.written !== undefined || current.item.written !== undefined) next.written = now\n assertValid(next, false)\n }\n\n const id = next.id as string\n await this.#assertSlugFree(next, ignoreSlugOf)\n const path = this.#itemPath(itemType(next), id)\n if (existing && existing.path !== path) {\n // Rule 14: a type change moves the file; one file per id throughout.\n await mkdir(join(path, \"..\"), { recursive: true })\n await rename(existing.path, path)\n }\n const text = renderMemory(next)\n await atomicWrite(path, text)\n await this.#dropProposal(opts.fromProposal)\n return { item: withId(parseMemory(text), id), revision: sha256(text) }\n }\n\n /**\n * Supersede and archive are status-only rewrites (rules 6 and 19): the\n * `status` line is replaced, or added before the closing fence, and\n * every other byte stays as it was, whoever wrote the file.\n */\n async #rewriteStatus(stored: StoredItem, status: MemoryStatus): Promise<MemoryRecord> {\n const text = setStatusLine(stored.text, status)\n const item = withId(parseMemory(text), stored.record.item.id as string)\n if (item.status !== status) {\n throw new Error(`memory store (AIP-72): could not rewrite the status of '${item.id}'`)\n }\n await atomicWrite(stored.path, text)\n return { item, revision: sha256(text) }\n }\n\n async #assertSlugFree(next: MemoryDocument, ignore?: string): Promise<void> {\n if (next.slug === undefined || memoryStatus(next) !== \"active\") return\n for (const { record } of await this.#allItems()) {\n const other = record.item\n if (other.id === next.id || other.id === ignore) continue\n if (other.slug === next.slug && memoryStatus(other) === \"active\") {\n throw new MemorySlugTakenError(next.slug, other.id as string)\n }\n }\n }\n\n async #dropProposal(proposalId: string | undefined): Promise<void> {\n if (proposalId === undefined) return\n try {\n await unlink(this.#proposalPath(proposalId))\n } catch (err) {\n if (!isNotFound(err)) throw err\n }\n }\n\n async #newId(): Promise<string> {\n for (;;) {\n const id = `mem_${Array.from(randomBytes(8), (b) => ID_ALPHABET[b % 36]).join(\"\")}`\n if (!(await this.#find(id))) return id\n }\n }\n\n async #mustFind(id: string, scope?: MemoryScope): Promise<StoredItem> {\n const stored = await this.#find(id)\n if (!stored || !visible(stored.record, scope)) throw new MemoryNotFoundError(\"item\", id)\n return stored\n }\n\n async #proposalVisible(proposalId: string, scope: MemoryScope): Promise<boolean> {\n const text = await readText(this.#proposalPath(proposalId))\n return text !== null && isInNodeProjection(parseMemory(text), scope)\n }\n\n async #find(id: string): Promise<StoredItem | null> {\n if (!SAFE_ID.test(id)) return null\n for (const dir of await listDir(join(this.#root, \"items\"))) {\n const path = join(this.#root, \"items\", dir, `${id}.md`)\n const text = await readText(path)\n if (text !== null) return { record: itemRecord(text, id), path, text }\n }\n return null\n }\n\n async #allItems(): Promise<StoredItem[]> {\n const out: StoredItem[] = []\n for (const dir of await listDir(join(this.#root, \"items\"))) {\n for (const file of await listDir(join(this.#root, \"items\", dir))) {\n if (!isMarkdown(file)) continue\n const path = join(this.#root, \"items\", dir, file)\n const text = await readText(path)\n if (text !== null) out.push({ record: itemRecord(text, file.slice(0, -3)), path, text })\n }\n }\n return out\n }\n\n async #allProposals(): Promise<StoredItem[]> {\n const out: StoredItem[] = []\n for (const file of await listDir(join(this.#root, \"proposals\"))) {\n if (!isMarkdown(file)) continue\n const path = join(this.#root, \"proposals\", file)\n const text = await readText(path)\n if (text === null) continue\n const proposalId = file.slice(0, -3)\n out.push({ record: { item: parseMemory(text), revision: sha256(text), proposalId }, path, text })\n }\n return out\n }\n\n #itemPath(type: string, id: string): string {\n return join(this.#root, \"items\", type, `${id}.md`)\n }\n\n #proposalPath(proposalId: string): string {\n return join(this.#root, \"proposals\", `${proposalId}.md`)\n }\n\n #exclusive<T>(fn: () => Promise<T>): Promise<T> {\n const run = this.#tail.then(fn)\n this.#tail = run.catch(() => undefined)\n return run\n }\n}\n\n/** Rule 27: no scope is a host call, which sees everything. */\nfunction visible(record: MemoryRecord, scope: MemoryScope | undefined): boolean {\n return scope === undefined || isInNodeProjection(record.item, scope)\n}\n\nfunction itemRecord(text: string, id: string): MemoryRecord {\n return { item: withId(parseMemory(text), id), revision: sha256(text) }\n}\n\n/** The path stem is the id (section 8 layout); fill it in when the file omits it. */\nfunction withId(item: MemoryDocument, id: string): MemoryDocument {\n return item.id === undefined ? { ...item, id } : item\n}\n\nfunction itemType(item: MemoryDocument): string {\n return (item.type ?? item.kind) as string\n}\n\nfunction assertValid(doc: MemoryDocument, creating: boolean): void {\n // Rule 1: canonical fields on an item the store creates; a rewrite of a\n // legacy item may stay legacy (rule 9).\n const result = validateMemory(doc, { canonical: creating })\n if (!result.ok) {\n throw new MemoryValidationError(\"FilesMemoryStore.write (AIP-72 rule 13)\", result.errors)\n }\n}\n\nfunction invalid(path: string, message: string): MemoryValidationError {\n const issue: MemoryIssue = { path, message, rule: \"rule-13\" }\n return new MemoryValidationError(\"FilesMemoryStore (AIP-72)\", [issue])\n}\n\nfunction checkRevision(id: string, given: string | undefined, actual: string): void {\n if (given !== actual) throw new MemoryConflictError(id, given, actual)\n}\n\n/** Equal in every field but `updated_at` and `written`, body included (rule 18). */\nfunction sameContent(a: MemoryDocument, b: MemoryDocument): boolean {\n const strip = (d: MemoryDocument) => {\n const { updated_at: _u, written: _w, ...rest } = d\n return stableJson({ ...rest, status: memoryStatus(d) })\n }\n return strip(a) === strip(b)\n}\n\nfunction stableJson(value: unknown): string {\n return JSON.stringify(value, (_key, v: unknown) =>\n v && typeof v === \"object\" && !Array.isArray(v)\n ? Object.fromEntries(Object.entries(v).sort(([x], [y]) => (x < y ? -1 : x > y ? 1 : 0)))\n : v,\n )\n}\n\n/** Drop `undefined` fields (rule 4: omitted, never written empty). */\nfunction clean(item: MemoryDocument): MemoryDocument {\n return JSON.parse(JSON.stringify(item)) as MemoryDocument\n}\n\nfunction setStatusLine(text: string, status: MemoryStatus): string {\n const lines = text.split(\"\\n\")\n const open = lines[0]?.replace(/^/, \"\").trimEnd()\n const close = lines.findIndex((l, i) => i > 0 && l.trimEnd() === \"---\")\n if (open !== \"---\" || close < 0) {\n throw new Error(\"memory store (AIP-72): item file has no frontmatter fence\")\n }\n const cr = lines[close]!.endsWith(\"\\r\") ? \"\\r\" : \"\"\n const line = `status: \"${status}\"`\n const at = lines.findIndex((l, i) => i > 0 && i < close && /^status[ \\t]*:/.test(l))\n if (at >= 0) lines[at] = line + (lines[at]!.endsWith(\"\\r\") ? \"\\r\" : \"\")\n else lines.splice(close, 0, line + cr)\n return lines.join(\"\\n\")\n}\n\nfunction keywordHit(record: MemoryRecord, terms: readonly string[]): MemorySearchHit | null {\n if (terms.length === 0) return null\n const { item } = record\n const title = [item.title, item.name, item.slug].filter(Boolean).join(\" \").toLowerCase()\n const description = (item.description ?? \"\").toLowerCase()\n const body = item.body.toLowerCase()\n let points = 0\n for (const term of terms) {\n if (title.includes(term)) points += 3\n if (description.includes(term)) points += 2\n if (body.includes(term)) points += 1\n }\n if (points === 0) return null\n const snippetFrom = [item.body, item.description ?? \"\"].find((t) =>\n terms.some((term) => t.toLowerCase().includes(term)),\n )\n const snippet = snippetFrom ? around(snippetFrom, terms) : undefined\n // Normalized to (0, 1] so it ranks against a provider's scores.\n return memoryHit(record, snippet, points / (6 * terms.length))\n}\n\nfunction memoryHit(record: MemoryRecord, snippet: string | undefined, score: number): MemorySearchHit {\n const { item } = record\n return compact({\n source: \"memory\" as const,\n id: item.id as string,\n slug: item.slug,\n title: item.title ?? item.name ?? (item.id as string),\n snippet: snippet ?? (item.description || clip(item.body) || undefined),\n score,\n })\n}\n\nfunction around(text: string, terms: readonly string[]): string {\n const lower = text.toLowerCase()\n const at = Math.min(\n ...terms.map((t) => lower.indexOf(t)).filter((i) => i >= 0),\n )\n const start = Math.max(0, at - SNIPPET_CHARS / 4)\n return clip(text.slice(start))\n}\n\nfunction clip(text: string): string {\n const flat = text.replace(/\\s+/g, \" \").trim()\n return flat.length > SNIPPET_CHARS ? `${flat.slice(0, SNIPPET_CHARS - 1)}…` : flat\n}\n\nfunction compact<T extends object>(value: T): T {\n return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== undefined)) as T\n}\n\nfunction byNewest(a: MemoryRecord, b: MemoryRecord): number {\n const ta = a.item.updated_at ?? a.item.written ?? \"\"\n const tb = b.item.updated_at ?? b.item.written ?? \"\"\n if (ta !== tb) return ta < tb ? 1 : -1\n const ia = a.proposalId ?? a.item.id ?? \"\"\n const ib = b.proposalId ?? b.item.id ?? \"\"\n return ia < ib ? -1 : ia > ib ? 1 : 0\n}\n\nfunction toArray<T>(value: T | readonly T[] | undefined): readonly T[] | undefined {\n if (value === undefined) return undefined\n return Array.isArray(value) ? (value as readonly T[]) : [value as T]\n}\n\nfunction isMarkdown(file: string): boolean {\n return file.endsWith(\".md\") && !file.startsWith(\".\")\n}\n\nfunction sha256(text: string): string {\n return createHash(\"sha256\").update(text).digest(\"hex\")\n}\n\nasync function atomicWrite(path: string, text: string): Promise<void> {\n const dir = join(path, \"..\")\n await mkdir(dir, { recursive: true })\n const tmp = join(dir, `.${randomBytes(6).toString(\"hex\")}.tmp`)\n await writeFile(tmp, text, \"utf8\")\n try {\n await rename(tmp, path)\n } catch (err) {\n await unlink(tmp).catch(() => undefined)\n throw err\n }\n}\n\nasync function readText(path: string): Promise<string | null> {\n try {\n return await readFile(path, \"utf8\")\n } catch (err) {\n if (isNotFound(err)) return null\n throw err\n }\n}\n\nasync function listDir(path: string): Promise<string[]> {\n try {\n return (await readdir(path)).sort()\n } catch (err) {\n if (isNotFound(err)) return []\n throw err\n }\n}\n\nfunction isNotFound(err: unknown): boolean {\n const code = (err as { code?: string } | null)?.code\n return code === \"ENOENT\" || code === \"ENOTDIR\"\n}\n","/**\n * @agentproto/memory: AIP-72 memory/v1 reference implementation.\n *\n * One small typed assertion (user, feedback, project, reference) about a\n * principal or its work, with a lifecycle, stored as a markdown file\n * with YAML frontmatter.\n *\n * Spec: https://agentproto.sh/docs/aip-72\n *\n * Authoring paths:\n * - TS: `defineMemory({...})` -> frozen `MemoryHandle` (writer, canonical)\n * - MD: `parseMemory(src)` -> `MemoryDocument`, then `validateMemory(doc)`\n * - out: `renderMemory(doc)` -> MEMORY.md text\n *\n * Store (section 8): the `MemoryStore` port and `FilesMemoryStore`, the\n * reference layout (`items/<type>/<id>.md`, `proposals/<id>.md`).\n *\n * Node scope (section 10): `MemoryScope`, the `node:` and `operator:`\n * anchors, and the projection and write rules over a scope the host\n * computed (`isInNodeProjection`, `applyWriteScope`).\n */\n\nexport const SPEC_NAME = \"memory/v1\" as const\nexport const SPEC_VERSION = \"1.0.0-alpha\" as const\n\nexport { defineMemory } from \"./define-memory.js\"\nexport { validateMemory, type ValidateMemoryOptions } from \"./validate.js\"\nexport { parseMemory, renderMemory } from \"./markdown.js\"\nexport { isAllowedStatusTransition, isInForce, memoryStatus } from \"./lifecycle.js\"\nexport { MemoryParseError, MemoryValidationError } from \"./errors.js\"\nexport { memoryFrontmatterSchema } from \"./schema.js\"\nexport {\n applyWriteScope,\n assertRetagOnly,\n isInNodeProjection,\n isNodeOrOperatorTag,\n nodeAnchorIds,\n nodeTag,\n operatorAnchorIds,\n operatorTag,\n type NodeProjectionOptions,\n type WriteScopeOptions,\n} from \"./node-scope.js\"\nexport {\n MemoryConflictError,\n MemoryNotFoundError,\n MemorySlugTakenError,\n MemoryStoreError,\n MemoryTransitionError,\n type IMemoryStore,\n type MemoryFilter,\n type MemoryRecord,\n type MemoryScope,\n type MemorySearchHit,\n type MemorySearchOptions,\n type MemoryStore,\n type MemoryStoreErrorCode,\n type MemoryWriteOptions,\n} from \"./store.js\"\nexport {\n FilesMemoryStore,\n type FilesMemoryStoreOptions,\n type MemoryKnowledgeHit,\n type MemoryKnowledgeProvider,\n} from \"./files-store.js\"\nexport {\n MEMORY_STATUSES,\n MEMORY_TYPES,\n type MemoryAnchor,\n type MemoryCapture,\n type MemoryDecidedBy,\n type MemoryDefinition,\n type MemoryDocument,\n type MemoryEvidence,\n type MemoryFrontmatter,\n type MemoryHandle,\n type MemoryIssue,\n type MemoryLifetime,\n type MemoryProvenance,\n type MemoryStatus,\n type MemoryType,\n type MemoryValidationResult,\n} from \"./types.js\"\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentproto/memory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "@agentproto/memory: AIP-72 memory/v1 reference implementation. Define, validate, parse and render MEMORY.md items: one small typed assertion (user, feedback, project, reference) about a principal or its work, with a lifecycle.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentproto",
|