memeloop 0.0.1 → 0.1.1

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 (228) hide show
  1. package/README.md +63 -0
  2. package/dist/browser.cjs +1413 -0
  3. package/dist/browser.cjs.map +1 -0
  4. package/dist/browser.d.cts +3066 -0
  5. package/dist/browser.d.ts +3066 -0
  6. package/dist/browser.js +43 -0
  7. package/dist/chunk-2C6BJZI3.js +382 -0
  8. package/dist/chunk-2C6BJZI3.js.map +1 -0
  9. package/dist/chunk-426CJUZP.js +630 -0
  10. package/dist/chunk-426CJUZP.js.map +1 -0
  11. package/dist/chunk-7ZDTB4VZ.js +63 -0
  12. package/dist/chunk-7ZDTB4VZ.js.map +1 -0
  13. package/dist/chunk-AZFYDWIN.js +98 -0
  14. package/dist/chunk-AZFYDWIN.js.map +1 -0
  15. package/dist/chunk-BGPU4RR7.js +367 -0
  16. package/dist/chunk-BGPU4RR7.js.map +1 -0
  17. package/dist/chunk-CCEFAOSH.js +496 -0
  18. package/dist/chunk-CCEFAOSH.js.map +1 -0
  19. package/dist/chunk-FWSY5HOA.js +63 -0
  20. package/dist/chunk-FWSY5HOA.js.map +1 -0
  21. package/dist/chunk-GYIOMQMY.js +8726 -0
  22. package/dist/chunk-GYIOMQMY.js.map +1 -0
  23. package/dist/chunk-K6P63KD4.js +68 -0
  24. package/dist/chunk-K6P63KD4.js.map +1 -0
  25. package/dist/chunk-KFS2EJT6.js +42 -0
  26. package/dist/chunk-KFS2EJT6.js.map +1 -0
  27. package/dist/chunk-MAJWHAKR.js +3637 -0
  28. package/dist/chunk-MAJWHAKR.js.map +1 -0
  29. package/dist/chunk-MRKY4HGF.js +205 -0
  30. package/dist/chunk-MRKY4HGF.js.map +1 -0
  31. package/dist/chunk-T7FSXWFR.js +2744 -0
  32. package/dist/chunk-T7FSXWFR.js.map +1 -0
  33. package/dist/chunk-VZKQX5PP.js +1 -0
  34. package/dist/chunk-VZKQX5PP.js.map +1 -0
  35. package/dist/chunk-WAI6BODI.js +175 -0
  36. package/dist/chunk-WAI6BODI.js.map +1 -0
  37. package/dist/chunk-YMNXDNDW.js +798 -0
  38. package/dist/chunk-YMNXDNDW.js.map +1 -0
  39. package/dist/conversation.cjs +208 -0
  40. package/dist/conversation.cjs.map +1 -0
  41. package/dist/conversation.d.cts +100 -0
  42. package/dist/conversation.d.ts +100 -0
  43. package/dist/conversation.js +21 -0
  44. package/dist/conversation.js.map +1 -0
  45. package/dist/device-network-portable.cjs +702 -0
  46. package/dist/device-network-portable.cjs.map +1 -0
  47. package/dist/device-network-portable.d.cts +110 -0
  48. package/dist/device-network-portable.d.ts +110 -0
  49. package/dist/device-network-portable.js +53 -0
  50. package/dist/device-network-portable.js.map +1 -0
  51. package/dist/device-network.cjs +906 -0
  52. package/dist/device-network.cjs.map +1 -0
  53. package/dist/device-network.d.cts +6 -0
  54. package/dist/device-network.d.ts +6 -0
  55. package/dist/device-network.js +59 -0
  56. package/dist/device-network.js.map +1 -0
  57. package/dist/fetchProvider-WWnWnQFP.d.ts +91 -0
  58. package/dist/fetchProvider-toTHy5Nu.d.cts +91 -0
  59. package/dist/index.cjs +28051 -5459
  60. package/dist/index.cjs.map +1 -1
  61. package/dist/index.d.cts +94 -1320
  62. package/dist/index.d.ts +94 -1320
  63. package/dist/index.js +10616 -2420
  64. package/dist/index.js.map +1 -1
  65. package/dist/interface-IrKBFtL1.d.cts +493 -0
  66. package/dist/interface-IrKBFtL1.d.ts +493 -0
  67. package/dist/llm-providers.cjs +43 -8
  68. package/dist/llm-providers.cjs.map +1 -1
  69. package/dist/llm-providers.d.cts +2 -1
  70. package/dist/llm-providers.d.ts +2 -1
  71. package/dist/llm-providers.js +4 -2
  72. package/dist/llm-providers.js.map +1 -1
  73. package/dist/loop-api.cjs +5227 -2010
  74. package/dist/loop-api.cjs.map +1 -1
  75. package/dist/loop-api.d.cts +11 -5
  76. package/dist/loop-api.d.ts +11 -5
  77. package/dist/loop-api.js +86 -49
  78. package/dist/mobile.cjs +2711 -0
  79. package/dist/mobile.cjs.map +1 -0
  80. package/dist/mobile.d.cts +6 -0
  81. package/dist/mobile.d.ts +6 -0
  82. package/dist/mobile.js +22 -0
  83. package/dist/mobile.js.map +1 -0
  84. package/dist/orchestration-portable-BHB_YrNN.d.ts +2192 -0
  85. package/dist/orchestration-portable-mvYBvGBb.d.cts +2192 -0
  86. package/dist/orchestration-portable.cjs +9553 -0
  87. package/dist/orchestration-portable.cjs.map +1 -0
  88. package/dist/orchestration-portable.d.cts +5 -0
  89. package/dist/orchestration-portable.d.ts +5 -0
  90. package/dist/orchestration-portable.js +290 -0
  91. package/dist/orchestration-portable.js.map +1 -0
  92. package/dist/pairingInvite-BXPWY3aM.d.cts +149 -0
  93. package/dist/pairingInvite-Cuz0wuq9.d.ts +149 -0
  94. package/dist/promptConcat-0WNFTg4l.d.ts +516 -0
  95. package/dist/promptConcat-D6wr5V-V.d.cts +516 -0
  96. package/dist/providerRegistry-Bi6pAvSj.d.ts +86 -0
  97. package/dist/providerRegistry-CPsktuiX.d.cts +86 -0
  98. package/dist/registry-D0kbxksn.d.cts +393 -0
  99. package/dist/registry-DDbvhlhs.d.ts +393 -0
  100. package/dist/remoteClient-B_spK019.d.ts +87 -0
  101. package/dist/remoteClient-CBggnRy3.d.cts +87 -0
  102. package/dist/runtime-PGWR6FIV.js +18 -0
  103. package/dist/runtime-PGWR6FIV.js.map +1 -0
  104. package/dist/scriptDeploymentPipeline-CXJcC82H.d.ts +2464 -0
  105. package/dist/scriptDeploymentPipeline-yG1ZhVVI.d.cts +2464 -0
  106. package/dist/syncCloudDevices-BEqwgrhD.d.ts +49 -0
  107. package/dist/syncCloudDevices-Ds_Kcgrv.d.cts +49 -0
  108. package/dist/types-7pYti-k9.d.cts +255 -0
  109. package/dist/types-CdFVSntj.d.ts +255 -0
  110. package/package.json +110 -35
  111. package/dist/anthropic.cjs +0 -72
  112. package/dist/anthropic.cjs.map +0 -1
  113. package/dist/anthropic.d.cts +0 -21
  114. package/dist/anthropic.d.ts +0 -21
  115. package/dist/anthropic.js +0 -21
  116. package/dist/anthropic.js.map +0 -1
  117. package/dist/azure.cjs +0 -72
  118. package/dist/azure.cjs.map +0 -1
  119. package/dist/azure.d.cts +0 -21
  120. package/dist/azure.d.ts +0 -21
  121. package/dist/azure.js +0 -21
  122. package/dist/azure.js.map +0 -1
  123. package/dist/chunk-3CN7DFBL.js +0 -4894
  124. package/dist/chunk-3CN7DFBL.js.map +0 -1
  125. package/dist/chunk-4AZ4D7U5.js +0 -32
  126. package/dist/chunk-4AZ4D7U5.js.map +0 -1
  127. package/dist/chunk-6ON4XSOV.js +0 -63
  128. package/dist/chunk-6ON4XSOV.js.map +0 -1
  129. package/dist/chunk-DJQNGIXX.js +0 -4793
  130. package/dist/chunk-DJQNGIXX.js.map +0 -1
  131. package/dist/chunk-FKQP6AOQ.js +0 -32
  132. package/dist/chunk-FKQP6AOQ.js.map +0 -1
  133. package/dist/chunk-OVJ7JJBA.js +0 -35
  134. package/dist/chunk-OVJ7JJBA.js.map +0 -1
  135. package/dist/chunk-P4UZ7IXC.js +0 -42
  136. package/dist/chunk-YHJ2AEFR.js +0 -4933
  137. package/dist/chunk-YHJ2AEFR.js.map +0 -1
  138. package/dist/chunk-YVK7RYRO.js +0 -4973
  139. package/dist/chunk-YVK7RYRO.js.map +0 -1
  140. package/dist/code-assistant.json +0 -114
  141. package/dist/cohere.cjs +0 -72
  142. package/dist/cohere.cjs.map +0 -1
  143. package/dist/cohere.d.cts +0 -21
  144. package/dist/cohere.d.ts +0 -21
  145. package/dist/cohere.js +0 -21
  146. package/dist/cohere.js.map +0 -1
  147. package/dist/deepseek.cjs +0 -72
  148. package/dist/deepseek.cjs.map +0 -1
  149. package/dist/deepseek.d.cts +0 -21
  150. package/dist/deepseek.d.ts +0 -21
  151. package/dist/deepseek.js +0 -21
  152. package/dist/deepseek.js.map +0 -1
  153. package/dist/dist-65U7OYRG.js +0 -1257
  154. package/dist/dist-65U7OYRG.js.map +0 -1
  155. package/dist/fetchProvider-Cu4WkU5O.d.cts +0 -819
  156. package/dist/fetchProvider-Cu4WkU5O.d.ts +0 -819
  157. package/dist/frontend-ui-ux.json +0 -105
  158. package/dist/general-assistant.json +0 -95
  159. package/dist/git-master.json +0 -51
  160. package/dist/google-vertex.cjs +0 -72
  161. package/dist/google-vertex.cjs.map +0 -1
  162. package/dist/google-vertex.d.cts +0 -21
  163. package/dist/google-vertex.d.ts +0 -21
  164. package/dist/google-vertex.js +0 -21
  165. package/dist/google-vertex.js.map +0 -1
  166. package/dist/google.cjs +0 -72
  167. package/dist/google.cjs.map +0 -1
  168. package/dist/google.d.cts +0 -21
  169. package/dist/google.d.ts +0 -21
  170. package/dist/google.js +0 -21
  171. package/dist/google.js.map +0 -1
  172. package/dist/groq.cjs +0 -72
  173. package/dist/groq.cjs.map +0 -1
  174. package/dist/groq.d.cts +0 -21
  175. package/dist/groq.d.ts +0 -21
  176. package/dist/groq.js +0 -21
  177. package/dist/groq.js.map +0 -1
  178. package/dist/index.d.mts +0 -3203
  179. package/dist/index.mjs +0 -7064
  180. package/dist/index.mjs.map +0 -1
  181. package/dist/mistral.cjs +0 -72
  182. package/dist/mistral.cjs.map +0 -1
  183. package/dist/mistral.d.cts +0 -21
  184. package/dist/mistral.d.ts +0 -21
  185. package/dist/mistral.js +0 -21
  186. package/dist/mistral.js.map +0 -1
  187. package/dist/multipart-parser-EJCXIUHC.js +0 -372
  188. package/dist/multipart-parser-EJCXIUHC.js.map +0 -1
  189. package/dist/openai.cjs +0 -72
  190. package/dist/openai.cjs.map +0 -1
  191. package/dist/openai.d.cts +0 -21
  192. package/dist/openai.d.ts +0 -21
  193. package/dist/openai.js +0 -21
  194. package/dist/openai.js.map +0 -1
  195. package/dist/perplexity.cjs +0 -72
  196. package/dist/perplexity.cjs.map +0 -1
  197. package/dist/perplexity.d.cts +0 -21
  198. package/dist/perplexity.d.ts +0 -21
  199. package/dist/perplexity.js +0 -21
  200. package/dist/perplexity.js.map +0 -1
  201. package/dist/playwright.json +0 -52
  202. package/dist/promptConcat-BJdazTg5.d.cts +0 -1832
  203. package/dist/promptConcat-BJdazTg5.d.ts +0 -1832
  204. package/dist/promptConcat-CAkpni_8.d.cts +0 -1834
  205. package/dist/promptConcat-CAkpni_8.d.ts +0 -1834
  206. package/dist/promptConcat-CfH5-GAE.d.cts +0 -1036
  207. package/dist/promptConcat-ChcAZOOL.d.ts +0 -1036
  208. package/dist/promptConcat-G5TnJVRy.d.cts +0 -1800
  209. package/dist/promptConcat-G5TnJVRy.d.ts +0 -1800
  210. package/dist/promptConcat-L72eowzp.d.ts +0 -1090
  211. package/dist/promptConcat-eLHdN7K8.d.cts +0 -1090
  212. package/dist/src-VTSXKG72.js +0 -1409
  213. package/dist/src-VTSXKG72.js.map +0 -1
  214. package/dist/togetherai.cjs +0 -72
  215. package/dist/togetherai.cjs.map +0 -1
  216. package/dist/togetherai.d.cts +0 -21
  217. package/dist/togetherai.d.ts +0 -21
  218. package/dist/togetherai.js +0 -21
  219. package/dist/togetherai.js.map +0 -1
  220. package/dist/types-B0Jm2l38.d.cts +0 -767
  221. package/dist/types-B0Jm2l38.d.ts +0 -767
  222. package/dist/xai.cjs +0 -72
  223. package/dist/xai.cjs.map +0 -1
  224. package/dist/xai.d.cts +0 -21
  225. package/dist/xai.d.ts +0 -21
  226. package/dist/xai.js +0 -21
  227. package/dist/xai.js.map +0 -1
  228. /package/dist/{chunk-P4UZ7IXC.js.map → browser.js.map} +0 -0
@@ -0,0 +1,86 @@
1
+ import { m as AgentDefinition } from './interface-IrKBFtL1.cjs';
2
+ import { k as ILLMProvider } from './scriptDeploymentPipeline-yG1ZhVVI.cjs';
3
+
4
+ /**
5
+ * Extended agent definition used by the agent profile registry.
6
+ * Wraps the protocol-level AgentDefinition with additional runtime metadata.
7
+ */
8
+ interface AgentProfile {
9
+ /** Unique ID for this agent (matches protocol id convention like "memeloop:build") */
10
+ id: string;
11
+ /** Display name */
12
+ name: string;
13
+ /** Agent type / role */
14
+ type: AgentProfileType;
15
+ /** System prompt / instructions for the agent */
16
+ prompt: string;
17
+ /** Tool permission rules (mutually exclusive with permissive defaults) */
18
+ permissions: ToolPermissionRules;
19
+ /** Optional model override (provider/model string) */
20
+ model?: string;
21
+ /** Underlying protocol-compatible definition for framework integration */
22
+ protocolDef: AgentDefinition;
23
+ }
24
+ type AgentProfileType = 'build' | 'plan' | 'explore' | 'oracle' | 'librarian';
25
+ interface ToolPermissionRules {
26
+ /** Default action for tools not matching any rule */
27
+ default: 'allow' | 'ask' | 'deny';
28
+ /** Per-tool or wildcard rules */
29
+ rules: Array<{
30
+ pattern: string;
31
+ action: 'allow' | 'ask' | 'deny';
32
+ }>;
33
+ }
34
+ /**
35
+ * Build agent: full access, default model.
36
+ * Primary agent for executing tasks, writing code, running commands.
37
+ */
38
+ declare const buildAgent: AgentProfile;
39
+ /**
40
+ * Plan agent: read-only, denies file edits and terminal execution.
41
+ * Used for high-level planning and task decomposition.
42
+ */
43
+ declare const planAgent: AgentProfile;
44
+ /**
45
+ * Explore agent: read + search tools only.
46
+ * Fast search and codebase exploration without modification.
47
+ */
48
+ declare const exploreAgent: AgentProfile;
49
+ /**
50
+ * Oracle agent: read-only, for architecture consultation and code review.
51
+ */
52
+ declare const oracleAgent: AgentProfile;
53
+ /**
54
+ * Librarian agent: read + web search tools only.
55
+ * External documentation lookup and context gathering.
56
+ */
57
+ declare const librarianAgent: AgentProfile;
58
+ /** Built-in agent profiles used by the task delegation tool. */
59
+ declare const BUILTIN_AGENT_PROFILES: AgentProfile[];
60
+
61
+ interface ProviderConfig {
62
+ name: string;
63
+ baseUrl?: string;
64
+ apiKey?: string;
65
+ }
66
+ interface RegisteredProvider {
67
+ provider: ILLMProvider;
68
+ config: ProviderConfig;
69
+ }
70
+ declare class ProviderRegistry {
71
+ private providers;
72
+ register(provider: ILLMProvider, config?: Omit<ProviderConfig, 'name'>): void;
73
+ unregister(name: string): void;
74
+ get(name: string): ILLMProvider | undefined;
75
+ getConfig(name: string): ProviderConfig | undefined;
76
+ upsertConfig(config: ProviderConfig): void;
77
+ list(): string[];
78
+ listConfigs(): ProviderConfig[];
79
+ resolve(modelId: string): {
80
+ provider: ILLMProvider;
81
+ providerName: string;
82
+ modelName?: string;
83
+ };
84
+ }
85
+
86
+ export { type AgentProfile as A, BUILTIN_AGENT_PROFILES as B, type ProviderConfig as P, type RegisteredProvider as R, type ToolPermissionRules as T, type AgentProfileType as a, ProviderRegistry as b, buildAgent as c, exploreAgent as e, librarianAgent as l, oracleAgent as o, planAgent as p };
@@ -0,0 +1,393 @@
1
+ import { A as AgentFrameworkContext, f as AgentLoopInput, e as AgentLoopGenerator, n as LoopProfile, g as AgentLoopRuntime, z as ToolOperationEffect } from './scriptDeploymentPipeline-yG1ZhVVI.cjs';
2
+ import { b as ChatMessage } from './interface-IrKBFtL1.cjs';
3
+ import { A as AgentProfile, a as AgentProfileType } from './providerRegistry-CPsktuiX.cjs';
4
+
5
+ /**
6
+ * Layered permission system types.
7
+ *
8
+ * Permissions are resolved by merging rule sets from multiple layers
9
+ * (default → agent → user → session), where later layers override earlier ones.
10
+ */
11
+ /** Permission action for a tool invocation. */
12
+ type PermissionAction = 'allow' | 'deny' | 'ask';
13
+ /** A single permission rule: matches a tool name pattern to an action. */
14
+ interface PermissionRule {
15
+ /** Wildcard-capable pattern, e.g. `"file.*"`, `"shell(rm)"`, `"*"`. */
16
+ toolPattern: string;
17
+ action: PermissionAction;
18
+ }
19
+ /** A set of permission rules belonging to a specific source/layer. */
20
+ interface PermissionSet {
21
+ rules: PermissionRule[];
22
+ /** Human-readable source identifier for debugging (e.g. "default", "agent:cli-buddy", "user"). */
23
+ source: string;
24
+ }
25
+ /**
26
+ * Result of merging multiple `PermissionSet` layers.
27
+ * Each array contains flattened, deduplicated tool patterns for that action.
28
+ */
29
+ interface MergedPermissions {
30
+ allow: string[];
31
+ deny: string[];
32
+ ask: string[];
33
+ }
34
+
35
+ /**
36
+ * Hook system types for memeloop.
37
+ * Hooks are lifecycle callbacks that execute before/after key events in the agent loop.
38
+ */
39
+
40
+ /** Context passed to all hook handlers. */
41
+ type HookContext = AgentFrameworkContext;
42
+ /** Result returned by a hook handler. */
43
+ interface HookResult {
44
+ /** Whether to allow the action to proceed (false = block/deny) */
45
+ allowed: boolean;
46
+ /** Optional message explaining why the action was blocked */
47
+ reason?: string;
48
+ /** Optional data modified by the hook (e.g., transformed tool args) */
49
+ modified?: Record<string, unknown>;
50
+ /** Optional tool permission action. Interpreted by PreToolUse callers. */
51
+ permissionAction?: PermissionAction;
52
+ }
53
+ /** Signature of a hook handler function. */
54
+ type HookHandler = (context: HookContext, data: Record<string, unknown>) => Promise<HookResult>;
55
+ /** Enum of supported hook event types. */
56
+ type HookType = 'PreToolUse' | 'PostToolUse' | 'UserPromptSubmit' | 'ContextCompaction' | 'AgentStart' | 'AgentStop';
57
+ /** Data passed to PreToolUse hooks. */
58
+ interface PreToolUseData extends Record<string, unknown> {
59
+ toolId: string;
60
+ parameters: Record<string, unknown>;
61
+ conversationId: string;
62
+ }
63
+ /** Data passed to PostToolUse hooks. */
64
+ interface PostToolUseData extends Record<string, unknown> {
65
+ toolId: string;
66
+ parameters: Record<string, unknown>;
67
+ result: string;
68
+ isError: boolean;
69
+ conversationId: string;
70
+ }
71
+ /** Data passed to UserPromptSubmit hooks. */
72
+ interface UserPromptSubmitData extends Record<string, unknown> {
73
+ message: string;
74
+ conversationId: string;
75
+ }
76
+ /** Data passed to ContextCompaction hooks before built-in history compaction. */
77
+ interface ContextCompactionData extends Record<string, unknown> {
78
+ conversationId: string;
79
+ iteration: number;
80
+ history: ChatMessage[];
81
+ autoCompact?: AgentFrameworkContext['agentToolLoop'] extends infer Options ? Options extends {
82
+ autoCompact?: infer AutoCompact;
83
+ } ? AutoCompact : never : never;
84
+ contextCompaction?: AgentFrameworkContext['agentToolLoop'] extends infer Options ? Options extends {
85
+ contextCompaction?: infer ContextCompaction;
86
+ } ? ContextCompaction : never : never;
87
+ }
88
+ /** Data passed to AgentStart hooks. */
89
+ interface AgentStartData extends Record<string, unknown> {
90
+ conversationId: string;
91
+ definitionId?: string;
92
+ }
93
+ /** Data passed to AgentStop hooks. */
94
+ interface AgentStopData extends Record<string, unknown> {
95
+ conversationId: string;
96
+ reason: 'completed' | 'cancelled' | 'max-iterations' | 'error';
97
+ }
98
+
99
+ interface CreateAgentOptions {
100
+ definitionId: string;
101
+ initialMessage?: string;
102
+ }
103
+ interface SendMessageOptions {
104
+ conversationId: string;
105
+ message: string;
106
+ definitionId?: string;
107
+ userMessage?: AgentLoopInput['userMessage'];
108
+ resumeSession?: ChatMessage[];
109
+ }
110
+ interface MemeLoopRuntime {
111
+ createAgent(options: CreateAgentOptions): Promise<{
112
+ conversationId: string;
113
+ }>;
114
+ sendMessage(options: SendMessageOptions): Promise<void>;
115
+ cancelAgent(conversationId: string): Promise<void>;
116
+ subscribeToUpdates(conversationId: string, listener: (update: unknown) => void): () => void;
117
+ }
118
+ interface CreateAgentLoopRunnerOptions {
119
+ definitionId: string;
120
+ conversationId?: string;
121
+ }
122
+ /**
123
+ * Create a loop runner for an already-resolved profile. Registers builtin
124
+ * loops/tools/prompts and threads the host script policy through, exactly
125
+ * like the definition-based path.
126
+ */
127
+ declare function createAgentProfileRunner(context: AgentFrameworkContext, profile: LoopProfile, runtime?: Partial<AgentLoopRuntime>): Promise<((input: AgentLoopInput) => AgentLoopGenerator) | null>;
128
+ /**
129
+ * Create a loop runner for a profile with a fresh per-conversation script
130
+ * runtime (state, checkpoints, cancellation, child propagation). Used by the
131
+ * workload execution path (plan 24.14) where the profile is synthesized from
132
+ * a resource rather than resolved from the definition store.
133
+ */
134
+ declare function createAgentLoopScriptRunner(context: AgentFrameworkContext, profile: LoopProfile, conversationId: string): Promise<((input: AgentLoopInput) => AgentLoopGenerator) | null>;
135
+ declare function createAgentLoopRunner(context: AgentFrameworkContext, options: CreateAgentLoopRunnerOptions): Promise<((input: AgentLoopInput) => AgentLoopGenerator) | null>;
136
+ declare function createMemeLoopRuntime(context: AgentFrameworkContext): MemeLoopRuntime;
137
+
138
+ /**
139
+ * Registry for agent profiles used by task delegation.
140
+ * Pre-seeded with built-in profiles (build, plan, explore, oracle, librarian).
141
+ */
142
+ declare class AgentProfileRegistry {
143
+ private readonly profiles;
144
+ constructor();
145
+ /** Seed the registry with built-in agent profiles. */
146
+ private seedDefaults;
147
+ /**
148
+ * Register a new agent profile or override an existing one.
149
+ * Throws if the profile is invalid.
150
+ */
151
+ registerAgentProfile(profile: AgentProfile): void;
152
+ /**
153
+ * Get an agent profile by ID.
154
+ * Returns undefined if not found.
155
+ */
156
+ getAgentProfile(id: string): AgentProfile | undefined;
157
+ /**
158
+ * List all registered agent profiles.
159
+ */
160
+ listAgentProfiles(): AgentProfile[];
161
+ /**
162
+ * List agent profiles filtered by type.
163
+ */
164
+ listAgentProfilesByType(type: AgentProfileType): AgentProfile[];
165
+ /**
166
+ * Remove an agent profile by ID.
167
+ */
168
+ unregisterAgentProfile(id: string): boolean;
169
+ /**
170
+ * Reset the registry to only built-in defaults.
171
+ */
172
+ reset(): void;
173
+ }
174
+ declare function getAgentProfileRegistry(): AgentProfileRegistry;
175
+ declare function resetAgentProfileRegistry(): void;
176
+
177
+ /**
178
+ * Task category system for routing tasks to appropriate agent configurations.
179
+ * Each category maps to a model, temperature, and description for delegation decisions.
180
+ */
181
+ type TaskCategory = 'visual-engineering' | 'ultrabrain' | 'artistry' | 'quick' | 'unspecified-low' | 'unspecified-high' | 'writing';
182
+ interface CategoryConfig {
183
+ /** Model identifier (e.g., "default", "gpt-4o", "claude-opus") */
184
+ model: string;
185
+ /** LLM temperature (0.0 = deterministic, 1.0 = creative) */
186
+ temperature: number;
187
+ /** Human-readable description of the category's purpose */
188
+ description: string;
189
+ }
190
+ /**
191
+ * Get the configuration for a task category.
192
+ * @throws {Error} if the category is unknown
193
+ */
194
+ declare function getCategoryConfig(category: TaskCategory): CategoryConfig;
195
+ /**
196
+ * Type guard: check if a string is a valid TaskCategory.
197
+ */
198
+ declare function isTaskCategory(value: string): value is TaskCategory;
199
+ /** All registered category identifiers (read-only). */
200
+ declare const ALL_CATEGORIES: TaskCategory[];
201
+ /**
202
+ * Resolve a category string (or fallback to "unspecified-low").
203
+ * Never throws; always returns a valid config.
204
+ */
205
+ declare function resolveCategory(category: string): CategoryConfig;
206
+
207
+ /**
208
+ * Test whether a tool name matches a wildcard pattern.
209
+ *
210
+ * Supported patterns:
211
+ * - `*` → matches everything
212
+ * - `file.*` → matches any tool starting with `file.`
213
+ * - `shell(*)` → matches tools like `shell(rm)`, `shell(ls)` (literal parens)
214
+ * - exact name → matches only that exact tool name
215
+ *
216
+ * Patterns are converted to anchored regexes internally.
217
+ */
218
+ declare function matchPattern(toolName: string, pattern: string): boolean;
219
+ /**
220
+ * Merge multiple permission sets from lowest to highest priority.
221
+ *
222
+ * Sets are processed in order; later rules override earlier ones for the same tool pattern.
223
+ * Within a single set, rules are processed in order (last wins).
224
+ *
225
+ * @param sets - Ordered from lowest to highest priority (e.g. default → agent → user → session)
226
+ * @returns Flattened `MergedPermissions` with all unique patterns per action.
227
+ */
228
+ declare function mergePermissionSets(sets: PermissionSet[]): MergedPermissions;
229
+ /**
230
+ * Check what action applies to a given tool name under merged permissions.
231
+ *
232
+ * Precedence: exact patterns always beat wildcards.
233
+ * Within same specificity: deny > ask > allow.
234
+ */
235
+ declare function checkPermission(toolName: string, merged: MergedPermissions): PermissionAction;
236
+
237
+ interface PermissionSqlStatement {
238
+ get(...arguments_: unknown[]): unknown;
239
+ run(...arguments_: unknown[]): unknown;
240
+ }
241
+ interface PermissionSqlDatabase {
242
+ prepare(sql: string): PermissionSqlStatement;
243
+ }
244
+ /**
245
+ * Load user-level permission set from SQLite.
246
+ *
247
+ * The `permissions` table stores JSON blobs keyed by `source`.
248
+ * Returns an empty set if no persisted rules exist.
249
+ */
250
+ declare function loadUserPermissions(database: PermissionSqlDatabase): PermissionSet;
251
+ /**
252
+ * Persist user-level permission set to SQLite.
253
+ *
254
+ * Uses INSERT OR REPLACE so first-time saves work without explicit table detection.
255
+ */
256
+ declare function saveUserPermissions(database: PermissionSqlDatabase, set: PermissionSet): void;
257
+ /** SQL statement to create the permissions table during migration. */
258
+ declare const PERMISSIONS_TABLE_DDL = "\n CREATE TABLE IF NOT EXISTS permissions (\n source TEXT PRIMARY KEY,\n rulesJson TEXT NOT NULL,\n updatedAt INTEGER NOT NULL\n );\n";
259
+
260
+ /**
261
+ * Plugin marketplace architecture types.
262
+ * Plugins can provide tools and hooks to extend memeloop.
263
+ */
264
+
265
+ /**
266
+ * Plugin manifest schema.
267
+ * Host adapters may read this from files or construct it programmatically.
268
+ */
269
+ interface PluginManifest {
270
+ /** Unique plugin identifier (e.g. "plugin-hello", "@scope/my-plugin") */
271
+ name: string;
272
+ /** Semantic version */
273
+ version: string;
274
+ /** Human-readable description */
275
+ description: string;
276
+ /** Declared exports: what the plugin provides */
277
+ exports?: PluginExports;
278
+ /** Plugin author */
279
+ author?: string;
280
+ /** Minimum memeloop version requirement (semver range) */
281
+ minMemeloopVersion?: string;
282
+ }
283
+ /** Declared capabilities a plugin may export. */
284
+ interface PluginExports {
285
+ /** Tool IDs this plugin implements */
286
+ tools?: string[];
287
+ /** Hook types this plugin listens for */
288
+ hooks?: HookType[];
289
+ }
290
+ /**
291
+ * Shape of a loaded plugin module's default export.
292
+ * Plugins must export default an object conforming to this interface.
293
+ */
294
+ interface PluginModule {
295
+ /** Plugin identity (must match manifest name) */
296
+ name: string;
297
+ /**
298
+ * Called when the plugin is loaded. Receives the PluginAPI for registering
299
+ * tools and hooks. Return a cleanup function for teardown.
300
+ */
301
+ activate: (api: PluginAPI) => (() => void) | Promise<() => void> | undefined;
302
+ }
303
+ /**
304
+ * API surface exposed to plugins. Plugins call these methods in their
305
+ * `activate` function to register their capabilities.
306
+ */
307
+ interface PluginAPI {
308
+ /**
309
+ * Register a tool implementation.
310
+ * @param toolId - Unique tool ID (e.g. "plugin-hello.sayHi")
311
+ * @param impl - Tool implementation function
312
+ * @param schema - Optional parameter schema (Zod type)
313
+ */
314
+ registerTool(toolId: string, impl: (...arguments_: unknown[]) => unknown, schema?: unknown, effect?: ToolOperationEffect): void;
315
+ /**
316
+ * Register a lifecycle hook handler.
317
+ * @param type - Hook event type
318
+ * @param handler - Async handler function
319
+ * @param name - Optional handler name (enables dedup/unregistration)
320
+ */
321
+ registerHook(type: HookType, handler: HookHandler, name?: string): void;
322
+ /** Log to memeloop's logger (falls back to console). */
323
+ logger: {
324
+ debug: (message: string, ...arguments_: unknown[]) => void;
325
+ info: (message: string, ...arguments_: unknown[]) => void;
326
+ warn: (message: string, ...arguments_: unknown[]) => void;
327
+ error: (message: string, ...arguments_: unknown[]) => void;
328
+ };
329
+ }
330
+ /** Metadata about a loaded plugin instance. */
331
+ interface LoadedPlugin {
332
+ /** Manifest data */
333
+ manifest: PluginManifest;
334
+ /** Optional host-provided source identifier, e.g. package name or file path. */
335
+ source: string;
336
+ /** The loaded plugin module */
337
+ module: PluginModule;
338
+ /** Cleanup function returned by activate(), if any */
339
+ cleanup: (() => void) | undefined;
340
+ /** When the plugin was loaded */
341
+ loadedAt: Date;
342
+ }
343
+
344
+ declare function validatePluginManifest(object: unknown): PluginManifest | null;
345
+ interface LoadPluginModuleOptions {
346
+ manifest: PluginManifest;
347
+ module: PluginModule;
348
+ api?: unknown;
349
+ source?: string;
350
+ }
351
+ declare function loadPluginModule(options: LoadPluginModuleOptions): Promise<LoadedPlugin | null>;
352
+ declare function loadPluginModules(plugins: LoadPluginModuleOptions[]): Promise<LoadedPlugin[]>;
353
+ declare function unloadPlugin(name: string): boolean;
354
+ declare function listPlugins(): LoadedPlugin[];
355
+ declare function getLoadedPlugin(name: string): LoadedPlugin | undefined;
356
+ declare function isPluginLoaded(name: string): boolean;
357
+ declare function unloadAllPlugins(): void;
358
+
359
+ /**
360
+ * Plugin registry: bridges plugin exports to memeloop's tool and hook registries.
361
+ *
362
+ * Provides a `createPluginAPI()` factory that plugins call during `activate()`
363
+ * to register their tools and hooks with the host runtime.
364
+ *
365
+ * Converted from module-level singletons to an instance class for test isolation
366
+ * and multi-runtime support.
367
+ */
368
+
369
+ /** Plugin API factory options. */
370
+ interface PluginAPIOptions {
371
+ toolRegistry?: {
372
+ registerTool(id: string, impl: unknown, schema?: unknown, effect?: ToolOperationEffect): void;
373
+ };
374
+ logger?: PluginAPI['logger'];
375
+ }
376
+ /**
377
+ * Track which tools/plugins belong to each plugin so we can clean up on unload.
378
+ */
379
+ interface PluginRegistration {
380
+ pluginName: string;
381
+ tools: string[];
382
+ hooks: Array<{
383
+ type: HookType;
384
+ name: string;
385
+ }>;
386
+ }
387
+ declare function createPluginAPI(options?: PluginAPIOptions): PluginAPI;
388
+ declare function registerPluginTools(pluginName: string, tools: Array<readonly [string, (...arguments_: unknown[]) => unknown, unknown?]>): void;
389
+ declare function registerPluginHooks(pluginName: string, hooks: Array<readonly [HookType, HookHandler, string?]>): void;
390
+ declare function getPluginRegistrations(pluginName: string): PluginRegistration | undefined;
391
+ declare function clearPluginRegistrations(): void;
392
+
393
+ export { resetAgentProfileRegistry as $, ALL_CATEGORIES as A, createAgentLoopScriptRunner as B, type CategoryConfig as C, createAgentProfileRunner as D, createMemeLoopRuntime as E, createPluginAPI as F, getAgentProfileRegistry as G, type HookContext as H, getCategoryConfig as I, getLoadedPlugin as J, getPluginRegistrations as K, type LoadPluginModuleOptions as L, type MemeLoopRuntime as M, isPluginLoaded as N, isTaskCategory as O, PERMISSIONS_TABLE_DDL as P, listPlugins as Q, loadPluginModule as R, type SendMessageOptions as S, type TaskCategory as T, type UserPromptSubmitData as U, loadPluginModules as V, loadUserPermissions as W, matchPattern as X, mergePermissionSets as Y, registerPluginHooks as Z, registerPluginTools as _, AgentProfileRegistry as a, resolveCategory as a0, saveUserPermissions as a1, unloadAllPlugins as a2, unloadPlugin as a3, validatePluginManifest as a4, type AgentStartData as b, type AgentStopData as c, type ContextCompactionData as d, type CreateAgentLoopRunnerOptions as e, type CreateAgentOptions as f, type HookHandler as g, type HookResult as h, type HookType as i, type LoadedPlugin as j, type MergedPermissions as k, type PermissionAction as l, type PermissionRule as m, type PermissionSet as n, type PermissionSqlDatabase as o, type PermissionSqlStatement as p, type PluginAPI as q, type PluginAPIOptions as r, type PluginExports as s, type PluginManifest as t, type PluginModule as u, type PostToolUseData as v, type PreToolUseData as w, checkPermission as x, clearPluginRegistrations as y, createAgentLoopRunner as z };