@aviaratech/ai-delivery 0.3.47 → 0.3.49
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 +1 -1
- package/dist/agentReadiness.test.js +12 -0
- package/dist/agentReadiness.test.js.map +2 -2
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +2 -2
- package/dist/dispatch.js +6 -2
- package/dist/dispatch.js.map +2 -2
- package/dist/issue.js +1 -4
- package/dist/issue.js.map +2 -2
- package/dist/issueBatchUpdate.test.js +9 -1
- package/dist/issueBatchUpdate.test.js.map +2 -2
- package/dist/issueContract.js +7 -0
- package/dist/issueContract.js.map +2 -2
- package/dist/issueContract.test.js +33 -0
- package/dist/issueContract.test.js.map +2 -2
- package/dist/mcp/index.js +16 -19
- package/dist/mcp/index.js.map +2 -2
- package/dist/pr.d.ts +2 -0
- package/dist/pr.js +6 -1
- package/dist/pr.js.map +2 -2
- package/dist/pr.test.js +44 -0
- package/dist/pr.test.js.map +2 -2
- package/dist/services/agentReadinessService.js +6 -2
- package/dist/services/agentReadinessService.js.map +2 -2
- package/dist/staleServer.test.d.ts +1 -0
- package/dist/staleServer.test.js +148 -0
- package/dist/staleServer.test.js.map +7 -0
- package/dist/version.d.ts +4 -0
- package/dist/version.js +20 -1
- package/dist/version.js.map +2 -2
- package/package.json +1 -1
- package/plugins/ai-delivery/.claude-plugin/plugin.json +2 -2
- package/plugins/ai-delivery/plugin.json +1 -1
- package/plugins/ai-delivery/runtime/dist/cli.js +96 -96
- package/plugins/ai-delivery/runtime/package.json +1 -1
- package/plugins/ai-delivery/skills/intake-create/SKILL.md +1 -1
package/dist/mcp/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { executeTool } from "../dispatch.js";
|
|
5
5
|
import { setLogsSuppressed } from "../logger.js";
|
|
6
|
-
import { PACKAGE_VERSION } from "../version.js";
|
|
6
|
+
import { PACKAGE_VERSION, staleServerNotice } from "../version.js";
|
|
7
7
|
import { acceptedKeysError } from "../issueContract.js";
|
|
8
8
|
import {
|
|
9
9
|
JOURNAL_SCHEMA_METADATA,
|
|
@@ -17,6 +17,13 @@ import { AI_DELIVERY_MCP_TOOLS } from "./tools.js";
|
|
|
17
17
|
import { AI_DELIVERY_MCP_CONTRACT_VERSION, AI_DELIVERY_MCP_TOOLS as AI_DELIVERY_MCP_TOOLS2 } from "./tools.js";
|
|
18
18
|
const SERVER_INSTRUCTIONS = "Use issue_info with an explicit repo; follow repository policy for checks and authorization, and respect requested providers and read-only intent.";
|
|
19
19
|
function createAiDeliveryMcpServer(context, activeCalls) {
|
|
20
|
+
const withNotice = (text) => {
|
|
21
|
+
const notice = staleServerNotice(context.runtimeEntryPath);
|
|
22
|
+
return [
|
|
23
|
+
{ type: "text", text },
|
|
24
|
+
...notice === void 0 ? [] : [{ type: "text", text: notice }]
|
|
25
|
+
];
|
|
26
|
+
};
|
|
20
27
|
const server = new McpServer(
|
|
21
28
|
{ name: "ai-delivery", version: PACKAGE_VERSION },
|
|
22
29
|
{ instructions: SERVER_INSTRUCTIONS }
|
|
@@ -40,12 +47,9 @@ function createAiDeliveryMcpServer(context, activeCalls) {
|
|
|
40
47
|
const missing = journal && args.body === void 0 ? missingJournalFields(args) : [];
|
|
41
48
|
const stated = journal ? parsed.error.issues.map((issue) => issue.message).filter((m) => [NEXT_DATE_REFUSAL, PLAIN_COMMENT_REFUSAL].includes(m)) : [];
|
|
42
49
|
return {
|
|
43
|
-
content:
|
|
44
|
-
{
|
|
45
|
-
|
|
46
|
-
text: `Invalid arguments for ${tool.name}.${missing.length ? ` Missing required fields: ${missing.join(", ")}. Provide every missing field.` : stated.length ? ` ${stated.join(" ")}` : journal ? ` ${tool.description}` : ""}`
|
|
47
|
-
}
|
|
48
|
-
],
|
|
50
|
+
content: withNotice(
|
|
51
|
+
`Invalid arguments for ${tool.name}.${missing.length ? ` Missing required fields: ${missing.join(", ")}. Provide every missing field.` : stated.length ? ` ${stated.join(" ")}` : journal ? ` ${tool.description}` : ""}`
|
|
52
|
+
),
|
|
49
53
|
isError: true
|
|
50
54
|
};
|
|
51
55
|
}
|
|
@@ -65,26 +69,19 @@ function createAiDeliveryMcpServer(context, activeCalls) {
|
|
|
65
69
|
activeCalls?.delete(pending);
|
|
66
70
|
}
|
|
67
71
|
return {
|
|
68
|
-
content:
|
|
69
|
-
{ type: "text", text: JSON.stringify(projectToolOutput(tool.name, value, verbose === true)) }
|
|
70
|
-
]
|
|
72
|
+
content: withNotice(JSON.stringify(projectToolOutput(tool.name, value, verbose === true)))
|
|
71
73
|
};
|
|
72
74
|
} catch (error) {
|
|
73
75
|
const incomplete = getIncompleteIssueUpdate(error);
|
|
74
76
|
if (incomplete !== void 0)
|
|
75
77
|
return {
|
|
76
|
-
content:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
text: JSON.stringify(
|
|
80
|
-
projectToolOutput(tool.name, incomplete, "verbose" in args && args.verbose === true)
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
],
|
|
78
|
+
content: withNotice(
|
|
79
|
+
JSON.stringify(projectToolOutput(tool.name, incomplete, "verbose" in args && args.verbose === true))
|
|
80
|
+
),
|
|
84
81
|
isError: true
|
|
85
82
|
};
|
|
86
83
|
const message = error instanceof Error ? error.message : String(error);
|
|
87
|
-
return { content:
|
|
84
|
+
return { content: withNotice(message), isError: true };
|
|
88
85
|
}
|
|
89
86
|
}
|
|
90
87
|
);
|
package/dist/mcp/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/mcp/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { z } from 'zod';\n\nimport { executeTool, type ExecutionContext } from '../dispatch.js';\nimport { setLogsSuppressed } from '../logger.js';\nimport { PACKAGE_VERSION } from '../version.js';\nimport { acceptedKeysError } from '../issueContract.js';\nimport {\n JOURNAL_SCHEMA_METADATA,\n NEXT_DATE_REFUSAL,\n PLAIN_COMMENT_REFUSAL,\n missingJournalFields,\n} from '../issueJournal.js';\nimport { getIncompleteIssueUpdate } from '../issue.js';\nimport { projectToolOutput } from '../toolOutput.js';\nimport { AI_DELIVERY_MCP_TOOLS, type AiDeliveryMcpToolName } from './tools.js';\n\nexport { AI_DELIVERY_MCP_CONTRACT_VERSION, AI_DELIVERY_MCP_TOOLS } from './tools.js';\n\nconst SERVER_INSTRUCTIONS =\n 'Use issue_info with an explicit repo; follow repository policy for checks and authorization, and respect requested providers and read-only intent.';\n\nexport function createAiDeliveryMcpServer(context: ExecutionContext, activeCalls?: Set<Promise<unknown>>): McpServer {\n const server = new McpServer(\n { name: 'ai-delivery', version: PACKAGE_VERSION },\n { instructions: SERVER_INSTRUCTIONS },\n );\n const tools: readonly {\n name: string;\n description: string;\n inputSchema: z.ZodObject<z.ZodRawShape>;\n readOnly?: true;\n }[] = AI_DELIVERY_MCP_TOOLS;\n for (const tool of tools) {\n server.registerTool(\n tool.name,\n {\n description: tool.description,\n ...(tool.readOnly ? { annotations: { readOnlyHint: true } } : {}),\n // The SDK must leave journal kind refinements to the handler so missing\n // conditional fields receive a safe, actionable contract refusal. Unknown\n // property names stay private through a schema-local error message.\n inputSchema:\n tool.name === 'issue_comment'\n ? z\n .strictObject(tool.inputSchema.shape, { error: acceptedKeysError })\n .partial()\n .meta(JOURNAL_SCHEMA_METADATA)\n : tool.inputSchema,\n },\n async (args, extra) => {\n const parsed = tool.inputSchema.safeParse(args);\n if (!parsed.success) {\n const journal = tool.name === 'issue_comment';\n const missing = journal && args.body === undefined ? missingJournalFields(args) : [];\n // A missing-field list comes first; these refusals already say what to send, so they replace the generic text.\n const stated = journal\n ? parsed.error.issues\n .map((issue) => issue.message)\n .filter((m) => [NEXT_DATE_REFUSAL, PLAIN_COMMENT_REFUSAL].includes(m))\n : [];\n return {\n content:
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,SAAS;AAElB,SAAS,mBAA0C;AACnD,SAAS,yBAAyB;AAClC,SAAS,
|
|
4
|
+
"sourcesContent": ["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { z } from 'zod';\n\nimport { executeTool, type ExecutionContext } from '../dispatch.js';\nimport { setLogsSuppressed } from '../logger.js';\nimport { PACKAGE_VERSION, staleServerNotice } from '../version.js';\nimport { acceptedKeysError } from '../issueContract.js';\nimport {\n JOURNAL_SCHEMA_METADATA,\n NEXT_DATE_REFUSAL,\n PLAIN_COMMENT_REFUSAL,\n missingJournalFields,\n} from '../issueJournal.js';\nimport { getIncompleteIssueUpdate } from '../issue.js';\nimport { projectToolOutput } from '../toolOutput.js';\nimport { AI_DELIVERY_MCP_TOOLS, type AiDeliveryMcpToolName } from './tools.js';\n\nexport { AI_DELIVERY_MCP_CONTRACT_VERSION, AI_DELIVERY_MCP_TOOLS } from './tools.js';\n\nconst SERVER_INSTRUCTIONS =\n 'Use issue_info with an explicit repo; follow repository policy for checks and authorization, and respect requested providers and read-only intent.';\n\nexport function createAiDeliveryMcpServer(context: ExecutionContext, activeCalls?: Set<Promise<unknown>>): McpServer {\n const withNotice = (text: string) => {\n const notice = staleServerNotice(context.runtimeEntryPath);\n return [\n { type: 'text' as const, text },\n ...(notice === undefined ? [] : [{ type: 'text' as const, text: notice }]),\n ];\n };\n const server = new McpServer(\n { name: 'ai-delivery', version: PACKAGE_VERSION },\n { instructions: SERVER_INSTRUCTIONS },\n );\n const tools: readonly {\n name: string;\n description: string;\n inputSchema: z.ZodObject<z.ZodRawShape>;\n readOnly?: true;\n }[] = AI_DELIVERY_MCP_TOOLS;\n for (const tool of tools) {\n server.registerTool(\n tool.name,\n {\n description: tool.description,\n ...(tool.readOnly ? { annotations: { readOnlyHint: true } } : {}),\n // The SDK must leave journal kind refinements to the handler so missing\n // conditional fields receive a safe, actionable contract refusal. Unknown\n // property names stay private through a schema-local error message.\n inputSchema:\n tool.name === 'issue_comment'\n ? z\n .strictObject(tool.inputSchema.shape, { error: acceptedKeysError })\n .partial()\n .meta(JOURNAL_SCHEMA_METADATA)\n : tool.inputSchema,\n },\n async (args, extra) => {\n const parsed = tool.inputSchema.safeParse(args);\n if (!parsed.success) {\n const journal = tool.name === 'issue_comment';\n const missing = journal && args.body === undefined ? missingJournalFields(args) : [];\n // A missing-field list comes first; these refusals already say what to send, so they replace the generic text.\n const stated = journal\n ? parsed.error.issues\n .map((issue) => issue.message)\n .filter((m) => [NEXT_DATE_REFUSAL, PLAIN_COMMENT_REFUSAL].includes(m))\n : [];\n return {\n content: withNotice(\n `Invalid arguments for ${tool.name}.${missing.length ? ` Missing required fields: ${missing.join(', ')}. Provide every missing field.` : stated.length ? ` ${stated.join(' ')}` : journal ? ` ${tool.description}` : ''}`,\n ),\n isError: true,\n };\n }\n try {\n const signal = context.signal === undefined ? extra.signal : AbortSignal.any([context.signal, extra.signal]);\n const { verbose, ...input } = parsed.data;\n const pending = executeTool(tool.name as AiDeliveryMcpToolName, input, {\n ...context,\n signal,\n ...(verbose === true ? { verbose } : {}),\n });\n activeCalls?.add(pending);\n let value: unknown;\n try {\n value = await pending;\n } finally {\n activeCalls?.delete(pending);\n }\n return {\n content: withNotice(JSON.stringify(projectToolOutput(tool.name, value, verbose === true))),\n };\n } catch (error) {\n const incomplete = getIncompleteIssueUpdate(error);\n if (incomplete !== undefined)\n return {\n content: withNotice(\n JSON.stringify(projectToolOutput(tool.name, incomplete, 'verbose' in args && args.verbose === true)),\n ),\n isError: true,\n };\n const message = error instanceof Error ? error.message : String(error);\n return { content: withNotice(message), isError: true };\n }\n },\n );\n }\n return server;\n}\n\nexport async function serveAiDeliveryMcp(context: ExecutionContext): Promise<void> {\n setLogsSuppressed(true);\n const shutdown = new AbortController();\n const activeCalls = new Set<Promise<unknown>>();\n const server = createAiDeliveryMcpServer({ ...context, signal: shutdown.signal }, activeCalls);\n let closing: Promise<void> | undefined;\n const close = (): Promise<void> => {\n closing ??= (async () => {\n shutdown.abort();\n await Promise.allSettled(activeCalls);\n await server.close();\n process.exit(0);\n })();\n return closing;\n };\n process.once('SIGINT', () => {\n void close();\n });\n process.once('SIGTERM', () => {\n void close();\n });\n await server.connect(new StdioServerTransport());\n process.stderr.write('ai-delivery MCP server started\\n');\n await new Promise<void>(() => {});\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,SAAS;AAElB,SAAS,mBAA0C;AACnD,SAAS,yBAAyB;AAClC,SAAS,iBAAiB,yBAAyB;AACnD,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;AACzC,SAAS,yBAAyB;AAClC,SAAS,6BAAyD;AAElE,SAAS,kCAAkC,yBAAAA,8BAA6B;AAExE,MAAM,sBACJ;AAEK,SAAS,0BAA0B,SAA2B,aAAgD;AACnH,QAAM,aAAa,CAAC,SAAiB;AACnC,UAAM,SAAS,kBAAkB,QAAQ,gBAAgB;AACzD,WAAO;AAAA,MACL,EAAE,MAAM,QAAiB,KAAK;AAAA,MAC9B,GAAI,WAAW,SAAY,CAAC,IAAI,CAAC,EAAE,MAAM,QAAiB,MAAM,OAAO,CAAC;AAAA,IAC1E;AAAA,EACF;AACA,QAAM,SAAS,IAAI;AAAA,IACjB,EAAE,MAAM,eAAe,SAAS,gBAAgB;AAAA,IAChD,EAAE,cAAc,oBAAoB;AAAA,EACtC;AACA,QAAM,QAKA;AACN,aAAW,QAAQ,OAAO;AACxB,WAAO;AAAA,MACL,KAAK;AAAA,MACL;AAAA,QACE,aAAa,KAAK;AAAA,QAClB,GAAI,KAAK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VERY_MCP_TOOLS"]
|
|
7
7
|
}
|
package/dist/pr.d.ts
CHANGED
|
@@ -84,6 +84,8 @@ export declare function publishPr(context: DeliveryContext, input: {
|
|
|
84
84
|
headBranch?: string;
|
|
85
85
|
baseBranch?: string;
|
|
86
86
|
dryRun?: boolean;
|
|
87
|
+
/** Set when the running MCP server is older than the installed plugin; refuses a ready PR on a moneyPath issue. */
|
|
88
|
+
staleNotice?: string;
|
|
87
89
|
}): Promise<{
|
|
88
90
|
dryRun: boolean;
|
|
89
91
|
body?: string;
|
package/dist/pr.js
CHANGED
|
@@ -847,8 +847,13 @@ async function publishPr(context, input) {
|
|
|
847
847
|
if ("pull_request" in issue || issue.number !== input.issueNumber || issue.state !== "open")
|
|
848
848
|
throw new DeliveryError("PR creation requires the requested open GitHub issue.");
|
|
849
849
|
if (input.draft === false) {
|
|
850
|
-
const
|
|
850
|
+
const fields = parseIssueBody(issue.body ?? "", { title: issue.title }).issue;
|
|
851
|
+
const owed = ownerOkOwed(fields);
|
|
851
852
|
if (owed) throw new IssueValidationError([owed]);
|
|
853
|
+
if (fields.moneyPath === true && input.staleNotice !== void 0)
|
|
854
|
+
throw new IssueValidationError([
|
|
855
|
+
{ code: "stale-server", field: "server", message: input.staleNotice, fixHint: input.staleNotice }
|
|
856
|
+
]);
|
|
852
857
|
}
|
|
853
858
|
const repository = (await context.clients.rest.repos.get({ ...context.repo })).data;
|
|
854
859
|
if (repository.full_name?.toLowerCase() !== context.config.repository.toLowerCase() || context.config.repository.toLowerCase() !== `${context.repo.owner}/${context.repo.repo}`.toLowerCase())
|