@agentproto/mastra 0.1.1 → 0.2.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/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +64 -1
- package/dist/index.mjs.map +1 -1
- package/dist/playbook-overlay-processor.d.ts +53 -0
- package/dist/playbook-overlay-processor.d.ts.map +1 -0
- package/dist/tools/query-knowledge.d.ts +49 -0
- package/dist/tools/query-knowledge.d.ts.map +1 -0
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -15,4 +15,8 @@
|
|
|
15
15
|
export { buildMastraAgent } from "./build-agent.js";
|
|
16
16
|
export { composeInstructions } from "./instructions.js";
|
|
17
17
|
export type { BuildMastraAgentOptions, BuildMastraAgentResult, ModelResolver, ToolResolver, WorkflowResolver, MemoryBuilder, VoiceBuilder, InstructionsFormatter, LanguageModelLike, MastraToolLike, MastraMemoryLike, MastraVoiceLike, MastraWorkflowLike, AgentHandle, AnyRef, ActionRef, ModelRef, MemoryConfig, } from "./types.js";
|
|
18
|
+
export { makePlaybookOverlayProcessor } from "./playbook-overlay-processor.js";
|
|
19
|
+
export type { PlaybookOverlayProcessorOptions } from "./playbook-overlay-processor.js";
|
|
20
|
+
export { makeQueryKnowledgeTool } from "./tools/query-knowledge.js";
|
|
21
|
+
export type { QueryKnowledgeToolOptions, QueryKnowledgeTool, QueryKnowledgeInput, } from "./tools/query-knowledge.js";
|
|
18
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,MAAM,EACN,SAAS,EACT,QAAQ,EACR,YAAY,GACb,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,MAAM,EACN,SAAS,EACT,QAAQ,EACR,YAAY,GACb,MAAM,YAAY,CAAA;AAInB,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAA;AAC9E,YAAY,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAA;AAGtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,YAAY,EACV,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,4BAA4B,CAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Agent } from '@mastra/core/agent';
|
|
2
|
+
import { OperatorOverlayResolver, renderOverlays } from '@agentproto/corpus';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @agentproto/mastra v0.1.0-alpha
|
|
@@ -150,7 +151,69 @@ function stripOwner(id) {
|
|
|
150
151
|
const m = id.match(/^@[^/]+\/(.+)$/);
|
|
151
152
|
return m ? m[1] : id;
|
|
152
153
|
}
|
|
154
|
+
function systemNote(text, id) {
|
|
155
|
+
return {
|
|
156
|
+
id,
|
|
157
|
+
role: "system",
|
|
158
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
159
|
+
content: { format: 2, parts: [{ type: "text", text }], content: text }
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function makePlaybookOverlayProcessor(opts) {
|
|
163
|
+
return {
|
|
164
|
+
id: "playbook-overlay",
|
|
165
|
+
name: "PlaybookOverlay",
|
|
166
|
+
description: "Splices active AIP-12 playbook overlays bound to the running operator into the prompt as a system note",
|
|
167
|
+
async processInput(args) {
|
|
168
|
+
const { requestContext } = args;
|
|
169
|
+
const scopeId = opts.getScopeId(requestContext);
|
|
170
|
+
if (!scopeId) return args.messages;
|
|
171
|
+
const dimensions = opts.getDimensions?.(requestContext);
|
|
172
|
+
const operatorSlug = opts.getOperatorSlug?.(requestContext) ?? "";
|
|
173
|
+
const conversationId = opts.getConversationId?.(requestContext);
|
|
174
|
+
if (!operatorSlug && !dimensions) return args.messages;
|
|
175
|
+
try {
|
|
176
|
+
const registry = await opts.host.getPlaybookRegistry(scopeId);
|
|
177
|
+
const result = new OperatorOverlayResolver(registry).resolve({
|
|
178
|
+
operatorSlug,
|
|
179
|
+
...dimensions ? { dimensions } : {},
|
|
180
|
+
...conversationId ? { conversationId } : {}
|
|
181
|
+
});
|
|
182
|
+
const { appendBlock } = renderOverlays(result);
|
|
183
|
+
if (!appendBlock) return args.messages;
|
|
184
|
+
const note = "Operating playbooks in effect (active SOPs \u2014 follow them; they override your defaults where they conflict):\n\n" + appendBlock;
|
|
185
|
+
return [systemNote(note, `playbook-overlay-${Date.now()}`), ...args.messages];
|
|
186
|
+
} catch (error) {
|
|
187
|
+
console.warn(
|
|
188
|
+
"[playbook-overlay] resolve failed; skipping injection:",
|
|
189
|
+
error instanceof Error ? error.message : error
|
|
190
|
+
);
|
|
191
|
+
return args.messages;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// src/tools/query-knowledge.ts
|
|
198
|
+
function makeQueryKnowledgeTool(opts) {
|
|
199
|
+
return {
|
|
200
|
+
name: "query_knowledge",
|
|
201
|
+
tool: {
|
|
202
|
+
id: "corpus:query_knowledge",
|
|
203
|
+
description: "Query the attached knowledge base for entries matching the given tags or text query.",
|
|
204
|
+
execute: async (input, context) => {
|
|
205
|
+
const scopeId = opts.getScopeId(context);
|
|
206
|
+
if (!scopeId) return [];
|
|
207
|
+
const dimensions = opts.getDimensions?.(context);
|
|
208
|
+
const q = {
|
|
209
|
+
...input.tags && input.tags.length > 0 ? { tags: input.tags } : {}
|
|
210
|
+
};
|
|
211
|
+
return opts.host.resolveKnowledgeEntries(scopeId, q, dimensions);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
}
|
|
153
216
|
|
|
154
|
-
export { buildMastraAgent, composeInstructions };
|
|
217
|
+
export { buildMastraAgent, composeInstructions, makePlaybookOverlayProcessor, makeQueryKnowledgeTool };
|
|
155
218
|
//# sourceMappingURL=index.mjs.map
|
|
156
219
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/instructions.ts","../src/build-agent.ts"],"names":[],"mappings":";;;;;;;;;AAWA,IAAM,WAAA,GAAc,2CAAA;AAgBb,SAAS,mBAAA,CACd,QACA,IAAA,EACQ;AACR,EAAA,MAAM,QAAkB,EAAC;AACzB,EAAA,KAAA,CAAM,KAAK,IAAA,EAAM,IAAA,MAAU,MAAA,CAAO,WAAA,CAAY,MAAM,CAAA;AAEpD,EAAA,MAAM,aAAA,GAAgB,qBAAqB,MAAM,CAAA;AACjD,EAAA,IAAI,aAAA,EAAe,KAAA,CAAM,IAAA,CAAK,aAAa,CAAA;AAE3C,EAAA,IAAI,MAAA,CAAO,UAAA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AA,EAAoB;AAEtC,EAAA,MAAM,CAAA,GAAI,EAAA,CAAG,KAAA,CAAM,gBAAgB,CAAA;AACnC,EAAA,OAAO,CAAA,GAAI,CAAA,CAAE,CAAC,CAAA,GAAK,EAAA;AACrB","file":"index.mjs","sourcesContent":["/**\n * Default instructions composer.\n *\n * AIP-42 says the markdown body of an AGENT.md is the agent's primary\n * system prompt. Boundaries, persona inline content, and trait scores\n * are appended in that order so the body — the human-authored part —\n * stays at the top where the model sees it first.\n */\n\nimport type { AgentHandle } from \"@agentproto/agent\"\n\nconst HEADER_RULE = \"Hard rules — these MUST be followed:\"\n\n/**\n * Compose the AGENT.md body + structural fields into a system prompt.\n *\n * Order:\n * 1. body (markdown after frontmatter), or `description` if absent\n * 2. inline persona block (when `persona` is `{ inline: ... }`)\n * 3. boundaries (rendered as a bulleted \"hard rules\" block)\n * 4. traits (rendered as a one-line guidance hint when present)\n *\n * Refs (`persona: \"@some/persona\"`) are NOT inlined — the host is\n * expected to resolve them externally and inject them via\n * `formatInstructions` if it cares, or pre-resolve and pass the\n * resolved body in via `body:`.\n */\nexport function composeInstructions(\n handle: AgentHandle,\n body: string | undefined,\n): string {\n const parts: string[] = []\n parts.push(body?.trim() ?? handle.description.trim())\n\n const personaInline = extractPersonaInline(handle)\n if (personaInline) parts.push(personaInline)\n\n if (handle.boundaries && handle.boundaries.length > 0) {\n const lines = handle.boundaries.map((b) => `- ${b}`).join(\"\\n\")\n parts.push(`${HEADER_RULE}\\n${lines}`)\n }\n\n if (handle.traits && Object.keys(handle.traits).length > 0) {\n parts.push(traitsLine(handle.traits))\n }\n\n return parts.filter((s) => s.length > 0).join(\"\\n\\n\")\n}\n\nfunction extractPersonaInline(handle: AgentHandle): string | undefined {\n const p = handle.persona\n if (!p || typeof p === \"string\") return undefined\n if (typeof p !== \"object\" || p === null || !(\"inline\" in p)) return undefined\n const inline = (p as { inline?: Record<string, unknown> }).inline\n if (!inline) return undefined\n const lines: string[] = []\n if (typeof inline.name === \"string\") lines.push(`Name: ${inline.name}`)\n if (typeof inline.tone === \"string\") lines.push(`Tone: ${inline.tone}`)\n if (Array.isArray(inline.values)) {\n lines.push(`Values: ${inline.values.join(\", \")}`)\n }\n if (typeof inline.bio === \"string\") lines.push(inline.bio)\n return lines.length > 0 ? `Persona\\n${lines.join(\"\\n\")}` : undefined\n}\n\nfunction traitsLine(traits: Record<string, number>): string {\n const formatted = Object.entries(traits)\n .map(([k, v]) => `${k}=${v}`)\n .join(\", \")\n return `Trait scores (0-10): ${formatted}.`\n}\n","/**\n * `buildMastraAgent(handle, opts)` — turn an AIP-42 AGENT.md handle\n * into a runnable `new Agent({ ... })` from `@mastra/core/agent`.\n *\n * The function is intentionally narrow: it walks the manifest's\n * structural fields and calls user-supplied resolvers for everything\n * that needs runtime knowledge (model, tools, workflows, memory,\n * voice). Anything the resolvers can't translate is either dropped\n * with a warning (default) or throws (`strict: true`).\n */\n\nimport { Agent } from \"@mastra/core/agent\"\nimport type { AgentHandle, AnyRef } from \"@agentproto/agent\"\nimport { composeInstructions } from \"./instructions.js\"\nimport type {\n BuildMastraAgentOptions,\n BuildMastraAgentResult,\n ToolResolver,\n WorkflowResolver,\n MastraToolLike,\n} from \"./types.js\"\n\nexport async function buildMastraAgent(\n handle: AgentHandle,\n opts: BuildMastraAgentOptions,\n): Promise<BuildMastraAgentResult> {\n const formatInstructions = opts.formatInstructions ?? composeInstructions\n const instructions = formatInstructions(handle, opts.body)\n const model = await opts.resolveModel(handle.model)\n\n const { tools, resolvedTools, droppedTools } = await resolveTools(\n handle.tools,\n opts.resolveTool,\n { strict: opts.strict ?? false, agentId: handle.id },\n )\n\n const { resolvedWorkflows, droppedWorkflows } = await resolveWorkflows(\n handle.workflows,\n opts.resolveWorkflow,\n { strict: opts.strict ?? false, agentId: handle.id },\n )\n\n const memory = opts.buildMemory && handle.memory\n ? await opts.buildMemory(handle.memory)\n : undefined\n\n const voice = opts.buildVoice ? await opts.buildVoice(handle) : undefined\n\n const name = opts.name ?? stripOwner(handle.id)\n const id = opts.id ?? handle.id\n\n // Mastra's Agent ctor types are heterogeneous (model union, tools\n // record etc.) and have generic-variance issues that leak through\n // structuredOutput inference; we widen at both ends so the package\n // stays independent of @mastra/core's internal generic shape.\n const agent = new Agent({\n name,\n id,\n instructions,\n model,\n tools,\n memory,\n voice,\n } as unknown as ConstructorParameters<typeof Agent>[0]) as unknown as Agent\n\n return {\n agent,\n resolvedTools,\n droppedTools,\n resolvedWorkflows,\n droppedWorkflows,\n instructions,\n }\n}\n\ninterface ResolveToolsCtx {\n strict: boolean\n agentId: string\n}\n\nasync function resolveTools(\n refs: AnyRef[] | undefined,\n resolve: ToolResolver | undefined,\n ctx: ResolveToolsCtx,\n): Promise<{\n tools: Record<string, MastraToolLike>\n resolvedTools: string[]\n droppedTools: string[]\n}> {\n const tools: Record<string, MastraToolLike> = {}\n const resolvedTools: string[] = []\n const droppedTools: string[] = []\n\n if (!refs || refs.length === 0) return { tools, resolvedTools, droppedTools }\n\n if (!resolve) {\n if (ctx.strict) {\n throw new Error(\n `buildMastraAgent: agent '${ctx.agentId}' declares ${refs.length} tool(s) but no resolveTool was provided`,\n )\n }\n console.warn(\n `[@agentproto/mastra] agent '${ctx.agentId}' declares ${refs.length} tool(s) but no resolveTool was provided — skipping`,\n )\n refs.forEach((r) => droppedTools.push(refKey(r)))\n return { tools, resolvedTools, droppedTools }\n }\n\n for (const ref of refs) {\n const resolved = await resolve(ref)\n if (!resolved) {\n droppedTools.push(refKey(ref))\n if (ctx.strict) {\n throw new Error(\n `buildMastraAgent: agent '${ctx.agentId}' tool '${refKey(ref)}' did not resolve`,\n )\n }\n console.warn(\n `[@agentproto/mastra] agent '${ctx.agentId}' tool '${refKey(ref)}' did not resolve — skipping`,\n )\n continue\n }\n tools[resolved.name] = resolved.tool\n resolvedTools.push(resolved.name)\n }\n\n return { tools, resolvedTools, droppedTools }\n}\n\nasync function resolveWorkflows(\n refs: AnyRef[] | undefined,\n resolve: WorkflowResolver | undefined,\n ctx: ResolveToolsCtx,\n): Promise<{ resolvedWorkflows: string[]; droppedWorkflows: string[] }> {\n const resolvedWorkflows: string[] = []\n const droppedWorkflows: string[] = []\n\n if (!refs || refs.length === 0) {\n return { resolvedWorkflows, droppedWorkflows }\n }\n if (!resolve) {\n refs.forEach((r) => droppedWorkflows.push(refKey(r)))\n return { resolvedWorkflows, droppedWorkflows }\n }\n\n for (const ref of refs) {\n const resolved = await resolve(ref)\n if (!resolved) {\n droppedWorkflows.push(refKey(ref))\n if (ctx.strict) {\n throw new Error(\n `buildMastraAgent: agent '${ctx.agentId}' workflow '${refKey(ref)}' did not resolve`,\n )\n }\n continue\n }\n resolvedWorkflows.push(resolved.name)\n }\n\n return { resolvedWorkflows, droppedWorkflows }\n}\n\nfunction refKey(ref: AnyRef): string {\n if (typeof ref === \"string\") return ref\n return ref.ref ?? ref.file ?? JSON.stringify(ref.inline ?? ref)\n}\n\nfunction stripOwner(id: string): string {\n // `@agentik/writer` → `writer`; bare ids untouched.\n const m = id.match(/^@[^/]+\\/(.+)$/)\n return m ? m[1]! : id\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/instructions.ts","../src/build-agent.ts","../src/playbook-overlay-processor.ts","../src/tools/query-knowledge.ts"],"names":[],"mappings":";;;;;;;;;;AAWA,IAAM,WAAA,GAAc,2CAAA;AAgBb,SAAS,mBAAA,CACd,QACA,IAAA,EACQ;AACR,EAAA,MAAM,QAAkB,EAAC;AACzB,EAAA,KAAA,CAAM,KAAK,IAAA,EAAM,IAAA,MAAU,MAAA,CAAO,WAAA,CAAY,MAAM,CAAA;AAEpD,EAAA,MAAM,aAAA,GAAgB,qBAAqB,MAAM,CAAA;AACjD,EAAA,IAAI,aAAA,EAAe,KAAA,CAAM,IAAA,CAAK,aAAa,CAAA;AAE3C,EAAA,IAAI,MAAA,CAAO,UAAA,IAAc,MAAA,CAAO,UAAA,CAAW,SAAS,CAAA,EAAG;AACrD,IAAA,MAAM,KAAA,GAAQ,MAAA,CAAO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AA,OAAO,IAAA,CAAK,IAAA,CAAK,uBAAA,CAAwB,OAAA,EAAS,GAAG,UAAU,CAAA;AAAA,MACjE;AAAA;AACF,GACF;AACF","file":"index.mjs","sourcesContent":["/**\n * Default instructions composer.\n *\n * AIP-42 says the markdown body of an AGENT.md is the agent's primary\n * system prompt. Boundaries, persona inline content, and trait scores\n * are appended in that order so the body — the human-authored part —\n * stays at the top where the model sees it first.\n */\n\nimport type { AgentHandle } from \"@agentproto/agent\"\n\nconst HEADER_RULE = \"Hard rules — these MUST be followed:\"\n\n/**\n * Compose the AGENT.md body + structural fields into a system prompt.\n *\n * Order:\n * 1. body (markdown after frontmatter), or `description` if absent\n * 2. inline persona block (when `persona` is `{ inline: ... }`)\n * 3. boundaries (rendered as a bulleted \"hard rules\" block)\n * 4. traits (rendered as a one-line guidance hint when present)\n *\n * Refs (`persona: \"@some/persona\"`) are NOT inlined — the host is\n * expected to resolve them externally and inject them via\n * `formatInstructions` if it cares, or pre-resolve and pass the\n * resolved body in via `body:`.\n */\nexport function composeInstructions(\n handle: AgentHandle,\n body: string | undefined,\n): string {\n const parts: string[] = []\n parts.push(body?.trim() ?? handle.description.trim())\n\n const personaInline = extractPersonaInline(handle)\n if (personaInline) parts.push(personaInline)\n\n if (handle.boundaries && handle.boundaries.length > 0) {\n const lines = handle.boundaries.map((b) => `- ${b}`).join(\"\\n\")\n parts.push(`${HEADER_RULE}\\n${lines}`)\n }\n\n if (handle.traits && Object.keys(handle.traits).length > 0) {\n parts.push(traitsLine(handle.traits))\n }\n\n return parts.filter((s) => s.length > 0).join(\"\\n\\n\")\n}\n\nfunction extractPersonaInline(handle: AgentHandle): string | undefined {\n const p = handle.persona\n if (!p || typeof p === \"string\") return undefined\n if (typeof p !== \"object\" || p === null || !(\"inline\" in p)) return undefined\n const inline = (p as { inline?: Record<string, unknown> }).inline\n if (!inline) return undefined\n const lines: string[] = []\n if (typeof inline.name === \"string\") lines.push(`Name: ${inline.name}`)\n if (typeof inline.tone === \"string\") lines.push(`Tone: ${inline.tone}`)\n if (Array.isArray(inline.values)) {\n lines.push(`Values: ${inline.values.join(\", \")}`)\n }\n if (typeof inline.bio === \"string\") lines.push(inline.bio)\n return lines.length > 0 ? `Persona\\n${lines.join(\"\\n\")}` : undefined\n}\n\nfunction traitsLine(traits: Record<string, number>): string {\n const formatted = Object.entries(traits)\n .map(([k, v]) => `${k}=${v}`)\n .join(\", \")\n return `Trait scores (0-10): ${formatted}.`\n}\n","/**\n * `buildMastraAgent(handle, opts)` — turn an AIP-42 AGENT.md handle\n * into a runnable `new Agent({ ... })` from `@mastra/core/agent`.\n *\n * The function is intentionally narrow: it walks the manifest's\n * structural fields and calls user-supplied resolvers for everything\n * that needs runtime knowledge (model, tools, workflows, memory,\n * voice). Anything the resolvers can't translate is either dropped\n * with a warning (default) or throws (`strict: true`).\n */\n\nimport { Agent } from \"@mastra/core/agent\"\nimport type { AgentHandle, AnyRef } from \"@agentproto/agent\"\nimport { composeInstructions } from \"./instructions.js\"\nimport type {\n BuildMastraAgentOptions,\n BuildMastraAgentResult,\n ToolResolver,\n WorkflowResolver,\n MastraToolLike,\n} from \"./types.js\"\n\nexport async function buildMastraAgent(\n handle: AgentHandle,\n opts: BuildMastraAgentOptions,\n): Promise<BuildMastraAgentResult> {\n const formatInstructions = opts.formatInstructions ?? composeInstructions\n const instructions = formatInstructions(handle, opts.body)\n const model = await opts.resolveModel(handle.model)\n\n const { tools, resolvedTools, droppedTools } = await resolveTools(\n handle.tools,\n opts.resolveTool,\n { strict: opts.strict ?? false, agentId: handle.id },\n )\n\n const { resolvedWorkflows, droppedWorkflows } = await resolveWorkflows(\n handle.workflows,\n opts.resolveWorkflow,\n { strict: opts.strict ?? false, agentId: handle.id },\n )\n\n const memory = opts.buildMemory && handle.memory\n ? await opts.buildMemory(handle.memory)\n : undefined\n\n const voice = opts.buildVoice ? await opts.buildVoice(handle) : undefined\n\n const name = opts.name ?? stripOwner(handle.id)\n const id = opts.id ?? handle.id\n\n // Mastra's Agent ctor types are heterogeneous (model union, tools\n // record etc.) and have generic-variance issues that leak through\n // structuredOutput inference; we widen at both ends so the package\n // stays independent of @mastra/core's internal generic shape.\n const agent = new Agent({\n name,\n id,\n instructions,\n model,\n tools,\n memory,\n voice,\n } as unknown as ConstructorParameters<typeof Agent>[0]) as unknown as Agent\n\n return {\n agent,\n resolvedTools,\n droppedTools,\n resolvedWorkflows,\n droppedWorkflows,\n instructions,\n }\n}\n\ninterface ResolveToolsCtx {\n strict: boolean\n agentId: string\n}\n\nasync function resolveTools(\n refs: AnyRef[] | undefined,\n resolve: ToolResolver | undefined,\n ctx: ResolveToolsCtx,\n): Promise<{\n tools: Record<string, MastraToolLike>\n resolvedTools: string[]\n droppedTools: string[]\n}> {\n const tools: Record<string, MastraToolLike> = {}\n const resolvedTools: string[] = []\n const droppedTools: string[] = []\n\n if (!refs || refs.length === 0) return { tools, resolvedTools, droppedTools }\n\n if (!resolve) {\n if (ctx.strict) {\n throw new Error(\n `buildMastraAgent: agent '${ctx.agentId}' declares ${refs.length} tool(s) but no resolveTool was provided`,\n )\n }\n console.warn(\n `[@agentproto/mastra] agent '${ctx.agentId}' declares ${refs.length} tool(s) but no resolveTool was provided — skipping`,\n )\n refs.forEach((r) => droppedTools.push(refKey(r)))\n return { tools, resolvedTools, droppedTools }\n }\n\n for (const ref of refs) {\n const resolved = await resolve(ref)\n if (!resolved) {\n droppedTools.push(refKey(ref))\n if (ctx.strict) {\n throw new Error(\n `buildMastraAgent: agent '${ctx.agentId}' tool '${refKey(ref)}' did not resolve`,\n )\n }\n console.warn(\n `[@agentproto/mastra] agent '${ctx.agentId}' tool '${refKey(ref)}' did not resolve — skipping`,\n )\n continue\n }\n tools[resolved.name] = resolved.tool\n resolvedTools.push(resolved.name)\n }\n\n return { tools, resolvedTools, droppedTools }\n}\n\nasync function resolveWorkflows(\n refs: AnyRef[] | undefined,\n resolve: WorkflowResolver | undefined,\n ctx: ResolveToolsCtx,\n): Promise<{ resolvedWorkflows: string[]; droppedWorkflows: string[] }> {\n const resolvedWorkflows: string[] = []\n const droppedWorkflows: string[] = []\n\n if (!refs || refs.length === 0) {\n return { resolvedWorkflows, droppedWorkflows }\n }\n if (!resolve) {\n refs.forEach((r) => droppedWorkflows.push(refKey(r)))\n return { resolvedWorkflows, droppedWorkflows }\n }\n\n for (const ref of refs) {\n const resolved = await resolve(ref)\n if (!resolved) {\n droppedWorkflows.push(refKey(ref))\n if (ctx.strict) {\n throw new Error(\n `buildMastraAgent: agent '${ctx.agentId}' workflow '${refKey(ref)}' did not resolve`,\n )\n }\n continue\n }\n resolvedWorkflows.push(resolved.name)\n }\n\n return { resolvedWorkflows, droppedWorkflows }\n}\n\nfunction refKey(ref: AnyRef): string {\n if (typeof ref === \"string\") return ref\n return ref.ref ?? ref.file ?? JSON.stringify(ref.inline ?? ref)\n}\n\nfunction stripOwner(id: string): string {\n // `@agentik/writer` → `writer`; bare ids untouched.\n const m = id.match(/^@[^/]+\\/(.+)$/)\n return m ? m[1]! : id\n}\n","/**\n * makePlaybookOverlayProcessor — portable Mastra InputProcessor factory.\n *\n * Parameterized on a `CorpusHost` and request-context extractors so it\n * can run in any Mastra app without assuming Guilde's request context\n * shape. Guilde's `guildePlaybookOverlayProcessor` can become a thin\n * wrapper: call this factory with extractors that read from\n * `asGuildeRequestContext`.\n *\n * Before each agent turn it:\n * 1. Extracts scopeId + dimensions from the request context.\n * 2. Fetches the PlaybookRegistry for the scope via the host.\n * 3. Resolves active (and deterministically-sampled shadow) overlays\n * via OperatorOverlayResolver.\n * 4. Prepends them as a system note. Best-effort: any failure skips\n * injection rather than failing the turn.\n */\n\nimport type { InputProcessor, ProcessInputArgs, ProcessInputResult } from \"@mastra/core/processors\"\nimport type { MastraDBMessage } from \"@mastra/core/agent/message-list\"\nimport { OperatorOverlayResolver, renderOverlays } from \"@agentproto/corpus\"\nimport type { CorpusHost, Dimensions } from \"@agentproto/corpus\"\n\nfunction systemNote(text: string, id: string): MastraDBMessage {\n return {\n id,\n role: \"system\",\n createdAt: new Date(),\n content: { format: 2, parts: [{ type: \"text\", text }], content: text },\n }\n}\n\nexport interface PlaybookOverlayProcessorOptions {\n /** The corpus host that owns per-scope FsPorts and the StackResolver. */\n readonly host: CorpusHost\n /**\n * Extract a stable scope ID (e.g. guild id, workspace id) from the\n * Mastra request context. Return `undefined` to skip injection for\n * this request.\n */\n readonly getScopeId: (requestContext: unknown) => string | undefined\n /**\n * Extract the operator's dimension bag (identity/role/position/capability\n * + any host-registered axes) from the request context. Used for\n * selector matching. Optional — falls back to operatorSlug-only matching.\n */\n readonly getDimensions?: (requestContext: unknown) => Dimensions | undefined\n /**\n * Extract the operator slug for the resolver's `operatorSlug` field.\n * The slug is used as a fallback when `getDimensions` is absent or\n * returns nothing.\n */\n readonly getOperatorSlug?: (requestContext: unknown) => string | undefined\n /**\n * Extract a stable conversation id for deterministic shadow-traffic\n * sampling. Optional — without it shadow playbooks never fire.\n */\n readonly getConversationId?: (requestContext: unknown) => string | undefined\n}\n\n/**\n * Factory that creates a Mastra `InputProcessor` for AIP-12 playbook\n * overlay injection. Wire this into `new Agent({ inputProcessors: [...] })`\n * or add it via Mastra's agent-level processor registry.\n */\nexport function makePlaybookOverlayProcessor(\n opts: PlaybookOverlayProcessorOptions\n): InputProcessor {\n return {\n id: \"playbook-overlay\",\n name: \"PlaybookOverlay\",\n description:\n \"Splices active AIP-12 playbook overlays bound to the running operator into the prompt as a system note\",\n\n async processInput(args: ProcessInputArgs): Promise<ProcessInputResult> {\n const { requestContext } = args\n const scopeId = opts.getScopeId(requestContext)\n if (!scopeId) return args.messages\n\n const dimensions = opts.getDimensions?.(requestContext)\n const operatorSlug = opts.getOperatorSlug?.(requestContext) ?? \"\"\n const conversationId = opts.getConversationId?.(requestContext)\n\n // If we have no slug and no dimensions, nothing to match against.\n if (!operatorSlug && !dimensions) return args.messages\n\n try {\n const registry = await opts.host.getPlaybookRegistry(scopeId)\n const result = new OperatorOverlayResolver(registry).resolve({\n operatorSlug,\n ...(dimensions ? { dimensions } : {}),\n ...(conversationId ? { conversationId } : {}),\n })\n const { appendBlock } = renderOverlays(result)\n if (!appendBlock) return args.messages\n\n const note =\n \"Operating playbooks in effect (active SOPs — follow them; \" +\n \"they override your defaults where they conflict):\\n\\n\" +\n appendBlock\n return [systemNote(note, `playbook-overlay-${Date.now()}`), ...args.messages]\n } catch (error) {\n console.warn(\n \"[playbook-overlay] resolve failed; skipping injection:\",\n error instanceof Error ? error.message : error\n )\n return args.messages\n }\n },\n }\n}\n","/**\n * makeQueryKnowledgeTool — tool factory for on-demand knowledge recall.\n *\n * Returns a `{ name, tool }` pair where `tool` is a Mastra-compatible\n * object (id / description / execute) closed over a `CorpusHost`. Pass\n * the result directly as a resolved tool in `buildMastraAgent`'s\n * `resolveTool` callback, or register it in your tool catalog.\n *\n * The `execute` function is also directly testable without a running\n * Mastra agent — it just calls `host.resolveKnowledgeEntries`.\n */\n\nimport type { CorpusHost, CorpusEntryQuery, ResolvedEntry, Dimensions } from \"@agentproto/corpus\"\n\nexport interface QueryKnowledgeToolOptions {\n readonly host: CorpusHost\n /** Extract the scope id from the Mastra tool execution context. */\n readonly getScopeId: (context: unknown) => string | undefined\n /** Optionally extract dimensions to influence stack resolution. */\n readonly getDimensions?: (context: unknown) => Dimensions | undefined\n}\n\nexport interface QueryKnowledgeInput {\n /** Match entries sharing any of these tags. */\n readonly tags?: string[]\n /** Free-text query (currently passed as a tag hint; semantic search TBD). */\n readonly query?: string\n}\n\nexport interface QueryKnowledgeTool {\n readonly name: string\n readonly tool: {\n readonly id: string\n readonly description: string\n execute(\n input: QueryKnowledgeInput,\n context: unknown\n ): Promise<readonly ResolvedEntry[]>\n }\n}\n\n/**\n * Create a `query_knowledge` tool that resolves entries from the\n * `CorpusHost` for the request's scope. Wire into `buildMastraAgent`\n * via `resolveTool` when a corpus host is available:\n *\n * ```ts\n * const kbTool = makeQueryKnowledgeTool({ host, getScopeId })\n * buildMastraAgent(handle, {\n * resolveTool: (ref) =>\n * ref === \"corpus:query_knowledge\" ? kbTool : undefined,\n * ...\n * })\n * ```\n */\nexport function makeQueryKnowledgeTool(\n opts: QueryKnowledgeToolOptions\n): QueryKnowledgeTool {\n return {\n name: \"query_knowledge\",\n tool: {\n id: \"corpus:query_knowledge\",\n description:\n \"Query the attached knowledge base for entries matching the given tags or text query.\",\n execute: async (input, context) => {\n const scopeId = opts.getScopeId(context)\n if (!scopeId) return []\n const dimensions = opts.getDimensions?.(context)\n const q: CorpusEntryQuery = {\n ...(input.tags && input.tags.length > 0 ? { tags: input.tags } : {}),\n }\n return opts.host.resolveKnowledgeEntries(scopeId, q, dimensions)\n },\n },\n }\n}\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* makePlaybookOverlayProcessor — portable Mastra InputProcessor factory.
|
|
3
|
+
*
|
|
4
|
+
* Parameterized on a `CorpusHost` and request-context extractors so it
|
|
5
|
+
* can run in any Mastra app without assuming Guilde's request context
|
|
6
|
+
* shape. Guilde's `guildePlaybookOverlayProcessor` can become a thin
|
|
7
|
+
* wrapper: call this factory with extractors that read from
|
|
8
|
+
* `asGuildeRequestContext`.
|
|
9
|
+
*
|
|
10
|
+
* Before each agent turn it:
|
|
11
|
+
* 1. Extracts scopeId + dimensions from the request context.
|
|
12
|
+
* 2. Fetches the PlaybookRegistry for the scope via the host.
|
|
13
|
+
* 3. Resolves active (and deterministically-sampled shadow) overlays
|
|
14
|
+
* via OperatorOverlayResolver.
|
|
15
|
+
* 4. Prepends them as a system note. Best-effort: any failure skips
|
|
16
|
+
* injection rather than failing the turn.
|
|
17
|
+
*/
|
|
18
|
+
import type { InputProcessor } from "@mastra/core/processors";
|
|
19
|
+
import type { CorpusHost, Dimensions } from "@agentproto/corpus";
|
|
20
|
+
export interface PlaybookOverlayProcessorOptions {
|
|
21
|
+
/** The corpus host that owns per-scope FsPorts and the StackResolver. */
|
|
22
|
+
readonly host: CorpusHost;
|
|
23
|
+
/**
|
|
24
|
+
* Extract a stable scope ID (e.g. guild id, workspace id) from the
|
|
25
|
+
* Mastra request context. Return `undefined` to skip injection for
|
|
26
|
+
* this request.
|
|
27
|
+
*/
|
|
28
|
+
readonly getScopeId: (requestContext: unknown) => string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Extract the operator's dimension bag (identity/role/position/capability
|
|
31
|
+
* + any host-registered axes) from the request context. Used for
|
|
32
|
+
* selector matching. Optional — falls back to operatorSlug-only matching.
|
|
33
|
+
*/
|
|
34
|
+
readonly getDimensions?: (requestContext: unknown) => Dimensions | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Extract the operator slug for the resolver's `operatorSlug` field.
|
|
37
|
+
* The slug is used as a fallback when `getDimensions` is absent or
|
|
38
|
+
* returns nothing.
|
|
39
|
+
*/
|
|
40
|
+
readonly getOperatorSlug?: (requestContext: unknown) => string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Extract a stable conversation id for deterministic shadow-traffic
|
|
43
|
+
* sampling. Optional — without it shadow playbooks never fire.
|
|
44
|
+
*/
|
|
45
|
+
readonly getConversationId?: (requestContext: unknown) => string | undefined;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Factory that creates a Mastra `InputProcessor` for AIP-12 playbook
|
|
49
|
+
* overlay injection. Wire this into `new Agent({ inputProcessors: [...] })`
|
|
50
|
+
* or add it via Mastra's agent-level processor registry.
|
|
51
|
+
*/
|
|
52
|
+
export declare function makePlaybookOverlayProcessor(opts: PlaybookOverlayProcessorOptions): InputProcessor;
|
|
53
|
+
//# sourceMappingURL=playbook-overlay-processor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playbook-overlay-processor.d.ts","sourceRoot":"","sources":["../src/playbook-overlay-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAwC,MAAM,yBAAyB,CAAA;AAGnG,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAWhE,MAAM,WAAW,+BAA+B;IAC9C,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,CAAC,cAAc,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAA;IACpE;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,KAAK,UAAU,GAAG,SAAS,CAAA;IAC5E;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAA;IAC1E;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAA;CAC7E;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,+BAA+B,GACpC,cAAc,CA2ChB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* makeQueryKnowledgeTool — tool factory for on-demand knowledge recall.
|
|
3
|
+
*
|
|
4
|
+
* Returns a `{ name, tool }` pair where `tool` is a Mastra-compatible
|
|
5
|
+
* object (id / description / execute) closed over a `CorpusHost`. Pass
|
|
6
|
+
* the result directly as a resolved tool in `buildMastraAgent`'s
|
|
7
|
+
* `resolveTool` callback, or register it in your tool catalog.
|
|
8
|
+
*
|
|
9
|
+
* The `execute` function is also directly testable without a running
|
|
10
|
+
* Mastra agent — it just calls `host.resolveKnowledgeEntries`.
|
|
11
|
+
*/
|
|
12
|
+
import type { CorpusHost, ResolvedEntry, Dimensions } from "@agentproto/corpus";
|
|
13
|
+
export interface QueryKnowledgeToolOptions {
|
|
14
|
+
readonly host: CorpusHost;
|
|
15
|
+
/** Extract the scope id from the Mastra tool execution context. */
|
|
16
|
+
readonly getScopeId: (context: unknown) => string | undefined;
|
|
17
|
+
/** Optionally extract dimensions to influence stack resolution. */
|
|
18
|
+
readonly getDimensions?: (context: unknown) => Dimensions | undefined;
|
|
19
|
+
}
|
|
20
|
+
export interface QueryKnowledgeInput {
|
|
21
|
+
/** Match entries sharing any of these tags. */
|
|
22
|
+
readonly tags?: string[];
|
|
23
|
+
/** Free-text query (currently passed as a tag hint; semantic search TBD). */
|
|
24
|
+
readonly query?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface QueryKnowledgeTool {
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly tool: {
|
|
29
|
+
readonly id: string;
|
|
30
|
+
readonly description: string;
|
|
31
|
+
execute(input: QueryKnowledgeInput, context: unknown): Promise<readonly ResolvedEntry[]>;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create a `query_knowledge` tool that resolves entries from the
|
|
36
|
+
* `CorpusHost` for the request's scope. Wire into `buildMastraAgent`
|
|
37
|
+
* via `resolveTool` when a corpus host is available:
|
|
38
|
+
*
|
|
39
|
+
* ```ts
|
|
40
|
+
* const kbTool = makeQueryKnowledgeTool({ host, getScopeId })
|
|
41
|
+
* buildMastraAgent(handle, {
|
|
42
|
+
* resolveTool: (ref) =>
|
|
43
|
+
* ref === "corpus:query_knowledge" ? kbTool : undefined,
|
|
44
|
+
* ...
|
|
45
|
+
* })
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function makeQueryKnowledgeTool(opts: QueryKnowledgeToolOptions): QueryKnowledgeTool;
|
|
49
|
+
//# sourceMappingURL=query-knowledge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-knowledge.d.ts","sourceRoot":"","sources":["../../src/tools/query-knowledge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAoB,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAEjG,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,mEAAmE;IACnE,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAA;IAC7D,mEAAmE;IACnE,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,UAAU,GAAG,SAAS,CAAA;CACtE;AAED,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;QACnB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;QAC5B,OAAO,CACL,KAAK,EAAE,mBAAmB,EAC1B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,SAAS,aAAa,EAAE,CAAC,CAAA;KACrC,CAAA;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,yBAAyB,GAC9B,kBAAkB,CAkBpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentproto/mastra",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "@agentproto/mastra — turn an AIP-42 AGENT.md handle into a runnable Mastra Agent. The package is a thin adapter: you supply resolvers (model, tool, workflow, memory) and it composes the manifest's identity, persona, body, boundaries, and tool refs into a constructed `new Agent({...})` from `@mastra/core/agent`. Reference implementation for the agent/v1 → Mastra runtime path.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentproto",
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@agentproto/agent": "0.2.0"
|
|
45
|
+
"@agentproto/agent": "0.2.0",
|
|
46
|
+
"@agentproto/corpus": "0.2.1"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
48
49
|
"@mastra/core": ">=1.0.0"
|