@notus-os/mcp 0.1.2 → 0.1.4

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.
@@ -461,6 +461,9 @@ var init_api_client = __esm({
461
461
  patch(path, opts = {}) {
462
462
  return this.request("PATCH", path, { ...opts, mutation: opts.mutation ?? true });
463
463
  }
464
+ put(path, opts = {}) {
465
+ return this.request("PUT", path, { ...opts, mutation: opts.mutation ?? true });
466
+ }
464
467
  delete(path, opts = {}) {
465
468
  return this.request("DELETE", path, { ...opts, mutation: opts.mutation ?? true });
466
469
  }
@@ -19256,7 +19259,7 @@ var init_clients = __esm({
19256
19259
  });
19257
19260
  list_clients = {
19258
19261
  name: "list_clients",
19259
- description: "List the strategist's assigned clients across all organizations. Returns each client's profile, org, current onboarding phase, risk state, days since last post, and unresolved-comment counts. Use scope='mine' (default) for your clients; scope='global' is admin-only.",
19262
+ description: "List the strategist's assigned clients across all organizations. Returns each client's profile, org, assigned Content Strategist (strategist_user_id + full_name + email under assignment.strategist), internal notus Slack channel ID (slack_channel_id \u2014 this is the #client-name-notus-internal coordination channel, NOT the client-facing channel), current onboarding phase, risk state, days since last post, and unresolved-comment counts. Use scope='mine' (default) to filter to clients where you are the assigned CS (clients with no assignment are included so they can still be claimed). scope='global' is admin-only and returns every client across every org you can access.",
19260
19263
  inputSchema: listClientsSchema,
19261
19264
  handler: async (args, ctx) => {
19262
19265
  const query = {};
@@ -19270,7 +19273,7 @@ var init_clients = __esm({
19270
19273
  });
19271
19274
  get_client_detail = {
19272
19275
  name: "get_client_detail",
19273
- description: "Fetch a single client's full roadmap: profile, setup phase status, risk signals, and current strategist notes. Requires clientId (UUID). Pass organizationId when the client belongs to multiple orgs you manage.",
19276
+ description: "Fetch a single client's full roadmap: profile, setup phase status, risk signals, assigned Content Strategist, internal notus Slack channel ID (slack_channel_id \u2014 #client-name-notus-internal, the notus team's coordination channel, NOT the client-facing one), and current strategist notes. Requires clientId (UUID). Pass organizationId when the client belongs to multiple orgs you manage.",
19274
19277
  inputSchema: getClientDetailSchema,
19275
19278
  handler: async (args, ctx) => {
19276
19279
  const query = {};
@@ -19317,10 +19320,13 @@ var init_shared = __esm({
19317
19320
  // src/tools/setup.ts
19318
19321
  var setup_exports = {};
19319
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,
19320
19326
  get_setup_progress: () => get_setup_progress,
19321
19327
  update_setup_checkpoint: () => update_setup_checkpoint
19322
19328
  });
19323
- 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;
19324
19330
  var init_setup = __esm({
19325
19331
  "src/tools/setup.ts"() {
19326
19332
  "use strict";
@@ -19330,7 +19336,7 @@ var init_setup = __esm({
19330
19336
  getSetupProgressSchema = clientTargetSchema;
19331
19337
  get_setup_progress = {
19332
19338
  name: "get_setup_progress",
19333
- 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.",
19334
19340
  inputSchema: getSetupProgressSchema,
19335
19341
  handler: async (args, ctx) => {
19336
19342
  return ctx.api.get("/api/setup", { clientContext: toClientContext(args) });
@@ -19339,25 +19345,63 @@ var init_setup = __esm({
19339
19345
  updateSetupCheckpointSchema = external_exports.object({
19340
19346
  ...clientTargetSchema.shape,
19341
19347
  checkpointKey: external_exports.string().min(1).max(120),
19342
- checked: external_exports.boolean(),
19343
- dryRun: external_exports.boolean().optional()
19348
+ checked: external_exports.boolean()
19344
19349
  });
19345
19350
  update_setup_checkpoint = {
19346
19351
  name: "update_setup_checkpoint",
19347
19352
  description: "Mark an onboarding checkpoint as done/undone for a client. checkpointKey matches the setup page's checkpoint identifier.",
19348
19353
  inputSchema: updateSetupCheckpointSchema,
19349
19354
  handler: async (args, ctx) => {
19350
- const body = { checkpoint: args.checkpointKey, checked: args.checked };
19351
- if (args.dryRun) {
19352
- return { dryRun: true, would: { method: "PATCH", path: "/api/setup", body } };
19353
- }
19354
19355
  return ctx.api.patch("/api/setup", {
19355
- body,
19356
+ body: { checkpoint: args.checkpointKey, checked: args.checked },
19357
+ clientContext: toClientContext(args)
19358
+ });
19359
+ }
19360
+ };
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", {
19356
19368
  clientContext: toClientContext(args)
19357
19369
  });
19358
19370
  }
19359
19371
  };
19360
- registerTools(get_setup_progress, update_setup_checkpoint);
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
+ );
19361
19405
  }
19362
19406
  });
19363
19407
 
@@ -19365,12 +19409,14 @@ var init_setup = __esm({
19365
19409
  var posts_exports = {};
19366
19410
  __export(posts_exports, {
19367
19411
  create_post: () => create_post,
19412
+ delete_post: () => delete_post,
19368
19413
  generate_post: () => generate_post,
19369
19414
  get_post: () => get_post,
19415
+ get_post_versions: () => get_post_versions,
19370
19416
  list_posts: () => list_posts,
19371
19417
  update_post: () => update_post
19372
19418
  });
19373
- 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;
19374
19420
  var init_posts = __esm({
19375
19421
  "src/tools/posts.ts"() {
19376
19422
  "use strict";
@@ -19384,7 +19430,7 @@ var init_posts = __esm({
19384
19430
  });
19385
19431
  list_posts = {
19386
19432
  name: "list_posts",
19387
- 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.",
19388
19434
  inputSchema: listPostsSchema,
19389
19435
  handler: async (args, ctx) => {
19390
19436
  const { clientUserId, clientOrganizationId, appMode, ...q } = args;
@@ -19400,7 +19446,7 @@ var init_posts = __esm({
19400
19446
  });
19401
19447
  get_post = {
19402
19448
  name: "get_post",
19403
- 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.",
19404
19450
  inputSchema: getPostSchema,
19405
19451
  handler: async (args, ctx) => {
19406
19452
  const { clientUserId, clientOrganizationId, appMode, postId } = args;
@@ -19412,19 +19458,20 @@ var init_posts = __esm({
19412
19458
  createPostSchema = external_exports.object({
19413
19459
  ...clientTarget,
19414
19460
  body: external_exports.string().min(1).max(2e4),
19415
- title: external_exports.string().max(200).optional(),
19416
- status: external_exports.enum(["draft", "scheduled"]).default("draft"),
19417
- 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()
19418
19468
  });
19419
19469
  create_post = {
19420
19470
  name: "create_post",
19421
- 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.",
19422
19472
  inputSchema: createPostSchema,
19423
19473
  handler: async (args, ctx) => {
19424
- if (args.dryRun) {
19425
- return { dryRun: true, would: { method: "POST", path: "/api/posts", body: { body: args.body, title: args.title, status: args.status } } };
19426
- }
19427
- const { clientUserId, clientOrganizationId, appMode, dryRun: _dr, ...body } = args;
19474
+ const { clientUserId, clientOrganizationId, appMode, ...body } = args;
19428
19475
  return ctx.api.post("/api/posts", {
19429
19476
  body,
19430
19477
  clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
@@ -19434,22 +19481,49 @@ var init_posts = __esm({
19434
19481
  updatePostSchema = external_exports.object({
19435
19482
  ...clientTarget,
19436
19483
  postId: external_exports.string().uuid(),
19437
- body: external_exports.string().max(2e4).optional(),
19438
- title: external_exports.string().max(200).optional(),
19439
- status: external_exports.enum(["draft", "scheduled", "published", "archived"]).optional(),
19440
- 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()
19441
19488
  });
19442
19489
  update_post = {
19443
19490
  name: "update_post",
19444
- 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).",
19445
19492
  inputSchema: updatePostSchema,
19446
19493
  handler: async (args, ctx) => {
19447
- const { clientUserId, clientOrganizationId, appMode, postId, dryRun, ...patch } = args;
19448
- if (dryRun) {
19449
- return { dryRun: true, would: { method: "PATCH", path: `/api/posts/${postId}`, body: patch } };
19450
- }
19451
- return ctx.api.patch(`/api/posts/${postId}`, {
19452
- 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`, {
19453
19527
  clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19454
19528
  });
19455
19529
  }
@@ -19458,17 +19532,13 @@ var init_posts = __esm({
19458
19532
  ...clientTarget,
19459
19533
  prompt: external_exports.string().min(1).max(5e3),
19460
19534
  conversationId: external_exports.string().uuid().optional(),
19461
- contentPieceId: external_exports.string().uuid().optional(),
19462
- dryRun: external_exports.boolean().optional()
19535
+ contentPieceId: external_exports.string().uuid().optional()
19463
19536
  });
19464
19537
  generate_post = {
19465
19538
  name: "generate_post",
19466
- 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.",
19467
19540
  inputSchema: generatePostSchema,
19468
19541
  handler: async (args, ctx) => {
19469
- if (args.dryRun) {
19470
- return { dryRun: true, would: { method: "POST", path: "/api/chat", body: { message: args.prompt, flow_type: "generate_post", conversation_id: args.conversationId } } };
19471
- }
19472
19542
  const clientContext = toClientContext(args);
19473
19543
  let draft = "";
19474
19544
  let thinking = "";
@@ -19500,7 +19570,15 @@ var init_posts = __esm({
19500
19570
  return { draft: draft.trim(), thinking: thinking.trim() || void 0 };
19501
19571
  }
19502
19572
  };
19503
- 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
+ );
19504
19582
  }
19505
19583
  });
19506
19584
 
@@ -19508,9 +19586,13 @@ var init_posts = __esm({
19508
19586
  var content_pieces_exports = {};
19509
19587
  __export(content_pieces_exports, {
19510
19588
  create_content_piece: () => create_content_piece,
19511
- 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
19512
19594
  });
19513
- 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;
19514
19596
  var init_content_pieces = __esm({
19515
19597
  "src/tools/content-pieces.ts"() {
19516
19598
  "use strict";
@@ -19534,41 +19616,123 @@ var init_content_pieces = __esm({
19534
19616
  });
19535
19617
  }
19536
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
+ };
19537
19634
  createContentPieceSchema = external_exports.object({
19538
19635
  ...clientTarget,
19539
- title: external_exports.string().min(1).max(300),
19540
- idea_text: external_exports.string().min(1).max(5e3).optional(),
19541
- source_id: external_exports.string().uuid().optional(),
19542
- pillar: external_exports.string().max(100).optional(),
19543
- 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()
19544
19645
  });
19545
19646
  create_content_piece = {
19546
19647
  name: "create_content_piece",
19547
- 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.",
19548
19649
  inputSchema: createContentPieceSchema,
19549
19650
  handler: async (args, ctx) => {
19550
- const { clientUserId, clientOrganizationId, appMode, dryRun, ...body } = args;
19551
- if (dryRun) {
19552
- return { dryRun: true, would: { method: "POST", path: "/api/content-pieces", body } };
19553
- }
19651
+ const { clientUserId, clientOrganizationId, appMode, ...body } = args;
19554
19652
  return ctx.api.post("/api/content-pieces", {
19555
19653
  body,
19556
19654
  clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19557
19655
  });
19558
19656
  }
19559
19657
  };
19560
- 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
+ );
19561
19720
  }
19562
19721
  });
19563
19722
 
19564
19723
  // src/tools/resources.ts
19565
19724
  var resources_exports = {};
19566
19725
  __export(resources_exports, {
19726
+ delete_resource: () => delete_resource,
19567
19727
  get_brand_guidelines: () => get_brand_guidelines,
19568
19728
  get_resource: () => get_resource,
19569
- 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
19570
19734
  });
19571
- 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;
19572
19736
  var init_resources = __esm({
19573
19737
  "src/tools/resources.ts"() {
19574
19738
  "use strict";
@@ -19578,7 +19742,7 @@ var init_resources = __esm({
19578
19742
  listResourcesSchema = external_exports.object({ ...clientTarget });
19579
19743
  list_resources = {
19580
19744
  name: "list_resources",
19581
- 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.",
19582
19746
  inputSchema: listResourcesSchema,
19583
19747
  handler: async (args, ctx) => {
19584
19748
  return ctx.api.get("/api/resources", { clientContext: toClientContext(args) });
@@ -19599,16 +19763,114 @@ var init_resources = __esm({
19599
19763
  });
19600
19764
  }
19601
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
+ };
19602
19836
  getBrandGuidelinesSchema = external_exports.object({ ...clientTarget });
19603
19837
  get_brand_guidelines = {
19604
19838
  name: "get_brand_guidelines",
19605
- 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.",
19606
19840
  inputSchema: getBrandGuidelinesSchema,
19607
19841
  handler: async (args, ctx) => {
19608
19842
  return ctx.api.get("/api/brand-guidelines", { clientContext: toClientContext(args) });
19609
19843
  }
19610
19844
  };
19611
- 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
+ );
19612
19874
  }
19613
19875
  });
19614
19876
 
@@ -19727,10 +19989,16 @@ var init_analytics = __esm({
19727
19989
  var comments_exports = {};
19728
19990
  __export(comments_exports, {
19729
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,
19730
19996
  list_comments: () => list_comments,
19731
- resolve_comment: () => resolve_comment
19997
+ reply_to_comment: () => reply_to_comment,
19998
+ resolve_comment: () => resolve_comment,
19999
+ update_comment: () => update_comment
19732
20000
  });
19733
- 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;
19734
20002
  var init_comments = __esm({
19735
20003
  "src/tools/comments.ts"() {
19736
20004
  "use strict";
@@ -19757,18 +20025,54 @@ var init_comments = __esm({
19757
20025
  });
19758
20026
  }
19759
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
+ };
19760
20065
  addCommentSchema = external_exports.object({
19761
20066
  ...clientTarget,
19762
20067
  content: external_exports.string().min(1).max(4e3),
19763
20068
  contentPieceId: external_exports.string().uuid().optional(),
19764
20069
  resourceId: external_exports.string().uuid().optional(),
19765
20070
  reportId: external_exports.string().uuid().optional(),
19766
- contentSourceId: external_exports.string().uuid().optional(),
19767
- dryRun: external_exports.boolean().optional()
20071
+ contentSourceId: external_exports.string().uuid().optional()
19768
20072
  });
19769
20073
  add_comment = {
19770
20074
  name: "add_comment",
19771
- 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.",
19772
20076
  inputSchema: addCommentSchema,
19773
20077
  handler: async (args, ctx) => {
19774
20078
  const attach = [
@@ -19778,38 +20082,92 @@ var init_comments = __esm({
19778
20082
  args.contentSourceId && { content_source_id: args.contentSourceId }
19779
20083
  ].filter(Boolean);
19780
20084
  if (attach.length !== 1) {
19781
- throw new Error("Exactly one target id is required");
20085
+ throw new Error("Exactly one target id is required (contentPieceId/resourceId/reportId/contentSourceId)");
19782
20086
  }
19783
20087
  const body = { content: args.content, ...Object.assign({}, ...attach) };
19784
- if (args.dryRun) {
19785
- return { dryRun: true, would: { method: "POST", path: "/api/comments", body } };
19786
- }
19787
20088
  return ctx.api.post("/api/comments", {
19788
20089
  body,
19789
20090
  clientContext: toClientContext(args)
19790
20091
  });
19791
20092
  }
19792
20093
  };
19793
- resolveCommentSchema = external_exports.object({
20094
+ replyToCommentSchema = external_exports.object({
19794
20095
  ...clientTarget,
19795
20096
  commentId: external_exports.string().uuid(),
19796
- 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()
19797
20132
  });
19798
20133
  resolve_comment = {
19799
20134
  name: "resolve_comment",
19800
- description: "Mark a comment as resolved.",
20135
+ description: "Mark a comment as resolved (convenience wrapper over update_comment).",
19801
20136
  inputSchema: resolveCommentSchema,
19802
20137
  handler: async (args, ctx) => {
19803
- if (args.dryRun) {
19804
- return { dryRun: true, would: { method: "PATCH", path: `/api/comments/${args.commentId}`, body: { resolved: true } } };
19805
- }
19806
- return ctx.api.patch(`/api/comments/${args.commentId}`, {
20138
+ const { clientUserId, clientOrganizationId, appMode, commentId } = args;
20139
+ return ctx.api.patch(`/api/comments/${commentId}`, {
19807
20140
  body: { resolved: true },
19808
- clientContext: toClientContext(args)
20141
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19809
20142
  });
19810
20143
  }
19811
20144
  };
19812
- 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
+ );
19813
20171
  }
19814
20172
  });
19815
20173
 
@@ -19843,9 +20201,16 @@ var init_content_engine = __esm({
19843
20201
  // src/tools/content-sources.ts
19844
20202
  var content_sources_exports = {};
19845
20203
  __export(content_sources_exports, {
19846
- 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
19847
20212
  });
19848
- 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;
19849
20214
  var init_content_sources = __esm({
19850
20215
  "src/tools/content-sources.ts"() {
19851
20216
  "use strict";
@@ -19870,17 +20235,162 @@ var init_content_sources = __esm({
19870
20235
  });
19871
20236
  }
19872
20237
  };
19873
- 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
+ );
19874
20379
  }
19875
20380
  });
19876
20381
 
19877
20382
  // src/tools/reports.ts
19878
20383
  var reports_exports = {};
19879
20384
  __export(reports_exports, {
20385
+ check_report_readiness: () => check_report_readiness,
20386
+ delete_report: () => delete_report,
19880
20387
  get_report: () => get_report,
19881
- 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
19882
20392
  });
19883
- 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;
19884
20394
  var init_reports = __esm({
19885
20395
  "src/tools/reports.ts"() {
19886
20396
  "use strict";
@@ -19890,10 +20400,10 @@ var init_reports = __esm({
19890
20400
  listReportsSchema = external_exports.object({ ...clientTarget });
19891
20401
  list_reports = {
19892
20402
  name: "list_reports",
19893
- 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.",
19894
20404
  inputSchema: listReportsSchema,
19895
20405
  handler: async (args, ctx) => {
19896
- return ctx.api.get("/api/reports", { clientContext: toClientContext(args) });
20406
+ return ctx.api.get("/api/reports/monthly", { clientContext: toClientContext(args) });
19897
20407
  }
19898
20408
  };
19899
20409
  getReportSchema = external_exports.object({
@@ -19902,16 +20412,127 @@ var init_reports = __esm({
19902
20412
  });
19903
20413
  get_report = {
19904
20414
  name: "get_report",
19905
- 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.",
19906
20416
  inputSchema: getReportSchema,
19907
20417
  handler: async (args, ctx) => {
19908
20418
  const { clientUserId, clientOrganizationId, appMode, reportId } = args;
19909
- return ctx.api.get(`/api/reports/${reportId}`, {
20419
+ return ctx.api.get(`/api/reports/monthly/${reportId}`, {
20420
+ clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
20421
+ });
20422
+ }
20423
+ };
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,
19910
20497
  clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
19911
20498
  });
19912
20499
  }
19913
20500
  };
19914
- registerTools(list_reports, get_report);
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
+ );
19915
20536
  }
19916
20537
  });
19917
20538
 
@@ -19971,9 +20592,16 @@ var init_exclusions = __esm({
19971
20592
  // src/tools/images.ts
19972
20593
  var images_exports = {};
19973
20594
  __export(images_exports, {
19974
- 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
19975
20603
  });
19976
- 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;
19977
20605
  var init_images = __esm({
19978
20606
  "src/tools/images.ts"() {
19979
20607
  "use strict";
@@ -19998,7 +20626,128 @@ var init_images = __esm({
19998
20626
  });
19999
20627
  }
20000
20628
  };
20001
- 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
+ );
20002
20751
  }
20003
20752
  });
20004
20753
 
@@ -20033,9 +20782,15 @@ var init_feedback = __esm({
20033
20782
  // src/tools/analytics-deep.ts
20034
20783
  var analytics_deep_exports = {};
20035
20784
  __export(analytics_deep_exports, {
20036
- 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
20037
20792
  });
20038
- 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;
20039
20794
  var init_analytics_deep = __esm({
20040
20795
  "src/tools/analytics-deep.ts"() {
20041
20796
  "use strict";
@@ -20049,7 +20804,7 @@ var init_analytics_deep = __esm({
20049
20804
  });
20050
20805
  get_analytics_deep_dive = {
20051
20806
  name: "get_analytics_deep_dive",
20052
- 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).",
20053
20808
  inputSchema: getAnalyticsDeepDiveSchema,
20054
20809
  handler: async (args, ctx) => {
20055
20810
  const include = args.include ?? ["baseline", "posts", "insights"];
@@ -20074,7 +20829,119 @@ var init_analytics_deep = __esm({
20074
20829
  return Object.fromEntries(entries);
20075
20830
  }
20076
20831
  };
20077
- 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
+ );
20078
20945
  }
20079
20946
  });
20080
20947
 
@@ -20333,6 +21200,315 @@ var init_chat = __esm({
20333
21200
  }
20334
21201
  });
20335
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
+
20336
21512
  // src/tools/index.ts
20337
21513
  function registerTools(...tools) {
20338
21514
  for (const t of tools) TOOLS.push(t);
@@ -20358,6 +21534,9 @@ async function registerAllTools() {
20358
21534
  await Promise.resolve().then(() => (init_inspiration(), inspiration_exports));
20359
21535
  await Promise.resolve().then(() => (init_memories(), memories_exports));
20360
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));
20361
21540
  }
20362
21541
  var TOOLS;
20363
21542
  var init_tools = __esm({
@@ -20570,7 +21749,7 @@ async function main() {
20570
21749
  }
20571
21750
  case "--version":
20572
21751
  case "-v": {
20573
- process.stderr.write("0.1.2\n");
21752
+ process.stderr.write("0.1.3\n");
20574
21753
  return;
20575
21754
  }
20576
21755
  default: {