@stigmer/mcp-server 3.12.7 → 3.12.9

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.
Files changed (40) hide show
  1. package/cli/mcp-server-stigmer.js +4 -4
  2. package/config.d.ts +4 -1
  3. package/config.d.ts.map +1 -1
  4. package/config.js +2 -2
  5. package/config.js.map +1 -1
  6. package/domains/memory/calls.d.ts +8 -0
  7. package/domains/memory/calls.d.ts.map +1 -0
  8. package/domains/memory/calls.js +60 -0
  9. package/domains/memory/calls.js.map +1 -0
  10. package/domains/memory/context.d.ts +56 -0
  11. package/domains/memory/context.d.ts.map +1 -0
  12. package/domains/memory/context.js +92 -0
  13. package/domains/memory/context.js.map +1 -0
  14. package/domains/memory/errors.d.ts +21 -0
  15. package/domains/memory/errors.d.ts.map +1 -0
  16. package/domains/memory/errors.js +72 -0
  17. package/domains/memory/errors.js.map +1 -0
  18. package/domains/memory/tools.d.ts +12 -0
  19. package/domains/memory/tools.d.ts.map +1 -0
  20. package/domains/memory/tools.js +48 -0
  21. package/domains/memory/tools.js.map +1 -0
  22. package/index.d.ts +1 -1
  23. package/index.d.ts.map +1 -1
  24. package/index.js +1 -1
  25. package/index.js.map +1 -1
  26. package/package.json +3 -3
  27. package/server.d.ts +22 -4
  28. package/server.d.ts.map +1 -1
  29. package/server.js +32 -4
  30. package/server.js.map +1 -1
  31. package/src/config.ts +6 -3
  32. package/src/domains/memory/calls.ts +74 -0
  33. package/src/domains/memory/context.test.ts +95 -0
  34. package/src/domains/memory/context.ts +125 -0
  35. package/src/domains/memory/errors.ts +89 -0
  36. package/src/domains/memory/memory.integration.test.ts +253 -0
  37. package/src/domains/memory/tools.ts +75 -0
  38. package/src/http.integration.test.ts +1 -0
  39. package/src/index.ts +2 -0
  40. package/src/server.ts +38 -4
package/config.d.ts CHANGED
@@ -9,8 +9,11 @@ export type Transport = "stdio" | "http" | "both";
9
9
  * D8) with the agent-facing argument surface. This is what the
10
10
  * runner-synthesized channel attachment spawns over stdio; over HTTP
11
11
  * the same roster is served on the /channels route.
12
+ * - "memory": only remember (memory capture, DD-005 D1). What the
13
+ * runner-synthesized memory attachment spawns over stdio in local
14
+ * mode; over HTTP the same roster is served on the /memory route.
12
15
  */
13
- export type Roster = "full" | "channels";
16
+ export type Roster = "full" | "channels" | "memory";
14
17
  /**
15
18
  * OAuth 2.0 Protected Resource Metadata (RFC 9728) discovery settings.
16
19
  *
package/config.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAQA,OAAO,EAAO,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEjE,6DAA6D;AAC7D,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAElD;;;;;;;;GAQG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,oBAAoB,EAAE,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,CAAC;CACpC;AAED,gDAAgD;AAChD,MAAM,WAAW,MAAM;IACrB,mEAAmE;IACnE,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,kEAAkE;IAClE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,qEAAqE;IACrE,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,KAAK,E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EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAOD,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAkB9E;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAoDhD"}
package/config.js CHANGED
@@ -7,7 +7,7 @@
7
7
  // reproduces Go's hard-errors AND warnings, not just the defaults.
8
8
  import { log } from "./logger.js";
9
9
  const VALID_TRANSPORTS = ["stdio", "http", "both"];
10
- const VALID_ROSTERS = ["full", "channels"];
10
+ const VALID_ROSTERS = ["full", "channels", "memory"];
11
11
  const VALID_LOG_FORMATS = ["text", "json"];
12
12
  const VALID_LOG_LEVELS = ["debug", "info", "warn", "error"];
13
13
  /** Reads configuration from the process environment, applying defaults. */
@@ -41,7 +41,7 @@ export function validateConfig(cfg) {
41
41
  throw new Error(`invalid STIGMER_MCP_TRANSPORT "${cfg.transport}": must be stdio, http, or both`);
42
42
  }
43
43
  if (!VALID_ROSTERS.includes(cfg.roster)) {
44
- throw new Error(`invalid STIGMER_MCP_ROSTER "${cfg.roster}": must be full or channels`);
44
+ throw new Error(`invalid STIGMER_MCP_ROSTER "${cfg.roster}": must be full, channels, or memory`);
45
45
  }
46
46
  if (cfg.stigmerServerAddress === "") {
47
47
  throw new Error("STIGMER_SERVER_ADDRESS must not be empty");
package/config.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,+EAA+E;AAC/E,2EAA2E;AAC3E,mEAAmE;AAEnE,OAAO,EAAE,GAAG,EAAiC,MAAM,aAAa,CAAC;AAmDjE,MAAM,gBAAgB,GAAsB,CAA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E,OAAO,EAAE,CAAC;IACzC,OAAO,GAAG;SACP,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,SAAS,eAAe,CAAC,SAAiB;IACxC,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACrC,OAAO,KAAK,KAAK,CAAC,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IACpE,CAAC;IACD,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC7C,OAAO,SAAS,KAAK,CAAC,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC;AAClE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { CaptureContext } from "./context.js";
2
+ /**
3
+ * The model-facing outcome line. Honest by design: the record starts
4
+ * `proposed`, and only the user's confirm makes it recallable.
5
+ */
6
+ export declare const PROPOSED_OUTCOME = "Proposed \u2014 the user decides. Nothing is remembered unless they confirm this fact.";
7
+ export declare function proposeMemory(serverAddress: string, token: string, fact: string, context: CaptureContext): Promise<string>;
8
+ //# sourceMappingURL=calls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calls.d.ts","sourceRoot":"","sources":["../../../src/domains/memory/calls.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,2FACwD,CAAC;AAEtF,wBAAsB,aAAa,CACjC,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,MAAM,CAAC,CAiCjB"}
@@ -0,0 +1,60 @@
1
+ // Memory RPC invocation for the remember tool — a 1:1 projection of
2
+ // MemoryCommandController.create (DD-005 D2: the tool layer adds no
3
+ // semantics; enablement, the caller gate, subject derivation, the 500-char
4
+ // contract, and the 100-record cap all live in the server's create path).
5
+ //
6
+ // The channels-domain calls.ts shape: build request, call, marshal. The
7
+ // answer is a single JSON payload serving both audiences at once:
8
+ //
9
+ // { "outcome": "<honest one-liner for the model>", "memory": {…} }
10
+ //
11
+ // `outcome` is the DD-005 D2 relay — the fact was PROPOSED and awaits the
12
+ // user's decision, so the model never claims "I'll remember that". `memory`
13
+ // is the created record, verbatim proto JSON — the machine-checked contract
14
+ // the SDK's normalizeToolResult parses to render the consent chip (pinned
15
+ // in test/fixtures/tool-view/result-views.json).
16
+ import { create, toJson } from "@bufbuild/protobuf";
17
+ import { MemorySchema } from "@stigmer/protos/ai/stigmer/agentic/memory/v1/api_pb";
18
+ import { MemoryCommandController } from "@stigmer/protos/ai/stigmer/agentic/memory/v1/command_pb";
19
+ import { MemoryProvenanceSchema, MemorySpecSchema, } from "@stigmer/protos/ai/stigmer/agentic/memory/v1/spec_pb";
20
+ import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
21
+ import { withClient } from "../client.js";
22
+ /**
23
+ * The model-facing outcome line. Honest by design: the record starts
24
+ * `proposed`, and only the user's confirm makes it recallable.
25
+ */
26
+ export const PROPOSED_OUTCOME = "Proposed — the user decides. Nothing is remembered unless they confirm this fact.";
27
+ export async function proposeMemory(serverAddress, token, fact, context) {
28
+ const request = create(MemorySchema, {
29
+ apiVersion: "agentic.stigmer.ai/v1",
30
+ kind: "Memory",
31
+ metadata: create(ApiResourceMetadataSchema, {
32
+ // Org comes from the runner-threaded context, never from the model
33
+ // (no org argument exists — the channels rule). Name stays empty:
34
+ // memories are id-addressed and the server defaults the name.
35
+ org: context.org,
36
+ }),
37
+ spec: create(MemorySpecSchema, {
38
+ content: fact,
39
+ // subject_identity_account_id is deliberately absent: the server
40
+ // derives it from the calling credential (DD-005 D2) and ignores
41
+ // any supplied value.
42
+ provenance: create(MemoryProvenanceSchema, {
43
+ agentId: context.agentId,
44
+ sessionId: context.sessionId,
45
+ agentExecutionId: context.agentExecutionId,
46
+ // tool_call_id stays empty in v1 — MCP does not carry the
47
+ // harness's tool-call identity to the tool handler.
48
+ }),
49
+ }),
50
+ });
51
+ return withClient(MemoryCommandController, serverAddress, token, async (client, opts) => {
52
+ const created = await client.create(request, opts);
53
+ const answer = {
54
+ outcome: PROPOSED_OUTCOME,
55
+ memory: toJson(MemorySchema, created, { useProtoFieldName: true }),
56
+ };
57
+ return JSON.stringify(answer, null, 2);
58
+ });
59
+ }
60
+ //# sourceMappingURL=calls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calls.js","sourceRoot":"","sources":["../../../src/domains/memory/calls.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,oEAAoE;AACpE,2EAA2E;AAC3E,0EAA0E;AAC1E,EAAE;AACF,wEAAwE;AACxE,kEAAkE;AAClE,EAAE;AACF,qEAAqE;AACrE,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,4EAA4E;AAC5E,0EAA0E;AAC1E,iDAAiD;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAClG,OAAO,EACL,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,4DAA4D,CAAC;AAEvG,OAAO,EAAE,UAAU,EAAE,MAAM,c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 /** Header carrying the execution's org (per-request, bridge route). */
2
+ export declare const MEMORY_ORG_HEADER = "x-stigmer-memory-org";
3
+ /** Header carrying the executing agent's id. */
4
+ export declare const MEMORY_AGENT_ID_HEADER = "x-stigmer-memory-agent-id";
5
+ /** Header carrying the session id the execution belongs to. */
6
+ export declare const MEMORY_SESSION_ID_HEADER = "x-stigmer-memory-session-id";
7
+ /** Header carrying the agent execution id. */
8
+ export declare const MEMORY_EXECUTION_ID_HEADER = "x-stigmer-memory-execution-id";
9
+ /** Env var carrying the execution's org (per-process, stdio child). */
10
+ export declare const MEMORY_ORG_ENV = "STIGMER_MEMORY_ORG";
11
+ /** Env var carrying the executing agent's id. */
12
+ export declare const MEMORY_AGENT_ID_ENV = "STIGMER_MEMORY_AGENT_ID";
13
+ /** Env var carrying the session id the execution belongs to. */
14
+ export declare const MEMORY_SESSION_ID_ENV = "STIGMER_MEMORY_SESSION_ID";
15
+ /** Env var carrying the agent execution id. */
16
+ export declare const MEMORY_EXECUTION_ID_ENV = "STIGMER_MEMORY_EXECUTION_ID";
17
+ /**
18
+ * Where a proposed memory came from: the org the create is addressed to,
19
+ * plus the provenance triple stamped onto the record. Every field may be
20
+ * empty (best-effort attribution).
21
+ */
22
+ export interface CaptureContext {
23
+ readonly org: string;
24
+ readonly agentId: string;
25
+ readonly sessionId: string;
26
+ readonly agentExecutionId: string;
27
+ }
28
+ /** A context with no attribution — the resolve fallback of last resort. */
29
+ export declare const EMPTY_CAPTURE_CONTEXT: CaptureContext;
30
+ /**
31
+ * The subset of the MCP request `extra` this layer reads to resolve the
32
+ * capture context (the RequestAuth shape in client.ts, for headers).
33
+ * `headers` is the SDK's IsomorphicHeaders: a plain record whose values
34
+ * may be string arrays (Node folds repeated headers that way).
35
+ */
36
+ export interface RequestHeaders {
37
+ readonly requestInfo?: {
38
+ readonly headers?: Record<string, string | string[] | undefined>;
39
+ };
40
+ }
41
+ /**
42
+ * Read the capture context from the process environment — the stdio
43
+ * shape, captured once at server construction exactly like the startup
44
+ * API key. Deliberately NOT part of config.ts: Config mirrors the Go
45
+ * server's operator-facing surface, while these values are
46
+ * runner-injected per execution and owned by this domain.
47
+ */
48
+ export declare function loadCaptureContextFromEnv(env?: NodeJS.ProcessEnv): CaptureContext;
49
+ /**
50
+ * Resolve the capture context for an inbound remember call: the
51
+ * per-request headers when the transport carries request info (http),
52
+ * otherwise the startup context (stdio). Whole-object, not per-field —
53
+ * the two carriers are set by different processes and never mix.
54
+ */
55
+ export declare function resolveCaptureContext(extra: RequestHeaders | undefined, startup: CaptureContext): CaptureContext;
56
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/domains/memory/context.ts"],"names":[],"mappings":"AAoBA,uEAAuE;AACvE,eAAO,MAAM,iBAAiB,yBAAyB,CAAC;AACxD,gDAAgD;AAChD,eAAO,MAAM,sBAAsB,8BAA8B,CAAC;AAClE,+DAA+D;AAC/D,eAAO,MAAM,wBAAwB,gCAAgC,CAAC;AACtE,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B,kCAAkC,CAAC;AAE1E,uEAAuE;AACvE,eAAO,MAAM,cAAc,uBAAuB,CAAC;AACnD,iDAAiD;AACjD,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAC7D,gEAAgE;AAChE,eAAO,MAAM,qBAAqB,8BAA8B,CAAC;AACjE,+CAA+C;AAC/C,eAAO,MAAM,uBAAuB,gCAAgC,CAAC;AAErE;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC;AAED,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB,EAAE,cAKnC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE;QACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;KAClE,CAAC;CACH;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,cAAc,CAO9F;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,cAAc,GAAG,SAAS,EACjC,OAAO,EAAE,cAAc,GACtB,cAAc,CAShB"}
@@ -0,0 +1,92 @@
1
+ // The capture context a remember call attaches to the Memory it creates —
2
+ // org addressing plus provenance (agent, session, execution), threaded from
3
+ // the runner that synthesized the memory attachment (DD-005 D2; Stage 3
4
+ // provenance decision, owner-ratified 2026-08-22).
5
+ //
6
+ // Resolution mirrors the credential exactly (client.ts resolveToken): the
7
+ // per-request HTTP headers when the bridge transport carries them, falling
8
+ // back to the STIGMER_MEMORY_* environment captured at stdio startup. Each
9
+ // transport uses its natural carrier — headers are per-request on the
10
+ // bridge's /memory route, env is per-process on the runner-spawned stdio
11
+ // child — and both are written by the SAME author, the runner's
12
+ // synthesized attachment (memory-attachment.ts in the runner is the
13
+ // cross-repo twin; its test pins these names too).
14
+ //
15
+ // Trust posture: these values are attribution, never authorization. The
16
+ // cloud create handler accepts them only from a session-sandbox credential
17
+ // and overrides session/org with the token's own claims; the OSS server
18
+ // stores them under the local single-user trust model. A missing field
19
+ // degrades to empty — provenance is best-effort, the fact itself is not.
20
+ /** Header carrying the execution's org (per-request, bridge route). */
21
+ export const MEMORY_ORG_HEADER = "x-stigmer-memory-org";
22
+ /** Header carrying the executing agent's id. */
23
+ export const MEMORY_AGENT_ID_HEADER = "x-stigmer-memory-agent-id";
24
+ /** Header carrying the session id the execution belongs to. */
25
+ export const MEMORY_SESSION_ID_HEADER = "x-stigmer-memory-session-id";
26
+ /** Header carrying the agent execution id. */
27
+ export const MEMORY_EXECUTION_ID_HEADER = "x-stigmer-memory-execution-id";
28
+ /** Env var carrying the execution's org (per-process, stdio child). */
29
+ export const MEMORY_ORG_ENV = "STIGMER_MEMORY_ORG";
30
+ /** Env var carrying the executing agent's id. */
31
+ export const MEMORY_AGENT_ID_ENV = "STIGMER_MEMORY_AGENT_ID";
32
+ /** Env var carrying the session id the execution belongs to. */
33
+ export const MEMORY_SESSION_ID_ENV = "STIGMER_MEMORY_SESSION_ID";
34
+ /** Env var carrying the agent execution id. */
35
+ export const MEMORY_EXECUTION_ID_ENV = "STIGMER_MEMORY_EXECUTION_ID";
36
+ /** A context with no attribution — the resolve fallback of last resort. */
37
+ export const EMPTY_CAPTURE_CONTEXT = {
38
+ org: "",
39
+ agentId: "",
40
+ sessionId: "",
41
+ agentExecutionId: "",
42
+ };
43
+ /**
44
+ * Read the capture context from the process environment — the stdio
45
+ * shape, captured once at server construction exactly like the startup
46
+ * API key. Deliberately NOT part of config.ts: Config mirrors the Go
47
+ * server's operator-facing surface, while these values are
48
+ * runner-injected per execution and owned by this domain.
49
+ */
50
+ export function loadCaptureContextFromEnv(env = process.env) {
51
+ return {
52
+ org: env[MEMORY_ORG_ENV] ?? "",
53
+ agentId: env[MEMORY_AGENT_ID_ENV] ?? "",
54
+ sessionId: env[MEMORY_SESSION_ID_ENV] ?? "",
55
+ agentExecutionId: env[MEMORY_EXECUTION_ID_ENV] ?? "",
56
+ };
57
+ }
58
+ /**
59
+ * Resolve the capture context for an inbound remember call: the
60
+ * per-request headers when the transport carries request info (http),
61
+ * otherwise the startup context (stdio). Whole-object, not per-field —
62
+ * the two carriers are set by different processes and never mix.
63
+ */
64
+ export function resolveCaptureContext(extra, startup) {
65
+ const headers = extra?.requestInfo?.headers;
66
+ if (headers === undefined)
67
+ return startup;
68
+ return {
69
+ org: headerValue(headers, MEMORY_ORG_HEADER),
70
+ agentId: headerValue(headers, MEMORY_AGENT_ID_HEADER),
71
+ sessionId: headerValue(headers, MEMORY_SESSION_ID_HEADER),
72
+ agentExecutionId: headerValue(headers, MEMORY_EXECUTION_ID_HEADER),
73
+ };
74
+ }
75
+ /**
76
+ * Case-insensitive single-value header lookup. Node lowercases incoming
77
+ * header names but the web-standard transport may not; scanning keeps the
78
+ * lookup honest for both without depending on transport internals.
79
+ */
80
+ function headerValue(headers, name) {
81
+ const direct = headers[name];
82
+ if (direct !== undefined)
83
+ return Array.isArray(direct) ? (direct[0] ?? "") : direct;
84
+ const lower = name.toLowerCase();
85
+ for (const [key, value] of Object.entries(headers)) {
86
+ if (key.toLowerCase() === lower && value !== undefined) {
87
+ return Array.isArray(value) ? (value[0] ?? "") : value;
88
+ }
89
+ }
90
+ return "";
91
+ }
92
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/domains/memory/context.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,4EAA4E;AAC5E,wEAAwE;AACxE,mDAAmD;AACnD,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,2EAA2E;AAC3E,sEAAsE;AACtE,yEAAyE;AACzE,gEAAgE;AAChE,oEAAoE;AACpE,mDAAmD;AACnD,EAAE;AACF,wEAAwE;AACxE,2EAA2E;AAC3E,wEAAwE;AACxE,uEAAuE;AACvE,yEAAyE;AAEzE,uEAAuE;AACvE,MAAM,CAAC,MAAM,iBAAiB,GAAG,sBAAsB,CAAC;AACxD,gDAAgD;AAChD,MAAM,CAAC,MAAM,sBAAsB,GAAG,2BAA2B,CAAC;AAClE,+DAA+D;AAC/D,MAAM,CAAC,MAAM,wBAAwB,GAAG,6BAA6B,CAAC;AACtE,8CAA8C;AAC9C,MAAM,CAAC,MAAM,0BAA0B,GAAG,+BAA+B,CAAC;AAE1E,uEAAuE;AACvE,MAAM,CAAC,MAAM,cAAc,GAAG,oBAAoB,CAAC;AACnD,iDAAiD;AACjD,MAAM,CAAC,MAAM,mBAAmB,GAAG,yBA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KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACpF,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACjC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACnD,IAAI,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACvD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACzD,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { ConnectError } from "@connectrpc/connect";
2
+ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3
+ /** The structured error payload memory tools return for domain errors. */
4
+ export interface MemoryToolError {
5
+ /** The server's relayable message, byte-for-byte. */
6
+ error: string;
7
+ /** gRPC status name in SCREAMING_SNAKE (e.g. FAILED_PRECONDITION). */
8
+ code: string;
9
+ /** ErrorInfo reason, when the server attached one. */
10
+ reason?: string;
11
+ }
12
+ /**
13
+ * Run a memory-tool body: a string payload becomes a text result; a
14
+ * domain error becomes an isError JSON result carrying the verbatim
15
+ * message; a transport error delegates to the shared classifier. The
16
+ * only try/catch in this domain.
17
+ */
18
+ export declare function memoryResult(toolContext: string, produce: () => Promise<string>): Promise<CallToolResult>;
19
+ /** Project a domain ConnectError into the structured tool payload. */
20
+ export declare function domainError(ce: ConnectError): MemoryToolError;
21
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/domains/memory/errors.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAQ,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAkBzE,0EAA0E;AAC1E,MAAM,WAAW,eAAe;IAC9B,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,GAC7B,OAAO,CAAC,cAAc,CAAC,CAazB;AAED,sEAAsE;AACtE,wBAAgB,WAAW,CAAC,EAAE,EAAE,YAAY,GAAG,eAAe,CAU7D"}
@@ -0,0 +1,72 @@
1
+ // The memory-domain error mapper — the channels-domain sibling (DD-004
2
+ // S-7's recorded posture: siblings share the idiom, never an abstraction
3
+ // over it; each domain documents its own contract).
4
+ //
5
+ // Memory create errors carry agent-relayable messages that are contract
6
+ // bytes (DD-005 D2 / DD-006 D5): the visible-full refusal ("memory is
7
+ // full — review and delete existing memories"), the fail-closed
8
+ // enablement refusals (org or member has memory off), the strict caller
9
+ // gate's PERMISSION_DENIED, and the 1..500-char content contract. The
10
+ // shared ../rpcerr.ts would rewrite these into transport advice; here the
11
+ // domain codes pass the server's message through VERBATIM as isError JSON
12
+ // `{error, code, reason}` so the model can relay honestly — "memory is
13
+ // full" is something the user must act on, not something to retry.
14
+ // Transport codes still delegate to the shared helper, whose advice is
15
+ // right for them.
16
+ //
17
+ // The successful answer (outcome + created record) never reaches this
18
+ // file: a proposal is an ANSWER, never an error.
19
+ import { Code, ConnectError } from "@connectrpc/connect";
20
+ import { ErrorInfoSchema } from "@stigmer/protos/google/rpc/error_details_pb";
21
+ import { rpcError } from "../rpcerr.js";
22
+ import { errorResult, textResult } from "../toolresult.js";
23
+ /**
24
+ * The gRPC codes whose messages are the memory-domain contract: the
25
+ * strict caller gate (PERMISSION_DENIED), the content contract
26
+ * (INVALID_ARGUMENT — 1..500 chars), and actionable preconditions
27
+ * (FAILED_PRECONDITION — enablement off at either scope, the visible
28
+ * cap, the OSS/cloud edition refusals).
29
+ */
30
+ const DOMAIN_CODES = new Set([
31
+ Code.PermissionDenied,
32
+ Code.InvalidArgument,
33
+ Code.FailedPrecondition,
34
+ ]);
35
+ /**
36
+ * Run a memory-tool body: a string payload becomes a text result; a
37
+ * domain error becomes an isError JSON result carrying the verbatim
38
+ * message; a transport error delegates to the shared classifier. The
39
+ * only try/catch in this domain.
40
+ */
41
+ export async function memoryResult(toolContext, produce) {
42
+ try {
43
+ return textResult(await produce());
44
+ }
45
+ catch (err) {
46
+ const ce = ConnectError.from(err);
47
+ if (DOMAIN_CODES.has(ce.code)) {
48
+ return {
49
+ content: [{ type: "text", text: JSON.stringify(domainError(ce)) }],
50
+ isError: true,
51
+ };
52
+ }
53
+ return errorResult(rpcError(ce, toolContext));
54
+ }
55
+ }
56
+ /** Project a domain ConnectError into the structured tool payload. */
57
+ export function domainError(ce) {
58
+ const payload = {
59
+ error: ce.rawMessage,
60
+ code: grpcStatusName(ce.code),
61
+ };
62
+ const details = ce.findDetails(ErrorInfoSchema);
63
+ if (details.length > 0 && details[0].reason !== "") {
64
+ payload.reason = details[0].reason;
65
+ }
66
+ return payload;
67
+ }
68
+ /** Connect's PascalCase code name → the gRPC SCREAMING_SNAKE status name. */
69
+ function grpcStatusName(code) {
70
+ return Code[code].replace(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase();
71
+ }
72
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/domains/memory/errors.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yEAAyE;AACzE,oDAAoD;AACpD,EAAE;AACF,wEAAwE;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C,EAAgB;IAC1C,MAAM,OAAO,GAAoB;QAC/B,KAAK,EAAE,EAAE,CAAC,UAAU;QACpB,IAAI,EAAE,cAAc,CAAC,EAAE,CAAC,IAAI,CAAC;KAC9B,CAAC;IACF,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IAChD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QACnD,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACrC,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,6EAA6E;AAC7E,SAAS,cAAc,CAAC,IAAU;IAChC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;AACzE,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { type BackendTarget } from "../client.js";
3
+ import { type CaptureContext } from "./context.js";
4
+ /**
5
+ * Register the memory capture tool; returns the tool names.
6
+ *
7
+ * `startupContext` is the stdio-shape capture context (env-loaded at
8
+ * server construction); over HTTP each request's headers supersede it —
9
+ * the resolveToken fallback shape, applied to attribution.
10
+ */
11
+ export declare function registerMemoryTools(server: McpServer, target: BackendTarget, startupContext: CaptureContext): string[];
12
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/domains/memory/tools.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAEL,KAAK,cAAc,EAEpB,MAAM,cAAc,CAAC;AAGtB;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,aAAa,EACrB,cAAc,EAAE,cAAc,GAC7B,MAAM,EAAE,CAkCV"}
@@ -0,0 +1,48 @@
1
+ // The remember tool — the ONE tool of the memory roster (DD-005 D1: the
2
+ // first-party capture verb both harnesses receive through the
3
+ // runner-synthesized memory attachment).
4
+ //
5
+ // Agent audience only, by construction: this roster is what the memory
6
+ // attachment connects to, and the record's org, subject, and provenance
7
+ // all derive from the credential and the runner-threaded capture context
8
+ // (context.ts) — no org argument exists to invite rejected calls, and no
9
+ // argument can aim the record at another person. The tool is deliberately
10
+ // NOT on the full roster: a human operator manages memories through the
11
+ // console and SDK, which carry the addressing this path derives.
12
+ //
13
+ // The tool creates a PROPOSAL and nothing more (DD-005 D2/D3): the record
14
+ // lands lifecycle_state=proposed, and only the user's confirm — a
15
+ // control-plane command the model cannot reach — makes it recallable. The
16
+ // answer's `outcome` line states this so the model relays honestly.
17
+ import { z } from "zod";
18
+ import { resolveToken } from "../client.js";
19
+ import { proposeMemory } from "./calls.js";
20
+ import { resolveCaptureContext, } from "./context.js";
21
+ import { memoryResult } from "./errors.js";
22
+ /**
23
+ * Register the memory capture tool; returns the tool names.
24
+ *
25
+ * `startupContext` is the stdio-shape capture context (env-loaded at
26
+ * server construction); over HTTP each request's headers supersede it —
27
+ * the resolveToken fallback shape, applied to attribution.
28
+ */
29
+ export function registerMemoryTools(server, target, startupContext) {
30
+ server.registerTool("remember", {
31
+ description: "Propose one durable fact about the person you are assisting, to be recalled in " +
32
+ "their future sessions — a stable preference, situation, or way of working " +
33
+ "(e.g. \"Prefers concise answers with code examples\"). Not task state, not " +
34
+ "secrets or credentials, not one-off details. The fact is only PROPOSED: the " +
35
+ "user reviews the exact text and decides — tell them you have suggested it, " +
36
+ "never that you have remembered it. Keep each fact self-contained and under " +
37
+ "500 characters; call once per fact.",
38
+ inputSchema: {
39
+ fact: z
40
+ .string()
41
+ .describe("The fact to remember, stated in the third person and self-contained " +
42
+ '(e.g. "Works primarily in Go and prefers table-driven tests"). ' +
43
+ "1–500 characters; stored and shown to the user verbatim."),
44
+ },
45
+ }, (args, extra) => memoryResult("memory proposal", () => proposeMemory(target.serverAddress, resolveToken(extra, target.apiKey), args.fact, resolveCaptureContext(extra, startupContext))));
46
+ return ["remember"];
47
+ }
48
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/domains/memory/tools.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,8DAA8D;AAC9D,yCAAyC;AACzC,EAAE;AACF,uEAAuE;AACvE,wEAAwE;AACxE,yEAAyE;AACzE,yEAAyE;AACzE,0EAA0E;AAC1E,wEAAwE;AACxE,iEAAiE;AACjE,EAAE;AACF,0EAA0E;AAC1E,kEAAkE;AAClE,0EAA0E;AAC1E,oEAAoE;AAGpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAsB,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EACL,qBAAqB,GAGtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAiB,EACjB,MAAqB,EACrB,cAA8B;IAE9B,MAAM,CAAC,YAAY,CACjB,UAAU,EACV;QACE,WAAW,EACT,iFAAiF;YACjF,4EAA4E;YAC5E,6EAA6E;YAC7E,8EAA8E;YAC9E,6EAA6E;YAC7E,6EAA6E;YAC7E,qCAAqC;QACvC,WAAW,EAAE;YACX,IAAI,EAAE,CAAC;iBACJ,MAAM,EAAE;iBACR,QAAQ,CACP,sEAAsE;gBACpE,iEAAiE;gBACjE,0DAA0D,CAC7D;SACJ;KACF,EACD,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACd,YAAY,CAAC,iBAAiB,EAAE,GAAG,EAAE,CACnC,aAAa,CACX,MAAM,CAAC,aAAa,EACpB,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAClC,IAAI,CAAC,IAAI,EACT,qBAAqB,CAAC,KAAuB,EAAE,cAAc,CAAC,CAC/D,CACF,CACJ,CAAC;IAEF,OAAO,CAAC,UAAU,CAAC,CAAC;AACtB,CAAC"}
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { type Config } from "./config.js";
2
2
  export type { Config, OAuthConfig, Roster, Transport } from "./config.js";
3
3
  export { loadConfigFromEnv, validateConfig } from "./config.js";
4
- export { CHANNELS_ROUTE, CONVERSATION_ROUTE, createChannelsServer, createConversationServer, createServer, FULL_ROUTE, SERVER_VERSION, } from "./server.js";
4
+ export { CHANNELS_ROUTE, CONVERSATION_ROUTE, createChannelsServer, createConversationServer, createMemoryServer, createServer, FULL_ROUTE, MEMORY_ROUTE, SERVER_VERSION, } from "./server.js";
5
5
  /** Returns a Config populated from environment variables (no validation). */
6
6
  export declare function defaultConfig(): Config;
7
7
  /**
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAqC,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAY7E,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,YAAY,EACZ,UAAU,EACV,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,6EAA6E;AAC7E,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCzE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAqC,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAY7E,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,6EAA6E;AAC7E,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCzE"}
package/index.js CHANGED
@@ -7,7 +7,7 @@ import { loadConfigFromEnv, validateConfig } from "./config.js";
7
7
  import { configureLogger, log } from "./logger.js";
8
8
  import { isNormalShutdown, routedServerFactory, serveBoth, serveHttp, serveStdio, stdioServer, } from "./server.js";
9
9
  export { loadConfigFromEnv, validateConfig } from "./config.js";
10
- export { CHANNELS_ROUTE, CONVERSATION_ROUTE, createChannelsServer, createConversationServer, createServer, FULL_ROUTE, SERVER_VERSION, } from "./server.js";
10
+ export { CHANNELS_ROUTE, CONVERSATION_ROUTE, createChannelsServer, createConversationServer, createMemoryServer, createServer, FULL_ROUTE, MEMORY_ROUTE, SERVER_VERSION, } from "./server.js";
11
11
  /** Returns a Config populated from environment variables (no validation). */
12
12
  export function defaultConfig() {
13
13
  return loadConfigFromEnv();
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","source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C,4BAA4B,CAAC,CAAC;AACzC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigmer/mcp-server",
3
- "version": "3.12.7",
3
+ "version": "3.12.9",
4
4
  "description": "Model Context Protocol server for the Stigmer platform — exposes Stigmer agents, skills, MCP servers, and workflows as MCP tools and resources",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -35,8 +35,8 @@
35
35
  "@connectrpc/connect": "^2.0.0",
36
36
  "@connectrpc/connect-node": "^2.1.1",
37
37
  "@modelcontextprotocol/sdk": "^1.26.0",
38
- "@stigmer/protos": "3.12.7",
39
- "@stigmer/sdk": "3.12.7",
38
+ "@stigmer/protos": "3.12.9",
39
+ "@stigmer/sdk": "3.12.9",
40
40
  "yaml": "^2.8.2",
41
41
  "zod": "^3.25.0"
42
42
  }
package/server.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import type { Config } from "./config.js";
3
3
  import type { BackendTarget } from "./domains/client.js";
4
+ import { type CaptureContext } from "./domains/memory/context.js";
4
5
  /**
5
6
  * Server version. Overridable at publish/build time; "dev" otherwise, matching
6
7
  * the Go server's ldflags fallback.
@@ -36,6 +37,20 @@ export declare function createChannelsServer(target: BackendTarget): McpServer;
36
37
  * fail. Honest absence instead.
37
38
  */
38
39
  export declare function createConversationServer(target: BackendTarget): McpServer;
40
+ /**
41
+ * Build a memory-only MCP server: remember with the agent-facing argument
42
+ * surface, and nothing else (DD-005 D1 — the channels-roster pattern).
43
+ * This is the roster the runner-synthesized memory attachment connects
44
+ * to; the structural guarantee mirrors the channels roster's. Served on
45
+ * the /memory HTTP route and as the stdio roster when
46
+ * STIGMER_MCP_ROSTER=memory.
47
+ *
48
+ * `startupContext` is the stdio-shape capture context, read from the
49
+ * runner-set STIGMER_MEMORY_* environment at construction (the startup
50
+ * API key pattern). Over HTTP each request's provenance headers
51
+ * supersede it, so the http factory's env read is a harmless no-op.
52
+ */
53
+ export declare function createMemoryServer(target: BackendTarget, startupContext?: CaptureContext): McpServer;
39
54
  /**
40
55
  * Serve over stdin/stdout until the client disconnects or `signal` aborts.
41
56
  *
@@ -62,10 +77,13 @@ export declare const FULL_ROUTE = "/";
62
77
  export declare const CHANNELS_ROUTE = "/channels";
63
78
  /** HTTP route serving the conversation-only roster (channel-conversations A14). */
64
79
  export declare const CONVERSATION_ROUTE = "/conversation";
80
+ /** HTTP route serving the memory-only roster (memory capture, DD-005 D1). */
81
+ export declare const MEMORY_ROUTE = "/memory";
65
82
  /**
66
83
  * The standard HTTP route dispatch: the full roster on {@link FULL_ROUTE},
67
84
  * the channels-only roster on {@link CHANNELS_ROUTE}, the
68
- * conversation-only roster on {@link CONVERSATION_ROUTE} — and NOTHING
85
+ * conversation-only roster on {@link CONVERSATION_ROUTE}, the
86
+ * memory-only roster on {@link MEMORY_ROUTE} — and NOTHING
69
87
  * anywhere else.
70
88
  *
71
89
  * The closed route table is load-bearing, not tidiness. This dispatch
@@ -108,9 +126,9 @@ export declare function serveHttp(makeServer: RouteServerFactory, cfg: Config, s
108
126
  */
109
127
  export declare function serveBoth(target: BackendTarget, cfg: Config, signal: AbortSignal): Promise<void>;
110
128
  /**
111
- * The stdio server for the configured roster: the channels-only roster
112
- * when STIGMER_MCP_ROSTER names it (what the OSS runner-synthesized
113
- * attachment spawns), the full roster otherwise.
129
+ * The stdio server for the configured roster: the channels-only or
130
+ * memory-only roster when STIGMER_MCP_ROSTER names one (what the OSS
131
+ * runner-synthesized attachments spawn), the full roster otherwise.
114
132
  */
115
133
  export declare function stdioServer(target: BackendTarget, cfg: Config): McpServer;
116
134
  /**
package/server.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,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