@botbotgo/agent-harness 0.0.475 → 0.0.476

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 (227) hide show
  1. package/README.md +3 -1234
  2. package/README.zh.md +3 -1191
  3. package/dist/acp.js +1 -1
  4. package/dist/api.js +1 -404
  5. package/dist/benchmark/checkpoint-resume-cost-benchmark.js +1 -55
  6. package/dist/benchmark/deepagent-local-model-benchmark.js +2 -35
  7. package/dist/benchmark/upstream-runtime-ab-benchmark.js +1 -179
  8. package/dist/cli/chat-interactive.js +25 -244
  9. package/dist/cli/chat-rendering.js +6 -100
  10. package/dist/cli/chat-stream.js +23 -512
  11. package/dist/cli/chat-ui.js +21 -199
  12. package/dist/cli/chat-workspace.js +2 -210
  13. package/dist/cli/main.js +21 -428
  14. package/dist/cli/managed-service-commands.js +9 -63
  15. package/dist/cli/managed-service.js +2 -137
  16. package/dist/cli/options-init-chat.js +1 -108
  17. package/dist/cli/options-runtime.js +1 -158
  18. package/dist/cli/options-serve.js +1 -282
  19. package/dist/cli/options.js +2 -19
  20. package/dist/cli/process-guards.js +1 -139
  21. package/dist/cli/request-tree.js +7 -296
  22. package/dist/cli/runtime-commands.js +12 -258
  23. package/dist/cli/runtime-output.js +16 -155
  24. package/dist/cli/server-commands.js +16 -270
  25. package/dist/cli/workspace.js +1 -67
  26. package/dist/cli.js +1 -7
  27. package/dist/client/acp.js +1 -1
  28. package/dist/client/in-process.js +1 -67
  29. package/dist/client/index.js +1 -2
  30. package/dist/client/types.js +0 -1
  31. package/dist/client.js +1 -1
  32. package/dist/contracts/core.js +1 -1
  33. package/dist/contracts/runtime-evaluation.js +0 -1
  34. package/dist/contracts/runtime-memory.js +0 -1
  35. package/dist/contracts/runtime-observability.js +0 -1
  36. package/dist/contracts/runtime-requests.js +0 -1
  37. package/dist/contracts/runtime-scheduling.js +0 -1
  38. package/dist/contracts/runtime.js +1 -27
  39. package/dist/contracts/types.js +1 -3
  40. package/dist/contracts/workspace.js +0 -1
  41. package/dist/flow/build-flow-graph.js +1 -50
  42. package/dist/flow/export-mermaid.js +2 -464
  43. package/dist/flow/export-sequence-mermaid.js +2 -325
  44. package/dist/flow/flow-graph-normalization.js +1 -214
  45. package/dist/flow/flow-graph-runtime.js +1 -107
  46. package/dist/flow/flow-graph-upstream.js +1 -494
  47. package/dist/flow/index.js +1 -3
  48. package/dist/flow/types.js +0 -1
  49. package/dist/index.js +1 -5
  50. package/dist/init-project.js +1 -1
  51. package/dist/knowledge/config.js +1 -32
  52. package/dist/knowledge/contracts.js +0 -1
  53. package/dist/knowledge/index.js +1 -2
  54. package/dist/knowledge/module.js +12 -909
  55. package/dist/knowledge/procedural/config.js +1 -125
  56. package/dist/knowledge/procedural/index.js +1 -2
  57. package/dist/knowledge/procedural/manager.js +9 -345
  58. package/dist/mcp.js +1 -2
  59. package/dist/package-version.d.ts +1 -1
  60. package/dist/package-version.js +1 -2
  61. package/dist/persistence/file-store.js +3 -758
  62. package/dist/persistence/sqlite-request-context-store.js +5 -54
  63. package/dist/persistence/sqlite-request-queue-store.js +10 -108
  64. package/dist/persistence/sqlite-runtime.js +1 -86
  65. package/dist/persistence/sqlite-store.js +62 -810
  66. package/dist/persistence/types.js +0 -1
  67. package/dist/projections/presentation.js +37 -206
  68. package/dist/projections/request-events.js +2 -502
  69. package/dist/projections/upstream-events.js +1 -201
  70. package/dist/protocol/a2a/http-discovery.js +1 -178
  71. package/dist/protocol/a2a/http-rpc.js +6 -622
  72. package/dist/protocol/a2a/http.js +1 -138
  73. package/dist/protocol/a2a/task-state.js +3 -317
  74. package/dist/protocol/acp/client.js +8 -294
  75. package/dist/protocol/acp/harness-client.js +1 -218
  76. package/dist/protocol/acp/http.js +5 -130
  77. package/dist/protocol/acp/server.js +1 -310
  78. package/dist/protocol/acp/stdio.js +2 -69
  79. package/dist/protocol/ag-ui/http.js +3 -378
  80. package/dist/protocol/mcp/server.js +1 -428
  81. package/dist/resource/backend/workspace-scoped-backend.js +1 -319
  82. package/dist/resource/isolation.js +1 -237
  83. package/dist/resource/mcp/tool-support.js +3 -296
  84. package/dist/resource/mcp-tool-support.js +1 -2
  85. package/dist/resource/providers/resource-provider.js +1 -215
  86. package/dist/resource/resource-impl.js +1 -3
  87. package/dist/resource/resource-types.js +0 -1
  88. package/dist/resource/resource.js +1 -1
  89. package/dist/resource/sources.js +1 -247
  90. package/dist/resource/tools/function-tool-resolver.js +2 -272
  91. package/dist/runtime/adapter/compat/deepagent-compat.js +1 -29
  92. package/dist/runtime/adapter/compat/openai-compatible.js +1 -55
  93. package/dist/runtime/adapter/direct-builtin-utility.js +2 -90
  94. package/dist/runtime/adapter/flow/execution-context.js +1 -71
  95. package/dist/runtime/adapter/flow/invocation-flow.js +8 -425
  96. package/dist/runtime/adapter/flow/invoke-runtime.js +1 -20
  97. package/dist/runtime/adapter/flow/stream-runtime.js +11 -1395
  98. package/dist/runtime/adapter/invocation-result.js +2 -473
  99. package/dist/runtime/adapter/local-tool-invocation.js +6 -638
  100. package/dist/runtime/adapter/middleware/context-hygiene.js +1 -83
  101. package/dist/runtime/adapter/middleware-assembly.js +5 -477
  102. package/dist/runtime/adapter/model/invocation-request.js +3 -183
  103. package/dist/runtime/adapter/model/message-assembly.js +1 -28
  104. package/dist/runtime/adapter/model/model-providers.js +23 -1115
  105. package/dist/runtime/adapter/model/prompted-json-tool-call-capture.js +1 -40
  106. package/dist/runtime/adapter/model/prompted-json-tool-policy.js +1 -22
  107. package/dist/runtime/adapter/resilience.js +1 -104
  108. package/dist/runtime/adapter/runtime-adapter-support.js +3 -141
  109. package/dist/runtime/adapter/runtime-shell.js +5 -166
  110. package/dist/runtime/adapter/stream-event-projection.js +2 -622
  111. package/dist/runtime/adapter/stream-text-consumption.js +1 -18
  112. package/dist/runtime/adapter/terminal-status.js +2 -67
  113. package/dist/runtime/adapter/tool/builtin-middleware-tools.js +6 -627
  114. package/dist/runtime/adapter/tool/declared-middleware.js +1 -154
  115. package/dist/runtime/adapter/tool/interrupt-policy.js +1 -34
  116. package/dist/runtime/adapter/tool/provider-tool.js +1 -25
  117. package/dist/runtime/adapter/tool/resolved-tool.js +1 -225
  118. package/dist/runtime/adapter/tool/tool-arguments.js +3 -486
  119. package/dist/runtime/adapter/tool/tool-hitl.js +1 -346
  120. package/dist/runtime/adapter/tool/tool-name-mapping.js +1 -128
  121. package/dist/runtime/adapter/tool/tool-output-artifacts.js +2 -88
  122. package/dist/runtime/adapter/tool/tool-replay.js +1 -37
  123. package/dist/runtime/adapter/tool-resolution.js +1 -86
  124. package/dist/runtime/adapter/upstream-configurable-keys.js +1 -2
  125. package/dist/runtime/agent-runtime-adapter.js +60 -2338
  126. package/dist/runtime/agent-runtime-assembly.js +7 -249
  127. package/dist/runtime/env/runtime-env.js +1 -62
  128. package/dist/runtime/harness/background-runtime.js +1 -8
  129. package/dist/runtime/harness/bindings.js +1 -58
  130. package/dist/runtime/harness/events/event-bus.js +1 -16
  131. package/dist/runtime/harness/events/event-sink.js +1 -61
  132. package/dist/runtime/harness/events/events.js +1 -80
  133. package/dist/runtime/harness/events/listener-runtime.js +1 -13
  134. package/dist/runtime/harness/events/runtime-event-operations.js +1 -9
  135. package/dist/runtime/harness/events/streaming.js +1 -100
  136. package/dist/runtime/harness/events/timeline.js +1 -52
  137. package/dist/runtime/harness/public-shapes.js +1 -186
  138. package/dist/runtime/harness/run/artifact-paths.js +1 -15
  139. package/dist/runtime/harness/run/governance.js +1 -295
  140. package/dist/runtime/harness/run/helpers.js +1 -71
  141. package/dist/runtime/harness/run/inspection.js +1 -409
  142. package/dist/runtime/harness/run/operator-overview.js +1 -80
  143. package/dist/runtime/harness/run/queue-diagnostics.js +1 -15
  144. package/dist/runtime/harness/run/recovery.js +1 -162
  145. package/dist/runtime/harness/run/resources.js +1 -60
  146. package/dist/runtime/harness/run/resume.js +1 -56
  147. package/dist/runtime/harness/run/routing.js +1 -48
  148. package/dist/runtime/harness/run/run-lifecycle.js +1 -66
  149. package/dist/runtime/harness/run/run-operations.js +1 -217
  150. package/dist/runtime/harness/run/run-queue.js +1 -43
  151. package/dist/runtime/harness/run/run-slot-acquisition.js +1 -157
  152. package/dist/runtime/harness/run/session-records.js +1 -97
  153. package/dist/runtime/harness/run/start-run.js +1 -120
  154. package/dist/runtime/harness/run/startup-runtime.js +1 -69
  155. package/dist/runtime/harness/run/stream-run.js +8 -1418
  156. package/dist/runtime/harness/run/surface-semantics.js +1 -79
  157. package/dist/runtime/harness/runtime-defaults.js +1 -39
  158. package/dist/runtime/harness/system/boundary-analysis.js +1 -234
  159. package/dist/runtime/harness/system/health-monitor.js +1 -258
  160. package/dist/runtime/harness/system/inventory.js +1 -129
  161. package/dist/runtime/harness/system/mem0-ingestion-sync.js +5 -345
  162. package/dist/runtime/harness/system/policy-engine.js +1 -175
  163. package/dist/runtime/harness/system/runtime-memory-candidates.js +4 -110
  164. package/dist/runtime/harness/system/runtime-memory-consolidation.js +1 -51
  165. package/dist/runtime/harness/system/runtime-memory-manager.js +10 -693
  166. package/dist/runtime/harness/system/runtime-memory-policy.js +1 -155
  167. package/dist/runtime/harness/system/runtime-memory-records.js +11 -577
  168. package/dist/runtime/harness/system/runtime-memory-sync.js +5 -206
  169. package/dist/runtime/harness/system/session-memory-sync.js +3 -113
  170. package/dist/runtime/harness/system/skill-requirements.js +1 -112
  171. package/dist/runtime/harness/system/store.js +9 -365
  172. package/dist/runtime/harness/tool-gateway/index.js +1 -2
  173. package/dist/runtime/harness/tool-gateway/policy.js +1 -45
  174. package/dist/runtime/harness/tool-gateway/validation.js +1 -176
  175. package/dist/runtime/harness/tool-schema.js +1 -3
  176. package/dist/runtime/harness.js +3 -1490
  177. package/dist/runtime/index.js +1 -3
  178. package/dist/runtime/layout/runtime-layout.js +1 -31
  179. package/dist/runtime/maintenance/checkpoint-maintenance.js +2 -178
  180. package/dist/runtime/maintenance/file-checkpoint-saver.js +1 -106
  181. package/dist/runtime/maintenance/runtime-record-maintenance.js +2 -169
  182. package/dist/runtime/maintenance/sqlite-checkpoint-saver.js +4 -289
  183. package/dist/runtime/parsing/output-content.js +10 -550
  184. package/dist/runtime/parsing/output-parsing.js +1 -4
  185. package/dist/runtime/parsing/output-recovery.js +3 -213
  186. package/dist/runtime/parsing/output-tool-args.js +7 -663
  187. package/dist/runtime/parsing/stream-event-parsing.js +3 -362
  188. package/dist/runtime/prompts/runtime-prompts.js +4 -73
  189. package/dist/runtime/scheduling/system-schedule-manager.js +11 -532
  190. package/dist/runtime/skills/skill-metadata.js +1 -197
  191. package/dist/runtime/startup-tracing.js +2 -37
  192. package/dist/runtime/support/compiled-binding.js +1 -290
  193. package/dist/runtime/support/embedding-models.js +1 -118
  194. package/dist/runtime/support/harness-support.js +5 -137
  195. package/dist/runtime/support/llamaindex.js +1 -108
  196. package/dist/runtime/support/runtime-adapter-options.js +1 -29
  197. package/dist/runtime/support/runtime-factories.js +1 -51
  198. package/dist/runtime/support/vector-stores.js +9 -270
  199. package/dist/scaffold/init-project.js +54 -233
  200. package/dist/tooling/extensions.js +1 -311
  201. package/dist/tooling/module-loader.js +1 -55
  202. package/dist/tools.js +1 -176
  203. package/dist/utils/agent-display.js +1 -18
  204. package/dist/utils/bundled-text.js +4 -39
  205. package/dist/utils/compiled-binding.js +1 -33
  206. package/dist/utils/fs.js +2 -45
  207. package/dist/utils/id.js +1 -9
  208. package/dist/utils/message-content.js +1 -30
  209. package/dist/utils/object.js +1 -6
  210. package/dist/workspace/agent-binding-compiler.js +3 -613
  211. package/dist/workspace/compile.js +1 -472
  212. package/dist/workspace/framework-contract-validation.js +2 -322
  213. package/dist/workspace/index.js +1 -1
  214. package/dist/workspace/object-loader-paths.js +1 -71
  215. package/dist/workspace/object-loader-readers.js +1 -187
  216. package/dist/workspace/object-loader.js +1 -754
  217. package/dist/workspace/resource-compilers.js +1 -374
  218. package/dist/workspace/support/agent-capabilities.js +1 -37
  219. package/dist/workspace/support/agent-execution-config.js +1 -44
  220. package/dist/workspace/support/discovery.js +1 -147
  221. package/dist/workspace/support/source-collectors.js +1 -30
  222. package/dist/workspace/support/source-protocols.js +2 -192
  223. package/dist/workspace/support/workspace-ref-utils.js +1 -362
  224. package/dist/workspace/tool-hydration.js +1 -280
  225. package/dist/workspace/validate.js +1 -99
  226. package/dist/workspace/yaml-object-reader.js +1 -285
  227. package/package.json +7 -3
@@ -1,155 +1 @@
1
- import path from "node:path";
2
- function asRecord(value) {
3
- return typeof value === "object" && value !== null && !Array.isArray(value) ? value : undefined;
4
- }
5
- function asString(value) {
6
- return typeof value === "string" && value.trim().length > 0 ? value.trim() : undefined;
7
- }
8
- function asPositiveInteger(value) {
9
- return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : undefined;
10
- }
11
- function asStringArray(value) {
12
- if (!Array.isArray(value)) {
13
- return undefined;
14
- }
15
- const items = value
16
- .filter((item) => typeof item === "string")
17
- .map((item) => item.trim())
18
- .filter((item) => item.length > 0);
19
- return items.length > 0 ? Array.from(new Set(items)) : undefined;
20
- }
21
- export function normalizeLangMemMemoryKind(kind) {
22
- const normalized = kind?.trim().toLowerCase();
23
- if (!normalized) {
24
- return "semantic";
25
- }
26
- if (["episode", "episodic", "summary", "experience", "reflection"].includes(normalized)) {
27
- return "episodic";
28
- }
29
- if (["procedural", "workflow", "procedure", "runbook", "playbook"].includes(normalized)) {
30
- return "procedural";
31
- }
32
- return "semantic";
33
- }
34
- export function readRuntimeMemoryPolicyConfig(runtimeMemory, workspaceRoot) {
35
- if (runtimeMemory?.enabled !== true) {
36
- return undefined;
37
- }
38
- const retrieval = asRecord(runtimeMemory.retrieval);
39
- const writePolicy = asRecord(runtimeMemory.writePolicy);
40
- const namespaces = asRecord(runtimeMemory.namespaces);
41
- const workspaceId = path.basename(workspaceRoot) || "default";
42
- const writePolicyMode = writePolicy?.mode === "all" || writePolicy?.mode === "selective" || writePolicy?.mode === "disabled"
43
- ? writePolicy.mode
44
- : "all";
45
- return {
46
- enabled: true,
47
- retrieval: {
48
- defaultTopK: asPositiveInteger(retrieval?.defaultTopK) ?? 5,
49
- maxPromptMemories: asPositiveInteger(retrieval?.maxPromptMemories) ?? 8,
50
- },
51
- writePolicy: {
52
- mode: writePolicyMode,
53
- allow: asStringArray(writePolicy?.allow) ?? [],
54
- deny: asStringArray(writePolicy?.deny) ?? [],
55
- },
56
- namespaces: {
57
- session: asString(namespaces?.sessions) ?? "memories/sessions/{sessionId}",
58
- workspace: asString(namespaces?.workspaces) ?? `memories/workspaces/${workspaceId}`,
59
- agent: asString(namespaces?.agents) ?? "memories/agents/{agentId}",
60
- user: asString(namespaces?.users) ?? "memories/users/{userId}",
61
- project: asString(namespaces?.projects) ?? "memories/projects/{projectId}",
62
- },
63
- };
64
- }
65
- export function readRuntimeMemoryMaintenanceConfig(runtimeMemory) {
66
- if (runtimeMemory?.enabled !== true) {
67
- return undefined;
68
- }
69
- const consolidation = asRecord(runtimeMemory.consolidation);
70
- const decay = asRecord(consolidation?.decay);
71
- return {
72
- enabled: true,
73
- dedupe: consolidation?.dedupe !== false,
74
- ...(asBoolean(decay?.enabled) !== false && asPositiveInteger(decay?.maxAgeDays) ? { maxAgeDays: asPositiveInteger(decay?.maxAgeDays) } : {}),
75
- };
76
- }
77
- function asBoolean(value) {
78
- return typeof value === "boolean" ? value : undefined;
79
- }
80
- export function resolveMemoryNamespace(template, values) {
81
- const rendered = template.replace(/\{([a-zA-Z0-9_]+)\}/g, (_match, key) => values[key] ?? key);
82
- return rendered
83
- .split("/")
84
- .map((part) => part.trim())
85
- .filter((part) => part.length > 0);
86
- }
87
- export function hasExplicitResourceReference(text) {
88
- const normalized = text.trim();
89
- if (!normalized) {
90
- return false;
91
- }
92
- return /(https?:\/\/|www\.)/iu.test(normalized);
93
- }
94
- export function extractExplicitResourceReferences(text) {
95
- const normalized = text.trim();
96
- if (!normalized) {
97
- return [];
98
- }
99
- const matches = normalized.match(/https?:\/\/\S+/giu) ?? [];
100
- return Array.from(new Set(matches.map((item) => item.trim().replace(/[),.;:!?]+$/u, ""))))
101
- .filter((item) => item.length > 0);
102
- }
103
- export function shouldRecallDurableMemory(text) {
104
- const normalized = text.trim();
105
- if (!normalized) {
106
- return false;
107
- }
108
- return !hasExplicitResourceReference(normalized);
109
- }
110
- function normalizePolicyLabel(value) {
111
- return value.trim().toLowerCase().replace(/[\s-]+/g, "_");
112
- }
113
- function normalizeMemoryText(value) {
114
- return typeof value === "string" ? value.trim().toLowerCase() : "";
115
- }
116
- function hasTranscriptReflectionSource(input) {
117
- const sourceType = normalizeMemoryText(input.sourceType);
118
- void input.tags;
119
- return sourceType === "runtime-transcript" || sourceType === "runtime-reflection";
120
- }
121
- export function isNonDurableTranscriptWorkflowMemory(input, sourceCandidate) {
122
- if (!hasTranscriptReflectionSource({
123
- sourceType: input.sourceType ?? sourceCandidate?.sourceType,
124
- tags: [...(input.tags ?? []), ...(sourceCandidate?.tags ?? [])],
125
- })) {
126
- return false;
127
- }
128
- const kind = normalizeMemoryText(input.kind);
129
- const scope = normalizeMemoryText(input.scope ?? sourceCandidate?.scope);
130
- return kind === "procedural" || scope === "user" || scope === "workspace" || scope === "project";
131
- }
132
- export function collectMemoryCandidateLabels(candidate) {
133
- return Array.from(new Set([
134
- ...(candidate.kind ? [normalizePolicyLabel(candidate.kind)] : []),
135
- ...(candidate.scope ? [normalizePolicyLabel(candidate.scope)] : []),
136
- ...(candidate.sourceType ? [normalizePolicyLabel(candidate.sourceType)] : []),
137
- ...((candidate.tags ?? []).map((tag) => normalizePolicyLabel(tag))),
138
- ]));
139
- }
140
- export function shouldStoreMemoryCandidate(policy, candidate) {
141
- if (!policy || policy.writePolicy.mode === "all") {
142
- return true;
143
- }
144
- if (policy.writePolicy.mode === "disabled") {
145
- return false;
146
- }
147
- const labels = new Set(collectMemoryCandidateLabels(candidate));
148
- if (policy.writePolicy.deny.some((label) => labels.has(normalizePolicyLabel(label)))) {
149
- return false;
150
- }
151
- if (policy.writePolicy.allow.length === 0) {
152
- return true;
153
- }
154
- return policy.writePolicy.allow.some((label) => labels.has(normalizePolicyLabel(label)));
155
- }
1
+ import d from"node:path";function i(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}function a(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}function c(e){return typeof e=="number"&&Number.isInteger(e)&&e>0?e:void 0}function l(e){if(!Array.isArray(e))return;const r=e.filter(o=>typeof o=="string").map(o=>o.trim()).filter(o=>o.length>0);return r.length>0?Array.from(new Set(r)):void 0}function b(e){const r=e?.trim().toLowerCase();return r?["episode","episodic","summary","experience","reflection"].includes(r)?"episodic":["procedural","workflow","procedure","runbook","playbook"].includes(r)?"procedural":"semantic":"semantic"}function h(e,r){if(e?.enabled!==!0)return;const o=i(e.retrieval),t=i(e.writePolicy),n=i(e.namespaces),m=d.basename(r)||"default",f=t?.mode==="all"||t?.mode==="selective"||t?.mode==="disabled"?t.mode:"all";return{enabled:!0,retrieval:{defaultTopK:c(o?.defaultTopK)??5,maxPromptMemories:c(o?.maxPromptMemories)??8},writePolicy:{mode:f,allow:l(t?.allow)??[],deny:l(t?.deny)??[]},namespaces:{session:a(n?.sessions)??"memories/sessions/{sessionId}",workspace:a(n?.workspaces)??`memories/workspaces/${m}`,agent:a(n?.agents)??"memories/agents/{agentId}",user:a(n?.users)??"memories/users/{userId}",project:a(n?.projects)??"memories/projects/{projectId}"}}}function P(e){if(e?.enabled!==!0)return;const r=i(e.consolidation),o=i(r?.decay);return{enabled:!0,dedupe:r?.dedupe!==!1,...p(o?.enabled)!==!1&&c(o?.maxAgeDays)?{maxAgeDays:c(o?.maxAgeDays)}:{}}}function p(e){return typeof e=="boolean"?e:void 0}function k(e,r){return e.replace(/\{([a-zA-Z0-9_]+)\}/g,(t,n)=>r[n]??n).split("/").map(t=>t.trim()).filter(t=>t.length>0)}function y(e){const r=e.trim();return r?/(https?:\/\/|www\.)/iu.test(r):!1}function A(e){const r=e.trim();if(!r)return[];const o=r.match(/https?:\/\/\S+/giu)??[];return Array.from(new Set(o.map(t=>t.trim().replace(/[),.;:!?]+$/u,"")))).filter(t=>t.length>0)}function T(e){const r=e.trim();return r?!y(r):!1}function s(e){return e.trim().toLowerCase().replace(/[\s-]+/g,"_")}function u(e){return typeof e=="string"?e.trim().toLowerCase():""}function g(e){const r=u(e.sourceType);return e.tags,r==="runtime-transcript"||r==="runtime-reflection"}function M(e,r){if(!g({sourceType:e.sourceType??r?.sourceType,tags:[...e.tags??[],...r?.tags??[]]}))return!1;const o=u(e.kind),t=u(e.scope??r?.scope);return o==="procedural"||t==="user"||t==="workspace"||t==="project"}function w(e){return Array.from(new Set([...e.kind?[s(e.kind)]:[],...e.scope?[s(e.scope)]:[],...e.sourceType?[s(e.sourceType)]:[],...(e.tags??[]).map(r=>s(r))]))}function R(e,r){if(!e||e.writePolicy.mode==="all")return!0;if(e.writePolicy.mode==="disabled")return!1;const o=new Set(w(r));return e.writePolicy.deny.some(t=>o.has(s(t)))?!1:e.writePolicy.allow.length===0?!0:e.writePolicy.allow.some(t=>o.has(s(t)))}export{w as collectMemoryCandidateLabels,A as extractExplicitResourceReferences,y as hasExplicitResourceReference,M as isNonDurableTranscriptWorkflowMemory,b as normalizeLangMemMemoryKind,P as readRuntimeMemoryMaintenanceConfig,h as readRuntimeMemoryPolicyConfig,k as resolveMemoryNamespace,T as shouldRecallDurableMemory,R as shouldStoreMemoryCandidate};