managed-deepagents 0.5.0-dev.90 → 0.5.0-dev.97

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 (143) hide show
  1. package/README.md +36 -37
  2. package/dist/channels/manifest.d.ts +1 -1
  3. package/dist/channels/manifest.d.ts.map +1 -1
  4. package/dist/channels/slack/adapter.d.ts.map +1 -1
  5. package/dist/channels/slack/adapter.js +0 -1
  6. package/dist/channels/slack/adapter.js.map +1 -1
  7. package/dist/channels/slack/http.d.ts +3 -1
  8. package/dist/channels/slack/http.d.ts.map +1 -1
  9. package/dist/channels/slack/http.js +40 -5
  10. package/dist/channels/slack/http.js.map +1 -1
  11. package/dist/channels/slack/index.d.ts +23 -8
  12. package/dist/channels/slack/index.d.ts.map +1 -1
  13. package/dist/channels/slack/index.js +32 -29
  14. package/dist/channels/slack/index.js.map +1 -1
  15. package/dist/channels/slack/normalize.d.ts +4 -1
  16. package/dist/channels/slack/normalize.d.ts.map +1 -1
  17. package/dist/channels/slack/normalize.js +46 -10
  18. package/dist/channels/slack/normalize.js.map +1 -1
  19. package/dist/channels/store.d.ts +14 -0
  20. package/dist/channels/store.d.ts.map +1 -1
  21. package/dist/channels/store.js +41 -27
  22. package/dist/channels/store.js.map +1 -1
  23. package/dist/define-deep-agent.d.ts.map +1 -1
  24. package/dist/define-deep-agent.js +9 -3
  25. package/dist/define-deep-agent.js.map +1 -1
  26. package/dist/extension.d.ts +6 -14
  27. package/dist/extension.d.ts.map +1 -1
  28. package/dist/extension.js +5 -24
  29. package/dist/extension.js.map +1 -1
  30. package/dist/identity/github/connect-http.d.ts +1 -2
  31. package/dist/identity/github/connect-http.d.ts.map +1 -1
  32. package/dist/identity/github/connect-http.js +5 -8
  33. package/dist/identity/github/connect-http.js.map +1 -1
  34. package/dist/identity/github/credentials-store.d.ts.map +1 -1
  35. package/dist/identity/github/credentials-store.js +26 -10
  36. package/dist/identity/github/credentials-store.js.map +1 -1
  37. package/dist/identity/index.d.ts +15 -71
  38. package/dist/identity/index.d.ts.map +1 -1
  39. package/dist/identity/index.js +30 -223
  40. package/dist/identity/index.js.map +1 -1
  41. package/dist/identity/oauth-env.d.ts +4 -3
  42. package/dist/identity/oauth-env.d.ts.map +1 -1
  43. package/dist/identity/oauth-env.js +4 -3
  44. package/dist/identity/oauth-env.js.map +1 -1
  45. package/dist/identity/options.d.ts +12 -71
  46. package/dist/identity/options.d.ts.map +1 -1
  47. package/dist/identity/options.js +38 -112
  48. package/dist/identity/options.js.map +1 -1
  49. package/dist/identity/slack/links.d.ts +1 -1
  50. package/dist/identity/slack/links.d.ts.map +1 -1
  51. package/dist/identity/slack/links.js +27 -11
  52. package/dist/identity/slack/links.js.map +1 -1
  53. package/dist/identity/types.d.ts +11 -42
  54. package/dist/identity/types.d.ts.map +1 -1
  55. package/dist/index.d.ts +7 -9
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +3 -2
  58. package/dist/index.js.map +1 -1
  59. package/dist/ingress/index.d.ts.map +1 -1
  60. package/dist/ingress/index.js +26 -10
  61. package/dist/ingress/index.js.map +1 -1
  62. package/dist/memory/define-memory.d.ts +39 -0
  63. package/dist/memory/define-memory.d.ts.map +1 -0
  64. package/dist/memory/define-memory.js +78 -0
  65. package/dist/memory/define-memory.js.map +1 -0
  66. package/dist/memory/index.d.ts +9 -0
  67. package/dist/memory/index.d.ts.map +1 -0
  68. package/dist/memory/index.js +8 -0
  69. package/dist/memory/index.js.map +1 -0
  70. package/dist/memory/instructions-middleware.d.ts +74 -0
  71. package/dist/memory/instructions-middleware.d.ts.map +1 -0
  72. package/dist/memory/instructions-middleware.js +115 -0
  73. package/dist/memory/instructions-middleware.js.map +1 -0
  74. package/dist/memory/slices.d.ts +21 -0
  75. package/dist/memory/slices.d.ts.map +1 -0
  76. package/dist/memory/slices.js +61 -0
  77. package/dist/memory/slices.js.map +1 -0
  78. package/dist/memory/types.d.ts +71 -0
  79. package/dist/memory/types.d.ts.map +1 -0
  80. package/dist/memory/types.js +10 -0
  81. package/dist/memory/types.js.map +1 -0
  82. package/dist/namespaces.d.ts +3 -9
  83. package/dist/namespaces.d.ts.map +1 -1
  84. package/dist/namespaces.js +2 -19
  85. package/dist/namespaces.js.map +1 -1
  86. package/dist/runtime/auth.d.ts +30 -18
  87. package/dist/runtime/auth.d.ts.map +1 -1
  88. package/dist/runtime/auth.js +179 -65
  89. package/dist/runtime/auth.js.map +1 -1
  90. package/dist/runtime/identity-http.d.ts +1 -3
  91. package/dist/runtime/identity-http.d.ts.map +1 -1
  92. package/dist/runtime/identity-http.js +23 -40
  93. package/dist/runtime/identity-http.js.map +1 -1
  94. package/dist/runtime/identity-runtime.d.ts +0 -18
  95. package/dist/runtime/identity-runtime.d.ts.map +1 -1
  96. package/dist/runtime/identity-runtime.js +0 -27
  97. package/dist/runtime/identity-runtime.js.map +1 -1
  98. package/dist/runtime/index.d.ts +2 -3
  99. package/dist/runtime/index.d.ts.map +1 -1
  100. package/dist/runtime/index.js +29 -31
  101. package/dist/runtime/index.js.map +1 -1
  102. package/dist/runtime/memory/index.d.ts +0 -3
  103. package/dist/runtime/memory/index.d.ts.map +1 -1
  104. package/dist/runtime/memory/index.js +0 -3
  105. package/dist/runtime/memory/index.js.map +1 -1
  106. package/dist/runtime/memory/mounts.d.ts +2 -10
  107. package/dist/runtime/memory/mounts.d.ts.map +1 -1
  108. package/dist/runtime/memory/mounts.js +3 -11
  109. package/dist/runtime/memory/mounts.js.map +1 -1
  110. package/dist/runtime/sandbox-manager.d.ts +5 -0
  111. package/dist/runtime/sandbox-manager.d.ts.map +1 -1
  112. package/dist/runtime/sandbox-manager.js +18 -13
  113. package/dist/runtime/sandbox-manager.js.map +1 -1
  114. package/dist/runtime/types.d.ts +8 -0
  115. package/dist/runtime/types.d.ts.map +1 -1
  116. package/dist/runtime/validated-token.d.ts +7 -12
  117. package/dist/runtime/validated-token.d.ts.map +1 -1
  118. package/dist/runtime/validated-token.js +10 -66
  119. package/dist/runtime/validated-token.js.map +1 -1
  120. package/dist/sandbox.d.ts +16 -38
  121. package/dist/sandbox.d.ts.map +1 -1
  122. package/dist/sandbox.js +9 -16
  123. package/dist/sandbox.js.map +1 -1
  124. package/dist/types.d.ts +4 -3
  125. package/dist/types.d.ts.map +1 -1
  126. package/dist/types.js.map +1 -1
  127. package/package.json +8 -8
  128. package/dist/identity/memory-slices.d.ts +0 -21
  129. package/dist/identity/memory-slices.d.ts.map +0 -1
  130. package/dist/identity/memory-slices.js +0 -105
  131. package/dist/identity/memory-slices.js.map +0 -1
  132. package/dist/runtime/memory/lazy-context-backend.d.ts +0 -74
  133. package/dist/runtime/memory/lazy-context-backend.d.ts.map +0 -1
  134. package/dist/runtime/memory/lazy-context-backend.js +0 -166
  135. package/dist/runtime/memory/lazy-context-backend.js.map +0 -1
  136. package/dist/runtime/memory/seed.d.ts +0 -30
  137. package/dist/runtime/memory/seed.d.ts.map +0 -1
  138. package/dist/runtime/memory/seed.js +0 -199
  139. package/dist/runtime/memory/seed.js.map +0 -1
  140. package/dist/runtime/memory/user-repo.d.ts +0 -18
  141. package/dist/runtime/memory/user-repo.d.ts.map +0 -1
  142. package/dist/runtime/memory/user-repo.js +0 -50
  143. package/dist/runtime/memory/user-repo.js.map +0 -1
@@ -1,199 +0,0 @@
1
- import { mkdir, open, readFile, writeFile } from "node:fs/promises";
2
- import { dirname, join } from "node:path";
3
- import { downloadContextFile, pathExists } from "./context-io.js";
4
- const MEMORY_SEED_START = "<!-- MANAGED-DEEPAGENTS MEMORY INSTRUCTIONS: DO NOT DELETE -->";
5
- const MEMORY_SEED_END = "<!-- END MANAGED-DEEPAGENTS MEMORY INSTRUCTIONS: DO NOT DELETE -->";
6
- /**
7
- * True when hot memory has inject-able body text.
8
- *
9
- * deepagents' Python MemoryMiddleware drops `<!-- ... -->` before injection, so
10
- * blank or comment-only files surface as "(No memory loaded)". Uses a linear
11
- * scan (no regex) so CodeQL does not flag sanitization / ReDoS patterns.
12
- */
13
- function hotMemoryHasBody(content) {
14
- if (content === undefined) {
15
- return false;
16
- }
17
- return nonCommentBodyLength(content) > 0;
18
- }
19
- /** Count non-whitespace characters outside HTML comments. */
20
- function nonCommentBodyLength(content) {
21
- let i = 0;
22
- let count = 0;
23
- const n = content.length;
24
- while (i < n) {
25
- if (content.startsWith("<!--", i)) {
26
- const end = content.indexOf("-->", i + 4);
27
- if (end === -1) {
28
- // Unclosed comment: ignore the remainder (no inject-able body).
29
- break;
30
- }
31
- i = end + 3;
32
- continue;
33
- }
34
- const code = content.charCodeAt(i);
35
- // Whitespace: space, tab, LF, CR, FF, VT
36
- if (code !== 32 &&
37
- code !== 9 &&
38
- code !== 10 &&
39
- code !== 13 &&
40
- code !== 12 &&
41
- code !== 11) {
42
- count += 1;
43
- }
44
- i += 1;
45
- }
46
- return count;
47
- }
48
- /** Fallback hot-memory seed when the hub has no agent/flat AGENTS.md. */
49
- export const LOCAL_MEMORY_SEED = `<!-- MANAGED-DEEPAGENTS MEMORY INSTRUCTIONS: DO NOT DELETE -->
50
- # Memory Instructions
51
-
52
- Managed Deep Agents mounts durable memory under \`/memories/\` when enabled:
53
-
54
- - \`/memories/agent/\` — deployment-shared procedural memory (read/write; all callers)
55
- - \`/memories/user/\` — this run's private personal slice (read/write)
56
-
57
- ## Hot memory (always loaded when the slice is enabled)
58
-
59
- - \`/memories/agent/AGENTS.md\` — shared processes, playbooks, agent-wide facts
60
- - \`/memories/user/AGENTS.md\` — compact personal preferences for this caller
61
-
62
- Rules:
63
-
64
- - Keep hot files small. Prefer bullet points over long prose.
65
- - When adding new hot entries, remove or compress stale ones in the same edit.
66
- - Use only \`read_file\` / \`edit_file\` on these paths (not shell paths).
67
- - Cold files go under the matching tree (for example \`/memories/user/archive/\` or \`/memories/agent/processes/\`).
68
- - Do not store secrets, API keys, OAuth tokens, or passwords in any memory file.
69
-
70
- <!-- END MANAGED-DEEPAGENTS MEMORY INSTRUCTIONS: DO NOT DELETE -->
71
- `;
72
- /**
73
- * True when a managed memory seed still teaches an obsolete layout.
74
- *
75
- * Stale templates omit `/memories/agent/` or still mention removed `/memories/org`.
76
- */
77
- export function memorySeedNeedsRefresh(content) {
78
- if (content === undefined) {
79
- return false;
80
- }
81
- if (!content.includes("MANAGED-DEEPAGENTS MEMORY INSTRUCTIONS")) {
82
- return false;
83
- }
84
- return (!content.includes("/memories/agent/") ||
85
- content.includes("/memories/org") ||
86
- !content.includes("/memories/user/AGENTS.md"));
87
- }
88
- /**
89
- * Replace only the managed instruction block, preserving author notes outside it.
90
- *
91
- * When the end marker is missing (truncated legacy templates), replaces from the
92
- * start marker through EOF. Content before the start marker is kept.
93
- */
94
- export function refreshManagedMemoryInstructions(content, template = LOCAL_MEMORY_SEED) {
95
- const start = content.indexOf(MEMORY_SEED_START);
96
- if (start === -1) {
97
- return template;
98
- }
99
- const endMarker = content.indexOf(MEMORY_SEED_END, start);
100
- const end = endMarker === -1 ? content.length : endMarker + MEMORY_SEED_END.length;
101
- const before = content.slice(0, start).replace(/\s+$/u, "");
102
- const after = content.slice(end).replace(/^\s+/u, "");
103
- const mid = template.replace(/\s+$/u, "");
104
- const parts = [before, mid, after].filter((part) => part.length > 0);
105
- let out = parts.join("\n");
106
- if (template.endsWith("\n") && !out.endsWith("\n")) {
107
- out += "\n";
108
- }
109
- return out;
110
- }
111
- function selectMemorySeed(agentHot, flatHot) {
112
- const candidate = agentHot !== undefined && hotMemoryHasBody(agentHot)
113
- ? agentHot
114
- : flatHot !== undefined && hotMemoryHasBody(flatHot)
115
- ? flatHot
116
- : LOCAL_MEMORY_SEED;
117
- return memorySeedNeedsRefresh(candidate)
118
- ? refreshManagedMemoryInstructions(candidate)
119
- : candidate;
120
- }
121
- async function writeSeedFileExclusive(path, content) {
122
- let handle;
123
- try {
124
- handle = await open(path, "wx", 0o600);
125
- }
126
- catch (err) {
127
- if (err.code === "EEXIST") {
128
- return;
129
- }
130
- throw err;
131
- }
132
- try {
133
- await handle.writeFile(content, "utf8");
134
- }
135
- finally {
136
- await handle.close();
137
- }
138
- }
139
- /**
140
- * Seed `/AGENTS.md` in a per-user memory repo from the deploy agent template.
141
- * First write creates the Hub repo via LangSmith `pushAgent`.
142
- *
143
- * Stale managed instruction blocks are refreshed in place; notes outside the
144
- * managed markers are preserved.
145
- */
146
- export async function ensureUserMemorySeed(options) {
147
- const { userBackend, deployBackend, localRoot, deployRoot } = options;
148
- if (localRoot !== undefined) {
149
- const hotPath = join(localRoot, "AGENTS.md");
150
- if (await pathExists(hotPath)) {
151
- const existing = await readFile(hotPath, "utf8");
152
- if (hotMemoryHasBody(existing) && !memorySeedNeedsRefresh(existing)) {
153
- return;
154
- }
155
- if (hotMemoryHasBody(existing) && memorySeedNeedsRefresh(existing)) {
156
- await writeFile(hotPath, refreshManagedMemoryInstructions(existing), "utf8");
157
- return;
158
- }
159
- }
160
- await mkdir(dirname(hotPath), { recursive: true, mode: 0o700 });
161
- let agentHot;
162
- let flatHot;
163
- if (deployRoot !== undefined) {
164
- const agentPath = join(deployRoot, "memories", "agent", "AGENTS.md");
165
- const flatPath = join(deployRoot, "memories", "AGENTS.md");
166
- if (await pathExists(agentPath)) {
167
- agentHot = await readFile(agentPath, "utf8");
168
- }
169
- if (await pathExists(flatPath)) {
170
- flatHot = await readFile(flatPath, "utf8");
171
- }
172
- }
173
- const seed = selectMemorySeed(agentHot, flatHot);
174
- if (await pathExists(hotPath)) {
175
- // Blank / comment-only leftovers: overwrite.
176
- await writeFile(hotPath, seed, "utf8");
177
- return;
178
- }
179
- await writeSeedFileExclusive(hotPath, seed);
180
- return;
181
- }
182
- const existing = await downloadContextFile(userBackend, "/AGENTS.md");
183
- if (hotMemoryHasBody(existing) && !memorySeedNeedsRefresh(existing)) {
184
- return;
185
- }
186
- const content = existing !== undefined &&
187
- hotMemoryHasBody(existing) &&
188
- memorySeedNeedsRefresh(existing)
189
- ? refreshManagedMemoryInstructions(existing)
190
- : selectMemorySeed(await downloadContextFile(deployBackend, "/memories/agent/AGENTS.md"), await downloadContextFile(deployBackend, "/memories/AGENTS.md"));
191
- const result = await userBackend.write("/AGENTS.md", content);
192
- const error = result && typeof result === "object" && "error" in result
193
- ? result.error
194
- : undefined;
195
- if (error != null && error !== "") {
196
- throw new Error(`failed to seed user hot memory: ${String(error)}`);
197
- }
198
- }
199
- //# sourceMappingURL=seed.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"seed.js","sourceRoot":"","sources":["../../../src/runtime/memory/seed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElE,MAAM,iBAAiB,GACrB,gEAAgE,CAAC;AACnE,MAAM,eAAe,GACnB,oEAAoE,CAAC;AAEvE;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAC,OAA2B;IACnD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,oBAAoB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAC3C,CAAC;AAED,6DAA6D;AAC7D,SAAS,oBAAoB,CAAC,OAAe;IAC3C,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IACzB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACb,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;YAClC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1C,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;gBACf,gEAAgE;gBAChE,MAAM;YACR,CAA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QAAQ,CAAC;QAC1B,sBAAsB,CAAC,QAAQ,CAAC;QAC9B,CAAC,CAAC,gCAAgC,CAAC,QAAQ,CAAC;QAC5C,CAAC,CAAC,gBAAgB,CACd,MAAM,mBAAmB,CAAC,aAAa,EAAE,2BAA2B,CAAC,EACrE,MAAM,mBAAmB,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAChE,CAAC;IACR,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC9D,MAAM,KAAK,GACT,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,IAAI,MAAM;QACvD,CAAC,CAAE,MAA8B,CAAC,KAAK;QACvC,CAAC,CAAC,SAAS,CAAC;IAChB,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,mCAAmC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACtE,CAAC;AACH,CAAC"}
@@ -1,18 +0,0 @@
1
- import type { BackendProtocolV2 } from "deepagents";
2
- import { type IdentityConfig } from "../../identity/index.js";
3
- /**
4
- * Resolve the dedicated Hub repo handle for private user memory on this run.
5
- */
6
- export declare function resolveRunMemoryRepoHandle(deployRepo: string, identityConfig: IdentityConfig, runtime: unknown): string | null;
7
- export type UserMemoryBackend = {
8
- backend: BackendProtocolV2;
9
- rootDir?: string;
10
- };
11
- /** Open (or create-on-write) the per-user Hub repo / local mock root. */
12
- export declare function openUserMemoryBackend(repoHandle: string, deployRoot: string | undefined): Promise<UserMemoryBackend>;
13
- /**
14
- * Prefer the agent-scoped Hub slice (`memories/agent`). Fall back to the legacy
15
- * flat `memories/` layout for older Context Hub repos (open agents).
16
- */
17
- export declare function resolveMemoryRepoPrefix(backend: BackendProtocolV2, rootDir?: string): Promise<string>;
18
- //# sourceMappingURL=user-repo.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-repo.d.ts","sourceRoot":"","sources":["../../../src/runtime/memory/user-repo.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAQjC;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,GACf,MAAM,GAAG,IAAI,CASf;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,yEAAyE;AACzE,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,OAAO,CAAC,iBAAiB,CAAC,CAa5B;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAejB"}
@@ -1,50 +0,0 @@
1
- import { mkdir } from "node:fs/promises";
2
- import { join } from "node:path";
3
- import { ContextHubBackend, FilesystemBackend } from "deepagents";
4
- import { hasUserMemorySlice, } from "../../identity/index.js";
5
- import { buildRuntimeIdentity, memoryHubRepoHandle, resolveRuntimeConfigurable, } from "../identity-runtime.js";
6
- import { downloadContextFile, pathExists } from "./context-io.js";
7
- /**
8
- * Resolve the dedicated Hub repo handle for private user memory on this run.
9
- */
10
- export function resolveRunMemoryRepoHandle(deployRepo, identityConfig, runtime) {
11
- if (!hasUserMemorySlice(identityConfig.scope.memory)) {
12
- return null;
13
- }
14
- const configurable = resolveRuntimeConfigurable(runtime);
15
- const ident = buildRuntimeIdentity(configurable);
16
- return memoryHubRepoHandle(deployRepo, ident?.user.id);
17
- }
18
- /** Open (or create-on-write) the per-user Hub repo / local mock root. */
19
- export async function openUserMemoryBackend(repoHandle, deployRoot) {
20
- if (deployRoot !== undefined) {
21
- const rootDir = join(deployRoot, "__users__", repoHandle);
22
- await mkdir(rootDir, { recursive: true, mode: 0o700 });
23
- return {
24
- backend: new FilesystemBackend({
25
- rootDir,
26
- virtualMode: true,
27
- }),
28
- rootDir,
29
- };
30
- }
31
- return { backend: new ContextHubBackend(repoHandle) };
32
- }
33
- /**
34
- * Prefer the agent-scoped Hub slice (`memories/agent`). Fall back to the legacy
35
- * flat `memories/` layout for older Context Hub repos (open agents).
36
- */
37
- export async function resolveMemoryRepoPrefix(backend, rootDir) {
38
- if (rootDir !== undefined) {
39
- if (await pathExists(join(rootDir, "memories", "agent", "AGENTS.md"))) {
40
- return "memories/agent";
41
- }
42
- return "memories";
43
- }
44
- const agentHot = await downloadContextFile(backend, "/memories/agent/AGENTS.md");
45
- if (agentHot !== undefined) {
46
- return "memories/agent";
47
- }
48
- return "memories";
49
- }
50
- //# sourceMappingURL=user-repo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-repo.js","sourceRoot":"","sources":["../../../src/runtime/memory/user-repo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGlE,OAAO,EACL,kBAAkB,GAEnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElE;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACxC,UAAkB,EAClB,cAA8B,EAC9B,OAAgB;IAEhB,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CA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