nostr-bray 1.23.0 → 1.23.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.
@@ -17,6 +17,7 @@ import { handleCalendarCreate, handleCalendarRead, handleCalendarRsvp } from './
17
17
  import { handleBadgeCreate, handleBadgeAward, handleBadgeAccept, handleBadgeList } from './badges.js';
18
18
  import { handleCommunityCreate, handleCommunityFeed, handleCommunityPost, handleCommunityApprove, handleCommunityList } from './communities.js';
19
19
  import { handleWikiPublish, handleWikiRead, handleWikiList } from './wiki.js';
20
+ import { handlePostSchedule, handlePostQueueList, handlePostQueueCancel } from './scheduled.js';
20
21
  export function registerSocialTools(server, deps) {
21
22
  const trustCache = new TrustCache({
22
23
  ttl: deps.veilCacheTtl ?? 300_000,
@@ -977,4 +978,46 @@ export function registerSocialTools(server, deps) {
977
978
  });
978
979
  return toolResponse(topics, output, fmt.formatWikiList);
979
980
  });
981
+ // --- Scheduled posting ---
982
+ server.registerTool('post-schedule', {
983
+ description: 'Schedule a Nostr event for future publication. Signs the event now and queues it on disk. Use nostr-bray publish-scheduled (via cron) to publish when due.',
984
+ inputSchema: {
985
+ content: z.string().describe('Event content (note text, article body, etc.)'),
986
+ scheduled_at: z.string().describe('When to publish -- ISO datetime (e.g. "2026-04-01T14:00:00Z") or Unix timestamp'),
987
+ kind: z.number().int().optional().default(1).describe('Event kind (1 for note, 30023 for article, etc.)'),
988
+ tags: z.array(z.array(z.string())).optional().describe('Additional tags (e.g. [["t", "bitcoin"], ["d", "my-article"]])'),
989
+ output: z.enum(['json', 'human']).default('human').describe('Response format'),
990
+ },
991
+ annotations: { readOnlyHint: false, destructiveHint: false },
992
+ }, async ({ content, scheduled_at, kind, tags, output }) => {
993
+ const result = await handlePostSchedule(deps.ctx, {
994
+ content,
995
+ scheduledAt: scheduled_at,
996
+ kind,
997
+ tags,
998
+ relays: deps.pool.getRelays(deps.ctx.activeNpub).write,
999
+ });
1000
+ return toolResponse(result, output, fmt.formatScheduleResult);
1001
+ });
1002
+ server.registerTool('post-queue-list', {
1003
+ description: 'List all scheduled posts waiting to be published.',
1004
+ inputSchema: {
1005
+ output: z.enum(['json', 'human']).default('human').describe('Response format'),
1006
+ },
1007
+ annotations: { readOnlyHint: true },
1008
+ }, async ({ output }) => {
1009
+ const entries = handlePostQueueList();
1010
+ return toolResponse(entries, output, fmt.formatScheduledQueue);
1011
+ });
1012
+ server.registerTool('post-queue-cancel', {
1013
+ description: 'Cancel a scheduled post by event ID. Removes it from the queue.',
1014
+ inputSchema: {
1015
+ event_id: z.string().describe('Event ID to cancel (from post-queue-list)'),
1016
+ output: z.enum(['json', 'human']).default('human').describe('Response format'),
1017
+ },
1018
+ annotations: { readOnlyHint: false, destructiveHint: true },
1019
+ }, async ({ event_id, output }) => {
1020
+ const result = handlePostQueueCancel(event_id);
1021
+ return toolResponse(result, output, (r) => `Cancelled ${r.eventId.slice(0, 12)}...`);
1022
+ });
980
1023
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nostr-bray",
3
- "version": "1.23.0",
3
+ "version": "1.23.1",
4
4
  "description": "Trust-aware Nostr for AI and humans. Three dimensions of trust -- verification, proximity, and access -- woven into every interaction.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",