@notus-os/mcp 0.1.1 → 0.1.3

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.
Files changed (2) hide show
  1. package/dist/bin/notusos-mcp.js +1373 -108
  2. package/package.json +1 -1
@@ -132,7 +132,13 @@ async function runBrowserFlow(opts) {
132
132
  const token = url.searchParams.get("token");
133
133
  const receivedState = url.searchParams.get("state");
134
134
  if (error2) {
135
- res.writeHead(200, { "content-type": "text/html" }).end(pageHtml("Authorization cancelled", "You can close this tab and return to the CLI."));
135
+ res.writeHead(200, { "content-type": "text/html" }).end(
136
+ resultPage({
137
+ variant: "cancelled",
138
+ heading: "Authorization cancelled",
139
+ body: "No token was issued. You can close this tab and try again from your terminal."
140
+ })
141
+ );
136
142
  cleanup();
137
143
  reject(new Error(`Authorization ${error2}`));
138
144
  return;
@@ -144,10 +150,11 @@ async function runBrowserFlow(opts) {
144
150
  return;
145
151
  }
146
152
  res.writeHead(200, { "content-type": "text/html" }).end(
147
- pageHtml(
148
- "Connected to notusOS",
149
- "You can close this tab and return to the CLI."
150
- )
153
+ resultPage({
154
+ variant: "success",
155
+ heading: "You're connected",
156
+ body: "notusOS is ready to use in Claude Code. You can close this tab and head back to your terminal to start posting."
157
+ })
151
158
  );
152
159
  cleanup();
153
160
  resolve({ token });
@@ -179,20 +186,99 @@ ${authorizeUrl.toString()}
179
186
  });
180
187
  });
181
188
  }
182
- function pageHtml(title, body) {
189
+ function resultPage(opts) {
190
+ const icon = opts.variant === "success" ? `<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>` : `<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>`;
191
+ const badgeBg = opts.variant === "success" ? "#722F37" : "#78716c";
183
192
  return `<!doctype html>
193
+ <html lang="en">
194
+ <head>
184
195
  <meta charset="utf-8">
185
- <title>${title}</title>
196
+ <meta name="viewport" content="width=device-width,initial-scale=1">
197
+ <title>${opts.heading} \xB7 notusOS</title>
186
198
  <style>
187
- body { font: 14px system-ui, sans-serif; padding: 40px; color: #222; }
188
- .card { max-width: 420px; border: 1px solid #e2e2e2; border-radius: 12px; padding: 24px; }
189
- h1 { font-size: 16px; margin: 0 0 8px; }
190
- p { margin: 0; color: #555; }
199
+ :root { color-scheme: light; }
200
+ * { box-sizing: border-box; }
201
+ html, body { margin: 0; padding: 0; }
202
+ body {
203
+ min-height: 100vh;
204
+ display: flex;
205
+ align-items: center;
206
+ justify-content: center;
207
+ padding: 24px;
208
+ background: #FAF7F3;
209
+ font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
210
+ color: #1c1917;
211
+ -webkit-font-smoothing: antialiased;
212
+ }
213
+ .wrap {
214
+ width: 100%;
215
+ max-width: 420px;
216
+ text-align: center;
217
+ }
218
+ .logo {
219
+ width: 48px;
220
+ height: 48px;
221
+ margin: 0 auto 32px;
222
+ border-radius: 12px;
223
+ background: #722F37;
224
+ color: #fff;
225
+ display: flex;
226
+ align-items: center;
227
+ justify-content: center;
228
+ font-weight: 600;
229
+ font-size: 20px;
230
+ letter-spacing: -0.02em;
231
+ }
232
+ .card {
233
+ background: #fff;
234
+ border: 1px solid rgba(231, 229, 228, 0.8);
235
+ border-radius: 20px;
236
+ padding: 44px 32px 36px;
237
+ box-shadow: 0 1px 3px rgba(28, 25, 23, 0.04), 0 8px 24px rgba(28, 25, 23, 0.04);
238
+ }
239
+ .badge {
240
+ width: 56px;
241
+ height: 56px;
242
+ margin: 0 auto 20px;
243
+ border-radius: 999px;
244
+ background: ${badgeBg};
245
+ color: #fff;
246
+ display: flex;
247
+ align-items: center;
248
+ justify-content: center;
249
+ }
250
+ h1 {
251
+ margin: 0 0 10px;
252
+ font-size: 22px;
253
+ font-weight: 600;
254
+ letter-spacing: -0.02em;
255
+ color: #1c1917;
256
+ }
257
+ p {
258
+ margin: 0;
259
+ font-size: 14px;
260
+ line-height: 1.55;
261
+ color: #78716c;
262
+ }
263
+ .hint {
264
+ margin-top: 28px;
265
+ font-size: 12px;
266
+ color: #a8a29e;
267
+ }
191
268
  </style>
192
- <div class="card">
193
- <h1>${title}</h1>
194
- <p>${body}</p>
195
- </div>`;
269
+ </head>
270
+ <body>
271
+ <div class="wrap">
272
+ <div class="logo">n</div>
273
+ <div class="card">
274
+ <div class="badge">${icon}</div>
275
+ <h1>${opts.heading}</h1>
276
+ <p>${opts.body}</p>
277
+ </div>
278
+ <div class="hint">You can close this tab.</div>
279
+ </div>
280
+ </body>
281
+ </html>`;
196
282
  }
197
283
  var DEFAULT_TIMEOUT_MS;
198
284
  var init_browser_flow = __esm({
@@ -375,6 +461,9 @@ var init_api_client = __esm({
375
461
  patch(path, opts = {}) {
376
462
  return this.request("PATCH", path, { ...opts, mutation: opts.mutation ?? true });
377
463
  }
464
+ put(path, opts = {}) {
465
+ return this.request("PUT", path, { ...opts, mutation: opts.mutation ?? true });
466
+ }
378
467
  delete(path, opts = {}) {
379
468
  return this.request("DELETE", path, { ...opts, mutation: opts.mutation ?? true });
380
469
  }
@@ -19231,10 +19320,13 @@ var init_shared = __esm({
19231
19320
  // src/tools/setup.ts
19232
19321
  var setup_exports = {};
19233
19322
  __export(setup_exports, {
19323
+ generate_kickoff_recap: () => generate_kickoff_recap,
19324
+ generate_review_message: () => generate_review_message,
19325
+ get_onboarding_progress: () => get_onboarding_progress,
19234
19326
  get_setup_progress: () => get_setup_progress,
19235
19327
  update_setup_checkpoint: () => update_setup_checkpoint
19236
19328
  });
19237
- var getSetupProgressSchema, get_setup_progress, updateSetupCheckpointSchema, update_setup_checkpoint;
19329
+ var getSetupProgressSchema, get_setup_progress, updateSetupCheckpointSchema, update_setup_checkpoint, generateKickoffRecapSchema, generate_kickoff_recap, generateReviewMessageSchema, generate_review_message, getOnboardingProgressSchema, get_onboarding_progress;
19238
19330
  var init_setup = __esm({
19239
19331
  "src/tools/setup.ts"() {
19240
19332
  "use strict";
@@ -19244,7 +19336,7 @@ var init_setup = __esm({
19244
19336
  getSetupProgressSchema = clientTargetSchema;
19245
19337
  get_setup_progress = {
19246
19338
  name: "get_setup_progress",
19247
- description: "Onboarding roadmap for a client \u2014 phase (T1\u2013T5), per-checkpoint status, smart content saved against each checkpoint, and what's next. Scoped via impersonation headers.",
19339
+ description: "Onboarding roadmap for a client \u2014 phase (T1\u2013T5), per-checkpoint status, smart content saved against each checkpoint, and what's next.",
19248
19340
  inputSchema: getSetupProgressSchema,
19249
19341
  handler: async (args, ctx) => {
19250
19342
  return ctx.api.get("/api/setup", { clientContext: toClientContext(args) });
@@ -19253,25 +19345,63 @@ var init_setup = __esm({
19253
19345
  updateSetupCheckpointSchema = external_exports.object({
19254
19346
  ...clientTargetSchema.shape,
19255
19347
  checkpointKey: external_exports.string().min(1).max(120),
19256
- checked: external_exports.boolean(),
19257
- dryRun: external_exports.boolean().optional()
19348
+ checked: external_exports.boolean()
19258
19349
  });
19259
19350
  update_setup_checkpoint = {
19260
19351
  name: "update_setup_checkpoint",
19261
19352
  description: "Mark an onboarding checkpoint as done/undone for a client. checkpointKey matches the setup page's checkpoint identifier.",
19262
19353
  inputSchema: updateSetupCheckpointSchema,
19263
19354
  handler: async (args, ctx) => {
19264
- const body = { checkpoint: args.checkpointKey, checked: args.checked };
19265
- if (args.dryRun) {
19266
- return { dryRun: true, would: { method: "PATCH", path: "/api/setup", body } };
19267
- }
19268
19355
  return ctx.api.patch("/api/setup", {
19269
- body,
19356
+ body: { checkpoint: args.checkpointKey, checked: args.checked },
19270
19357
  clientContext: toClientContext(args)
19271
19358
  });
19272
19359
  }
19273
19360
  };
19274
- registerTools(get_setup_progress, update_setup_checkpoint);
19361
+ generateKickoffRecapSchema = external_exports.object({ ...clientTarget });
19362
+ generate_kickoff_recap = {
19363
+ name: "generate_kickoff_recap",
19364
+ description: "Compose a kickoff recap email for a client from the latest kickoff_call content source's preparation JSON. Returns subject + body. No side effects \u2014 sending the email is a separate manual step.",
19365
+ inputSchema: generateKickoffRecapSchema,
19366
+ handler: async (args, ctx) => {
19367
+ return ctx.api.post("/api/setup/generate-recap", {
19368
+ clientContext: toClientContext(args)
19369
+ });
19370
+ }
19371
+ };
19372
+ generateReviewMessageSchema = external_exports.object({
19373
+ ...clientTarget,
19374
+ includeCompanyProfile: external_exports.boolean().optional(),
19375
+ skipped: external_exports.boolean().optional()
19376
+ });
19377
+ generate_review_message = {
19378
+ name: "generate_review_message",
19379
+ description: "Generate the onboarding 'review & go live' message shown to a client at the end of setup. Optional overrides for includeCompanyProfile and skipped states.",
19380
+ inputSchema: generateReviewMessageSchema,
19381
+ handler: async (args, ctx) => {
19382
+ const { clientUserId, clientOrganizationId, appMode, ...body } = args;
19383
+ return ctx.api.post("/api/setup/generate-review-message", {
19384
+ body,
19385
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19386
+ });
19387
+ }
19388
+ };
19389
+ getOnboardingProgressSchema = external_exports.object({ ...clientTarget });
19390
+ get_onboarding_progress = {
19391
+ name: "get_onboarding_progress",
19392
+ description: "Higher-level onboarding progress summary: percent complete, current phase label, next actions. Complements get_setup_progress (which returns the raw checklist state).",
19393
+ inputSchema: getOnboardingProgressSchema,
19394
+ handler: async (args, ctx) => {
19395
+ return ctx.api.get("/api/onboarding-progress", { clientContext: toClientContext(args) });
19396
+ }
19397
+ };
19398
+ registerTools(
19399
+ get_setup_progress,
19400
+ update_setup_checkpoint,
19401
+ generate_kickoff_recap,
19402
+ generate_review_message,
19403
+ get_onboarding_progress
19404
+ );
19275
19405
  }
19276
19406
  });
19277
19407
 
@@ -19279,12 +19409,14 @@ var init_setup = __esm({
19279
19409
  var posts_exports = {};
19280
19410
  __export(posts_exports, {
19281
19411
  create_post: () => create_post,
19412
+ delete_post: () => delete_post,
19282
19413
  generate_post: () => generate_post,
19283
19414
  get_post: () => get_post,
19415
+ get_post_versions: () => get_post_versions,
19284
19416
  list_posts: () => list_posts,
19285
19417
  update_post: () => update_post
19286
19418
  });
19287
- var listPostsSchema, list_posts, getPostSchema, get_post, createPostSchema, create_post, updatePostSchema, update_post, generatePostSchema, generate_post;
19419
+ var listPostsSchema, list_posts, getPostSchema, get_post, createPostSchema, create_post, updatePostSchema, update_post, deletePostSchema, delete_post, getPostVersionsSchema, get_post_versions, generatePostSchema, generate_post;
19288
19420
  var init_posts = __esm({
19289
19421
  "src/tools/posts.ts"() {
19290
19422
  "use strict";
@@ -19298,7 +19430,7 @@ var init_posts = __esm({
19298
19430
  });
19299
19431
  list_posts = {
19300
19432
  name: "list_posts",
19301
- description: "List posts for a client, optionally filtered by status. Returns id, title, status, updated_at, and a short body preview.",
19433
+ description: "List posts for a client, optionally filtered by status. Returns id, body, pillars, image_urls, source_type, updated_at.",
19302
19434
  inputSchema: listPostsSchema,
19303
19435
  handler: async (args, ctx) => {
19304
19436
  const { clientUserId, clientOrganizationId, appMode, ...q } = args;
@@ -19314,7 +19446,7 @@ var init_posts = __esm({
19314
19446
  });
19315
19447
  get_post = {
19316
19448
  name: "get_post",
19317
- description: "Full text, version history, and metadata for one post. Use the postId returned by list_posts.",
19449
+ description: "Full post detail: body, pillars, images, source_type, conversation link, and source metadata.",
19318
19450
  inputSchema: getPostSchema,
19319
19451
  handler: async (args, ctx) => {
19320
19452
  const { clientUserId, clientOrganizationId, appMode, postId } = args;
@@ -19326,19 +19458,20 @@ var init_posts = __esm({
19326
19458
  createPostSchema = external_exports.object({
19327
19459
  ...clientTarget,
19328
19460
  body: external_exports.string().min(1).max(2e4),
19329
- title: external_exports.string().max(200).optional(),
19330
- status: external_exports.enum(["draft", "scheduled"]).default("draft"),
19331
- dryRun: external_exports.boolean().optional()
19461
+ pillars: external_exports.array(external_exports.string()).optional(),
19462
+ image_urls: external_exports.array(external_exports.string()).optional(),
19463
+ source_type: external_exports.enum(["generated", "manual", "client"]).optional(),
19464
+ post_id: external_exports.string().uuid().optional(),
19465
+ previous_post_id: external_exports.string().uuid().optional(),
19466
+ conversation_id: external_exports.string().uuid().nullable().optional(),
19467
+ is_manual_edit: external_exports.boolean().optional()
19332
19468
  });
19333
19469
  create_post = {
19334
19470
  name: "create_post",
19335
- description: "Create a new post (draft by default) for a client. Returns the new post id. Pass dryRun=true to preview the request body without creating anything.",
19471
+ description: "Create a new post (draft). `body` is the LinkedIn text; attach pillars + image_urls if relevant. For a new standalone draft omit post_id. To branch an AI-generated variant off an existing draft pass previous_post_id.",
19336
19472
  inputSchema: createPostSchema,
19337
19473
  handler: async (args, ctx) => {
19338
- if (args.dryRun) {
19339
- return { dryRun: true, would: { method: "POST", path: "/api/posts", body: { body: args.body, title: args.title, status: args.status } } };
19340
- }
19341
- const { clientUserId, clientOrganizationId, appMode, dryRun: _dr, ...body } = args;
19474
+ const { clientUserId, clientOrganizationId, appMode, ...body } = args;
19342
19475
  return ctx.api.post("/api/posts", {
19343
19476
  body,
19344
19477
  clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
@@ -19348,22 +19481,49 @@ var init_posts = __esm({
19348
19481
  updatePostSchema = external_exports.object({
19349
19482
  ...clientTarget,
19350
19483
  postId: external_exports.string().uuid(),
19351
- body: external_exports.string().max(2e4).optional(),
19352
- title: external_exports.string().max(200).optional(),
19353
- status: external_exports.enum(["draft", "scheduled", "published", "archived"]).optional(),
19354
- dryRun: external_exports.boolean().optional()
19484
+ body: external_exports.string().min(1).max(2e4).optional(),
19485
+ pillars: external_exports.array(external_exports.string()).optional(),
19486
+ image_urls: external_exports.array(external_exports.string()).optional(),
19487
+ source_type: external_exports.enum(["generated", "manual", "client"]).optional()
19355
19488
  });
19356
19489
  update_post = {
19357
19490
  name: "update_post",
19358
- description: "Edit an existing post. Manual edits accumulate on the same version; only AI-generated edits create new versions (server-enforced). Pass dryRun=true to preview.",
19491
+ description: "Edit an existing post (body, pillars, images). Manual edits accumulate on the same version row; only AI-generated edits create new versions (server-enforced, see posts.ts in /api).",
19359
19492
  inputSchema: updatePostSchema,
19360
19493
  handler: async (args, ctx) => {
19361
- const { clientUserId, clientOrganizationId, appMode, postId, dryRun, ...patch } = args;
19362
- if (dryRun) {
19363
- return { dryRun: true, would: { method: "PATCH", path: `/api/posts/${postId}`, body: patch } };
19364
- }
19365
- return ctx.api.patch(`/api/posts/${postId}`, {
19366
- body: patch,
19494
+ const { clientUserId, clientOrganizationId, appMode, postId, ...body } = args;
19495
+ return ctx.api.put(`/api/posts/${postId}`, {
19496
+ body,
19497
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19498
+ });
19499
+ }
19500
+ };
19501
+ deletePostSchema = external_exports.object({
19502
+ ...clientTarget,
19503
+ postId: external_exports.string().uuid()
19504
+ });
19505
+ delete_post = {
19506
+ name: "delete_post",
19507
+ description: "Delete a post permanently. Unlinks any content piece that was pointing at it.",
19508
+ inputSchema: deletePostSchema,
19509
+ handler: async (args, ctx) => {
19510
+ const { clientUserId, clientOrganizationId, appMode, postId } = args;
19511
+ return ctx.api.delete(`/api/posts/${postId}`, {
19512
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19513
+ });
19514
+ }
19515
+ };
19516
+ getPostVersionsSchema = external_exports.object({
19517
+ ...clientTarget,
19518
+ postId: external_exports.string().uuid()
19519
+ });
19520
+ get_post_versions = {
19521
+ name: "get_post_versions",
19522
+ description: "Full version history for a post chain (by conversation_id / previous_post_id linkage). Returns every version in ascending order with source_type labels (generated = AI, client = Client, manual = Edited).",
19523
+ inputSchema: getPostVersionsSchema,
19524
+ handler: async (args, ctx) => {
19525
+ const { clientUserId, clientOrganizationId, appMode, postId } = args;
19526
+ return ctx.api.get(`/api/posts/${postId}/versions`, {
19367
19527
  clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19368
19528
  });
19369
19529
  }
@@ -19372,17 +19532,13 @@ var init_posts = __esm({
19372
19532
  ...clientTarget,
19373
19533
  prompt: external_exports.string().min(1).max(5e3),
19374
19534
  conversationId: external_exports.string().uuid().optional(),
19375
- contentPieceId: external_exports.string().uuid().optional(),
19376
- dryRun: external_exports.boolean().optional()
19535
+ contentPieceId: external_exports.string().uuid().optional()
19377
19536
  });
19378
19537
  generate_post = {
19379
19538
  name: "generate_post",
19380
- description: "Use notusOS's AI to generate a post in the client's voice. Streams thinking + draft from /api/chat and returns the final accumulated draft text. Takes 10-30s.",
19539
+ description: "Generate a post in the client's voice via /api/chat SSE (flow_type=generate_post). Streams thinking + draft, returns the accumulated draft text. Takes 10-30s. Pass conversationId to continue an existing chat, or contentPieceId to ground in a specific idea.",
19381
19540
  inputSchema: generatePostSchema,
19382
19541
  handler: async (args, ctx) => {
19383
- if (args.dryRun) {
19384
- return { dryRun: true, would: { method: "POST", path: "/api/chat", body: { message: args.prompt, flow_type: "generate_post", conversation_id: args.conversationId } } };
19385
- }
19386
19542
  const clientContext = toClientContext(args);
19387
19543
  let draft = "";
19388
19544
  let thinking = "";
@@ -19414,7 +19570,15 @@ var init_posts = __esm({
19414
19570
  return { draft: draft.trim(), thinking: thinking.trim() || void 0 };
19415
19571
  }
19416
19572
  };
19417
- registerTools(list_posts, get_post, create_post, update_post, generate_post);
19573
+ registerTools(
19574
+ list_posts,
19575
+ get_post,
19576
+ create_post,
19577
+ update_post,
19578
+ delete_post,
19579
+ get_post_versions,
19580
+ generate_post
19581
+ );
19418
19582
  }
19419
19583
  });
19420
19584
 
@@ -19422,9 +19586,13 @@ var init_posts = __esm({
19422
19586
  var content_pieces_exports = {};
19423
19587
  __export(content_pieces_exports, {
19424
19588
  create_content_piece: () => create_content_piece,
19425
- list_content_pieces: () => list_content_pieces
19589
+ delete_content_piece: () => delete_content_piece,
19590
+ get_content_piece: () => get_content_piece,
19591
+ get_content_piece_suggestions: () => get_content_piece_suggestions,
19592
+ list_content_pieces: () => list_content_pieces,
19593
+ update_content_piece: () => update_content_piece
19426
19594
  });
19427
- var listContentPiecesSchema, list_content_pieces, createContentPieceSchema, create_content_piece;
19595
+ var listContentPiecesSchema, list_content_pieces, getContentPieceSchema, get_content_piece, createContentPieceSchema, create_content_piece, updateContentPieceSchema, update_content_piece, deleteContentPieceSchema, delete_content_piece, getSuggestionsSchema, get_content_piece_suggestions;
19428
19596
  var init_content_pieces = __esm({
19429
19597
  "src/tools/content-pieces.ts"() {
19430
19598
  "use strict";
@@ -19448,41 +19616,123 @@ var init_content_pieces = __esm({
19448
19616
  });
19449
19617
  }
19450
19618
  };
19619
+ getContentPieceSchema = external_exports.object({
19620
+ ...clientTarget,
19621
+ contentPieceId: external_exports.string().uuid()
19622
+ });
19623
+ get_content_piece = {
19624
+ name: "get_content_piece",
19625
+ description: "Full content piece detail: idea text, pillar, status, linked source + conversations, scheduled date, post draft reference.",
19626
+ inputSchema: getContentPieceSchema,
19627
+ handler: async (args, ctx) => {
19628
+ const { clientUserId, clientOrganizationId, appMode, contentPieceId } = args;
19629
+ return ctx.api.get(`/api/content-pieces/${contentPieceId}`, {
19630
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19631
+ });
19632
+ }
19633
+ };
19451
19634
  createContentPieceSchema = external_exports.object({
19452
19635
  ...clientTarget,
19453
- title: external_exports.string().min(1).max(300),
19454
- idea_text: external_exports.string().min(1).max(5e3).optional(),
19455
- source_id: external_exports.string().uuid().optional(),
19456
- pillar: external_exports.string().max(100).optional(),
19457
- dryRun: external_exports.boolean().optional()
19636
+ idea_text: external_exports.string().min(1).max(5e3),
19637
+ idea_excerpt: external_exports.string().optional(),
19638
+ idea_pillar: external_exports.string().optional(),
19639
+ idea_timestamp: external_exports.string().optional(),
19640
+ content_source_id: external_exports.string().uuid().nullable().optional(),
19641
+ idea_index: external_exports.number().int().min(0).optional(),
19642
+ status: external_exports.string().optional(),
19643
+ title: external_exports.string().max(200).optional(),
19644
+ visual_status: external_exports.enum(["needs_visual", "visual_in_progress", "visual_review", "visual_revision", "visual_approved"]).nullable().optional()
19458
19645
  });
19459
19646
  create_content_piece = {
19460
19647
  name: "create_content_piece",
19461
- description: "Add a new idea to a client's content pipeline. Optionally link to a source via source_id (from list_content_sources).",
19648
+ description: "Add a new idea to a client's content pipeline. idea_text is required. Optionally link to a content source (content_source_id + idea_index) to attach it to the content-engine source.",
19462
19649
  inputSchema: createContentPieceSchema,
19463
19650
  handler: async (args, ctx) => {
19464
- const { clientUserId, clientOrganizationId, appMode, dryRun, ...body } = args;
19465
- if (dryRun) {
19466
- return { dryRun: true, would: { method: "POST", path: "/api/content-pieces", body } };
19467
- }
19651
+ const { clientUserId, clientOrganizationId, appMode, ...body } = args;
19468
19652
  return ctx.api.post("/api/content-pieces", {
19469
19653
  body,
19470
19654
  clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19471
19655
  });
19472
19656
  }
19473
19657
  };
19474
- registerTools(list_content_pieces, create_content_piece);
19658
+ updateContentPieceSchema = external_exports.object({
19659
+ ...clientTarget,
19660
+ contentPieceId: external_exports.string().uuid(),
19661
+ title: external_exports.string().min(1).max(100).optional(),
19662
+ idea_text: external_exports.string().min(1).optional(),
19663
+ idea_excerpt: external_exports.string().optional(),
19664
+ idea_pillar: external_exports.string().optional(),
19665
+ post_id: external_exports.string().uuid().nullable().optional(),
19666
+ conversation_id: external_exports.string().uuid().nullable().optional(),
19667
+ status: external_exports.string().optional(),
19668
+ body: external_exports.string().min(1).optional()
19669
+ });
19670
+ update_content_piece = {
19671
+ name: "update_content_piece",
19672
+ description: "Update a content piece. Pass only fields to change. `status` drives pipeline stage (draft/in_revision/client_review/approved/scheduled/published/archived). `body` replaces the draft body text.",
19673
+ inputSchema: updateContentPieceSchema,
19674
+ handler: async (args, ctx) => {
19675
+ const { clientUserId, clientOrganizationId, appMode, contentPieceId, ...body } = args;
19676
+ return ctx.api.put(`/api/content-pieces/${contentPieceId}`, {
19677
+ body,
19678
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19679
+ });
19680
+ }
19681
+ };
19682
+ deleteContentPieceSchema = external_exports.object({
19683
+ ...clientTarget,
19684
+ contentPieceId: external_exports.string().uuid()
19685
+ });
19686
+ delete_content_piece = {
19687
+ name: "delete_content_piece",
19688
+ description: "Delete a content piece. Also removes the extracted-idea entry on the parent content source (if any) and shifts sibling idea_index values down. Cascades to calendar entries.",
19689
+ inputSchema: deleteContentPieceSchema,
19690
+ handler: async (args, ctx) => {
19691
+ const { clientUserId, clientOrganizationId, appMode, contentPieceId } = args;
19692
+ return ctx.api.delete(`/api/content-pieces/${contentPieceId}`, {
19693
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19694
+ });
19695
+ }
19696
+ };
19697
+ getSuggestionsSchema = external_exports.object({
19698
+ ...clientTarget,
19699
+ contentPieceId: external_exports.string().uuid()
19700
+ });
19701
+ get_content_piece_suggestions = {
19702
+ name: "get_content_piece_suggestions",
19703
+ description: "Pending client-side edit suggestions for a content piece (highlighted spans with replacement text, status pending/accepted/declined).",
19704
+ inputSchema: getSuggestionsSchema,
19705
+ handler: async (args, ctx) => {
19706
+ const { clientUserId, clientOrganizationId, appMode, contentPieceId } = args;
19707
+ return ctx.api.get(`/api/content-pieces/${contentPieceId}/suggestions`, {
19708
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19709
+ });
19710
+ }
19711
+ };
19712
+ registerTools(
19713
+ list_content_pieces,
19714
+ get_content_piece,
19715
+ create_content_piece,
19716
+ update_content_piece,
19717
+ delete_content_piece,
19718
+ get_content_piece_suggestions
19719
+ );
19475
19720
  }
19476
19721
  });
19477
19722
 
19478
19723
  // src/tools/resources.ts
19479
19724
  var resources_exports = {};
19480
19725
  __export(resources_exports, {
19726
+ delete_resource: () => delete_resource,
19481
19727
  get_brand_guidelines: () => get_brand_guidelines,
19482
19728
  get_resource: () => get_resource,
19483
- list_resources: () => list_resources
19729
+ list_resources: () => list_resources,
19730
+ rewrite_resource_section: () => rewrite_resource_section,
19731
+ toggle_resource: () => toggle_resource,
19732
+ update_brand_guidelines: () => update_brand_guidelines,
19733
+ update_resource: () => update_resource
19484
19734
  });
19485
- var listResourcesSchema, list_resources, getResourceSchema, get_resource, getBrandGuidelinesSchema, get_brand_guidelines;
19735
+ var listResourcesSchema, list_resources, getResourceSchema, get_resource, updateResourceSchema, update_resource, toggleResourceSchema, toggle_resource, deleteResourceSchema, delete_resource, rewriteSectionSchema, rewrite_resource_section, getBrandGuidelinesSchema, get_brand_guidelines, updateBrandGuidelinesSchema, update_brand_guidelines;
19486
19736
  var init_resources = __esm({
19487
19737
  "src/tools/resources.ts"() {
19488
19738
  "use strict";
@@ -19492,7 +19742,7 @@ var init_resources = __esm({
19492
19742
  listResourcesSchema = external_exports.object({ ...clientTarget });
19493
19743
  list_resources = {
19494
19744
  name: "list_resources",
19495
- description: "All strategy docs, brand guides, and content pillars in a client's library. Returns id, title, type, updated_at.",
19745
+ description: "All strategy docs, brand guides, and content pillars enabled in a client's library. Returns id, name, resource_type, content, enabled, timestamps.",
19496
19746
  inputSchema: listResourcesSchema,
19497
19747
  handler: async (args, ctx) => {
19498
19748
  return ctx.api.get("/api/resources", { clientContext: toClientContext(args) });
@@ -19513,16 +19763,114 @@ var init_resources = __esm({
19513
19763
  });
19514
19764
  }
19515
19765
  };
19766
+ updateResourceSchema = external_exports.object({
19767
+ ...clientTarget,
19768
+ resourceId: external_exports.string().uuid(),
19769
+ content: external_exports.string()
19770
+ });
19771
+ update_resource = {
19772
+ name: "update_resource",
19773
+ description: "Rewrite the markdown body of a resource. `content` is the entire new body (not a diff). Scoped by organization.",
19774
+ inputSchema: updateResourceSchema,
19775
+ handler: async (args, ctx) => {
19776
+ const { clientUserId, clientOrganizationId, appMode, resourceId, content } = args;
19777
+ return ctx.api.put(`/api/resources/${resourceId}`, {
19778
+ body: { content },
19779
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19780
+ });
19781
+ }
19782
+ };
19783
+ toggleResourceSchema = external_exports.object({
19784
+ ...clientTarget,
19785
+ resourceId: external_exports.string().uuid(),
19786
+ enabled: external_exports.boolean()
19787
+ });
19788
+ toggle_resource = {
19789
+ name: "toggle_resource",
19790
+ description: "Enable or disable a resource. Disabled resources are hidden from the client but kept in the strategist admin library.",
19791
+ inputSchema: toggleResourceSchema,
19792
+ handler: async (args, ctx) => {
19793
+ const { clientUserId, clientOrganizationId, appMode, resourceId, enabled } = args;
19794
+ return ctx.api.patch(`/api/resources/${resourceId}`, {
19795
+ body: { enabled },
19796
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19797
+ });
19798
+ }
19799
+ };
19800
+ deleteResourceSchema = external_exports.object({
19801
+ ...clientTarget,
19802
+ resourceId: external_exports.string().uuid()
19803
+ });
19804
+ delete_resource = {
19805
+ name: "delete_resource",
19806
+ description: "Delete a resource permanently. Unlinks its conversation if any. Scoped by organization.",
19807
+ inputSchema: deleteResourceSchema,
19808
+ handler: async (args, ctx) => {
19809
+ const { clientUserId, clientOrganizationId, appMode, resourceId } = args;
19810
+ return ctx.api.delete(`/api/resources/${resourceId}`, {
19811
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19812
+ });
19813
+ }
19814
+ };
19815
+ rewriteSectionSchema = external_exports.object({
19816
+ ...clientTarget,
19817
+ resourceId: external_exports.string().uuid(),
19818
+ sectionId: external_exports.string(),
19819
+ sectionTitle: external_exports.string().optional(),
19820
+ sectionContent: external_exports.string(),
19821
+ feedback: external_exports.string().min(1),
19822
+ sectionType: external_exports.string().optional()
19823
+ });
19824
+ rewrite_resource_section = {
19825
+ name: "rewrite_resource_section",
19826
+ description: "AI-rewrite one section of a resource. `feedback` is the instruction ('make this more tactical', 'shorten', etc.). Returns the rewritten section text.",
19827
+ inputSchema: rewriteSectionSchema,
19828
+ handler: async (args, ctx) => {
19829
+ const { clientUserId, clientOrganizationId, appMode, resourceId, ...body } = args;
19830
+ return ctx.api.post(`/api/resources/${resourceId}/rewrite-section`, {
19831
+ body,
19832
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19833
+ });
19834
+ }
19835
+ };
19516
19836
  getBrandGuidelinesSchema = external_exports.object({ ...clientTarget });
19517
19837
  get_brand_guidelines = {
19518
19838
  name: "get_brand_guidelines",
19519
- description: "Brand guidelines for a client: tone, voice, visual rules, do's and don'ts. Use instead of filtering list_resources.",
19839
+ description: "Brand guidelines for a client: uploaded files + reference URLs. Auto-creates an empty resource if none exists.",
19520
19840
  inputSchema: getBrandGuidelinesSchema,
19521
19841
  handler: async (args, ctx) => {
19522
19842
  return ctx.api.get("/api/brand-guidelines", { clientContext: toClientContext(args) });
19523
19843
  }
19524
19844
  };
19525
- registerTools(list_resources, get_resource, get_brand_guidelines);
19845
+ updateBrandGuidelinesSchema = external_exports.object({
19846
+ ...clientTarget,
19847
+ url: external_exports.string().url().optional(),
19848
+ label: external_exports.string().max(200).optional(),
19849
+ removeUrl: external_exports.string().url().optional(),
19850
+ removeFile: external_exports.string().optional()
19851
+ });
19852
+ update_brand_guidelines = {
19853
+ name: "update_brand_guidelines",
19854
+ description: "Mutate the client's brand guidelines entry: add a reference URL (`url` + optional `label`), remove a URL (`removeUrl`), or remove a file (`removeFile` = storage path from get_brand_guidelines). Exactly one operation per call.",
19855
+ inputSchema: updateBrandGuidelinesSchema,
19856
+ handler: async (args, ctx) => {
19857
+ const { clientUserId, clientOrganizationId, appMode, ...body } = args;
19858
+ return ctx.api.put("/api/brand-guidelines", {
19859
+ body,
19860
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19861
+ });
19862
+ }
19863
+ };
19864
+ registerTools(
19865
+ list_resources,
19866
+ get_resource,
19867
+ update_resource,
19868
+ toggle_resource,
19869
+ delete_resource,
19870
+ rewrite_resource_section,
19871
+ get_brand_guidelines,
19872
+ update_brand_guidelines
19873
+ );
19526
19874
  }
19527
19875
  });
19528
19876
 
@@ -19641,10 +19989,16 @@ var init_analytics = __esm({
19641
19989
  var comments_exports = {};
19642
19990
  __export(comments_exports, {
19643
19991
  add_comment: () => add_comment,
19992
+ delete_comment: () => delete_comment,
19993
+ get_comment_counts: () => get_comment_counts,
19994
+ get_comment_replies: () => get_comment_replies,
19995
+ get_unread_comments: () => get_unread_comments,
19644
19996
  list_comments: () => list_comments,
19645
- resolve_comment: () => resolve_comment
19997
+ reply_to_comment: () => reply_to_comment,
19998
+ resolve_comment: () => resolve_comment,
19999
+ update_comment: () => update_comment
19646
20000
  });
19647
- var listCommentsSchema, list_comments, addCommentSchema, add_comment, resolveCommentSchema, resolve_comment;
20001
+ var listCommentsSchema, list_comments, getCommentRepliesSchema, get_comment_replies, getCommentCountsSchema, get_comment_counts, getUnreadCommentsSchema, get_unread_comments, addCommentSchema, add_comment, replyToCommentSchema, reply_to_comment, updateCommentSchema, update_comment, resolveCommentSchema, resolve_comment, deleteCommentSchema, delete_comment;
19648
20002
  var init_comments = __esm({
19649
20003
  "src/tools/comments.ts"() {
19650
20004
  "use strict";
@@ -19671,18 +20025,54 @@ var init_comments = __esm({
19671
20025
  });
19672
20026
  }
19673
20027
  };
20028
+ getCommentRepliesSchema = external_exports.object({
20029
+ ...clientTarget,
20030
+ commentId: external_exports.string().uuid()
20031
+ });
20032
+ get_comment_replies = {
20033
+ name: "get_comment_replies",
20034
+ description: "All threaded replies for a comment in chronological order (oldest first). Author profile images + names resolved.",
20035
+ inputSchema: getCommentRepliesSchema,
20036
+ handler: async (args, ctx) => {
20037
+ const { clientUserId, clientOrganizationId, appMode, commentId } = args;
20038
+ return ctx.api.get(`/api/comments/${commentId}/replies`, {
20039
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20040
+ });
20041
+ }
20042
+ };
20043
+ getCommentCountsSchema = external_exports.object({
20044
+ ...clientTarget
20045
+ });
20046
+ get_comment_counts = {
20047
+ name: "get_comment_counts",
20048
+ description: "Per-surface unresolved comment counts for the client. Use to build a pipeline attention map without fetching every comment body.",
20049
+ inputSchema: getCommentCountsSchema,
20050
+ handler: async (args, ctx) => {
20051
+ return ctx.api.get("/api/comments/counts", { clientContext: toClientContext(args) });
20052
+ }
20053
+ };
20054
+ getUnreadCommentsSchema = external_exports.object({
20055
+ ...clientTarget
20056
+ });
20057
+ get_unread_comments = {
20058
+ name: "get_unread_comments",
20059
+ description: "Unread comments (and reply mentions) for the strategist on this client.",
20060
+ inputSchema: getUnreadCommentsSchema,
20061
+ handler: async (args, ctx) => {
20062
+ return ctx.api.get("/api/comments/unread", { clientContext: toClientContext(args) });
20063
+ }
20064
+ };
19674
20065
  addCommentSchema = external_exports.object({
19675
20066
  ...clientTarget,
19676
20067
  content: external_exports.string().min(1).max(4e3),
19677
20068
  contentPieceId: external_exports.string().uuid().optional(),
19678
20069
  resourceId: external_exports.string().uuid().optional(),
19679
20070
  reportId: external_exports.string().uuid().optional(),
19680
- contentSourceId: external_exports.string().uuid().optional(),
19681
- dryRun: external_exports.boolean().optional()
20071
+ contentSourceId: external_exports.string().uuid().optional()
19682
20072
  });
19683
20073
  add_comment = {
19684
20074
  name: "add_comment",
19685
- description: "Post a strategist comment on a content piece, resource, report, or content source. Exactly one of contentPieceId/resourceId/reportId/contentSourceId is required.",
20075
+ description: "Post a comment on a content piece, resource, report, or content source. Exactly ONE of contentPieceId/resourceId/reportId/contentSourceId is required.",
19686
20076
  inputSchema: addCommentSchema,
19687
20077
  handler: async (args, ctx) => {
19688
20078
  const attach = [
@@ -19692,38 +20082,92 @@ var init_comments = __esm({
19692
20082
  args.contentSourceId && { content_source_id: args.contentSourceId }
19693
20083
  ].filter(Boolean);
19694
20084
  if (attach.length !== 1) {
19695
- throw new Error("Exactly one target id is required");
20085
+ throw new Error("Exactly one target id is required (contentPieceId/resourceId/reportId/contentSourceId)");
19696
20086
  }
19697
20087
  const body = { content: args.content, ...Object.assign({}, ...attach) };
19698
- if (args.dryRun) {
19699
- return { dryRun: true, would: { method: "POST", path: "/api/comments", body } };
19700
- }
19701
20088
  return ctx.api.post("/api/comments", {
19702
20089
  body,
19703
20090
  clientContext: toClientContext(args)
19704
20091
  });
19705
20092
  }
19706
20093
  };
19707
- resolveCommentSchema = external_exports.object({
20094
+ replyToCommentSchema = external_exports.object({
19708
20095
  ...clientTarget,
19709
20096
  commentId: external_exports.string().uuid(),
19710
- dryRun: external_exports.boolean().optional()
20097
+ content: external_exports.string().min(1).max(1e4)
20098
+ });
20099
+ reply_to_comment = {
20100
+ name: "reply_to_comment",
20101
+ description: "Thread a reply under an existing comment.",
20102
+ inputSchema: replyToCommentSchema,
20103
+ handler: async (args, ctx) => {
20104
+ const { clientUserId, clientOrganizationId, appMode, commentId, content } = args;
20105
+ return ctx.api.post(`/api/comments/${commentId}/replies`, {
20106
+ body: { content },
20107
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20108
+ });
20109
+ }
20110
+ };
20111
+ updateCommentSchema = external_exports.object({
20112
+ ...clientTarget,
20113
+ commentId: external_exports.string().uuid(),
20114
+ resolved: external_exports.boolean().optional(),
20115
+ content: external_exports.string().min(1).max(4e3).optional()
20116
+ });
20117
+ update_comment = {
20118
+ name: "update_comment",
20119
+ description: "Patch a comment: toggle `resolved`, or edit `content`. Anchor data is intentionally immutable \u2014 comments stay pinned to their original text selection.",
20120
+ inputSchema: updateCommentSchema,
20121
+ handler: async (args, ctx) => {
20122
+ const { clientUserId, clientOrganizationId, appMode, commentId, ...body } = args;
20123
+ return ctx.api.patch(`/api/comments/${commentId}`, {
20124
+ body,
20125
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20126
+ });
20127
+ }
20128
+ };
20129
+ resolveCommentSchema = external_exports.object({
20130
+ ...clientTarget,
20131
+ commentId: external_exports.string().uuid()
19711
20132
  });
19712
20133
  resolve_comment = {
19713
20134
  name: "resolve_comment",
19714
- description: "Mark a comment as resolved.",
20135
+ description: "Mark a comment as resolved (convenience wrapper over update_comment).",
19715
20136
  inputSchema: resolveCommentSchema,
19716
20137
  handler: async (args, ctx) => {
19717
- if (args.dryRun) {
19718
- return { dryRun: true, would: { method: "PATCH", path: `/api/comments/${args.commentId}`, body: { resolved: true } } };
19719
- }
19720
- return ctx.api.patch(`/api/comments/${args.commentId}`, {
20138
+ const { clientUserId, clientOrganizationId, appMode, commentId } = args;
20139
+ return ctx.api.patch(`/api/comments/${commentId}`, {
19721
20140
  body: { resolved: true },
19722
- clientContext: toClientContext(args)
20141
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19723
20142
  });
19724
20143
  }
19725
20144
  };
19726
- registerTools(list_comments, add_comment, resolve_comment);
20145
+ deleteCommentSchema = external_exports.object({
20146
+ ...clientTarget,
20147
+ commentId: external_exports.string().uuid()
20148
+ });
20149
+ delete_comment = {
20150
+ name: "delete_comment",
20151
+ description: "Delete a comment. Only the author or the content owner can delete.",
20152
+ inputSchema: deleteCommentSchema,
20153
+ handler: async (args, ctx) => {
20154
+ const { clientUserId, clientOrganizationId, appMode, commentId } = args;
20155
+ return ctx.api.delete(`/api/comments/${commentId}`, {
20156
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20157
+ });
20158
+ }
20159
+ };
20160
+ registerTools(
20161
+ list_comments,
20162
+ get_comment_replies,
20163
+ get_comment_counts,
20164
+ get_unread_comments,
20165
+ add_comment,
20166
+ reply_to_comment,
20167
+ update_comment,
20168
+ resolve_comment,
20169
+ delete_comment
20170
+ );
19727
20171
  }
19728
20172
  });
19729
20173
 
@@ -19757,9 +20201,16 @@ var init_content_engine = __esm({
19757
20201
  // src/tools/content-sources.ts
19758
20202
  var content_sources_exports = {};
19759
20203
  __export(content_sources_exports, {
19760
- list_content_sources: () => list_content_sources
20204
+ create_content_source: () => create_content_source,
20205
+ delete_content_source: () => delete_content_source,
20206
+ extract_content_source_feedback: () => extract_content_source_feedback,
20207
+ extract_content_source_ideas: () => extract_content_source_ideas,
20208
+ get_content_source: () => get_content_source,
20209
+ list_content_sources: () => list_content_sources,
20210
+ regenerate_content_source_section: () => regenerate_content_source_section,
20211
+ update_content_source: () => update_content_source
19761
20212
  });
19762
- var listContentSourcesSchema, list_content_sources;
20213
+ var listContentSourcesSchema, list_content_sources, getContentSourceSchema, get_content_source, createContentSourceSchema, create_content_source, updateContentSourceSchema, update_content_source, deleteContentSourceSchema, delete_content_source, extractIdeasSchema, extract_content_source_ideas, regenerateSectionSchema, regenerate_content_source_section, extractFeedbackSchema, extract_content_source_feedback;
19763
20214
  var init_content_sources = __esm({
19764
20215
  "src/tools/content-sources.ts"() {
19765
20216
  "use strict";
@@ -19784,17 +20235,162 @@ var init_content_sources = __esm({
19784
20235
  });
19785
20236
  }
19786
20237
  };
19787
- registerTools(list_content_sources);
20238
+ getContentSourceSchema = external_exports.object({
20239
+ ...clientTarget,
20240
+ contentSourceId: external_exports.string().uuid()
20241
+ });
20242
+ get_content_source = {
20243
+ name: "get_content_source",
20244
+ description: "Full content source detail including the transcript, preparation JSON (for preps), extracted ideas, and linked conversation IDs.",
20245
+ inputSchema: getContentSourceSchema,
20246
+ handler: async (args, ctx) => {
20247
+ const { clientUserId, clientOrganizationId, appMode, contentSourceId } = args;
20248
+ return ctx.api.get(`/api/content-sources/${contentSourceId}`, {
20249
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20250
+ });
20251
+ }
20252
+ };
20253
+ createContentSourceSchema = external_exports.object({
20254
+ ...clientTarget,
20255
+ title: external_exports.string().max(200).optional(),
20256
+ transcript: external_exports.string().optional(),
20257
+ source_date: external_exports.string().optional(),
20258
+ source_type: external_exports.enum(["content_call", "kickoff_call", "deep_dive_call", "coaching_call", "interview", "recording", "document", "transcript", "other"]).optional(),
20259
+ processing_status: external_exports.enum(["unprocessed", "processing", "processed", "error"]).optional()
20260
+ });
20261
+ create_content_source = {
20262
+ name: "create_content_source",
20263
+ description: "Create a new content source (transcript, call recording note, document). Empty transcript is allowed \u2014 it can be added later. Defaults: source_type=content_call, processing_status=unprocessed, source_date=now.",
20264
+ inputSchema: createContentSourceSchema,
20265
+ handler: async (args, ctx) => {
20266
+ const { clientUserId, clientOrganizationId, appMode, ...body } = args;
20267
+ return ctx.api.post("/api/content-sources", {
20268
+ body,
20269
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20270
+ });
20271
+ }
20272
+ };
20273
+ updateContentSourceSchema = external_exports.object({
20274
+ ...clientTarget,
20275
+ contentSourceId: external_exports.string().uuid(),
20276
+ title: external_exports.string().max(200).optional(),
20277
+ transcript: external_exports.string().optional(),
20278
+ source_date: external_exports.string().optional(),
20279
+ source_type: external_exports.string().optional(),
20280
+ processing_status: external_exports.string().optional(),
20281
+ prep_shared: external_exports.boolean().optional()
20282
+ });
20283
+ update_content_source = {
20284
+ name: "update_content_source",
20285
+ description: "Update content source fields. Pass only the fields you want to change. Use prep_shared=true to share a call prep with the client.",
20286
+ inputSchema: updateContentSourceSchema,
20287
+ handler: async (args, ctx) => {
20288
+ const { clientUserId, clientOrganizationId, appMode, contentSourceId, ...body } = args;
20289
+ return ctx.api.put(`/api/content-sources/${contentSourceId}`, {
20290
+ body,
20291
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20292
+ });
20293
+ }
20294
+ };
20295
+ deleteContentSourceSchema = external_exports.object({
20296
+ ...clientTarget,
20297
+ contentSourceId: external_exports.string().uuid()
20298
+ });
20299
+ delete_content_source = {
20300
+ name: "delete_content_source",
20301
+ description: "Delete a content source and ALL derived content pieces, calendar entries, and conversation links. Irreversible.",
20302
+ inputSchema: deleteContentSourceSchema,
20303
+ handler: async (args, ctx) => {
20304
+ const { clientUserId, clientOrganizationId, appMode, contentSourceId } = args;
20305
+ return ctx.api.delete(`/api/content-sources/${contentSourceId}`, {
20306
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20307
+ });
20308
+ }
20309
+ };
20310
+ extractIdeasSchema = external_exports.object({
20311
+ ...clientTarget,
20312
+ contentSourceId: external_exports.string().uuid(),
20313
+ instructions: external_exports.string().max(2e3).optional()
20314
+ });
20315
+ extract_content_source_ideas = {
20316
+ name: "extract_content_source_ideas",
20317
+ description: 'Run AI idea extraction on a content source transcript. Produces content pieces (ideas) ready for post generation. Optional `instructions` steer the extraction (e.g. "focus on tactical advice for OC tenants"). Rate-limited.',
20318
+ inputSchema: extractIdeasSchema,
20319
+ handler: async (args, ctx) => {
20320
+ const { clientUserId, clientOrganizationId, appMode, contentSourceId, instructions } = args;
20321
+ return ctx.api.post(`/api/content-sources/${contentSourceId}/generate-ideas`, {
20322
+ body: instructions ? { instructions } : {},
20323
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20324
+ });
20325
+ }
20326
+ };
20327
+ regenerateSectionSchema = external_exports.object({
20328
+ ...clientTarget,
20329
+ contentSourceId: external_exports.string().uuid(),
20330
+ section: external_exports.enum(["hook", "format_intent", "strategy_notes", "outline"]),
20331
+ instruction: external_exports.string().optional(),
20332
+ idea: external_exports.object({
20333
+ text: external_exports.string(),
20334
+ pillar: external_exports.string(),
20335
+ excerpt: external_exports.string(),
20336
+ hook: external_exports.string().optional(),
20337
+ format_intent: external_exports.record(external_exports.string(), external_exports.string()).optional(),
20338
+ strategy_notes: external_exports.union([external_exports.string(), external_exports.record(external_exports.string(), external_exports.unknown())]).optional(),
20339
+ outline: external_exports.string().optional()
20340
+ })
20341
+ });
20342
+ regenerate_content_source_section = {
20343
+ name: "regenerate_content_source_section",
20344
+ description: "Regenerate a single idea section (hook, format_intent, strategy_notes, or outline) with optional instruction. Pass the current idea object as context.",
20345
+ inputSchema: regenerateSectionSchema,
20346
+ handler: async (args, ctx) => {
20347
+ const { clientUserId, clientOrganizationId, appMode, contentSourceId, ...body } = args;
20348
+ return ctx.api.post(`/api/content-sources/${contentSourceId}/regenerate-section`, {
20349
+ body,
20350
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20351
+ });
20352
+ }
20353
+ };
20354
+ extractFeedbackSchema = external_exports.object({
20355
+ ...clientTarget,
20356
+ contentSourceId: external_exports.string().uuid()
20357
+ });
20358
+ extract_content_source_feedback = {
20359
+ name: "extract_content_source_feedback",
20360
+ description: "Run AI feedback extraction on a content source transcript. Populates the client_feedback table with actionable items surfaced during the call.",
20361
+ inputSchema: extractFeedbackSchema,
20362
+ handler: async (args, ctx) => {
20363
+ const { clientUserId, clientOrganizationId, appMode, contentSourceId } = args;
20364
+ return ctx.api.post(`/api/content-sources/${contentSourceId}/extract-feedback`, {
20365
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20366
+ });
20367
+ }
20368
+ };
20369
+ registerTools(
20370
+ list_content_sources,
20371
+ get_content_source,
20372
+ create_content_source,
20373
+ update_content_source,
20374
+ delete_content_source,
20375
+ extract_content_source_ideas,
20376
+ regenerate_content_source_section,
20377
+ extract_content_source_feedback
20378
+ );
19788
20379
  }
19789
20380
  });
19790
20381
 
19791
20382
  // src/tools/reports.ts
19792
20383
  var reports_exports = {};
19793
20384
  __export(reports_exports, {
20385
+ check_report_readiness: () => check_report_readiness,
20386
+ delete_report: () => delete_report,
19794
20387
  get_report: () => get_report,
19795
- list_reports: () => list_reports
20388
+ get_report_extension_data: () => get_report_extension_data,
20389
+ get_report_feedback: () => get_report_feedback,
20390
+ list_reports: () => list_reports,
20391
+ update_report: () => update_report
19796
20392
  });
19797
- var listReportsSchema, list_reports, getReportSchema, get_report;
20393
+ var listReportsSchema, list_reports, getReportSchema, get_report, updateReportSchema, update_report, deleteReportSchema, delete_report, getReportFeedbackSchema, get_report_feedback, checkReportReadinessSchema, check_report_readiness, getExtensionReportDataSchema, get_report_extension_data;
19798
20394
  var init_reports = __esm({
19799
20395
  "src/tools/reports.ts"() {
19800
20396
  "use strict";
@@ -19804,10 +20400,10 @@ var init_reports = __esm({
19804
20400
  listReportsSchema = external_exports.object({ ...clientTarget });
19805
20401
  list_reports = {
19806
20402
  name: "list_reports",
19807
- description: "Monthly and quarterly reports for a client with type (monthly|quarterly|first), period, status, and share state.",
20403
+ description: "Monthly, quarterly, and first-month reports for a client with type, period (report_month, metrics.end_month for quarterly), status, and share state. Also returns recent report-generation conversations.",
19808
20404
  inputSchema: listReportsSchema,
19809
20405
  handler: async (args, ctx) => {
19810
- return ctx.api.get("/api/reports", { clientContext: toClientContext(args) });
20406
+ return ctx.api.get("/api/reports/monthly", { clientContext: toClientContext(args) });
19811
20407
  }
19812
20408
  };
19813
20409
  getReportSchema = external_exports.object({
@@ -19816,16 +20412,127 @@ var init_reports = __esm({
19816
20412
  });
19817
20413
  get_report = {
19818
20414
  name: "get_report",
19819
- description: "Full report: narrative, metrics JSON, feedback, and any in-line comments. Use reportId from list_reports.",
20415
+ description: "Full report: narrative (report_content), metrics JSON, status, share state. Use reportId from list_reports.",
19820
20416
  inputSchema: getReportSchema,
19821
20417
  handler: async (args, ctx) => {
19822
20418
  const { clientUserId, clientOrganizationId, appMode, reportId } = args;
19823
- return ctx.api.get(`/api/reports/${reportId}`, {
20419
+ return ctx.api.get(`/api/reports/monthly/${reportId}`, {
19824
20420
  clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19825
20421
  });
19826
20422
  }
19827
20423
  };
19828
- registerTools(list_reports, get_report);
20424
+ updateReportSchema = external_exports.object({
20425
+ ...clientTarget,
20426
+ reportId: external_exports.string().uuid(),
20427
+ status: external_exports.string().optional(),
20428
+ report_content: external_exports.string().optional(),
20429
+ shared: external_exports.boolean().optional(),
20430
+ report_month: external_exports.string().optional(),
20431
+ metrics: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
20432
+ });
20433
+ update_report = {
20434
+ name: "update_report",
20435
+ description: "Update a report: change status, edit report_content (the narrative markdown), toggle `shared` to send/unsend to client, or patch metrics. metrics is merged into existing, not replaced.",
20436
+ inputSchema: updateReportSchema,
20437
+ handler: async (args, ctx) => {
20438
+ const { clientUserId, clientOrganizationId, appMode, reportId, ...body } = args;
20439
+ return ctx.api.patch(`/api/reports/monthly/${reportId}`, {
20440
+ body,
20441
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20442
+ });
20443
+ }
20444
+ };
20445
+ deleteReportSchema = external_exports.object({
20446
+ ...clientTarget,
20447
+ reportId: external_exports.string().uuid()
20448
+ });
20449
+ delete_report = {
20450
+ name: "delete_report",
20451
+ description: "Delete a report permanently.",
20452
+ inputSchema: deleteReportSchema,
20453
+ handler: async (args, ctx) => {
20454
+ const { clientUserId, clientOrganizationId, appMode, reportId } = args;
20455
+ return ctx.api.delete(`/api/reports/monthly/${reportId}`, {
20456
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20457
+ });
20458
+ }
20459
+ };
20460
+ getReportFeedbackSchema = external_exports.object({
20461
+ ...clientTarget,
20462
+ reportId: external_exports.string().uuid()
20463
+ });
20464
+ get_report_feedback = {
20465
+ name: "get_report_feedback",
20466
+ description: "Client-submitted feedback on a report (satisfaction rating + comments). Use when auditing how reports have landed with clients.",
20467
+ inputSchema: getReportFeedbackSchema,
20468
+ handler: async (args, ctx) => {
20469
+ const { clientUserId, clientOrganizationId, appMode, reportId } = args;
20470
+ return ctx.api.get(`/api/reports/monthly/${reportId}/feedback`, {
20471
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20472
+ });
20473
+ }
20474
+ };
20475
+ checkReportReadinessSchema = external_exports.object({
20476
+ ...clientTarget,
20477
+ month: external_exports.number().int().min(1).max(12).optional(),
20478
+ year: external_exports.number().int().min(2020).max(2100).optional(),
20479
+ startMonth: external_exports.number().int().min(1).max(12).optional(),
20480
+ startYear: external_exports.number().int().min(2020).max(2100).optional(),
20481
+ endMonth: external_exports.number().int().min(1).max(12).optional(),
20482
+ endYear: external_exports.number().int().min(2020).max(2100).optional(),
20483
+ quarter: external_exports.number().int().min(1).max(4).optional()
20484
+ });
20485
+ check_report_readiness = {
20486
+ name: "check_report_readiness",
20487
+ description: "Pre-flight check before generating a report. Confirms whether analytics data is available for the requested window (month+year, OR startMonth+startYear+endMonth+endYear for quarterly, OR year+quarter). Returns hasData, missingDays, daily metric counts.",
20488
+ inputSchema: checkReportReadinessSchema,
20489
+ handler: async (args, ctx) => {
20490
+ const { clientUserId, clientOrganizationId, appMode, ...q } = args;
20491
+ const query = {};
20492
+ for (const [k, v] of Object.entries(q)) {
20493
+ if (v !== void 0) query[k] = v;
20494
+ }
20495
+ return ctx.api.get("/api/reports/analytics-check", {
20496
+ query,
20497
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20498
+ });
20499
+ }
20500
+ };
20501
+ getExtensionReportDataSchema = external_exports.object({
20502
+ ...clientTarget,
20503
+ month: external_exports.number().int().min(1).max(12).optional(),
20504
+ year: external_exports.number().int().min(2020).max(2100).optional(),
20505
+ startMonth: external_exports.number().int().min(1).max(12).optional(),
20506
+ startYear: external_exports.number().int().min(2020).max(2100).optional(),
20507
+ endMonth: external_exports.number().int().min(1).max(12).optional(),
20508
+ endYear: external_exports.number().int().min(2020).max(2100).optional(),
20509
+ quarter: external_exports.number().int().min(1).max(4).optional()
20510
+ });
20511
+ get_report_extension_data = {
20512
+ name: "get_report_extension_data",
20513
+ description: "Pulls the extension-scraped metrics block used during report generation (followers, impressions, engagements, breakdowns, post list) for a given period. Use this for accurate numbers when drafting a report narrative manually.",
20514
+ inputSchema: getExtensionReportDataSchema,
20515
+ handler: async (args, ctx) => {
20516
+ const { clientUserId, clientOrganizationId, appMode, ...q } = args;
20517
+ const query = {};
20518
+ for (const [k, v] of Object.entries(q)) {
20519
+ if (v !== void 0) query[k] = v;
20520
+ }
20521
+ return ctx.api.get("/api/reports/extension-data", {
20522
+ query,
20523
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20524
+ });
20525
+ }
20526
+ };
20527
+ registerTools(
20528
+ list_reports,
20529
+ get_report,
20530
+ update_report,
20531
+ delete_report,
20532
+ get_report_feedback,
20533
+ check_report_readiness,
20534
+ get_report_extension_data
20535
+ );
19829
20536
  }
19830
20537
  });
19831
20538
 
@@ -19885,9 +20592,16 @@ var init_exclusions = __esm({
19885
20592
  // src/tools/images.ts
19886
20593
  var images_exports = {};
19887
20594
  __export(images_exports, {
19888
- list_images: () => list_images
20595
+ create_image_folder: () => create_image_folder,
20596
+ delete_image: () => delete_image,
20597
+ delete_image_folder: () => delete_image_folder,
20598
+ get_image: () => get_image,
20599
+ list_image_folders: () => list_image_folders,
20600
+ list_images: () => list_images,
20601
+ move_image: () => move_image,
20602
+ rename_image_folder: () => rename_image_folder
19889
20603
  });
19890
- var listImagesSchema, list_images;
20604
+ var listImagesSchema, list_images, getImageSchema, get_image, moveImageSchema, move_image, deleteImageSchema, delete_image, listImageFoldersSchema, list_image_folders, createImageFolderSchema, create_image_folder, renameImageFolderSchema, rename_image_folder, deleteImageFolderSchema, delete_image_folder;
19891
20605
  var init_images = __esm({
19892
20606
  "src/tools/images.ts"() {
19893
20607
  "use strict";
@@ -19912,7 +20626,128 @@ var init_images = __esm({
19912
20626
  });
19913
20627
  }
19914
20628
  };
19915
- registerTools(list_images);
20629
+ getImageSchema = external_exports.object({
20630
+ ...clientTarget,
20631
+ imageId: external_exports.string().uuid()
20632
+ });
20633
+ get_image = {
20634
+ name: "get_image",
20635
+ description: "Single image detail: URL, dimensions, description, folder, tags, created_at.",
20636
+ inputSchema: getImageSchema,
20637
+ handler: async (args, ctx) => {
20638
+ const { clientUserId, clientOrganizationId, appMode, imageId } = args;
20639
+ return ctx.api.get(`/api/image-library/${imageId}`, {
20640
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20641
+ });
20642
+ }
20643
+ };
20644
+ moveImageSchema = external_exports.object({
20645
+ ...clientTarget,
20646
+ imageId: external_exports.string().uuid(),
20647
+ folder_id: external_exports.string().uuid().nullable()
20648
+ });
20649
+ move_image = {
20650
+ name: "move_image",
20651
+ description: "Move an image to a folder (or to root with folder_id=null).",
20652
+ inputSchema: moveImageSchema,
20653
+ handler: async (args, ctx) => {
20654
+ const { clientUserId, clientOrganizationId, appMode, imageId, folder_id } = args;
20655
+ return ctx.api.patch(`/api/image-library/${imageId}`, {
20656
+ body: { folder_id },
20657
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20658
+ });
20659
+ }
20660
+ };
20661
+ deleteImageSchema = external_exports.object({
20662
+ ...clientTarget,
20663
+ imageId: external_exports.string().uuid()
20664
+ });
20665
+ delete_image = {
20666
+ name: "delete_image",
20667
+ description: "Delete an image from the library (removes storage object + row).",
20668
+ inputSchema: deleteImageSchema,
20669
+ handler: async (args, ctx) => {
20670
+ const { clientUserId, clientOrganizationId, appMode, imageId } = args;
20671
+ return ctx.api.delete(`/api/image-library/${imageId}`, {
20672
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20673
+ });
20674
+ }
20675
+ };
20676
+ listImageFoldersSchema = external_exports.object({
20677
+ ...clientTarget,
20678
+ parent_id: external_exports.string().uuid().optional()
20679
+ });
20680
+ list_image_folders = {
20681
+ name: "list_image_folders",
20682
+ description: "Image library folders for a client. Optional parent_id to list children of a specific folder.",
20683
+ inputSchema: listImageFoldersSchema,
20684
+ handler: async (args, ctx) => {
20685
+ const { clientUserId, clientOrganizationId, appMode, parent_id } = args;
20686
+ return ctx.api.get("/api/image-library/folders", {
20687
+ query: compact({ parent_id }),
20688
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20689
+ });
20690
+ }
20691
+ };
20692
+ createImageFolderSchema = external_exports.object({
20693
+ ...clientTarget,
20694
+ name: external_exports.string().min(1).max(100),
20695
+ parent_id: external_exports.string().uuid().nullable().optional()
20696
+ });
20697
+ create_image_folder = {
20698
+ name: "create_image_folder",
20699
+ description: "Create a new image folder.",
20700
+ inputSchema: createImageFolderSchema,
20701
+ handler: async (args, ctx) => {
20702
+ const { clientUserId, clientOrganizationId, appMode, ...body } = args;
20703
+ return ctx.api.post("/api/image-library/folders", {
20704
+ body,
20705
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20706
+ });
20707
+ }
20708
+ };
20709
+ renameImageFolderSchema = external_exports.object({
20710
+ ...clientTarget,
20711
+ folderId: external_exports.string().uuid(),
20712
+ name: external_exports.string().min(1).max(100)
20713
+ });
20714
+ rename_image_folder = {
20715
+ name: "rename_image_folder",
20716
+ description: "Rename an image folder. Folder IDs are stable \u2014 storage paths use the UUID so renames never move files.",
20717
+ inputSchema: renameImageFolderSchema,
20718
+ handler: async (args, ctx) => {
20719
+ const { clientUserId, clientOrganizationId, appMode, folderId, name } = args;
20720
+ return ctx.api.patch(`/api/image-library/folders/${folderId}`, {
20721
+ body: { name },
20722
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20723
+ });
20724
+ }
20725
+ };
20726
+ deleteImageFolderSchema = external_exports.object({
20727
+ ...clientTarget,
20728
+ folderId: external_exports.string().uuid()
20729
+ });
20730
+ delete_image_folder = {
20731
+ name: "delete_image_folder",
20732
+ description: "Delete a folder. Images inside move to root (ON DELETE SET NULL on folder_id).",
20733
+ inputSchema: deleteImageFolderSchema,
20734
+ handler: async (args, ctx) => {
20735
+ const { clientUserId, clientOrganizationId, appMode, folderId } = args;
20736
+ return ctx.api.delete(`/api/image-library/folders/${folderId}`, {
20737
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20738
+ });
20739
+ }
20740
+ };
20741
+ registerTools(
20742
+ list_images,
20743
+ get_image,
20744
+ move_image,
20745
+ delete_image,
20746
+ list_image_folders,
20747
+ create_image_folder,
20748
+ rename_image_folder,
20749
+ delete_image_folder
20750
+ );
19916
20751
  }
19917
20752
  });
19918
20753
 
@@ -19947,9 +20782,15 @@ var init_feedback = __esm({
19947
20782
  // src/tools/analytics-deep.ts
19948
20783
  var analytics_deep_exports = {};
19949
20784
  __export(analytics_deep_exports, {
19950
- get_analytics_deep_dive: () => get_analytics_deep_dive
20785
+ get_analytics_deep_dive: () => get_analytics_deep_dive,
20786
+ get_icp_contacts: () => get_icp_contacts,
20787
+ get_icp_post_engagement: () => get_icp_post_engagement,
20788
+ get_linkedin_analytics: () => get_linkedin_analytics,
20789
+ get_mip_history: () => get_mip_history,
20790
+ reset_mip: () => reset_mip,
20791
+ run_mip_analysis: () => run_mip_analysis
19951
20792
  });
19952
- var getAnalyticsDeepDiveSchema, get_analytics_deep_dive;
20793
+ var getAnalyticsDeepDiveSchema, get_analytics_deep_dive, getLinkedinAnalyticsSchema, get_linkedin_analytics, getMipHistorySchema, get_mip_history, runMipAnalysisSchema, run_mip_analysis, resetMipSchema, reset_mip, getIcpContactsSchema, get_icp_contacts, getIcpPostSchema, get_icp_post_engagement;
19953
20794
  var init_analytics_deep = __esm({
19954
20795
  "src/tools/analytics-deep.ts"() {
19955
20796
  "use strict";
@@ -19963,7 +20804,7 @@ var init_analytics_deep = __esm({
19963
20804
  });
19964
20805
  get_analytics_deep_dive = {
19965
20806
  name: "get_analytics_deep_dive",
19966
- description: "PIP/MIP-style deep analytics: baseline metrics, top-performing posts with scores, Shield-Index-style insights, and MIP history. Choose which sections via `include`.",
20807
+ description: "PIP/MIP-style deep analytics: baseline metrics, top-performing posts with scores, Shield-Index-style insights, and MIP history. Choose which sections via `include` (default: baseline+posts+insights).",
19967
20808
  inputSchema: getAnalyticsDeepDiveSchema,
19968
20809
  handler: async (args, ctx) => {
19969
20810
  const include = args.include ?? ["baseline", "posts", "insights"];
@@ -19988,7 +20829,119 @@ var init_analytics_deep = __esm({
19988
20829
  return Object.fromEntries(entries);
19989
20830
  }
19990
20831
  };
19991
- registerTools(get_analytics_deep_dive);
20832
+ getLinkedinAnalyticsSchema = external_exports.object({
20833
+ ...clientTarget,
20834
+ days: external_exports.number().int().min(1).max(730).optional()
20835
+ });
20836
+ get_linkedin_analytics = {
20837
+ name: "get_linkedin_analytics",
20838
+ description: "Raw LinkedIn daily metrics for the client (followers, impressions, engagements per day, cumulative). Prefer get_analytics for the UI-shaped summary; use this when you need day-by-day arrays.",
20839
+ inputSchema: getLinkedinAnalyticsSchema,
20840
+ handler: async (args, ctx) => {
20841
+ const { clientUserId, clientOrganizationId, appMode, days } = args;
20842
+ return ctx.api.get("/api/linkedin-analytics", {
20843
+ query: compact({ days }),
20844
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20845
+ });
20846
+ }
20847
+ };
20848
+ getMipHistorySchema = external_exports.object({
20849
+ ...clientTarget,
20850
+ profileId: external_exports.string().uuid().optional(),
20851
+ limit: external_exports.number().int().min(1).max(200).optional()
20852
+ });
20853
+ get_mip_history = {
20854
+ name: "get_mip_history",
20855
+ description: "MIP (Manual Ingestion Pipeline) job history \u2014 completed/failed runs with article counts and timestamps. profileId defaults to the impersonated client's profile.",
20856
+ inputSchema: getMipHistorySchema,
20857
+ handler: async (args, ctx) => {
20858
+ const { clientUserId, clientOrganizationId, appMode, ...q } = args;
20859
+ return ctx.api.get("/api/analytics/mip/history", {
20860
+ query: compact(q),
20861
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20862
+ });
20863
+ }
20864
+ };
20865
+ runMipAnalysisSchema = external_exports.object({
20866
+ ...clientTarget,
20867
+ profileId: external_exports.string().uuid().optional()
20868
+ });
20869
+ run_mip_analysis = {
20870
+ name: "run_mip_analysis",
20871
+ description: "Kick off a new MIP analysis job for a client (fetch fresh articles + score them). Expensive \u2014 the server short-circuits if a completed job exists in the last 2 hours. profileId defaults to the impersonated client's profile.",
20872
+ inputSchema: runMipAnalysisSchema,
20873
+ handler: async (args, ctx) => {
20874
+ const { clientUserId, clientOrganizationId, appMode, profileId } = args;
20875
+ return ctx.api.post("/api/analytics/mip/run", {
20876
+ body: profileId ? { profileId } : {},
20877
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20878
+ });
20879
+ }
20880
+ };
20881
+ resetMipSchema = external_exports.object({
20882
+ ...clientTarget,
20883
+ profileId: external_exports.string().uuid()
20884
+ });
20885
+ reset_mip = {
20886
+ name: "reset_mip",
20887
+ description: "Wipe MIP state for a profile (jobs, news, scores). Used when the ingestion pipeline got into a bad state. Requires explicit profileId.",
20888
+ inputSchema: resetMipSchema,
20889
+ handler: async (args, ctx) => {
20890
+ const { clientUserId, clientOrganizationId, appMode, profileId } = args;
20891
+ return ctx.api.delete("/api/analytics/mip/reset", {
20892
+ body: { profileId },
20893
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20894
+ });
20895
+ }
20896
+ };
20897
+ getIcpContactsSchema = external_exports.object({
20898
+ ...clientTarget,
20899
+ days: external_exports.number().int().min(1).max(730).optional(),
20900
+ startDate: external_exports.string().optional(),
20901
+ endDate: external_exports.string().optional(),
20902
+ intentType: external_exports.enum(["YOUR_PROFILE", "YOUR_COMPANY", "VISITED_PROFILE", "YOUR_COMPANY_FOLLOWERS"]).optional(),
20903
+ search: external_exports.string().optional(),
20904
+ page: external_exports.number().int().min(1).optional(),
20905
+ limit: external_exports.number().int().min(1).max(500).optional()
20906
+ });
20907
+ get_icp_contacts = {
20908
+ name: "get_icp_contacts",
20909
+ description: "Goji-berry ICP contacts for a client (people engaging with their content by intent type). Filter by date range, intent, search, paginated.",
20910
+ inputSchema: getIcpContactsSchema,
20911
+ handler: async (args, ctx) => {
20912
+ const { clientUserId, clientOrganizationId, appMode, ...q } = args;
20913
+ return ctx.api.get("/api/analytics/icp/contacts", {
20914
+ query: compact(q),
20915
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20916
+ });
20917
+ }
20918
+ };
20919
+ getIcpPostSchema = external_exports.object({
20920
+ ...clientTarget,
20921
+ postUrn: external_exports.string(),
20922
+ forceRefresh: external_exports.boolean().optional()
20923
+ });
20924
+ get_icp_post_engagement = {
20925
+ name: "get_icp_post_engagement",
20926
+ description: "ICP engagement breakdown for a single LinkedIn post URN. Useful for drilling into who interacted with a high-performer.",
20927
+ inputSchema: getIcpPostSchema,
20928
+ handler: async (args, ctx) => {
20929
+ const { clientUserId, clientOrganizationId, appMode, postUrn, forceRefresh } = args;
20930
+ return ctx.api.get("/api/analytics/icp", {
20931
+ query: compact({ postUrn, forceRefresh }),
20932
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20933
+ });
20934
+ }
20935
+ };
20936
+ registerTools(
20937
+ get_analytics_deep_dive,
20938
+ get_linkedin_analytics,
20939
+ get_mip_history,
20940
+ run_mip_analysis,
20941
+ reset_mip,
20942
+ get_icp_contacts,
20943
+ get_icp_post_engagement
20944
+ );
19992
20945
  }
19993
20946
  });
19994
20947
 
@@ -20247,6 +21200,315 @@ var init_chat = __esm({
20247
21200
  }
20248
21201
  });
20249
21202
 
21203
+ // src/tools/conversations.ts
21204
+ var conversations_exports = {};
21205
+ __export(conversations_exports, {
21206
+ delete_conversation: () => delete_conversation,
21207
+ get_conversation: () => get_conversation,
21208
+ get_conversation_messages: () => get_conversation_messages,
21209
+ list_conversations: () => list_conversations
21210
+ });
21211
+ var listConversationsSchema, list_conversations, getConversationSchema, get_conversation, getMessagesSchema, get_conversation_messages, deleteConversationSchema, delete_conversation;
21212
+ var init_conversations = __esm({
21213
+ "src/tools/conversations.ts"() {
21214
+ "use strict";
21215
+ init_zod();
21216
+ init_tools();
21217
+ init_shared();
21218
+ listConversationsSchema = external_exports.object({
21219
+ ...clientTarget,
21220
+ summary: external_exports.boolean().optional(),
21221
+ limit: external_exports.number().int().min(1).max(500).optional(),
21222
+ offset: external_exports.number().int().min(0).optional()
21223
+ });
21224
+ list_conversations = {
21225
+ name: "list_conversations",
21226
+ description: "Chat/AI conversations for a client, newest first. Pass summary=true for a compact list (no bodies). Each conversation includes flow_type (generate_post, monthly_report, content_source_chat, etc.) + linked content_piece_id.",
21227
+ inputSchema: listConversationsSchema,
21228
+ handler: async (args, ctx) => {
21229
+ const { clientUserId, clientOrganizationId, appMode, ...q } = args;
21230
+ return ctx.api.get("/api/conversations", {
21231
+ query: compact(q),
21232
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
21233
+ });
21234
+ }
21235
+ };
21236
+ getConversationSchema = external_exports.object({
21237
+ ...clientTarget,
21238
+ conversationId: external_exports.string().uuid()
21239
+ });
21240
+ get_conversation = {
21241
+ name: "get_conversation",
21242
+ description: "Conversation metadata + all messages in order. Use for auditing a chat session, recovering a lost draft, or understanding what the AI saw.",
21243
+ inputSchema: getConversationSchema,
21244
+ handler: async (args, ctx) => {
21245
+ const { clientUserId, clientOrganizationId, appMode, conversationId } = args;
21246
+ return ctx.api.get(`/api/conversations/${conversationId}`, {
21247
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
21248
+ });
21249
+ }
21250
+ };
21251
+ getMessagesSchema = external_exports.object({
21252
+ ...clientTarget,
21253
+ conversationId: external_exports.string().uuid()
21254
+ });
21255
+ get_conversation_messages = {
21256
+ name: "get_conversation_messages",
21257
+ description: "Just the messages for a conversation, flat. Cheaper than get_conversation when you already have the metadata.",
21258
+ inputSchema: getMessagesSchema,
21259
+ handler: async (args, ctx) => {
21260
+ const { clientUserId, clientOrganizationId, appMode, conversationId } = args;
21261
+ return ctx.api.get("/api/messages", {
21262
+ query: { conversation_id: conversationId },
21263
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
21264
+ });
21265
+ }
21266
+ };
21267
+ deleteConversationSchema = external_exports.object({
21268
+ ...clientTarget,
21269
+ conversationId: external_exports.string().uuid()
21270
+ });
21271
+ delete_conversation = {
21272
+ name: "delete_conversation",
21273
+ description: "Delete a conversation and all of its messages. Irreversible.",
21274
+ inputSchema: deleteConversationSchema,
21275
+ handler: async (args, ctx) => {
21276
+ const { clientUserId, clientOrganizationId, appMode, conversationId } = args;
21277
+ return ctx.api.delete(`/api/conversations/${conversationId}`, {
21278
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
21279
+ });
21280
+ }
21281
+ };
21282
+ registerTools(
21283
+ list_conversations,
21284
+ get_conversation,
21285
+ get_conversation_messages,
21286
+ delete_conversation
21287
+ );
21288
+ }
21289
+ });
21290
+
21291
+ // src/tools/strategist.ts
21292
+ var strategist_exports = {};
21293
+ __export(strategist_exports, {
21294
+ create_client_resource: () => create_client_resource,
21295
+ delete_client_resource: () => delete_client_resource,
21296
+ get_client_risk_breakdown: () => get_client_risk_breakdown,
21297
+ get_client_roadmap: () => get_client_roadmap,
21298
+ list_client_resources: () => list_client_resources,
21299
+ reset_client_tour: () => reset_client_tour,
21300
+ update_client_roadmap: () => update_client_roadmap
21301
+ });
21302
+ var getClientRiskBreakdownSchema, get_client_risk_breakdown, getClientRoadmapSchema, get_client_roadmap, updateClientRoadmapSchema, update_client_roadmap, resetClientTourSchema, reset_client_tour, createClientResourceSchema, create_client_resource, listClientResourcesSchema, list_client_resources, deleteClientResourceSchema, delete_client_resource;
21303
+ var init_strategist = __esm({
21304
+ "src/tools/strategist.ts"() {
21305
+ "use strict";
21306
+ init_zod();
21307
+ init_tools();
21308
+ getClientRiskBreakdownSchema = external_exports.object({
21309
+ clientId: external_exports.string().uuid(),
21310
+ organization_id: external_exports.string().uuid(),
21311
+ assignment_id: external_exports.string().uuid().optional()
21312
+ });
21313
+ get_client_risk_breakdown = {
21314
+ name: "get_client_risk_breakdown",
21315
+ description: "Full risk-model signal breakdown for a client: posting adherence, feedback sentiment, engagement trend, comment responsiveness, each with score + inputs. Use to explain the churn-risk number.",
21316
+ inputSchema: getClientRiskBreakdownSchema,
21317
+ handler: async (args, ctx) => {
21318
+ const query = { organization_id: args.organization_id };
21319
+ if (args.assignment_id) query.assignment_id = args.assignment_id;
21320
+ return ctx.api.get(`/api/strategist/clients/${args.clientId}/risk-breakdown`, { query });
21321
+ }
21322
+ };
21323
+ getClientRoadmapSchema = external_exports.object({
21324
+ clientId: external_exports.string().uuid(),
21325
+ organization_id: external_exports.string().uuid()
21326
+ });
21327
+ get_client_roadmap = {
21328
+ name: "get_client_roadmap",
21329
+ description: "Strategist-view roadmap for a client: 5-phase DFY onboarding status, auto-signals (kickoff completed, first post scheduled, etc.), manual toggles, and next actions. Complements get_setup_progress (which is the client-facing checklist).",
21330
+ inputSchema: getClientRoadmapSchema,
21331
+ handler: async (args, ctx) => {
21332
+ return ctx.api.get(`/api/strategist/clients/${args.clientId}/roadmap`, {
21333
+ query: { organization_id: args.organization_id }
21334
+ });
21335
+ }
21336
+ };
21337
+ updateClientRoadmapSchema = external_exports.object({
21338
+ clientId: external_exports.string().uuid(),
21339
+ organization_id: external_exports.string().uuid(),
21340
+ updates: external_exports.record(external_exports.string(), external_exports.boolean()).optional(),
21341
+ dfy_phase_updates: external_exports.record(external_exports.string(), external_exports.boolean()).optional()
21342
+ });
21343
+ update_client_roadmap = {
21344
+ name: "update_client_roadmap",
21345
+ description: "Manually toggle roadmap checkpoints. `updates` = legacy setup keys (boolean per key). `dfy_phase_updates` = DFY phase keys ('phase1.kickoff', 'phase2.first_post', ...). At least one of the two must be provided.",
21346
+ inputSchema: updateClientRoadmapSchema,
21347
+ handler: async (args, ctx) => {
21348
+ const body = { organization_id: args.organization_id };
21349
+ if (args.updates) body.updates = args.updates;
21350
+ if (args.dfy_phase_updates) body.dfy_phase_updates = args.dfy_phase_updates;
21351
+ return ctx.api.patch(`/api/strategist/clients/${args.clientId}/roadmap`, { body });
21352
+ }
21353
+ };
21354
+ resetClientTourSchema = external_exports.object({
21355
+ clientId: external_exports.string().uuid(),
21356
+ organization_id: external_exports.string().uuid()
21357
+ });
21358
+ reset_client_tour = {
21359
+ name: "reset_client_tour",
21360
+ description: "Reset the product-tour state for a client so the next time they log in, the onboarding walkthroughs show again.",
21361
+ inputSchema: resetClientTourSchema,
21362
+ handler: async (args, ctx) => {
21363
+ return ctx.api.post(`/api/strategist/clients/${args.clientId}/reset-tour`, {
21364
+ body: { organization_id: args.organization_id }
21365
+ });
21366
+ }
21367
+ };
21368
+ createClientResourceSchema = external_exports.object({
21369
+ clientId: external_exports.string().uuid(),
21370
+ organization_id: external_exports.string().uuid(),
21371
+ name: external_exports.string().min(1).max(200),
21372
+ resource_type: external_exports.string(),
21373
+ template: external_exports.string().optional(),
21374
+ content: external_exports.string().optional(),
21375
+ conversation_id: external_exports.string().uuid().nullable().optional()
21376
+ });
21377
+ create_client_resource = {
21378
+ name: "create_client_resource",
21379
+ description: "Create a new resource (strategy doc, content pillars, playbook, custom markdown) for a specific client. `template` = starter template name (optional); `content` = explicit markdown body (takes priority over template).",
21380
+ inputSchema: createClientResourceSchema,
21381
+ handler: async (args, ctx) => {
21382
+ const { clientId, ...body } = args;
21383
+ return ctx.api.post(`/api/strategist/clients/${clientId}/resources`, { body });
21384
+ }
21385
+ };
21386
+ listClientResourcesSchema = external_exports.object({
21387
+ clientId: external_exports.string().uuid(),
21388
+ organization_id: external_exports.string().uuid()
21389
+ });
21390
+ list_client_resources = {
21391
+ name: "list_client_resources",
21392
+ description: "Strategist-view resource library for a client (includes disabled). Different from list_resources (client-view, enabled-only).",
21393
+ inputSchema: listClientResourcesSchema,
21394
+ handler: async (args, ctx) => {
21395
+ return ctx.api.get(`/api/strategist/clients/${args.clientId}/resources`, {
21396
+ query: { organization_id: args.organization_id }
21397
+ });
21398
+ }
21399
+ };
21400
+ deleteClientResourceSchema = external_exports.object({
21401
+ clientId: external_exports.string().uuid(),
21402
+ resourceId: external_exports.string().uuid()
21403
+ });
21404
+ delete_client_resource = {
21405
+ name: "delete_client_resource",
21406
+ description: "Remove a resource from a specific client's library (hard delete). Use the non-strategist delete_resource when scoped by the regular org flow.",
21407
+ inputSchema: deleteClientResourceSchema,
21408
+ handler: async (args, ctx) => {
21409
+ return ctx.api.delete(
21410
+ `/api/strategist/clients/${args.clientId}/resources/${args.resourceId}`
21411
+ );
21412
+ }
21413
+ };
21414
+ registerTools(
21415
+ get_client_risk_breakdown,
21416
+ get_client_roadmap,
21417
+ update_client_roadmap,
21418
+ reset_client_tour,
21419
+ create_client_resource,
21420
+ list_client_resources,
21421
+ delete_client_resource
21422
+ );
21423
+ }
21424
+ });
21425
+
21426
+ // src/tools/home.ts
21427
+ var home_exports = {};
21428
+ __export(home_exports, {
21429
+ get_home_summary: () => get_home_summary,
21430
+ get_leaderboard: () => get_leaderboard,
21431
+ get_linkedin_status: () => get_linkedin_status,
21432
+ get_profile: () => get_profile,
21433
+ update_profile: () => update_profile
21434
+ });
21435
+ var getHomeSummarySchema, get_home_summary, getProfileSchema, get_profile, updateProfileSchema, update_profile, getLeaderboardSchema, get_leaderboard, getLinkedinStatusSchema, get_linkedin_status;
21436
+ var init_home = __esm({
21437
+ "src/tools/home.ts"() {
21438
+ "use strict";
21439
+ init_zod();
21440
+ init_tools();
21441
+ init_shared();
21442
+ getHomeSummarySchema = external_exports.object({ ...clientTarget });
21443
+ get_home_summary = {
21444
+ name: "get_home_summary",
21445
+ description: "Home-tab snapshot for a client: recent activity, pipeline counts, attention items (review/in_revision), and posting cadence. Mirrors the /home page on notusOS.",
21446
+ inputSchema: getHomeSummarySchema,
21447
+ handler: async (args, ctx) => {
21448
+ return ctx.api.get("/api/home-summary", { clientContext: toClientContext(args) });
21449
+ }
21450
+ };
21451
+ getProfileSchema = external_exports.object({ ...clientTarget });
21452
+ get_profile = {
21453
+ name: "get_profile",
21454
+ description: "Full profile row for a client: knowledge_base (onboarding Q&A), content_archetype (pillar framework), LinkedIn settings, language, timezone, etc. Use instead of get_client_detail when you want the raw profile JSON.",
21455
+ inputSchema: getProfileSchema,
21456
+ handler: async (args, ctx) => {
21457
+ return ctx.api.get("/api/profile", { clientContext: toClientContext(args) });
21458
+ }
21459
+ };
21460
+ updateProfileSchema = external_exports.object({
21461
+ ...clientTarget,
21462
+ knowledge_base: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
21463
+ content_archetype: external_exports.record(external_exports.string(), external_exports.unknown()).nullable().optional(),
21464
+ full_name: external_exports.string().optional(),
21465
+ title: external_exports.string().optional(),
21466
+ linkedin_profile_url: external_exports.string().optional(),
21467
+ language: external_exports.string().optional(),
21468
+ client_timezone: external_exports.string().optional(),
21469
+ riverside_studio_url: external_exports.string().optional(),
21470
+ company_website: external_exports.string().optional()
21471
+ });
21472
+ update_profile = {
21473
+ name: "update_profile",
21474
+ description: "Update profile fields. Pass only fields to change. knowledge_base and content_archetype are merged into existing JSON.",
21475
+ inputSchema: updateProfileSchema,
21476
+ handler: async (args, ctx) => {
21477
+ const { clientUserId, clientOrganizationId, appMode, ...body } = args;
21478
+ return ctx.api.put("/api/profile", {
21479
+ body,
21480
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
21481
+ });
21482
+ }
21483
+ };
21484
+ getLeaderboardSchema = external_exports.object({ ...clientTarget });
21485
+ get_leaderboard = {
21486
+ name: "get_leaderboard",
21487
+ description: "Leaderboard rankings (org-wide or network, depending on how the route scopes).",
21488
+ inputSchema: getLeaderboardSchema,
21489
+ handler: async (args, ctx) => {
21490
+ return ctx.api.get("/api/leaderboard", { clientContext: toClientContext(args) });
21491
+ }
21492
+ };
21493
+ getLinkedinStatusSchema = external_exports.object({ ...clientTarget });
21494
+ get_linkedin_status = {
21495
+ name: "get_linkedin_status",
21496
+ description: "LinkedIn connection status for a client (connected, last_synced_at, sync health).",
21497
+ inputSchema: getLinkedinStatusSchema,
21498
+ handler: async (args, ctx) => {
21499
+ return ctx.api.get("/api/linkedin/status", { clientContext: toClientContext(args) });
21500
+ }
21501
+ };
21502
+ registerTools(
21503
+ get_home_summary,
21504
+ get_profile,
21505
+ update_profile,
21506
+ get_leaderboard,
21507
+ get_linkedin_status
21508
+ );
21509
+ }
21510
+ });
21511
+
20250
21512
  // src/tools/index.ts
20251
21513
  function registerTools(...tools) {
20252
21514
  for (const t of tools) TOOLS.push(t);
@@ -20272,6 +21534,9 @@ async function registerAllTools() {
20272
21534
  await Promise.resolve().then(() => (init_inspiration(), inspiration_exports));
20273
21535
  await Promise.resolve().then(() => (init_memories(), memories_exports));
20274
21536
  await Promise.resolve().then(() => (init_chat(), chat_exports));
21537
+ await Promise.resolve().then(() => (init_conversations(), conversations_exports));
21538
+ await Promise.resolve().then(() => (init_strategist(), strategist_exports));
21539
+ await Promise.resolve().then(() => (init_home(), home_exports));
20275
21540
  }
20276
21541
  var TOOLS;
20277
21542
  var init_tools = __esm({
@@ -20484,7 +21749,7 @@ async function main() {
20484
21749
  }
20485
21750
  case "--version":
20486
21751
  case "-v": {
20487
- process.stderr.write("0.1.1\n");
21752
+ process.stderr.write("0.1.3\n");
20488
21753
  return;
20489
21754
  }
20490
21755
  default: {