@tacitai/mcp-server 0.6.49 → 0.6.51

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.
@@ -194,6 +194,25 @@ export declare function handleSyncStatus(args: unknown): Promise<{
194
194
  }>;
195
195
  isError?: boolean;
196
196
  }>;
197
+ export declare const archiveStatusInputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
198
+ export type ArchiveStatusInput = z.infer<typeof archiveStatusInputSchema>;
199
+ export declare const ARCHIVE_STATUS_TOOL_DEF: {
200
+ name: "tacit_lake_archive_status";
201
+ description: string;
202
+ inputSchema: {
203
+ type: "object";
204
+ properties: {};
205
+ required: string[];
206
+ };
207
+ };
208
+ export declare function buildArchiveStatusRequest(client: TacitClient, _input: ArchiveStatusInput): ToolRequest;
209
+ export declare function handleArchiveStatus(args: unknown): Promise<{
210
+ content: Array<{
211
+ type: 'text';
212
+ text: string;
213
+ }>;
214
+ isError?: boolean;
215
+ }>;
197
216
  export declare const triggerSyncInputSchema: z.ZodObject<{
198
217
  source_id: z.ZodString;
199
218
  confirm_deletions: z.ZodOptional<z.ZodBoolean>;
@@ -485,10 +504,10 @@ export declare const browseCatalogInputSchema: z.ZodObject<{
485
504
  limit?: number | undefined;
486
505
  origin?: string | undefined;
487
506
  q?: string | undefined;
507
+ content_type?: string | undefined;
488
508
  offset?: number | undefined;
489
509
  source_id?: string | undefined;
490
510
  catalog_status?: string | undefined;
491
- content_type?: string | undefined;
492
511
  subject_id?: string | undefined;
493
512
  subject_needs_review?: boolean | undefined;
494
513
  subject_layer?: string | undefined;
@@ -496,10 +515,10 @@ export declare const browseCatalogInputSchema: z.ZodObject<{
496
515
  limit?: number | undefined;
497
516
  origin?: string | undefined;
498
517
  q?: string | undefined;
518
+ content_type?: string | undefined;
499
519
  offset?: number | undefined;
500
520
  source_id?: string | undefined;
501
521
  catalog_status?: string | undefined;
502
- content_type?: string | undefined;
503
522
  subject_id?: string | undefined;
504
523
  subject_needs_review?: boolean | undefined;
505
524
  subject_layer?: string | undefined;
@@ -211,6 +211,37 @@ export async function handleSyncStatus(args) {
211
211
  }
212
212
  return buildSyncStatusRequest(getClient(), parsed.data).execute();
213
213
  }
214
+ // ─── tacit_lake_archive_status ───────────────────────────────────────────────
215
+ export const archiveStatusInputSchema = z.object({});
216
+ export const ARCHIVE_STATUS_TOOL_DEF = {
217
+ name: 'tacit_lake_archive_status',
218
+ description: 'Get Durable Archive health status for all data lake sources with archive cadence configured — per source: archive_cadence (seconds), last_archive_at, archive_artifact_count, is_stale. Route: GET /api/v1/org/lake/archive/status.',
219
+ inputSchema: {
220
+ type: 'object',
221
+ properties: {},
222
+ required: [],
223
+ },
224
+ };
225
+ export function buildArchiveStatusRequest(client, _input) {
226
+ return {
227
+ async execute() {
228
+ try {
229
+ const result = await client.get('/api/v1/org/lake/archive/status');
230
+ return { content: [{ type: 'text', text: JSON.stringify(result) }] };
231
+ }
232
+ catch (err) {
233
+ return apiErrorResult(err, 'tacit_lake_archive_status');
234
+ }
235
+ },
236
+ };
237
+ }
238
+ export async function handleArchiveStatus(args) {
239
+ const parsed = archiveStatusInputSchema.safeParse(args ?? {});
240
+ if (!parsed.success) {
241
+ return { content: [{ type: 'text', text: `Invalid input: ${parsed.error.message}` }], isError: true };
242
+ }
243
+ return buildArchiveStatusRequest(getClient(), parsed.data).execute();
244
+ }
214
245
  // ─── tacit_lake_trigger_sync ─────────────────────────────────────────────────
215
246
  export const triggerSyncInputSchema = z.object({
216
247
  source_id: z.string().uuid().describe('Source to sync'),
@@ -430,8 +461,8 @@ export async function handleReclassify(args) {
430
461
  export const writebackInputSchema = z.object({
431
462
  source_id: z.string().uuid().describe('Source to write back to'),
432
463
  artifact_id: z.string().uuid().describe('Artifact to write back'),
433
- target_folder: z.string().optional().describe('Repo-relative folder to write into (overrides write_back_path)'),
434
- slug: z.string().optional().describe('Filename slug (without extension); defaults to artifact_id'),
464
+ target_folder: z.string().optional().describe('Repo-relative folder to write into. Accepted alone but does NOT change the committed path until custom-path commits ship — the file still lands at {write_back_path}/{artifact_id}.{ext}. Setting BOTH target_folder and slug is refused with 400'),
465
+ slug: z.string().optional().describe('Filename slug (without extension). Accepted alone but does NOT change the committed path until custom-path commits ship — the file still lands at {write_back_path}/{artifact_id}.{ext}. Setting BOTH slug and target_folder is refused with 400'),
435
466
  frontmatter: z.object({
436
467
  subject: z.string().optional(),
437
468
  title: z.string().optional(),
@@ -448,8 +479,8 @@ export const WRITEBACK_TOOL_DEF = {
448
479
  properties: {
449
480
  source_id: { type: 'string', description: 'Source to write back to' },
450
481
  artifact_id: { type: 'string', description: 'Artifact to write back' },
451
- target_folder: { type: 'string', description: 'Repo-relative folder to write into (overrides write_back_path)' },
452
- slug: { type: 'string', description: 'Filename slug (without extension); defaults to artifact_id' },
482
+ target_folder: { type: 'string', description: 'Repo-relative folder to write into. Accepted alone but does NOT change the committed path until custom-path commits ship — the file still lands at {write_back_path}/{artifact_id}.{ext}. Setting BOTH target_folder and slug is refused with 400' },
483
+ slug: { type: 'string', description: 'Filename slug (without extension). Accepted alone but does NOT change the committed path until custom-path commits ship — the file still lands at {write_back_path}/{artifact_id}.{ext}. Setting BOTH slug and target_folder is refused with 400' },
453
484
  frontmatter: { type: 'object', description: 'YAML frontmatter overrides: subject, title, supersedes, sensitivity, status' },
454
485
  },
455
486
  required: ['source_id', 'artifact_id'],
@@ -1005,6 +1036,10 @@ export function registerLakeTools(server, getClientFn) {
1005
1036
  const client = await getClientFn();
1006
1037
  return buildSyncStatusRequest(client, args).execute();
1007
1038
  });
1039
+ server.tool('tacit_lake_archive_status', ARCHIVE_STATUS_TOOL_DEF.description, {}, async () => {
1040
+ const client = await getClientFn();
1041
+ return buildArchiveStatusRequest(client, {}).execute();
1042
+ });
1008
1043
  server.tool('tacit_lake_trigger_sync', TRIGGER_SYNC_TOOL_DEF.description, triggerSyncInputSchema.shape, async (args) => {
1009
1044
  const client = await getClientFn();
1010
1045
  return buildTriggerSyncRequest(client, args).execute();
@@ -51,80 +51,80 @@ export declare const moveInputSchema: z.ZodObject<{
51
51
  }>]>, "many">>;
52
52
  }, "strip", z.ZodTypeAny, {
53
53
  portfolio_id?: string | undefined;
54
- program_id?: string | undefined;
55
54
  dossiers?: (string | {
56
55
  name: string;
57
56
  })[] | undefined;
57
+ program_id?: string | undefined;
58
58
  }, {
59
59
  portfolio_id?: string | undefined;
60
- program_id?: string | undefined;
61
60
  dossiers?: (string | {
62
61
  name: string;
63
62
  })[] | undefined;
63
+ program_id?: string | undefined;
64
64
  }>>;
65
65
  }, "strip", z.ZodTypeAny, {
66
- kb?: {
67
- collections: (string | {
68
- name: string;
69
- slug?: string | undefined;
70
- })[];
71
- } | undefined;
72
66
  pyramid?: {
73
67
  portfolio_id?: string | undefined;
74
- program_id?: string | undefined;
75
68
  dossiers?: (string | {
76
69
  name: string;
77
70
  })[] | undefined;
71
+ program_id?: string | undefined;
78
72
  } | undefined;
79
- }, {
80
73
  kb?: {
81
74
  collections: (string | {
82
75
  name: string;
83
76
  slug?: string | undefined;
84
77
  })[];
85
78
  } | undefined;
79
+ }, {
86
80
  pyramid?: {
87
81
  portfolio_id?: string | undefined;
88
- program_id?: string | undefined;
89
82
  dossiers?: (string | {
90
83
  name: string;
91
84
  })[] | undefined;
85
+ program_id?: string | undefined;
92
86
  } | undefined;
93
- }>;
94
- }, "strip", z.ZodTypeAny, {
95
- artifact_id: string;
96
- placement: {
97
87
  kb?: {
98
88
  collections: (string | {
99
89
  name: string;
100
90
  slug?: string | undefined;
101
91
  })[];
102
92
  } | undefined;
93
+ }>;
94
+ }, "strip", z.ZodTypeAny, {
95
+ placement: {
103
96
  pyramid?: {
104
97
  portfolio_id?: string | undefined;
105
- program_id?: string | undefined;
106
98
  dossiers?: (string | {
107
99
  name: string;
108
100
  })[] | undefined;
101
+ program_id?: string | undefined;
109
102
  } | undefined;
110
- };
111
- }, {
112
- artifact_id: string;
113
- placement: {
114
103
  kb?: {
115
104
  collections: (string | {
116
105
  name: string;
117
106
  slug?: string | undefined;
118
107
  })[];
119
108
  } | undefined;
109
+ };
110
+ artifact_id: string;
111
+ }, {
112
+ placement: {
120
113
  pyramid?: {
121
114
  portfolio_id?: string | undefined;
122
- program_id?: string | undefined;
123
115
  dossiers?: (string | {
124
116
  name: string;
125
117
  })[] | undefined;
118
+ program_id?: string | undefined;
119
+ } | undefined;
120
+ kb?: {
121
+ collections: (string | {
122
+ name: string;
123
+ slug?: string | undefined;
124
+ })[];
126
125
  } | undefined;
127
126
  };
127
+ artifact_id: string;
128
128
  }>;
129
129
  export type MoveInput = z.infer<typeof moveInputSchema>;
130
130
  export declare const MOVE_TOOL_DEF: {
@@ -44,44 +44,44 @@ export declare const outboxWriteInputSchema: z.ZodObject<{
44
44
  }>]>, "many">>;
45
45
  }, "strip", z.ZodTypeAny, {
46
46
  portfolio_id?: string | undefined;
47
- program_id?: string | undefined;
48
47
  dossiers?: (string | {
49
48
  name: string;
50
49
  })[] | undefined;
50
+ program_id?: string | undefined;
51
51
  }, {
52
52
  portfolio_id?: string | undefined;
53
- program_id?: string | undefined;
54
53
  dossiers?: (string | {
55
54
  name: string;
56
55
  })[] | undefined;
56
+ program_id?: string | undefined;
57
57
  }>>;
58
58
  }, "strip", z.ZodTypeAny, {
59
- kb?: {
60
- collections: (string | {
61
- name: string;
62
- slug?: string | undefined;
63
- })[];
64
- } | undefined;
65
59
  pyramid?: {
66
60
  portfolio_id?: string | undefined;
67
- program_id?: string | undefined;
68
61
  dossiers?: (string | {
69
62
  name: string;
70
63
  })[] | undefined;
64
+ program_id?: string | undefined;
71
65
  } | undefined;
72
- }, {
73
66
  kb?: {
74
67
  collections: (string | {
75
68
  name: string;
76
69
  slug?: string | undefined;
77
70
  })[];
78
71
  } | undefined;
72
+ }, {
79
73
  pyramid?: {
80
74
  portfolio_id?: string | undefined;
81
- program_id?: string | undefined;
82
75
  dossiers?: (string | {
83
76
  name: string;
84
77
  })[] | undefined;
78
+ program_id?: string | undefined;
79
+ } | undefined;
80
+ kb?: {
81
+ collections: (string | {
82
+ name: string;
83
+ slug?: string | undefined;
84
+ })[];
85
85
  } | undefined;
86
86
  }>;
87
87
  content_origin: z.ZodDefault<z.ZodEnum<["agent", "human", "git_sync"]>>;
@@ -94,18 +94,18 @@ export declare const outboxWriteInputSchema: z.ZodObject<{
94
94
  content: string;
95
95
  title: string;
96
96
  placement: {
97
- kb?: {
98
- collections: (string | {
99
- name: string;
100
- slug?: string | undefined;
101
- })[];
102
- } | undefined;
103
97
  pyramid?: {
104
98
  portfolio_id?: string | undefined;
105
- program_id?: string | undefined;
106
99
  dossiers?: (string | {
107
100
  name: string;
108
101
  })[] | undefined;
102
+ program_id?: string | undefined;
103
+ } | undefined;
104
+ kb?: {
105
+ collections: (string | {
106
+ name: string;
107
+ slug?: string | undefined;
108
+ })[];
109
109
  } | undefined;
110
110
  };
111
111
  content_origin: "agent" | "human" | "git_sync";
@@ -118,18 +118,18 @@ export declare const outboxWriteInputSchema: z.ZodObject<{
118
118
  content: string;
119
119
  title: string;
120
120
  placement: {
121
- kb?: {
122
- collections: (string | {
123
- name: string;
124
- slug?: string | undefined;
125
- })[];
126
- } | undefined;
127
121
  pyramid?: {
128
122
  portfolio_id?: string | undefined;
129
- program_id?: string | undefined;
130
123
  dossiers?: (string | {
131
124
  name: string;
132
125
  })[] | undefined;
126
+ program_id?: string | undefined;
127
+ } | undefined;
128
+ kb?: {
129
+ collections: (string | {
130
+ name: string;
131
+ slug?: string | undefined;
132
+ })[];
133
133
  } | undefined;
134
134
  };
135
135
  autonomy_level?: "MENTAT" | "TWIN" | undefined;
@@ -257,22 +257,22 @@ export declare const createDossierInputSchema: z.ZodObject<{
257
257
  }, "strip", z.ZodTypeAny, {
258
258
  name: string;
259
259
  status?: string | undefined;
260
+ document_ids?: string[] | undefined;
260
261
  portfolio_id?: string | undefined;
261
262
  program_id?: string | undefined;
262
263
  weight?: number | undefined;
263
264
  target_starts_at?: string | undefined;
264
265
  target_ends_at?: string | undefined;
265
- document_ids?: string[] | undefined;
266
266
  dossier_kind?: string | undefined;
267
267
  }, {
268
268
  name: string;
269
269
  status?: string | undefined;
270
+ document_ids?: string[] | undefined;
270
271
  portfolio_id?: string | undefined;
271
272
  program_id?: string | undefined;
272
273
  weight?: number | undefined;
273
274
  target_starts_at?: string | undefined;
274
275
  target_ends_at?: string | undefined;
275
- document_ids?: string[] | undefined;
276
276
  dossier_kind?: string | undefined;
277
277
  }>;
278
278
  export type CreateDossierInput = z.infer<typeof createDossierInputSchema>;
@@ -347,22 +347,22 @@ export declare const updateDossierInputSchema: z.ZodObject<{
347
347
  dossier_id: string;
348
348
  name?: string | undefined;
349
349
  status?: string | undefined;
350
+ document_ids?: string[] | undefined;
350
351
  portfolio_id?: string | undefined;
351
352
  program_id?: string | undefined;
352
353
  weight?: number | undefined;
353
354
  target_starts_at?: string | null | undefined;
354
355
  target_ends_at?: string | null | undefined;
355
- document_ids?: string[] | undefined;
356
356
  }, {
357
357
  dossier_id: string;
358
358
  name?: string | undefined;
359
359
  status?: string | undefined;
360
+ document_ids?: string[] | undefined;
360
361
  portfolio_id?: string | undefined;
361
362
  program_id?: string | undefined;
362
363
  weight?: number | undefined;
363
364
  target_starts_at?: string | null | undefined;
364
365
  target_ends_at?: string | null | undefined;
365
- document_ids?: string[] | undefined;
366
366
  }>;
367
367
  export type UpdateDossierInput = z.infer<typeof updateDossierInputSchema>;
368
368
  export declare const UPDATE_DOSSIER_TOOL_DEF: {
@@ -519,11 +519,11 @@ export declare const assignProgramToVSInputSchema: z.ZodObject<{
519
519
  value_stream_id: z.ZodString;
520
520
  program_id: z.ZodString;
521
521
  }, "strip", z.ZodTypeAny, {
522
- program_id: string;
523
522
  value_stream_id: string;
524
- }, {
525
523
  program_id: string;
524
+ }, {
526
525
  value_stream_id: string;
526
+ program_id: string;
527
527
  }>;
528
528
  export type AssignProgramToVSInput = z.infer<typeof assignProgramToVSInputSchema>;
529
529
  export declare const ASSIGN_PROGRAM_TO_VS_TOOL_DEF: {
@@ -32,6 +32,7 @@ const ADMIN_ONLY = [
32
32
  ];
33
33
  const GATE_ONLY = ['tacit_approve_gate', 'tacit_reject_gate'];
34
34
  const READ_TOOLS = [
35
+ 'tacit_lake_archive_status',
35
36
  'tacit_workflow_prereqs',
36
37
  'tacit_agent_approvals',
37
38
  'tacit_agent_list',
@@ -104,6 +105,9 @@ const READ_TOOLS = [
104
105
  'tacit_web_url',
105
106
  'tacit_wiki_classify',
106
107
  'tacit_wiki_validate',
108
+ 'tacit_secretary_recall',
109
+ 'tacit_capture_find',
110
+ 'tacit_capture_synthesize',
107
111
  ];
108
112
  const DISPATCH_TOOLS = [
109
113
  'tacit_agent_delegate',
@@ -183,6 +187,12 @@ const WRITE_TOOLS = [
183
187
  'tacit_workflow_type_create',
184
188
  'tacit_workflow_type_list',
185
189
  'tacit_workflow_type_update',
190
+ 'tacit_secretary_log',
191
+ 'tacit_capture_save',
192
+ 'tacit_capture_remove',
193
+ 'tacit_capture_restore',
194
+ 'tacit_capture_note',
195
+ 'tacit_capture_place',
186
196
  ];
187
197
  function build() {
188
198
  const map = new Map();
@@ -209,8 +219,8 @@ function build() {
209
219
  if (!exclusive.has(n))
210
220
  add(n, classOf(n), 'https', false);
211
221
  }
212
- if (map.size !== 165)
213
- throw new Error(`tool registry expected 165 tools, got ${map.size}`);
222
+ if (map.size !== 175)
223
+ throw new Error(`tool registry expected 175 tools, got ${map.size}`);
214
224
  return map;
215
225
  }
216
226
  export const TOOL_REGISTRY = build();
@@ -10,19 +10,16 @@ export declare const searchInputSchema: z.ZodObject<{
10
10
  query: z.ZodString;
11
11
  limit: z.ZodOptional<z.ZodNumber>;
12
12
  source_types: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
13
- entity_types: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
14
13
  origin: z.ZodOptional<z.ZodString>;
15
14
  }, "strip", z.ZodTypeAny, {
16
15
  query: string;
17
16
  limit?: number | undefined;
18
17
  source_types?: string[] | undefined;
19
- entity_types?: string[] | undefined;
20
18
  origin?: string | undefined;
21
19
  }, {
22
20
  query: string;
23
21
  limit?: number | undefined;
24
22
  source_types?: string[] | undefined;
25
- entity_types?: string[] | undefined;
26
23
  origin?: string | undefined;
27
24
  }>;
28
25
  export type SearchInput = z.infer<typeof searchInputSchema>;
@@ -47,13 +44,6 @@ export declare const SEARCH_TOOL_DEF: {
47
44
  };
48
45
  description: string;
49
46
  };
50
- entity_types: {
51
- type: string;
52
- items: {
53
- type: string;
54
- };
55
- description: string;
56
- };
57
47
  origin: {
58
48
  type: string;
59
49
  description: string;
@@ -10,7 +10,6 @@ export const searchInputSchema = z.object({
10
10
  query: z.string().min(1).describe('Search query string'),
11
11
  limit: z.number().int().positive().optional().describe('Maximum results to return'),
12
12
  source_types: z.array(z.string()).optional().describe('Filter by source types (e.g. ["artifact","chronicle"])'),
13
- entity_types: z.array(z.string()).optional().describe('Filter by entity types'),
14
13
  origin: z.string().optional().describe('Optional origin filter (e.g., PYRAMID, LAKE_SYNC, MANUAL) to scope results'),
15
14
  });
16
15
  export const SEARCH_TOOL_DEF = {
@@ -22,7 +21,6 @@ export const SEARCH_TOOL_DEF = {
22
21
  query: { type: 'string', description: 'Search query string' },
23
22
  limit: { type: 'number', description: 'Maximum results to return' },
24
23
  source_types: { type: 'array', items: { type: 'string' }, description: 'Filter by source types' },
25
- entity_types: { type: 'array', items: { type: 'string' }, description: 'Filter by entity types' },
26
24
  origin: { type: 'string', description: 'Optional origin filter (e.g., PYRAMID, LAKE_SYNC, MANUAL) to scope results' },
27
25
  },
28
26
  required: ['query'],
@@ -35,15 +33,13 @@ export const SEARCH_TOOL_DEF = {
35
33
  export function buildSearchRequest(client, input) {
36
34
  return {
37
35
  async execute() {
38
- const { query, limit, source_types, entity_types, origin } = input;
36
+ const { query, limit, source_types, origin } = input;
39
37
  try {
40
38
  const params = { q: query };
41
39
  if (limit !== undefined)
42
40
  params['limit'] = limit;
43
41
  if (source_types && source_types.length > 0)
44
42
  params['source_types'] = source_types.join(',');
45
- if (entity_types && entity_types.length > 0)
46
- params['entity_types'] = entity_types.join(',');
47
43
  if (origin !== undefined)
48
44
  params['origin'] = origin;
49
45
  // GET /api/v1/search?q=<term>
@@ -73,7 +69,6 @@ export function registerSearchTools(server, getClientFn) {
73
69
  query: z.string().min(1).describe('Search query string'),
74
70
  limit: z.number().int().positive().optional().describe('Maximum results to return'),
75
71
  source_types: z.array(z.string()).optional().describe('Filter by source types (e.g. ["artifact","chronicle"])'),
76
- entity_types: z.array(z.string()).optional().describe('Filter by entity types'),
77
72
  origin: z.string().optional().describe('Optional origin filter (e.g., PYRAMID, LAKE_SYNC, MANUAL) to scope results'),
78
73
  }, async (args) => {
79
74
  const client = await getClientFn();
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { TacitClient } from '../client.js';
3
+ export declare function registerSecretaryTools(server: McpServer, getClient: () => Promise<TacitClient>): void;
@@ -0,0 +1,165 @@
1
+ import { z } from 'zod';
2
+ import { TacitApiError } from '../client.js';
3
+ import { success, error, featureDisabledResult } from './errors.js';
4
+ /**
5
+ * NL→EventType keyword table (longest-match-first).
6
+ * Each entry: [keyword_phrase, chronicle_event_type].
7
+ * Sorted by phrase length descending so "status update" matches before "status".
8
+ */
9
+ const EVENT_TYPE_KEYWORDS = [
10
+ // Multi-word first (longest match)
11
+ ['status update', 'status_update'],
12
+ ['action item', 'action_item'],
13
+ ['follow up', 'action_item'],
14
+ ['next step', 'action_item'],
15
+ ['kicked off', 'milestone'],
16
+ ['signed off', 'decision'],
17
+ ['agreed to', 'decision'],
18
+ ['wrapped up', 'milestone'],
19
+ ['checked in', 'meeting_note'],
20
+ ['caught up', 'meeting_note'],
21
+ // Single-word
22
+ ['decided', 'decision'],
23
+ ['decision', 'decision'],
24
+ ['approved', 'decision'],
25
+ ['rejected', 'decision'],
26
+ ['met', 'meeting_note'],
27
+ ['meeting', 'meeting_note'],
28
+ ['call', 'meeting_note'],
29
+ ['sync', 'meeting_note'],
30
+ ['standup', 'meeting_note'],
31
+ ['milestone', 'milestone'],
32
+ ['launched', 'milestone'],
33
+ ['shipped', 'milestone'],
34
+ ['completed', 'milestone'],
35
+ ['released', 'milestone'],
36
+ ['deployed', 'milestone'],
37
+ ['blocker', 'blocker'],
38
+ ['blocked', 'blocker'],
39
+ ['stuck', 'blocker'],
40
+ ['risk', 'risk'],
41
+ ['concern', 'risk'],
42
+ ['warning', 'risk'],
43
+ ['note', 'note'],
44
+ ['noticed', 'note'],
45
+ ['observed', 'note'],
46
+ ['fyi', 'note'],
47
+ ['idea', 'insight'],
48
+ ['insight', 'insight'],
49
+ ['realized', 'insight'],
50
+ ['learned', 'insight'],
51
+ ['discovery', 'insight'],
52
+ ['todo', 'action_item'],
53
+ ['task', 'action_item'],
54
+ ['assign', 'action_item'],
55
+ ];
56
+ function classifyEventType(text, hint) {
57
+ if (hint)
58
+ return hint;
59
+ const lower = text.toLowerCase();
60
+ for (const [phrase, eventType] of EVENT_TYPE_KEYWORDS) {
61
+ if (lower.includes(phrase))
62
+ return eventType;
63
+ }
64
+ return 'note';
65
+ }
66
+ export function registerSecretaryTools(server, getClient) {
67
+ server.tool('tacit_secretary_log', 'Log an event to Chronicle using natural language. Classifies the event type automatically from your description, or accepts an explicit event_hint override. Examples: "Decided to use Postgres for the queue", "Met with the design team about onboarding", "Blocker: CI pipeline broken".', {
68
+ description: z.string().describe('Natural language description of the event'),
69
+ event_hint: z
70
+ .enum([
71
+ 'decision',
72
+ 'meeting_note',
73
+ 'milestone',
74
+ 'blocker',
75
+ 'risk',
76
+ 'note',
77
+ 'insight',
78
+ 'action_item',
79
+ 'status_update',
80
+ ])
81
+ .optional()
82
+ .describe('Override automatic classification with an explicit event type'),
83
+ title: z
84
+ .string()
85
+ .optional()
86
+ .describe('Short title (auto-generated from first 80 chars if omitted)'),
87
+ project_id: z.string().uuid().optional().describe('Scope to a specific project'),
88
+ chapter_id: z.string().uuid().optional().describe('Scope to a specific chapter'),
89
+ participants: z
90
+ .string()
91
+ .optional()
92
+ .describe('Comma-separated participant names or emails'),
93
+ }, async (args) => {
94
+ try {
95
+ const client = await getClient();
96
+ const eventType = classifyEventType(args.description, args.event_hint);
97
+ const title = args.title ??
98
+ (args.description.length > 80
99
+ ? args.description.slice(0, 77) + '...'
100
+ : args.description);
101
+ const payload = {
102
+ event_type: eventType,
103
+ title,
104
+ raw_payload: args.description,
105
+ metadata: {},
106
+ };
107
+ if (args.project_id)
108
+ payload['project_id'] = args.project_id;
109
+ if (args.chapter_id)
110
+ payload['chapter_id'] = args.chapter_id;
111
+ if (args.participants) {
112
+ payload['metadata']['participants'] = args.participants
113
+ .split(',')
114
+ .map((p) => p.trim());
115
+ }
116
+ const data = await client.request('POST', '/api/v1/events', payload);
117
+ return success({
118
+ logged: true,
119
+ classified_as: eventType,
120
+ event: data,
121
+ });
122
+ }
123
+ catch (e) {
124
+ if (e instanceof TacitApiError)
125
+ return featureDisabledResult(e) ?? error(e.message);
126
+ return error(`Unexpected error: ${e instanceof Error ? e.message : String(e)}`);
127
+ }
128
+ });
129
+ server.tool('tacit_secretary_recall', 'Search Chronicle history with natural language. Finds events matching your query across all event types, with optional date filtering. Examples: "decisions about auth", "meetings last week", "blockers this sprint".', {
130
+ query: z.string().describe('Natural language search query'),
131
+ from: z.string().optional().describe('RFC 3339 lower bound (inclusive)'),
132
+ to: z.string().optional().describe('RFC 3339 upper bound (inclusive)'),
133
+ event_types: z
134
+ .string()
135
+ .optional()
136
+ .describe('Comma-separated event types to filter (e.g. "decision,milestone")'),
137
+ limit: z.number().int().optional().describe('Max results (default 20, cap 100)'),
138
+ project_id: z.string().uuid().optional().describe('Scope to a specific project'),
139
+ }, async (args) => {
140
+ try {
141
+ const client = await getClient();
142
+ const params = new URLSearchParams();
143
+ params.set('q', args.query);
144
+ if (args.from)
145
+ params.set('from', args.from);
146
+ if (args.to)
147
+ params.set('to', args.to);
148
+ if (args.event_types)
149
+ params.set('event_types', args.event_types);
150
+ if (args.limit !== undefined)
151
+ params.set('limit', String(args.limit));
152
+ if (args.project_id)
153
+ params.set('project_id', args.project_id);
154
+ params.set('full_content', 'true');
155
+ const qs = params.toString();
156
+ const data = await client.request('GET', `/api/v1/chronicle/events/recent?${qs}`);
157
+ return success(data);
158
+ }
159
+ catch (e) {
160
+ if (e instanceof TacitApiError)
161
+ return featureDisabledResult(e) ?? error(e.message);
162
+ return error(`Unexpected error: ${e instanceof Error ? e.message : String(e)}`);
163
+ }
164
+ });
165
+ }