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.
- package/README.md +63 -0
- package/dist/browser.cjs +1413 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.cts +3066 -0
- package/dist/browser.d.ts +3066 -0
- package/dist/browser.js +43 -0
- package/dist/chunk-2C6BJZI3.js +382 -0
- package/dist/chunk-2C6BJZI3.js.map +1 -0
- package/dist/chunk-426CJUZP.js +630 -0
- package/dist/chunk-426CJUZP.js.map +1 -0
- package/dist/chunk-7ZDTB4VZ.js +63 -0
- package/dist/chunk-7ZDTB4VZ.js.map +1 -0
- package/dist/chunk-AZFYDWIN.js +98 -0
- package/dist/chunk-AZFYDWIN.js.map +1 -0
- package/dist/chunk-BGPU4RR7.js +367 -0
- package/dist/chunk-BGPU4RR7.js.map +1 -0
- package/dist/chunk-CCEFAOSH.js +496 -0
- package/dist/chunk-CCEFAOSH.js.map +1 -0
- package/dist/chunk-FWSY5HOA.js +63 -0
- package/dist/chunk-FWSY5HOA.js.map +1 -0
- package/dist/chunk-GYIOMQMY.js +8726 -0
- package/dist/chunk-GYIOMQMY.js.map +1 -0
- package/dist/chunk-K6P63KD4.js +68 -0
- package/dist/chunk-K6P63KD4.js.map +1 -0
- package/dist/chunk-KFS2EJT6.js +42 -0
- package/dist/chunk-KFS2EJT6.js.map +1 -0
- package/dist/chunk-MAJWHAKR.js +3637 -0
- package/dist/chunk-MAJWHAKR.js.map +1 -0
- package/dist/chunk-MRKY4HGF.js +205 -0
- package/dist/chunk-MRKY4HGF.js.map +1 -0
- package/dist/chunk-T7FSXWFR.js +2744 -0
- package/dist/chunk-T7FSXWFR.js.map +1 -0
- package/dist/chunk-VZKQX5PP.js +1 -0
- package/dist/chunk-VZKQX5PP.js.map +1 -0
- package/dist/chunk-WAI6BODI.js +175 -0
- package/dist/chunk-WAI6BODI.js.map +1 -0
- package/dist/chunk-YMNXDNDW.js +798 -0
- package/dist/chunk-YMNXDNDW.js.map +1 -0
- package/dist/conversation.cjs +208 -0
- package/dist/conversation.cjs.map +1 -0
- package/dist/conversation.d.cts +100 -0
- package/dist/conversation.d.ts +100 -0
- package/dist/conversation.js +21 -0
- package/dist/conversation.js.map +1 -0
- package/dist/device-network-portable.cjs +702 -0
- package/dist/device-network-portable.cjs.map +1 -0
- package/dist/device-network-portable.d.cts +110 -0
- package/dist/device-network-portable.d.ts +110 -0
- package/dist/device-network-portable.js +53 -0
- package/dist/device-network-portable.js.map +1 -0
- package/dist/device-network.cjs +906 -0
- package/dist/device-network.cjs.map +1 -0
- package/dist/device-network.d.cts +6 -0
- package/dist/device-network.d.ts +6 -0
- package/dist/device-network.js +59 -0
- package/dist/device-network.js.map +1 -0
- package/dist/fetchProvider-WWnWnQFP.d.ts +91 -0
- package/dist/fetchProvider-toTHy5Nu.d.cts +91 -0
- package/dist/index.cjs +28051 -5459
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +94 -1320
- package/dist/index.d.ts +94 -1320
- package/dist/index.js +10616 -2420
- package/dist/index.js.map +1 -1
- package/dist/interface-IrKBFtL1.d.cts +493 -0
- package/dist/interface-IrKBFtL1.d.ts +493 -0
- package/dist/llm-providers.cjs +43 -8
- package/dist/llm-providers.cjs.map +1 -1
- package/dist/llm-providers.d.cts +2 -1
- package/dist/llm-providers.d.ts +2 -1
- package/dist/llm-providers.js +4 -2
- package/dist/llm-providers.js.map +1 -1
- package/dist/loop-api.cjs +5227 -2010
- package/dist/loop-api.cjs.map +1 -1
- package/dist/loop-api.d.cts +11 -5
- package/dist/loop-api.d.ts +11 -5
- package/dist/loop-api.js +86 -49
- package/dist/mobile.cjs +2711 -0
- package/dist/mobile.cjs.map +1 -0
- package/dist/mobile.d.cts +6 -0
- package/dist/mobile.d.ts +6 -0
- package/dist/mobile.js +22 -0
- package/dist/mobile.js.map +1 -0
- package/dist/orchestration-portable-BHB_YrNN.d.ts +2192 -0
- package/dist/orchestration-portable-mvYBvGBb.d.cts +2192 -0
- package/dist/orchestration-portable.cjs +9553 -0
- package/dist/orchestration-portable.cjs.map +1 -0
- package/dist/orchestration-portable.d.cts +5 -0
- package/dist/orchestration-portable.d.ts +5 -0
- package/dist/orchestration-portable.js +290 -0
- package/dist/orchestration-portable.js.map +1 -0
- package/dist/pairingInvite-BXPWY3aM.d.cts +149 -0
- package/dist/pairingInvite-Cuz0wuq9.d.ts +149 -0
- package/dist/promptConcat-0WNFTg4l.d.ts +516 -0
- package/dist/promptConcat-D6wr5V-V.d.cts +516 -0
- package/dist/providerRegistry-Bi6pAvSj.d.ts +86 -0
- package/dist/providerRegistry-CPsktuiX.d.cts +86 -0
- package/dist/registry-D0kbxksn.d.cts +393 -0
- package/dist/registry-DDbvhlhs.d.ts +393 -0
- package/dist/remoteClient-B_spK019.d.ts +87 -0
- package/dist/remoteClient-CBggnRy3.d.cts +87 -0
- package/dist/runtime-PGWR6FIV.js +18 -0
- package/dist/runtime-PGWR6FIV.js.map +1 -0
- package/dist/scriptDeploymentPipeline-CXJcC82H.d.ts +2464 -0
- package/dist/scriptDeploymentPipeline-yG1ZhVVI.d.cts +2464 -0
- package/dist/syncCloudDevices-BEqwgrhD.d.ts +49 -0
- package/dist/syncCloudDevices-Ds_Kcgrv.d.cts +49 -0
- package/dist/types-7pYti-k9.d.cts +255 -0
- package/dist/types-CdFVSntj.d.ts +255 -0
- package/package.json +110 -35
- package/dist/anthropic.cjs +0 -72
- package/dist/anthropic.cjs.map +0 -1
- package/dist/anthropic.d.cts +0 -21
- package/dist/anthropic.d.ts +0 -21
- package/dist/anthropic.js +0 -21
- package/dist/anthropic.js.map +0 -1
- package/dist/azure.cjs +0 -72
- package/dist/azure.cjs.map +0 -1
- package/dist/azure.d.cts +0 -21
- package/dist/azure.d.ts +0 -21
- package/dist/azure.js +0 -21
- package/dist/azure.js.map +0 -1
- package/dist/chunk-3CN7DFBL.js +0 -4894
- package/dist/chunk-3CN7DFBL.js.map +0 -1
- package/dist/chunk-4AZ4D7U5.js +0 -32
- package/dist/chunk-4AZ4D7U5.js.map +0 -1
- package/dist/chunk-6ON4XSOV.js +0 -63
- package/dist/chunk-6ON4XSOV.js.map +0 -1
- package/dist/chunk-DJQNGIXX.js +0 -4793
- package/dist/chunk-DJQNGIXX.js.map +0 -1
- package/dist/chunk-FKQP6AOQ.js +0 -32
- package/dist/chunk-FKQP6AOQ.js.map +0 -1
- package/dist/chunk-OVJ7JJBA.js +0 -35
- package/dist/chunk-OVJ7JJBA.js.map +0 -1
- package/dist/chunk-P4UZ7IXC.js +0 -42
- package/dist/chunk-YHJ2AEFR.js +0 -4933
- package/dist/chunk-YHJ2AEFR.js.map +0 -1
- package/dist/chunk-YVK7RYRO.js +0 -4973
- package/dist/chunk-YVK7RYRO.js.map +0 -1
- package/dist/code-assistant.json +0 -114
- package/dist/cohere.cjs +0 -72
- package/dist/cohere.cjs.map +0 -1
- package/dist/cohere.d.cts +0 -21
- package/dist/cohere.d.ts +0 -21
- package/dist/cohere.js +0 -21
- package/dist/cohere.js.map +0 -1
- package/dist/deepseek.cjs +0 -72
- package/dist/deepseek.cjs.map +0 -1
- package/dist/deepseek.d.cts +0 -21
- package/dist/deepseek.d.ts +0 -21
- package/dist/deepseek.js +0 -21
- package/dist/deepseek.js.map +0 -1
- package/dist/dist-65U7OYRG.js +0 -1257
- package/dist/dist-65U7OYRG.js.map +0 -1
- package/dist/fetchProvider-Cu4WkU5O.d.cts +0 -819
- package/dist/fetchProvider-Cu4WkU5O.d.ts +0 -819
- package/dist/frontend-ui-ux.json +0 -105
- package/dist/general-assistant.json +0 -95
- package/dist/git-master.json +0 -51
- package/dist/google-vertex.cjs +0 -72
- package/dist/google-vertex.cjs.map +0 -1
- package/dist/google-vertex.d.cts +0 -21
- package/dist/google-vertex.d.ts +0 -21
- package/dist/google-vertex.js +0 -21
- package/dist/google-vertex.js.map +0 -1
- package/dist/google.cjs +0 -72
- package/dist/google.cjs.map +0 -1
- package/dist/google.d.cts +0 -21
- package/dist/google.d.ts +0 -21
- package/dist/google.js +0 -21
- package/dist/google.js.map +0 -1
- package/dist/groq.cjs +0 -72
- package/dist/groq.cjs.map +0 -1
- package/dist/groq.d.cts +0 -21
- package/dist/groq.d.ts +0 -21
- package/dist/groq.js +0 -21
- package/dist/groq.js.map +0 -1
- package/dist/index.d.mts +0 -3203
- package/dist/index.mjs +0 -7064
- package/dist/index.mjs.map +0 -1
- package/dist/mistral.cjs +0 -72
- package/dist/mistral.cjs.map +0 -1
- package/dist/mistral.d.cts +0 -21
- package/dist/mistral.d.ts +0 -21
- package/dist/mistral.js +0 -21
- package/dist/mistral.js.map +0 -1
- package/dist/multipart-parser-EJCXIUHC.js +0 -372
- package/dist/multipart-parser-EJCXIUHC.js.map +0 -1
- package/dist/openai.cjs +0 -72
- package/dist/openai.cjs.map +0 -1
- package/dist/openai.d.cts +0 -21
- package/dist/openai.d.ts +0 -21
- package/dist/openai.js +0 -21
- package/dist/openai.js.map +0 -1
- package/dist/perplexity.cjs +0 -72
- package/dist/perplexity.cjs.map +0 -1
- package/dist/perplexity.d.cts +0 -21
- package/dist/perplexity.d.ts +0 -21
- package/dist/perplexity.js +0 -21
- package/dist/perplexity.js.map +0 -1
- package/dist/playwright.json +0 -52
- package/dist/promptConcat-BJdazTg5.d.cts +0 -1832
- package/dist/promptConcat-BJdazTg5.d.ts +0 -1832
- package/dist/promptConcat-CAkpni_8.d.cts +0 -1834
- package/dist/promptConcat-CAkpni_8.d.ts +0 -1834
- package/dist/promptConcat-CfH5-GAE.d.cts +0 -1036
- package/dist/promptConcat-ChcAZOOL.d.ts +0 -1036
- package/dist/promptConcat-G5TnJVRy.d.cts +0 -1800
- package/dist/promptConcat-G5TnJVRy.d.ts +0 -1800
- package/dist/promptConcat-L72eowzp.d.ts +0 -1090
- package/dist/promptConcat-eLHdN7K8.d.cts +0 -1090
- package/dist/src-VTSXKG72.js +0 -1409
- package/dist/src-VTSXKG72.js.map +0 -1
- package/dist/togetherai.cjs +0 -72
- package/dist/togetherai.cjs.map +0 -1
- package/dist/togetherai.d.cts +0 -21
- package/dist/togetherai.d.ts +0 -21
- package/dist/togetherai.js +0 -21
- package/dist/togetherai.js.map +0 -1
- package/dist/types-B0Jm2l38.d.cts +0 -767
- package/dist/types-B0Jm2l38.d.ts +0 -767
- package/dist/xai.cjs +0 -72
- package/dist/xai.cjs.map +0 -1
- package/dist/xai.d.cts +0 -21
- package/dist/xai.d.ts +0 -21
- package/dist/xai.js +0 -21
- package/dist/xai.js.map +0 -1
- /package/dist/{chunk-P4UZ7IXC.js.map → browser.js.map} +0 -0
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
import { q as LoopProfileScriptReference, h as AgentLoopScriptPolicy, i as AgentLoopStep, f as AgentLoopInput, n as LoopProfile, g as AgentLoopRuntime, e as AgentLoopGenerator, B as AgentClient, C as ScriptDeploymentClient, d as AgentLoopDefinition, k as ILLMProvider, A as AgentFrameworkContext, L as LoopPlugin, o as LoopProfilePluginEntry, P as PromptConcatTool } from './scriptDeploymentPipeline-yG1ZhVVI.cjs';
|
|
2
|
+
import { t as AgentOrchestrationClient, b as ChatMessage, W as PromptNode, X as AgentPromptDescription } from './interface-IrKBFtL1.cjs';
|
|
3
|
+
import { c as AgentStopData, i as HookType, g as HookHandler, H as HookContext, h as HookResult } from './registry-D0kbxksn.cjs';
|
|
4
|
+
|
|
5
|
+
declare const BUILTIN_AGENT_AGENT_LOOP_ARTIFACT_RESOURCE_LIFECYCLE_SCRIPT_ID = "builtin:agent-agent-loop/artifact-resource-lifecycle";
|
|
6
|
+
declare const BUILTIN_AGENT_AGENT_LOOP_DECLARATIVE_AGENT_RUN_SCRIPT_ID = "builtin:agent-agent-loop/declarative-agent-run";
|
|
7
|
+
declare const BUILTIN_AGENT_AGENT_LOOP_QUALITY_GATE_SCRIPT_ID = "builtin:agent-agent-loop/quality-gate";
|
|
8
|
+
declare const builtinAgentAgentLoopSources: Readonly<Record<string, string>>;
|
|
9
|
+
declare function getBuiltinAgentAgentLoopSource(id: string): string | undefined;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Agent loop script loader (plan 24.15: source is never imported directly
|
|
13
|
+
* from an LLM string without passing the admission chain).
|
|
14
|
+
*
|
|
15
|
+
* Loading rules:
|
|
16
|
+
* - Builtin loop sources are allowlisted by content digest at startup
|
|
17
|
+
* ({@link registerBuiltinScriptSources}); they load with zero gate overhead.
|
|
18
|
+
* - Any other source-bearing reference (`source` refs and `data:` URLs) must
|
|
19
|
+
* pass the host-injected {@link ScriptLoadGate}: validate (AST) → admit
|
|
20
|
+
* (trust-class policy) → only then `import()`.
|
|
21
|
+
* - When no gate is configured, all non-builtin sources are DENIED
|
|
22
|
+
* (fail-closed) with a structured {@link ScriptLoadDeniedError}.
|
|
23
|
+
*
|
|
24
|
+
* Admission results (trust class, RuntimeClass, checkpoint compatibility)
|
|
25
|
+
* are attached to the loaded script via {@link LOADED_SCRIPT_METADATA} so
|
|
26
|
+
* hosts can enforce sandboxing.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
type AgentLoopScriptReference = string | LoopProfileScriptReference;
|
|
30
|
+
|
|
31
|
+
type LoadAgentAgentLoopScriptOptions = AgentLoopScriptPolicy;
|
|
32
|
+
type AgentAgentLoopScriptReference = AgentLoopScriptReference;
|
|
33
|
+
declare function loadAgentAgentLoopScript(scriptReference: AgentAgentLoopScriptReference, options?: LoadAgentAgentLoopScriptOptions): Promise<AgentAgentLoopScript>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* AgentAgent_Loop — a loop that orchestrates child agents.
|
|
37
|
+
*
|
|
38
|
+
* This loop does NOT call the LLM directly. Instead it coordinates child agents:
|
|
39
|
+
* - running a child agent and feeding its result to another child agent (review / verify)
|
|
40
|
+
* - splitting work across multiple parallel child agents
|
|
41
|
+
* - looping back to a child agent with feedback when a reviewer rejects the output
|
|
42
|
+
*
|
|
43
|
+
* The loop script (.mjs) holds the orchestration logic. This file provides the
|
|
44
|
+
* runtime that invokes the script and manages child agent runs.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Typed API passed to a AgentAgent `.mjs` script.
|
|
49
|
+
*
|
|
50
|
+
* The API is intentionally primitive: scripts decide the workflow shape, role
|
|
51
|
+
* names, approval rules, retry limits, and delivery gates. This runtime only
|
|
52
|
+
* handles child-agent execution, progress events, cancellation, state, and
|
|
53
|
+
* checkpoints.
|
|
54
|
+
*/
|
|
55
|
+
interface AgentAgentLoopScriptArguments {
|
|
56
|
+
/** The parent turn input. `input.message` is the user's original goal. */
|
|
57
|
+
input: AgentLoopInput;
|
|
58
|
+
/** Host/runtime context for advanced integrations. Prefer the typed helpers below when possible. */
|
|
59
|
+
context: AgentAgentLoopContext;
|
|
60
|
+
/** Active profile. Scripts may define their own workflow-specific metadata keys here. */
|
|
61
|
+
profile?: LoopProfile;
|
|
62
|
+
/** Normalized worker agents read from `context.agents` or `profile.metadata.agents`. */
|
|
63
|
+
agents: AgentAgentDescriptor[];
|
|
64
|
+
/**
|
|
65
|
+
* Read raw agent entries from `profile.metadata[key]`; defaults to `agents`.
|
|
66
|
+
* This is deliberately generic so scripts can choose names like `critics`,
|
|
67
|
+
* `builders`, `verifiers`, or any other workflow-specific role.
|
|
68
|
+
*/
|
|
69
|
+
getAgentEntries: (key?: string) => AgentAgentConfigEntry[];
|
|
70
|
+
/** Low-level runtime hooks. Prefer `state`, `checkpoint`, `emit`, and run helpers first. */
|
|
71
|
+
runtime?: Partial<AgentLoopRuntime>;
|
|
72
|
+
/** Policy-scoped declarative manager facade. It never exposes raw infrastructure drivers or secrets. */
|
|
73
|
+
orchestration?: AgentOrchestrationClient;
|
|
74
|
+
/** Typed convenience client for creating, reading, and deleting Agent workloads and runs. */
|
|
75
|
+
agentClient?: AgentClient;
|
|
76
|
+
/**
|
|
77
|
+
* Declarative generated-script deployment (plan 24.14). The script declares
|
|
78
|
+
* placement and lifecycle; trust, interface ceilings, and persistence are
|
|
79
|
+
* host-bound. Undefined when the host provides no deployment configuration.
|
|
80
|
+
*/
|
|
81
|
+
scriptClient?: ScriptDeploymentClient;
|
|
82
|
+
/** Run one child agent and collect all yielded steps into a text result. */
|
|
83
|
+
runAgent: (input: AgentAgentRunAgentInput) => Promise<AgentAgentRunAgentResult>;
|
|
84
|
+
/** Run child agents concurrently. Use `runSequential` when order matters. */
|
|
85
|
+
runAgents: (inputs: AgentAgentRunAgentInput[]) => Promise<AgentAgentRunAgentResult[]>;
|
|
86
|
+
/** Run a batch of agents in order, aggregating successful output and failures. */
|
|
87
|
+
runSequential: (input?: AgentAgentBatchRunInput) => Promise<AgentAgentBatchRunResult>;
|
|
88
|
+
/** Run a batch of agents concurrently, aggregating successful output and failures. */
|
|
89
|
+
runParallel: (input?: AgentAgentBatchRunInput) => Promise<AgentAgentBatchRunResult>;
|
|
90
|
+
/** Format a batch result for final delivery or an intermediate report. */
|
|
91
|
+
formatAgentResults: (result: AgentAgentBatchRunResult, options?: AgentAgentFormatResultsOptions) => string;
|
|
92
|
+
/** Emit a formatted batch result as the parent loop's final/user-visible message. */
|
|
93
|
+
finishAgentResults: (result: AgentAgentBatchRunResult, options?: AgentAgentFormatResultsOptions) => void;
|
|
94
|
+
/** Emit a raw loop step upstream. Use sparingly; helpers already emit progress. */
|
|
95
|
+
emit: (step: AgentLoopStep) => void;
|
|
96
|
+
/** Emit a user-visible message or step and end the script's work. */
|
|
97
|
+
finish: (message: string | AgentLoopStep) => void;
|
|
98
|
+
/** True when the host cancelled this parent run. Long-running scripts should check this between phases. */
|
|
99
|
+
isCancelled: () => boolean;
|
|
100
|
+
/** Write an observability event through the host runtime logger. */
|
|
101
|
+
log: (event: string, data?: Record<string, unknown>) => void;
|
|
102
|
+
/** Per-run persistent state scoped by the host runtime. */
|
|
103
|
+
state: AgentLoopRuntime['state'];
|
|
104
|
+
/** Record a resumable milestone for long workflows. */
|
|
105
|
+
checkpoint: AgentLoopRuntime['checkpoint'];
|
|
106
|
+
/** Read a milestone recorded by an earlier process and skip completed work. */
|
|
107
|
+
loadCheckpoint: AgentLoopRuntime['loadCheckpoint'];
|
|
108
|
+
}
|
|
109
|
+
type AgentAgentScriptContext = AgentAgentLoopScriptArguments;
|
|
110
|
+
type AgentAgentContext = AgentAgentScriptContext;
|
|
111
|
+
interface AgentAgentDescriptor {
|
|
112
|
+
/** Child profile id to run. */
|
|
113
|
+
profileId: string;
|
|
114
|
+
/** Prompt override for this child run. Defaults to the parent input message. */
|
|
115
|
+
prompt?: string;
|
|
116
|
+
/** Conversation id override. Defaults to `${parent}:child:${index}` for batch helpers. */
|
|
117
|
+
conversationId?: string;
|
|
118
|
+
/** Optional human-readable role label, e.g. "implementer" or "reviewer". */
|
|
119
|
+
label?: string;
|
|
120
|
+
[key: string]: unknown;
|
|
121
|
+
}
|
|
122
|
+
type AgentAgentConfigEntry = string | ({
|
|
123
|
+
profileId?: string;
|
|
124
|
+
profile?: string;
|
|
125
|
+
prompt?: string;
|
|
126
|
+
conversationId?: string;
|
|
127
|
+
label?: string;
|
|
128
|
+
} & Record<string, unknown>);
|
|
129
|
+
interface AgentAgentRunAgentInput {
|
|
130
|
+
/** Child profile id. `profile` is accepted as an ergonomic alias for scripts. */
|
|
131
|
+
profileId?: string;
|
|
132
|
+
profile?: string;
|
|
133
|
+
/** Defaults to the parent input message. */
|
|
134
|
+
prompt?: string;
|
|
135
|
+
conversationId?: string;
|
|
136
|
+
label?: string;
|
|
137
|
+
}
|
|
138
|
+
interface AgentAgentRunAgentResult {
|
|
139
|
+
profileId: string;
|
|
140
|
+
conversationId: string;
|
|
141
|
+
steps: AgentLoopStep[];
|
|
142
|
+
text: string;
|
|
143
|
+
}
|
|
144
|
+
interface AgentAgentRunAgentFailure {
|
|
145
|
+
profileId: string;
|
|
146
|
+
conversationId?: string;
|
|
147
|
+
error: string;
|
|
148
|
+
}
|
|
149
|
+
interface AgentAgentBatchRunInput {
|
|
150
|
+
/** Agents to run. Defaults to `ctx.agents`. */
|
|
151
|
+
agents?: AgentAgentConfigEntry[];
|
|
152
|
+
/** Prompt shared by every agent in this batch. Defaults to the parent input message. */
|
|
153
|
+
prompt?: string;
|
|
154
|
+
/** When false, the first child failure rejects the batch. Defaults to true. */
|
|
155
|
+
continueOnError?: boolean;
|
|
156
|
+
}
|
|
157
|
+
interface AgentAgentBatchRunResult {
|
|
158
|
+
results: AgentAgentRunAgentResult[];
|
|
159
|
+
failures: AgentAgentRunAgentFailure[];
|
|
160
|
+
text: string;
|
|
161
|
+
}
|
|
162
|
+
interface AgentAgentFormatResultsOptions {
|
|
163
|
+
emptyMessage?: string;
|
|
164
|
+
failureHeader?: string;
|
|
165
|
+
includeFailureSection?: boolean;
|
|
166
|
+
}
|
|
167
|
+
type AgentAgentLoopScriptResult = AgentLoopGenerator | AgentLoopStep | AgentLoopStep[] | string | undefined;
|
|
168
|
+
type AgentAgentLoopScript = (scriptArguments: AgentAgentLoopScriptArguments) => AgentAgentLoopScriptResult | Promise<AgentAgentLoopScriptResult>;
|
|
169
|
+
interface AgentAgentLoopContext {
|
|
170
|
+
[key: string]: unknown;
|
|
171
|
+
profile?: LoopProfile;
|
|
172
|
+
runtime?: Partial<AgentLoopRuntime>;
|
|
173
|
+
agents?: AgentAgentConfigEntry[];
|
|
174
|
+
script?: AgentAgentLoopScript;
|
|
175
|
+
loadScript?: (script: AgentAgentLoopScriptReference, context: AgentAgentLoopContext) => AgentAgentLoopScript | Promise<AgentAgentLoopScript>;
|
|
176
|
+
scriptPolicy?: LoadAgentAgentLoopScriptOptions;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Create the AgentAgent_Loop definition and register it with the loop registry.
|
|
180
|
+
*/
|
|
181
|
+
declare function createAgentAgentLoopDefinition(): AgentLoopDefinition;
|
|
182
|
+
/** Export loop id for consumers. */
|
|
183
|
+
declare function getAgentAgentLoopId(): string;
|
|
184
|
+
|
|
185
|
+
declare const BUILTIN_AGENT_TOOL_LOOP_DEFAULT_SCRIPT_ID = "builtin:agent-tool-loop/default";
|
|
186
|
+
declare const builtinAgentToolLoopSources: Readonly<Record<string, string>>;
|
|
187
|
+
declare function getBuiltinAgentToolLoopSource(id: string): string | undefined;
|
|
188
|
+
|
|
189
|
+
interface CompactionOptions {
|
|
190
|
+
/** Maximum token count to aim for after compaction (estimated by char count / 3.5). Default: 0 (no limit). */
|
|
191
|
+
maxTokens?: number;
|
|
192
|
+
/** Number of recent message turns (user+assistant pairs) to preserve. Default: 4. */
|
|
193
|
+
recentTurnsToKeep?: number;
|
|
194
|
+
/** Whether to attempt LLM summarization. Falls back to truncation if LLM unavailable or fails. Default: true. */
|
|
195
|
+
useLlmSummary?: boolean;
|
|
196
|
+
/** Optional LLM provider for summarization. */
|
|
197
|
+
llmProvider?: ILLMProvider;
|
|
198
|
+
}
|
|
199
|
+
interface CompactionResult {
|
|
200
|
+
/** Compacted messages (summary + recent turns). */
|
|
201
|
+
messages: ChatMessage[];
|
|
202
|
+
/** True if compaction reduced the message count. */
|
|
203
|
+
compacted: boolean;
|
|
204
|
+
/** Number of messages dropped. */
|
|
205
|
+
droppedCount: number;
|
|
206
|
+
/** Summary text generated or fallback notice. */
|
|
207
|
+
summaryText: string;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Deterministic compaction: keeps recent N turns and replaces older messages
|
|
211
|
+
* with a single summary message.
|
|
212
|
+
*/
|
|
213
|
+
declare function compactMessages(messages: ChatMessage[], options?: Omit<CompactionOptions, 'llmProvider' | 'useLlmSummary'>): CompactionResult;
|
|
214
|
+
/**
|
|
215
|
+
* Checks whether compaction is needed based on message count threshold.
|
|
216
|
+
* @returns true if message count exceeds threshold (default 50).
|
|
217
|
+
*/
|
|
218
|
+
declare function shouldCompact(messages: ChatMessage[], threshold?: number): boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Auto-compact: estimates token usage, and if it exceeds maxTokens,
|
|
221
|
+
* performs compaction to keep the context within bounds.
|
|
222
|
+
*
|
|
223
|
+
* Uses the LLM provider for summarization if available, falling back to
|
|
224
|
+
* simple truncation + turn counting.
|
|
225
|
+
*/
|
|
226
|
+
declare function autoCompact(messages: ChatMessage[], options?: CompactionOptions): Promise<CompactionResult>;
|
|
227
|
+
|
|
228
|
+
type LoadAgentToolLoopScriptOptions$1 = AgentLoopScriptPolicy;
|
|
229
|
+
type AgentToolLoopScriptReference$1 = AgentLoopScriptReference;
|
|
230
|
+
interface AgentToolLoopContext extends AgentFrameworkContext {
|
|
231
|
+
profile?: LoopProfile;
|
|
232
|
+
runtime?: Partial<AgentLoopRuntime>;
|
|
233
|
+
script?: AgentToolLoopScript;
|
|
234
|
+
loadScript?: (script: AgentToolLoopScriptReference$1, context: AgentToolLoopContext) => AgentToolLoopScript | Promise<AgentToolLoopScript>;
|
|
235
|
+
scriptPolicy?: LoadAgentToolLoopScriptOptions$1;
|
|
236
|
+
}
|
|
237
|
+
interface AgentToolLoopState {
|
|
238
|
+
iteration: number;
|
|
239
|
+
maxIterations: number;
|
|
240
|
+
recentToolCalls: string[];
|
|
241
|
+
agentStarted: boolean;
|
|
242
|
+
agentStopped: boolean;
|
|
243
|
+
stopReason?: AgentStopData['reason'];
|
|
244
|
+
}
|
|
245
|
+
interface AgentToolLoopTurnStartResult {
|
|
246
|
+
action: 'continue' | 'stop';
|
|
247
|
+
step?: AgentLoopStep;
|
|
248
|
+
}
|
|
249
|
+
interface AgentToolLoopIterationResult {
|
|
250
|
+
action: 'continue' | 'stop';
|
|
251
|
+
reason?: AgentStopData['reason'];
|
|
252
|
+
}
|
|
253
|
+
type AgentToolLoopIterationGenerator = AsyncGenerator<AgentLoopStep, AgentToolLoopIterationResult, void>;
|
|
254
|
+
interface AgentToolLoopScriptContext {
|
|
255
|
+
/** The host turn input. `input.message` is the user prompt for this turn. */
|
|
256
|
+
input: AgentLoopInput;
|
|
257
|
+
/** Full host context for advanced integrations. Prefer the primitive helpers below. */
|
|
258
|
+
context: AgentToolLoopContext;
|
|
259
|
+
/** Active profile selected by the registry/runtime. */
|
|
260
|
+
profile?: LoopProfile;
|
|
261
|
+
/** Create mutable loop state for one turn. Scripts can store it in checkpoints if they implement resume. */
|
|
262
|
+
createState: () => AgentToolLoopState;
|
|
263
|
+
/** Persist the user turn and run pre-agent hooks. Returns a blocking step when a hook stops the turn. */
|
|
264
|
+
startTurn: (state: AgentToolLoopState) => Promise<AgentToolLoopTurnStartResult>;
|
|
265
|
+
/** Run exactly one LLM/tool iteration. The script owns the surrounding loop policy. */
|
|
266
|
+
runIteration: (state: AgentToolLoopState) => AgentToolLoopIterationGenerator;
|
|
267
|
+
/** Run AgentStop hooks once. Pass a reason when stopping because of an error outside `runIteration`. */
|
|
268
|
+
stopTurn: (state: AgentToolLoopState, reason?: AgentStopData['reason']) => Promise<void>;
|
|
269
|
+
/** Emit a raw loop step upstream. */
|
|
270
|
+
emit: (step: AgentLoopStep) => void;
|
|
271
|
+
/** Emit a user-visible message or step. */
|
|
272
|
+
finish: (message: string | AgentLoopStep) => void;
|
|
273
|
+
/** True when host cancellation has been requested for this conversation. */
|
|
274
|
+
isCancelled: () => boolean;
|
|
275
|
+
/** Write an observability event through the runtime and host logger. */
|
|
276
|
+
log: (event: string, data?: Record<string, unknown>) => void;
|
|
277
|
+
}
|
|
278
|
+
type AgentToolLoopScriptResult = AgentLoopGenerator | AgentLoopStep | AgentLoopStep[] | string | undefined;
|
|
279
|
+
type AgentToolLoopScript = (scriptContext: AgentToolLoopScriptContext) => AgentToolLoopScriptResult | Promise<AgentToolLoopScriptResult>;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Direct agent/tool runner with no dynamic script-loader dependency.
|
|
283
|
+
*
|
|
284
|
+
* This is the portable path used by React Native. Hosts that need deployable
|
|
285
|
+
* script references use `createAgentToolLoopDefinition` from the full entry.
|
|
286
|
+
*/
|
|
287
|
+
declare function createAgentToolLoopRunner(context: AgentFrameworkContext): (input: AgentLoopInput) => AgentLoopGenerator;
|
|
288
|
+
|
|
289
|
+
declare function createAgentToolLoopDefinition(name?: string): AgentLoopDefinition;
|
|
290
|
+
|
|
291
|
+
type LoadAgentToolLoopScriptOptions = AgentLoopScriptPolicy;
|
|
292
|
+
type AgentToolLoopScriptReference = AgentLoopScriptReference;
|
|
293
|
+
declare function loadAgentToolLoopScript(scriptReference: AgentToolLoopScriptReference, options?: LoadAgentToolLoopScriptOptions): Promise<AgentToolLoopScript>;
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Built-in loop registrations — installed at startup so getLoopRegistry().createRunner('agent-tool-loop') works.
|
|
297
|
+
*
|
|
298
|
+
* This module allows hosts to skip manual registerLoop() for the built-in loop types.
|
|
299
|
+
* Hosts can still override by calling registerLoop() with the same id after.
|
|
300
|
+
*/
|
|
301
|
+
declare const AGENT_TOOL_LOOP_ID = "agent-tool-loop";
|
|
302
|
+
declare const AGENT_AGENT_LOOP_ID: string;
|
|
303
|
+
/**
|
|
304
|
+
* Register the default built-in loops (agent-tool-loop and agent-agent-loop) with the loop registry.
|
|
305
|
+
* Safe to call multiple times — skips already-registered loops.
|
|
306
|
+
*/
|
|
307
|
+
declare function registerBuiltinLoops(): void;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Builtin tool plugins — registers core tools as LoopPlugin entries.
|
|
311
|
+
*
|
|
312
|
+
* Each tool is a separate LoopPlugin that can be overridden by user/host plugins
|
|
313
|
+
* with the same id. The plugin.install callback calls the tool registry to
|
|
314
|
+
* register the tool implementation.
|
|
315
|
+
*
|
|
316
|
+
* These are registered in the loop registry at startup and loaded by
|
|
317
|
+
* `registerBuiltinTools` via plugin discovery.
|
|
318
|
+
*/
|
|
319
|
+
|
|
320
|
+
declare const PLUGIN_MCP_CLIENT = "builtin:mcp-client";
|
|
321
|
+
declare const PLUGIN_MCP_FORWARD = "builtin:mcp-forward";
|
|
322
|
+
declare const PLUGIN_ORCHESTRATION = "builtin:orchestration";
|
|
323
|
+
declare const PLUGIN_SPAWN_AGENT = "builtin:spawn-agent";
|
|
324
|
+
declare const PLUGIN_REMOTE_AGENT = "builtin:remote-agent";
|
|
325
|
+
declare const PLUGIN_ASK_QUESTION = "builtin:ask-question";
|
|
326
|
+
declare const PLUGIN_TODO_WRITE = "builtin:todo-write";
|
|
327
|
+
declare const PLUGIN_ASK_USER_QUESTION = "builtin:ask-user-question";
|
|
328
|
+
declare const PLUGIN_TASK = "builtin:task";
|
|
329
|
+
declare const BUILTIN_TOOL_PLUGIN_IDS: readonly ["builtin:mcp-client", "builtin:mcp-forward", "builtin:orchestration", "builtin:spawn-agent", "builtin:remote-agent", "builtin:ask-question", "builtin:todo-write", "builtin:ask-user-question", "builtin:task"];
|
|
330
|
+
declare function getBuiltinToolPlugins(): LoopPlugin[];
|
|
331
|
+
/** Register all builtin tool plugins with the loop registry. */
|
|
332
|
+
declare function registerBuiltinToolPlugins(): void;
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Agent loop registry.
|
|
336
|
+
*
|
|
337
|
+
* Discovers, registers, and resolves loop types, loop profiles, and loop plugins.
|
|
338
|
+
* Core does NOT hard-import any loop implementation; all are registered by host or plugin.
|
|
339
|
+
*/
|
|
340
|
+
|
|
341
|
+
type LoopPluginSelection = string | LoopProfilePluginEntry;
|
|
342
|
+
declare class LoopRegistryImpl {
|
|
343
|
+
private readonly loops;
|
|
344
|
+
private readonly profiles;
|
|
345
|
+
private readonly plugins;
|
|
346
|
+
registerLoop(definition: AgentLoopDefinition): void;
|
|
347
|
+
getLoop(id: string): AgentLoopDefinition | undefined;
|
|
348
|
+
listLoops(): AgentLoopDefinition[];
|
|
349
|
+
registerProfile(profile: LoopProfile): void;
|
|
350
|
+
getProfile(id: string): LoopProfile | undefined;
|
|
351
|
+
listProfiles(): LoopProfile[];
|
|
352
|
+
registerPlugin(plugin: LoopPlugin): void;
|
|
353
|
+
getPlugin(id: string): LoopPlugin | undefined;
|
|
354
|
+
listPlugins(): LoopPlugin[];
|
|
355
|
+
installPluginsForLoop(loopId: string, target: {
|
|
356
|
+
[key: string]: unknown;
|
|
357
|
+
}, selected?: LoopPluginSelection[]): void;
|
|
358
|
+
installPluginsForProfile(profile: LoopProfile, target: {
|
|
359
|
+
[key: string]: unknown;
|
|
360
|
+
}): void;
|
|
361
|
+
createRunnerForProfile(profile: LoopProfile, context?: {
|
|
362
|
+
[key: string]: unknown;
|
|
363
|
+
}): ((input: AgentLoopInput) => AgentLoopGenerator) | null;
|
|
364
|
+
createRunner(loopId: string, context?: {
|
|
365
|
+
[key: string]: unknown;
|
|
366
|
+
}): ((input: AgentLoopInput) => AgentLoopGenerator) | null;
|
|
367
|
+
reset(): void;
|
|
368
|
+
}
|
|
369
|
+
declare function getLoopRegistry(): LoopRegistryImpl;
|
|
370
|
+
declare function resetLoopRegistry(): void;
|
|
371
|
+
|
|
372
|
+
interface TokenTrackerConfig {
|
|
373
|
+
/** Maximum context window in tokens (default: 200000) */
|
|
374
|
+
contextWindow?: number;
|
|
375
|
+
/** Trigger compaction when usage exceeds this fraction (default: 0.90) */
|
|
376
|
+
compactionThreshold?: number;
|
|
377
|
+
/** Buffer tokens reserved for output (default: 16000) */
|
|
378
|
+
outputBuffer?: number;
|
|
379
|
+
}
|
|
380
|
+
interface TokenUsage {
|
|
381
|
+
promptTokens: number;
|
|
382
|
+
completionTokens: number;
|
|
383
|
+
totalTokens: number;
|
|
384
|
+
contextWindow: number;
|
|
385
|
+
usagePercent: number;
|
|
386
|
+
shouldCompact: boolean;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Tracks token usage and decides when to trigger auto-compaction.
|
|
390
|
+
*/
|
|
391
|
+
declare class TokenTracker {
|
|
392
|
+
private promptTokens;
|
|
393
|
+
private completionTokens;
|
|
394
|
+
private readonly contextWindow;
|
|
395
|
+
private readonly compactionThreshold;
|
|
396
|
+
private readonly outputBuffer;
|
|
397
|
+
private compacting;
|
|
398
|
+
private consecutiveCompactionFailures;
|
|
399
|
+
private maxConsecutiveFailures;
|
|
400
|
+
constructor(config?: TokenTrackerConfig);
|
|
401
|
+
/** Record token usage from an LLM response */
|
|
402
|
+
recordUsage(promptTokens: number, completionTokens: number): void;
|
|
403
|
+
/** Manually set the prompt token count (e.g., from estimation) */
|
|
404
|
+
setPromptTokens(tokens: number): void;
|
|
405
|
+
/** Get current usage */
|
|
406
|
+
getUsage(): TokenUsage;
|
|
407
|
+
/** Check if auto-compaction should be triggered */
|
|
408
|
+
shouldTriggerCompaction(): boolean;
|
|
409
|
+
/** Mark that compaction is starting */
|
|
410
|
+
markCompactionStart(): void;
|
|
411
|
+
/** Mark that compaction succeeded — reset token counts */
|
|
412
|
+
markCompactionSuccess(estimatedPostTokens: number): void;
|
|
413
|
+
/** Mark that compaction failed */
|
|
414
|
+
markCompactionFailure(): void;
|
|
415
|
+
/** Reset all counters */
|
|
416
|
+
reset(): void;
|
|
417
|
+
/** Get a human-readable summary */
|
|
418
|
+
formatUsage(): string;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Hook registry for managing lifecycle hook handlers.
|
|
423
|
+
* Hooks execute in registration order (first registered, first executed).
|
|
424
|
+
*
|
|
425
|
+
* Converted from module-level singletons to an instance class for test isolation
|
|
426
|
+
* and multi-runtime support. Backward-compatible function exports delegate to a
|
|
427
|
+
* default global instance.
|
|
428
|
+
*/
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Instance-level hook registry. Each instance maintains its own handler state.
|
|
432
|
+
*/
|
|
433
|
+
declare class HookRegistry {
|
|
434
|
+
private readonly hookRegistry;
|
|
435
|
+
private readonly hookOrder;
|
|
436
|
+
/**
|
|
437
|
+
* Register a hook handler for a specific lifecycle event.
|
|
438
|
+
*/
|
|
439
|
+
registerHook(type: HookType, handler: HookHandler, name?: string): void;
|
|
440
|
+
/**
|
|
441
|
+
* Unregister a specific hook handler by name.
|
|
442
|
+
*/
|
|
443
|
+
unregisterHook(type: HookType, name: string): boolean;
|
|
444
|
+
/**
|
|
445
|
+
* Execute all registered hooks for a given type in registration order.
|
|
446
|
+
*/
|
|
447
|
+
executeHooks(type: HookType, context: HookContext, data: Record<string, unknown>): Promise<HookResult>;
|
|
448
|
+
/**
|
|
449
|
+
* Check if any hooks are registered for a given type.
|
|
450
|
+
*/
|
|
451
|
+
hasHooks(type: HookType): boolean;
|
|
452
|
+
/**
|
|
453
|
+
* Remove all registered hooks of all types.
|
|
454
|
+
*/
|
|
455
|
+
clearHooks(): void;
|
|
456
|
+
/**
|
|
457
|
+
* List all hook types that have at least one registered handler.
|
|
458
|
+
*/
|
|
459
|
+
listRegisteredHookTypes(): HookType[];
|
|
460
|
+
/**
|
|
461
|
+
* Get the count of registered handlers for a hook type.
|
|
462
|
+
*/
|
|
463
|
+
getHookCount(type: HookType): number;
|
|
464
|
+
}
|
|
465
|
+
declare function getDefaultHookRegistry(): HookRegistry;
|
|
466
|
+
declare function registerHook(type: HookType, handler: HookHandler, name?: string): void;
|
|
467
|
+
declare function unregisterHook(type: HookType, name: string): boolean;
|
|
468
|
+
declare function executeHooks(type: HookType, context: HookContext, data: Record<string, unknown>): Promise<HookResult>;
|
|
469
|
+
declare function hasHooks(type: HookType): boolean;
|
|
470
|
+
declare function clearHooks(): void;
|
|
471
|
+
declare function listRegisteredHookTypes(): HookType[];
|
|
472
|
+
/**
|
|
473
|
+
* Get the count of registered handlers for a hook type.
|
|
474
|
+
*/
|
|
475
|
+
declare function getHookCount(type: HookType): number;
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* 注册内置 prompt 插件(fullReplacement、dynamicPosition)。
|
|
479
|
+
* @param target 若传入(如节点 `ToolRegistry` 上的 Map),只写入该表;否则写入活动注册表(全局或 ALS)。
|
|
480
|
+
*/
|
|
481
|
+
declare function registerBuiltinPromptPlugins(target?: Map<string, PromptConcatTool>): void;
|
|
482
|
+
|
|
483
|
+
/** 扁平化后的 LLM 消息(不依赖 peer `ai` 包导出,避免 d.ts 与 SDK 主版本不一致) */
|
|
484
|
+
type PromptFlatModelMessage = {
|
|
485
|
+
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
486
|
+
content: unknown;
|
|
487
|
+
};
|
|
488
|
+
declare function findPromptById(prompts: PromptNode[], id: string): {
|
|
489
|
+
prompt: PromptNode;
|
|
490
|
+
parent: PromptNode[];
|
|
491
|
+
index: number;
|
|
492
|
+
} | undefined;
|
|
493
|
+
declare function flattenPrompts(prompts: PromptNode[]): PromptFlatModelMessage[];
|
|
494
|
+
interface PromptConcatPluginPreview {
|
|
495
|
+
id: string;
|
|
496
|
+
toolId?: string;
|
|
497
|
+
caption?: string;
|
|
498
|
+
}
|
|
499
|
+
interface PromptConcatStreamState {
|
|
500
|
+
processedPrompts: PromptNode[];
|
|
501
|
+
flatPrompts: PromptFlatModelMessage[];
|
|
502
|
+
step: 'flatten' | 'complete' | 'plugin' | 'finalize';
|
|
503
|
+
isComplete: boolean;
|
|
504
|
+
/** prompt 节点 id → JSON 路径(如 agentFrameworkConfig.prompts.0) */
|
|
505
|
+
sourcePaths?: Record<string, string>;
|
|
506
|
+
/** Desktop UI: plugin currently being processed. */
|
|
507
|
+
currentPlugin?: PromptConcatPluginPreview;
|
|
508
|
+
/** Desktop UI: progress value between 0 and 1. */
|
|
509
|
+
progress?: number;
|
|
510
|
+
}
|
|
511
|
+
interface PromptConcatOptions {
|
|
512
|
+
readAttachmentFile?: (path: string) => Promise<Uint8Array>;
|
|
513
|
+
}
|
|
514
|
+
declare function promptConcatStream(agentConfig: Pick<AgentPromptDescription, 'agentFrameworkConfig'>, messages: ChatMessage[], agentFrameworkContext: AgentFrameworkContext, options?: PromptConcatOptions): AsyncGenerator<PromptConcatStreamState, PromptConcatStreamState, unknown>;
|
|
515
|
+
|
|
516
|
+
export { createAgentToolLoopDefinition as $, AGENT_AGENT_LOOP_ID as A, BUILTIN_AGENT_AGENT_LOOP_ARTIFACT_RESOURCE_LIFECYCLE_SCRIPT_ID as B, BUILTIN_TOOL_PLUGIN_IDS as C, type CompactionOptions as D, type CompactionResult as E, type LoadAgentToolLoopScriptOptions as F, LoopRegistryImpl as G, HookRegistry as H, PLUGIN_ASK_USER_QUESTION as I, PLUGIN_MCP_CLIENT as J, PLUGIN_MCP_FORWARD as K, type LoadAgentAgentLoopScriptOptions as L, PLUGIN_ORCHESTRATION as M, PLUGIN_REMOTE_AGENT as N, PLUGIN_SPAWN_AGENT as O, PLUGIN_ASK_QUESTION as P, PLUGIN_TASK as Q, PLUGIN_TODO_WRITE as R, type PromptConcatPluginPreview as S, type PromptConcatStreamState as T, TokenTracker as U, autoCompact as V, builtinAgentAgentLoopSources as W, builtinAgentToolLoopSources as X, clearHooks as Y, compactMessages as Z, createAgentAgentLoopDefinition as _, AGENT_TOOL_LOOP_ID as a, createAgentToolLoopRunner as a0, executeHooks as a1, findPromptById as a2, flattenPrompts as a3, getAgentAgentLoopId as a4, getBuiltinAgentAgentLoopSource as a5, getBuiltinAgentToolLoopSource as a6, getBuiltinToolPlugins as a7, getDefaultHookRegistry as a8, getHookCount as a9, getLoopRegistry as aa, hasHooks as ab, listRegisteredHookTypes as ac, loadAgentAgentLoopScript as ad, loadAgentToolLoopScript as ae, promptConcatStream as af, registerBuiltinLoops as ag, registerBuiltinPromptPlugins as ah, registerBuiltinToolPlugins as ai, registerHook as aj, resetLoopRegistry as ak, shouldCompact as al, unregisterHook as am, type AgentAgentBatchRunInput as b, type AgentAgentBatchRunResult as c, type AgentAgentConfigEntry as d, type AgentAgentContext as e, type AgentAgentDescriptor as f, type AgentAgentFormatResultsOptions as g, type AgentAgentLoopContext as h, type AgentAgentLoopScript as i, type AgentAgentLoopScriptArguments as j, type AgentAgentLoopScriptReference as k, type AgentAgentRunAgentFailure as l, type AgentAgentRunAgentInput as m, type AgentAgentRunAgentResult as n, type AgentAgentScriptContext as o, type AgentToolLoopContext as p, type AgentToolLoopIterationGenerator as q, type AgentToolLoopIterationResult as r, type AgentToolLoopScript as s, type AgentToolLoopScriptContext as t, type AgentToolLoopScriptReference as u, type AgentToolLoopState as v, type AgentToolLoopTurnStartResult as w, BUILTIN_AGENT_AGENT_LOOP_DECLARATIVE_AGENT_RUN_SCRIPT_ID as x, BUILTIN_AGENT_AGENT_LOOP_QUALITY_GATE_SCRIPT_ID as y, BUILTIN_AGENT_TOOL_LOOP_DEFAULT_SCRIPT_ID as z };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { m as AgentDefinition } from './interface-IrKBFtL1.js';
|
|
2
|
+
import { k as ILLMProvider } from './scriptDeploymentPipeline-CXJcC82H.js';
|
|
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 };
|