@chronary/toolkit 1.3.0 → 1.4.0
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/CHANGELOG.md +7 -2
- package/README.md +2 -2
- package/dist/ai-sdk.cjs +44 -2
- package/dist/ai-sdk.cjs.map +1 -1
- package/dist/ai-sdk.d.cts +1 -1
- package/dist/ai-sdk.d.ts +1 -1
- package/dist/ai-sdk.js +44 -2
- package/dist/ai-sdk.js.map +1 -1
- package/dist/{base-C6QWbxc1.d.cts → base-BM5HxeCZ.d.cts} +2 -2
- package/dist/{base-C6QWbxc1.d.ts → base-BM5HxeCZ.d.ts} +2 -2
- package/dist/index.cjs +50 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -3
- package/dist/index.d.ts +24 -3
- package/dist/index.js +50 -2
- package/dist/index.js.map +1 -1
- package/dist/langchain.cjs +44 -2
- package/dist/langchain.cjs.map +1 -1
- package/dist/langchain.d.cts +1 -1
- package/dist/langchain.d.ts +1 -1
- package/dist/langchain.js +44 -2
- package/dist/langchain.js.map +1 -1
- package/dist/mastra.cjs +44 -2
- package/dist/mastra.cjs.map +1 -1
- package/dist/mastra.d.cts +1 -1
- package/dist/mastra.d.ts +1 -1
- package/dist/mastra.js +44 -2
- package/dist/mastra.js.map +1 -1
- package/dist/mcp.cjs +181 -2
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.cts +44 -2
- package/dist/mcp.d.ts +44 -2
- package/dist/mcp.js +181 -2
- package/dist/mcp.js.map +1 -1
- package/dist/openai.cjs +44 -2
- package/dist/openai.cjs.map +1 -1
- package/dist/openai.d.cts +1 -1
- package/dist/openai.d.ts +1 -1
- package/dist/openai.js +44 -2
- package/dist/openai.js.map +1 -1
- package/package.json +2 -2
package/dist/mcp.cjs
CHANGED
|
@@ -175,6 +175,15 @@ var FindMeetingTimeSchema = import_zod.z.object({
|
|
|
175
175
|
calendars: import_zod.z.array(import_zod.z.string()).optional().describe("Additional shared calendar IDs to treat as busy"),
|
|
176
176
|
include_busy: import_zod.z.boolean().default(false).describe("Include per-agent busy blocks in response")
|
|
177
177
|
});
|
|
178
|
+
var CreateConnectionLinkSchema = import_zod.z.object({
|
|
179
|
+
calendar_id: import_zod.z.string().startsWith("cal_").describe("Chronary calendar whose owning agent will receive authorized availability"),
|
|
180
|
+
capabilities: import_zod.z.array(import_zod.z.enum(["availability", "publishing"])).min(1).max(2).default(["availability"]).describe("Request opaque availability and optional publishing permission"),
|
|
181
|
+
publication_policy: import_zod.z.enum(["none", "confirmed", "confirmed_tentative"]).default("none").describe("Desired event publishing policy; a human still selects the destination")
|
|
182
|
+
});
|
|
183
|
+
var GetConnectionLinkSchema = import_zod.z.object({
|
|
184
|
+
connection_link_id: import_zod.z.string().startsWith("csl_").describe("Connection setup link ID")
|
|
185
|
+
});
|
|
186
|
+
var CancelConnectionLinkSchema = GetConnectionLinkSchema;
|
|
178
187
|
var GetCalendarContextSchema = import_zod.z.object({
|
|
179
188
|
calendar_id: import_zod.z.string().describe("Calendar ID")
|
|
180
189
|
});
|
|
@@ -471,6 +480,15 @@ var findMeetingTime = safeFunc(async (ctx) => {
|
|
|
471
480
|
include_busy: params.include_busy
|
|
472
481
|
});
|
|
473
482
|
});
|
|
483
|
+
var createConnectionLink = safeFunc(async (ctx) => {
|
|
484
|
+
const { calendar_id, ...params } = ctx.params;
|
|
485
|
+
return ctx.client.connectionLinks.create(calendar_id, params);
|
|
486
|
+
});
|
|
487
|
+
var getConnectionLink = safeFunc(async (ctx) => ctx.client.connectionLinks.get(ctx.params.connection_link_id));
|
|
488
|
+
var cancelConnectionLink = safeFunc(async (ctx) => {
|
|
489
|
+
await ctx.client.connectionLinks.cancel(ctx.params.connection_link_id);
|
|
490
|
+
return { cancelled: true, id: ctx.params.connection_link_id };
|
|
491
|
+
});
|
|
474
492
|
var getCalendarContext = safeFunc(async (ctx) => {
|
|
475
493
|
return ctx.client.calendars.getContext(ctx.params.calendar_id);
|
|
476
494
|
});
|
|
@@ -600,6 +618,9 @@ var HOSTED_API_MCP_TOOL_NAMES = [
|
|
|
600
618
|
"update_event",
|
|
601
619
|
"get_availability",
|
|
602
620
|
"find_meeting_time",
|
|
621
|
+
"create_connection_link",
|
|
622
|
+
"get_connection_link",
|
|
623
|
+
"cancel_connection_link",
|
|
603
624
|
"cancel_event",
|
|
604
625
|
"confirm_event",
|
|
605
626
|
"release_event",
|
|
@@ -765,18 +786,39 @@ var TOOL_DEFINITIONS = [
|
|
|
765
786
|
// ── Availability ───────────────────────────────────────────────
|
|
766
787
|
{
|
|
767
788
|
name: "get_availability",
|
|
768
|
-
description: "Check when a single agent is free
|
|
789
|
+
description: "Check when a single agent is free across Chronary and authorized human calendars. This tool is fail-closed: always inspect availability_state and warnings before using slots.",
|
|
769
790
|
schema: GetAvailabilitySchema,
|
|
770
791
|
annotations: { title: "Get Availability", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
771
792
|
execute: createExecutor(getAvailability)
|
|
772
793
|
},
|
|
773
794
|
{
|
|
774
795
|
name: "find_meeting_time",
|
|
775
|
-
description: "Find time
|
|
796
|
+
description: "Find time when multiple agents are free across Chronary and their authorized human calendars. This tool is fail-closed: always inspect availability_state and warnings before using slots.",
|
|
776
797
|
schema: FindMeetingTimeSchema,
|
|
777
798
|
annotations: { title: "Find Meeting Time", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
778
799
|
execute: createExecutor(findMeetingTime)
|
|
779
800
|
},
|
|
801
|
+
{
|
|
802
|
+
name: "create_connection_link",
|
|
803
|
+
description: "Request human setup of Google Calendar or Microsoft Outlook for a Chronary calendar. Give setup_url to a human; agents never receive provider credentials or event data. The secret URL is returned only once.",
|
|
804
|
+
schema: CreateConnectionLinkSchema,
|
|
805
|
+
annotations: { title: "Create Human Calendar Setup Link", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
806
|
+
execute: createExecutor(createConnectionLink)
|
|
807
|
+
},
|
|
808
|
+
{
|
|
809
|
+
name: "get_connection_link",
|
|
810
|
+
description: "Poll provider-neutral human-calendar setup status. The bearer setup URL and provider data are never returned by polling.",
|
|
811
|
+
schema: GetConnectionLinkSchema,
|
|
812
|
+
annotations: { title: "Get Human Calendar Setup Status", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
813
|
+
execute: createExecutor(getConnectionLink)
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
name: "cancel_connection_link",
|
|
817
|
+
description: "Cancel a pending human-calendar setup request and invalidate its setup URL.",
|
|
818
|
+
schema: CancelConnectionLinkSchema,
|
|
819
|
+
annotations: { title: "Cancel Human Calendar Setup Link", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
820
|
+
execute: createExecutor(cancelConnectionLink)
|
|
821
|
+
},
|
|
780
822
|
// ── Calendar context ───────────────────────────────────────────
|
|
781
823
|
{
|
|
782
824
|
name: "get_calendar_context",
|
|
@@ -1012,6 +1054,23 @@ var ListToolkit = class extends BaseToolkit {
|
|
|
1012
1054
|
};
|
|
1013
1055
|
|
|
1014
1056
|
// src/adapters/mcp.ts
|
|
1057
|
+
var ABOUT_MARKDOWN = `# Chronary
|
|
1058
|
+
|
|
1059
|
+
Calendar-as-a-service for AI agents. Give an agent its own calendars and
|
|
1060
|
+
events, coordinate availability across agents, run multi-party scheduling
|
|
1061
|
+
proposals, place auto-expiring holds, manage availability rules, sync external
|
|
1062
|
+
iCal feeds, and receive webhooks.
|
|
1063
|
+
|
|
1064
|
+
## Getting started
|
|
1065
|
+
1. \`create_agent\` \u2014 register an agent (skip if you already have one).
|
|
1066
|
+
2. \`create_calendar\` \u2014 give the agent a calendar.
|
|
1067
|
+
3. \`create_event\` / \`get_availability\` / \`find_meeting_time\` \u2014 schedule and coordinate.
|
|
1068
|
+
|
|
1069
|
+
## Keys & plans
|
|
1070
|
+
Org keys (\`chr_sk_\`) can use every tool; agent-scoped keys (\`chr_ak_\`) are
|
|
1071
|
+
limited to their own agent and cannot use org-only tools such as
|
|
1072
|
+
\`create_agent\` or \`find_meeting_time\`. Temporal holds, cross-agent
|
|
1073
|
+
availability, and scheduling proposals require a Pro plan.`;
|
|
1015
1074
|
var ChronaryToolkit = class extends ListToolkit {
|
|
1016
1075
|
constructor(config) {
|
|
1017
1076
|
super(config);
|
|
@@ -1048,6 +1107,126 @@ var ChronaryToolkit = class extends ListToolkit {
|
|
|
1048
1107
|
);
|
|
1049
1108
|
}
|
|
1050
1109
|
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Register the reusable prompt templates (MCP `prompts` capability) on an
|
|
1112
|
+
* McpServer. Mirrors the hosted server's four prompts so stdio and hosted
|
|
1113
|
+
* expose the same `prompts/list`. No-op if the server can't register prompts.
|
|
1114
|
+
*/
|
|
1115
|
+
registerPrompts(server) {
|
|
1116
|
+
if (!server.registerPrompt) return;
|
|
1117
|
+
server.registerPrompt(
|
|
1118
|
+
"schedule_event",
|
|
1119
|
+
{
|
|
1120
|
+
title: "Schedule an event",
|
|
1121
|
+
description: "Create a calendar event on an agent's calendar at a specific time.",
|
|
1122
|
+
argsSchema: {
|
|
1123
|
+
calendar_id: import_zod2.z.string().describe("Target calendar ID (cal_...). Run list_calendars first if unknown."),
|
|
1124
|
+
title: import_zod2.z.string().describe("Event title"),
|
|
1125
|
+
start_time: import_zod2.z.string().describe("Start time, ISO 8601 (e.g. 2026-07-10T15:00:00Z)"),
|
|
1126
|
+
end_time: import_zod2.z.string().describe("End time, ISO 8601")
|
|
1127
|
+
}
|
|
1128
|
+
},
|
|
1129
|
+
({ calendar_id, title, start_time, end_time }) => ({
|
|
1130
|
+
messages: [
|
|
1131
|
+
{
|
|
1132
|
+
role: "user",
|
|
1133
|
+
content: {
|
|
1134
|
+
type: "text",
|
|
1135
|
+
text: `Create an event on calendar ${calendar_id} titled "${title}" from ${start_time} to ${end_time}. Call the create_event tool with those arguments (calendar_id, title, start_time, end_time). If the calendar ID is unknown, call list_calendars first. Report the created event ID when done.`
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
]
|
|
1139
|
+
})
|
|
1140
|
+
);
|
|
1141
|
+
server.registerPrompt(
|
|
1142
|
+
"find_meeting_time",
|
|
1143
|
+
{
|
|
1144
|
+
title: "Find a meeting time",
|
|
1145
|
+
description: "Find a slot that works across several agents, then optionally book it.",
|
|
1146
|
+
argsSchema: {
|
|
1147
|
+
agent_ids: import_zod2.z.string().describe("Comma-separated agent IDs to coordinate (agt_...)."),
|
|
1148
|
+
duration: import_zod2.z.string().describe('Meeting length, e.g. "30m" or "1h".'),
|
|
1149
|
+
window: import_zod2.z.string().optional().describe('Optional ISO 8601 range to search, e.g. "2026-07-10T09:00:00Z/2026-07-10T18:00:00Z".')
|
|
1150
|
+
}
|
|
1151
|
+
},
|
|
1152
|
+
({ agent_ids, duration, window }) => ({
|
|
1153
|
+
messages: [
|
|
1154
|
+
{
|
|
1155
|
+
role: "user",
|
|
1156
|
+
content: {
|
|
1157
|
+
type: "text",
|
|
1158
|
+
text: `Find a ${duration} slot that works for all of these agents: ${agent_ids}${window ? ` within ${window}` : ""}. Call the find_meeting_time tool (agents, duration, and start/end if a window is given). Present the top few candidate slots and ask which to book before calling create_event. (find_meeting_time requires a Pro plan.)`
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
]
|
|
1162
|
+
})
|
|
1163
|
+
);
|
|
1164
|
+
server.registerPrompt(
|
|
1165
|
+
"daily_agenda",
|
|
1166
|
+
{
|
|
1167
|
+
title: "Summarize an agent's day",
|
|
1168
|
+
description: "Get an agent's current status and upcoming schedule at a glance.",
|
|
1169
|
+
argsSchema: {
|
|
1170
|
+
agent_id: import_zod2.z.string().describe("Agent whose day to summarize (agt_...)."),
|
|
1171
|
+
date: import_zod2.z.string().optional().describe("Optional ISO 8601 date to focus on (defaults to today).")
|
|
1172
|
+
}
|
|
1173
|
+
},
|
|
1174
|
+
({ agent_id, date }) => ({
|
|
1175
|
+
messages: [
|
|
1176
|
+
{
|
|
1177
|
+
role: "user",
|
|
1178
|
+
content: {
|
|
1179
|
+
type: "text",
|
|
1180
|
+
text: `Summarize agent ${agent_id}'s schedule${date ? ` for ${date}` : " for today"}. Use list_calendars to find the agent's calendar(s), then get_calendar_context for the current/next/upcoming events and status. Present a concise agenda.`
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
]
|
|
1184
|
+
})
|
|
1185
|
+
);
|
|
1186
|
+
server.registerPrompt(
|
|
1187
|
+
"new_scheduling_proposal",
|
|
1188
|
+
{
|
|
1189
|
+
title: "Propose a multi-party meeting",
|
|
1190
|
+
description: "Create a scheduling proposal offering several time slots to participants.",
|
|
1191
|
+
argsSchema: {
|
|
1192
|
+
title: import_zod2.z.string().describe("Proposal / meeting title"),
|
|
1193
|
+
organizer_agent_id: import_zod2.z.string().describe("Organizer agent ID (agt_...)."),
|
|
1194
|
+
participant_agent_ids: import_zod2.z.string().describe("Comma-separated participant agent IDs (agt_...).")
|
|
1195
|
+
}
|
|
1196
|
+
},
|
|
1197
|
+
({ title, organizer_agent_id, participant_agent_ids }) => ({
|
|
1198
|
+
messages: [
|
|
1199
|
+
{
|
|
1200
|
+
role: "user",
|
|
1201
|
+
content: {
|
|
1202
|
+
type: "text",
|
|
1203
|
+
text: `Create a scheduling proposal "${title}" organized by ${organizer_agent_id} for participants ${participant_agent_ids}. First use get_availability / find_meeting_time to pick 2-3 candidate slots, then call create_proposal with those slots. Report the proposal ID. (Scheduling proposals require a Pro plan and an org-level key.)`
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
]
|
|
1207
|
+
})
|
|
1208
|
+
);
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Register the static `chronary://about` resource (MCP `resources` capability)
|
|
1212
|
+
* so stdio and hosted expose the same `resources/list`. No-op if the server
|
|
1213
|
+
* can't register resources.
|
|
1214
|
+
*/
|
|
1215
|
+
registerResources(server) {
|
|
1216
|
+
if (!server.registerResource) return;
|
|
1217
|
+
server.registerResource(
|
|
1218
|
+
"about",
|
|
1219
|
+
"chronary://about",
|
|
1220
|
+
{
|
|
1221
|
+
title: "About Chronary",
|
|
1222
|
+
description: "What Chronary is and how to use its MCP tools.",
|
|
1223
|
+
mimeType: "text/markdown"
|
|
1224
|
+
},
|
|
1225
|
+
() => ({
|
|
1226
|
+
contents: [{ uri: "chronary://about", mimeType: "text/markdown", text: ABOUT_MARKDOWN }]
|
|
1227
|
+
})
|
|
1228
|
+
);
|
|
1229
|
+
}
|
|
1051
1230
|
};
|
|
1052
1231
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1053
1232
|
0 && (module.exports = {
|