@debugbundle/mcp 1.0.2 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.cjs CHANGED
@@ -14628,8 +14628,22 @@ var BillingUsageMetricSchema = external_exports.object({
14628
14628
  used: external_exports.number().int().nonnegative(),
14629
14629
  limit: external_exports.number().int().nonnegative()
14630
14630
  }).strict();
14631
+ var BillingStateSchema = external_exports.enum(["active", "past_due", "canceled", "unpaid", "incomplete", "admin_override", "trialing", "trial_expired"]).nullable();
14632
+ var BillingTrialPlanSchema = external_exports.enum(["solo", "team"]);
14633
+ var BillingTrialSummarySchema = external_exports.object({
14634
+ available: external_exports.boolean(),
14635
+ active: external_exports.boolean(),
14636
+ plan: BillingTrialPlanSchema.nullable(),
14637
+ started_at: external_exports.string().nullable(),
14638
+ ends_at: external_exports.string().nullable(),
14639
+ used_at: external_exports.string().nullable(),
14640
+ converted_at: external_exports.string().nullable(),
14641
+ expired_at: external_exports.string().nullable(),
14642
+ days_remaining: external_exports.number().int().nullable()
14643
+ }).strict();
14631
14644
  var BillingSummarySchema = external_exports.object({
14632
14645
  plan: external_exports.enum(["free", "solo", "team"]),
14646
+ billing_state: BillingStateSchema,
14633
14647
  stripe_customer_id: external_exports.string().nullable(),
14634
14648
  active_projects: external_exports.number().int().nonnegative(),
14635
14649
  capacity_units: external_exports.object({
@@ -14653,7 +14667,8 @@ var BillingSummarySchema = external_exports.object({
14653
14667
  monthly_remote_activations: BillingUsageMetricSchema,
14654
14668
  monthly_alert_deliveries: BillingUsageMetricSchema,
14655
14669
  monthly_webhook_deliveries: BillingUsageMetricSchema
14656
- }).strict()
14670
+ }).strict(),
14671
+ trial: BillingTrialSummarySchema
14657
14672
  }).strict();
14658
14673
  var BillingSummaryResponseSchema = external_exports.object({
14659
14674
  billing: BillingSummarySchema
@@ -14699,6 +14714,18 @@ function createBillingApi(client) {
14699
14714
  })
14700
14715
  );
14701
14716
  },
14717
+ async startTrial(input) {
14718
+ return expectBilling(
14719
+ client.request({
14720
+ method: "POST",
14721
+ path: "/v1/billing/trial/start",
14722
+ bearerToken: input.bearerToken,
14723
+ body: {
14724
+ target_plan: input.targetPlan
14725
+ }
14726
+ })
14727
+ );
14728
+ },
14702
14729
  async increaseCapacity(input) {
14703
14730
  return expectBilling(
14704
14731
  client.request({
@@ -15076,6 +15103,7 @@ var ProjectRecordSchema = external_exports.object({
15076
15103
  relationship: external_exports.enum(["owned", "shared"]),
15077
15104
  sharing_state: external_exports.enum(["private", "shared_by_you", "shared_with_you"]),
15078
15105
  effective_role: external_exports.enum(["owner", "admin", "member"]),
15106
+ shared_access_suspended: external_exports.boolean().optional(),
15079
15107
  name: external_exports.string(),
15080
15108
  slug: external_exports.string(),
15081
15109
  environment_default: external_exports.string(),
@@ -15098,6 +15126,7 @@ var DeletedProjectRecordSchema = external_exports.object({
15098
15126
  relationship: external_exports.enum(["owned", "shared"]),
15099
15127
  sharing_state: external_exports.enum(["private", "shared_by_you", "shared_with_you"]),
15100
15128
  effective_role: external_exports.enum(["owner", "admin", "member"]),
15129
+ shared_access_suspended: external_exports.boolean().optional(),
15101
15130
  name: external_exports.string(),
15102
15131
  slug: external_exports.string(),
15103
15132
  environment_default: external_exports.string(),
@@ -15299,6 +15328,9 @@ var IncidentsResponseSchema = external_exports.object({
15299
15328
  var IncidentResponseSchema = external_exports.object({
15300
15329
  incident: IncidentSchema
15301
15330
  }).strict();
15331
+ var BulkIncidentResponseSchema = external_exports.object({
15332
+ incidents: external_exports.array(IncidentSchema)
15333
+ }).strict();
15302
15334
  var ImprovementResponseSchema = external_exports.object({
15303
15335
  improvement: ImprovementSchema
15304
15336
  }).strict();
@@ -15505,6 +15537,20 @@ function createRetrievalApi(client) {
15505
15537
  );
15506
15538
  return parsed.incident;
15507
15539
  },
15540
+ async resolveIncidents(input) {
15541
+ const parsed = await expectParsed(
15542
+ client.request({
15543
+ method: "POST",
15544
+ path: "/v1/incidents/resolve",
15545
+ bearerToken: input.bearerToken,
15546
+ body: {
15547
+ incident_ids: input.incidentIds
15548
+ }
15549
+ }),
15550
+ BulkIncidentResponseSchema
15551
+ );
15552
+ return parsed.incidents;
15553
+ },
15508
15554
  async reopenIncident(input) {
15509
15555
  const parsed = await expectParsed(
15510
15556
  client.request({
@@ -15516,6 +15562,20 @@ function createRetrievalApi(client) {
15516
15562
  );
15517
15563
  return parsed.incident;
15518
15564
  },
15565
+ async reopenIncidents(input) {
15566
+ const parsed = await expectParsed(
15567
+ client.request({
15568
+ method: "POST",
15569
+ path: "/v1/incidents/reopen",
15570
+ bearerToken: input.bearerToken,
15571
+ body: {
15572
+ incident_ids: input.incidentIds
15573
+ }
15574
+ }),
15575
+ BulkIncidentResponseSchema
15576
+ );
15577
+ return parsed.incidents;
15578
+ },
15519
15579
  async getBundle(input) {
15520
15580
  const bundle = await expectParsed(
15521
15581
  client.request({
@@ -17569,10 +17629,11 @@ function buildSkill() {
17569
17629
  "When the user reports a bug, runtime failure, production incident, regression, broken deploy, or unknown error, start here before reading arbitrary source files.",
17570
17630
  "",
17571
17631
  "1. Run `debugbundle doctor --json` to learn whether the project is local-only or connected and whether the local scaffold is healthy.",
17572
- "2. List actionable failures with `debugbundle incidents --source local --status open --json` for local data, or `debugbundle incidents --source cloud --status open --json` when the issue came from a hosted environment.",
17573
- "3. Inspect the chosen incident with `debugbundle inspect <incident-id> --source <local|cloud> --json` and `debugbundle explain <incident-id> --source <local|cloud> --json`.",
17574
- "4. Fetch evidence before editing code: `debugbundle bundle <incident-id> --source <local|cloud> --json` and `debugbundle reproduce <incident-id> --source <local|cloud> --json`.",
17575
- "5. If local SDK or relay events have landed but no bundle exists yet, run `debugbundle process --preset <minimal|balanced|investigative> --json` and then list incidents again.",
17632
+ "2. If `debugbundle doctor --json` reports `mode=local-only`, start with `debugbundle incidents --source local --status open --json`.",
17633
+ "3. If `debugbundle doctor --json` reports `mode=connected` and the target environment is cloud-enabled, check both `debugbundle incidents --source local --status open --json` and `debugbundle incidents --source cloud --status open --json` unless the user explicitly scoped the issue to local-only development. For user-reported production incidents, check cloud incidents after local incidents and explicitly report whether each source had matches.",
17634
+ "4. Inspect the chosen incident with `debugbundle inspect <incident-id> --source <local|cloud> --json` and `debugbundle explain <incident-id> --source <local|cloud> --json`.",
17635
+ "5. Fetch evidence before editing code: `debugbundle bundle <incident-id> --source <local|cloud> --json` and `debugbundle reproduce <incident-id> --source <local|cloud> --json`.",
17636
+ "6. If local SDK or relay events have landed but no bundle exists yet, run `debugbundle process --preset <minimal|balanced|investigative> --json` and then list incidents again.",
17576
17637
  "",
17577
17638
  "Key local paths:",
17578
17639
  "- `.debugbundle/profile.json` \u2014 project map, service paths, and validation state",
@@ -17857,7 +17918,8 @@ function buildSkillEvals() {
17857
17918
  name: "connected_incident_fetch",
17858
17919
  prompt: "The user says a production incident fired in the hosted DebugBundle project. Confirm the skill points the agent to the cloud retrieval path.",
17859
17920
  expected_behavior: [
17860
- "List cloud open incidents or use MCP list_incidents with source cloud.",
17921
+ "Check both local and cloud incident sources when the project is connected and the environment is cloud-enabled.",
17922
+ "Explicitly report whether the local source, the cloud source, or both had matches.",
17861
17923
  "Fetch inspect, context, bundle, and reproduction artifacts before editing code."
17862
17924
  ]
17863
17925
  }
@@ -20069,7 +20131,7 @@ var DEFAULT_PROCESSING_TIMEOUT_MS = 5 * 60 * 1e3;
20069
20131
  // ../../packages/storage/src/schema-migrations.ts
20070
20132
  var import_node_crypto3 = require("node:crypto");
20071
20133
 
20072
- // ../../packages/storage/src/migrations.ts
20134
+ // ../../packages/storage/src/storage-bootstrap-statements.ts
20073
20135
  var STORAGE_BOOTSTRAP_STATEMENTS = [
20074
20136
  `
20075
20137
  CREATE TABLE users (
@@ -20101,7 +20163,22 @@ var STORAGE_BOOTSTRAP_STATEMENTS = [
20101
20163
  billing_period_ends_at timestamptz,
20102
20164
  last_billing_sync_at timestamptz,
20103
20165
  last_billing_event_id text,
20104
- billing_period_starts_at timestamptz
20166
+ billing_period_starts_at timestamptz,
20167
+ trial_plan text CHECK (trial_plan IN ('solo', 'team') OR trial_plan IS NULL),
20168
+ trial_started_at timestamptz,
20169
+ trial_ends_at timestamptz,
20170
+ trial_used_at timestamptz,
20171
+ trial_converted_at timestamptz,
20172
+ trial_expired_at timestamptz,
20173
+ CONSTRAINT organizations_trial_window_check CHECK (
20174
+ trial_started_at IS NULL
20175
+ OR trial_ends_at IS NULL
20176
+ OR trial_ends_at > trial_started_at
20177
+ ),
20178
+ CONSTRAINT organizations_trial_started_requires_plan_check CHECK (
20179
+ trial_started_at IS NULL
20180
+ OR trial_plan IS NOT NULL
20181
+ )
20105
20182
  )
20106
20183
  `,
20107
20184
  `
@@ -20919,7 +20996,8 @@ var STORAGE_BOOTSTRAP_STATEMENTS = [
20919
20996
  `
20920
20997
  CREATE TABLE github_dispatch_deliveries (
20921
20998
  id uuid PRIMARY KEY,
20922
- rule_id uuid NOT NULL REFERENCES github_dispatch_rules(id) ON DELETE CASCADE,
20999
+ rule_id uuid NOT NULL,
21000
+ rule_name text NOT NULL,
20923
21001
  project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
20924
21002
  incident_id uuid REFERENCES incidents(id) ON DELETE CASCADE,
20925
21003
  improvement_opportunity_id uuid REFERENCES improvement_opportunities(id) ON DELETE CASCADE,
@@ -20965,9 +21043,18 @@ var STORAGE_BOOTSTRAP_STATEMENTS = [
20965
21043
  CREATE TABLE operational_email_deliveries (
20966
21044
  id uuid PRIMARY KEY,
20967
21045
  organization_id uuid NOT NULL REFERENCES organizations(id) ON DELETE CASCADE,
20968
- project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
21046
+ project_id uuid REFERENCES projects(id) ON DELETE CASCADE,
20969
21047
  kind text NOT NULL
20970
- CHECK (kind IN ('webhook_auto_disabled', 'allowance_warning_80', 'allowance_limit_reached', 'retention_rotation_notice')),
21048
+ CHECK (kind IN (
21049
+ 'webhook_auto_disabled',
21050
+ 'allowance_warning_80',
21051
+ 'allowance_limit_reached',
21052
+ 'retention_rotation_notice',
21053
+ 'trial_started',
21054
+ 'trial_ending_soon',
21055
+ 'trial_expired',
21056
+ 'trial_converted'
21057
+ )),
20971
21058
  dedupe_key text NOT NULL,
20972
21059
  payload jsonb NOT NULL DEFAULT '{}'::jsonb,
20973
21060
  status text NOT NULL DEFAULT 'pending'
@@ -20984,8 +21071,44 @@ var STORAGE_BOOTSTRAP_STATEMENTS = [
20984
21071
  `
20985
21072
  CREATE INDEX operational_email_deliveries_status_next_attempt_idx
20986
21073
  ON operational_email_deliveries (status, next_attempt_at, created_at)
21074
+ `,
21075
+ `
21076
+ CREATE TABLE trial_lifecycle_events (
21077
+ id uuid PRIMARY KEY,
21078
+ organization_id uuid NOT NULL REFERENCES organizations(id) ON DELETE CASCADE,
21079
+ event_type text NOT NULL,
21080
+ dedupe_key text NOT NULL,
21081
+ created_at timestamptz NOT NULL DEFAULT now(),
21082
+ UNIQUE (organization_id, event_type, dedupe_key)
21083
+ )
21084
+ `,
21085
+ `
21086
+ CREATE INDEX trial_lifecycle_events_org_event_created_idx
21087
+ ON trial_lifecycle_events (organization_id, event_type, created_at DESC)
21088
+ `,
21089
+ `
21090
+ CREATE TABLE plan_cleanup_tasks (
21091
+ id uuid PRIMARY KEY,
21092
+ organization_id uuid NOT NULL REFERENCES organizations(id) ON DELETE CASCADE,
21093
+ project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
21094
+ cleanup_type text NOT NULL
21095
+ CHECK (cleanup_type IN ('delete_improvement_bundle_objects')),
21096
+ attempt_count integer NOT NULL DEFAULT 0,
21097
+ last_error text,
21098
+ next_attempt_at timestamptz NOT NULL DEFAULT now(),
21099
+ completed_at timestamptz,
21100
+ created_at timestamptz NOT NULL DEFAULT now(),
21101
+ updated_at timestamptz NOT NULL DEFAULT now(),
21102
+ UNIQUE (project_id, cleanup_type)
21103
+ )
21104
+ `,
21105
+ `
21106
+ CREATE INDEX plan_cleanup_tasks_pending_idx
21107
+ ON plan_cleanup_tasks (completed_at, next_attempt_at, created_at)
20987
21108
  `
20988
21109
  ];
21110
+
21111
+ // ../../packages/storage/src/migrations.ts
20989
21112
  var STORAGE_BOOTSTRAP_SQL = STORAGE_BOOTSTRAP_STATEMENTS.join(";\n\n");
20990
21113
 
20991
21114
  // ../../packages/storage/src/schema-migrations.ts
@@ -21041,9 +21164,7 @@ var STORAGE_SCHEMA_MIGRATIONS = [
21041
21164
  defineStorageSchemaMigration({
21042
21165
  id: "202605130001_allow_synthetic_webhook_test_deliveries_without_incident_fk",
21043
21166
  description: "Allow webhook test deliveries to persist without requiring a backing incidents row.",
21044
- statements: [
21045
- "ALTER TABLE webhook_deliveries ALTER COLUMN incident_id DROP NOT NULL"
21046
- ]
21167
+ statements: ["ALTER TABLE webhook_deliveries ALTER COLUMN incident_id DROP NOT NULL"]
21047
21168
  }),
21048
21169
  defineStorageSchemaMigration({
21049
21170
  id: "202605130002_add_slack_destinations",
@@ -21560,6 +21681,125 @@ var STORAGE_SCHEMA_MIGRATIONS = [
21560
21681
  ON alert_email_digest_items (alert_id, notification_key, created_at DESC)
21561
21682
  `
21562
21683
  ]
21684
+ }),
21685
+ defineStorageSchemaMigration({
21686
+ id: "202606040001_add_no_card_trial_billing_state",
21687
+ description: "Add organization no-card trial metadata and the lifecycle event ledger.",
21688
+ statements: [
21689
+ "ALTER TABLE organizations ADD COLUMN IF NOT EXISTS trial_plan text",
21690
+ "ALTER TABLE organizations ADD COLUMN IF NOT EXISTS trial_started_at timestamptz",
21691
+ "ALTER TABLE organizations ADD COLUMN IF NOT EXISTS trial_ends_at timestamptz",
21692
+ "ALTER TABLE organizations ADD COLUMN IF NOT EXISTS trial_used_at timestamptz",
21693
+ "ALTER TABLE organizations ADD COLUMN IF NOT EXISTS trial_converted_at timestamptz",
21694
+ "ALTER TABLE organizations ADD COLUMN IF NOT EXISTS trial_expired_at timestamptz",
21695
+ "ALTER TABLE organizations DROP CONSTRAINT IF EXISTS organizations_trial_plan_check",
21696
+ `
21697
+ ALTER TABLE organizations
21698
+ ADD CONSTRAINT organizations_trial_plan_check
21699
+ CHECK (trial_plan IN ('solo', 'team') OR trial_plan IS NULL)
21700
+ `,
21701
+ "ALTER TABLE organizations DROP CONSTRAINT IF EXISTS organizations_trial_window_check",
21702
+ `
21703
+ ALTER TABLE organizations
21704
+ ADD CONSTRAINT organizations_trial_window_check
21705
+ CHECK (
21706
+ trial_started_at IS NULL
21707
+ OR trial_ends_at IS NULL
21708
+ OR trial_ends_at > trial_started_at
21709
+ )
21710
+ `,
21711
+ "ALTER TABLE organizations DROP CONSTRAINT IF EXISTS organizations_trial_started_requires_plan_check",
21712
+ `
21713
+ ALTER TABLE organizations
21714
+ ADD CONSTRAINT organizations_trial_started_requires_plan_check
21715
+ CHECK (
21716
+ trial_started_at IS NULL
21717
+ OR trial_plan IS NOT NULL
21718
+ )
21719
+ `,
21720
+ `
21721
+ CREATE TABLE IF NOT EXISTS trial_lifecycle_events (
21722
+ id uuid PRIMARY KEY,
21723
+ organization_id uuid NOT NULL REFERENCES organizations(id) ON DELETE CASCADE,
21724
+ event_type text NOT NULL,
21725
+ dedupe_key text NOT NULL,
21726
+ created_at timestamptz NOT NULL DEFAULT now(),
21727
+ UNIQUE (organization_id, event_type, dedupe_key)
21728
+ )
21729
+ `,
21730
+ `
21731
+ CREATE INDEX IF NOT EXISTS trial_lifecycle_events_org_event_created_idx
21732
+ ON trial_lifecycle_events (organization_id, event_type, created_at DESC)
21733
+ `
21734
+ ]
21735
+ }),
21736
+ defineStorageSchemaMigration({
21737
+ id: "202606040002_expand_operational_emails_for_trial_lifecycle",
21738
+ description: "Allow operational email deliveries without a project and add no-card trial email kinds.",
21739
+ statements: [
21740
+ "ALTER TABLE operational_email_deliveries ALTER COLUMN project_id DROP NOT NULL",
21741
+ "ALTER TABLE operational_email_deliveries DROP CONSTRAINT IF EXISTS operational_email_deliveries_kind_check",
21742
+ `
21743
+ ALTER TABLE operational_email_deliveries
21744
+ ADD CONSTRAINT operational_email_deliveries_kind_check
21745
+ CHECK (
21746
+ kind IN (
21747
+ 'webhook_auto_disabled',
21748
+ 'allowance_warning_80',
21749
+ 'allowance_limit_reached',
21750
+ 'retention_rotation_notice',
21751
+ 'trial_started',
21752
+ 'trial_ending_soon',
21753
+ 'trial_expired',
21754
+ 'trial_converted'
21755
+ )
21756
+ )
21757
+ `
21758
+ ]
21759
+ }),
21760
+ defineStorageSchemaMigration({
21761
+ id: "202606050001_preserve_github_dispatch_history_when_rules_are_deleted",
21762
+ description: "Snapshot GitHub rule names onto deliveries and decouple delivery history from live rule rows.",
21763
+ statements: [
21764
+ "ALTER TABLE github_dispatch_deliveries ADD COLUMN IF NOT EXISTS rule_name text",
21765
+ `
21766
+ UPDATE github_dispatch_deliveries deliveries
21767
+ SET rule_name = rules.name
21768
+ FROM github_dispatch_rules rules
21769
+ WHERE deliveries.rule_id = rules.id
21770
+ AND deliveries.rule_name IS NULL
21771
+ `,
21772
+ "ALTER TABLE github_dispatch_deliveries ALTER COLUMN rule_name SET DEFAULT ''",
21773
+ "UPDATE github_dispatch_deliveries SET rule_name = '' WHERE rule_name IS NULL",
21774
+ "ALTER TABLE github_dispatch_deliveries ALTER COLUMN rule_name SET NOT NULL",
21775
+ "ALTER TABLE github_dispatch_deliveries DROP CONSTRAINT IF EXISTS github_dispatch_deliveries_rule_id_fkey"
21776
+ ]
21777
+ }),
21778
+ defineStorageSchemaMigration({
21779
+ id: "202606050002_add_durable_plan_cleanup_tasks",
21780
+ description: "Persist retryable external cleanup tasks for side effects that cannot be completed transactionally.",
21781
+ statements: [
21782
+ `
21783
+ CREATE TABLE IF NOT EXISTS plan_cleanup_tasks (
21784
+ id uuid PRIMARY KEY,
21785
+ organization_id uuid NOT NULL REFERENCES organizations(id) ON DELETE CASCADE,
21786
+ project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
21787
+ cleanup_type text NOT NULL
21788
+ CHECK (cleanup_type IN ('delete_improvement_bundle_objects')),
21789
+ attempt_count integer NOT NULL DEFAULT 0,
21790
+ last_error text,
21791
+ next_attempt_at timestamptz NOT NULL DEFAULT now(),
21792
+ completed_at timestamptz,
21793
+ created_at timestamptz NOT NULL DEFAULT now(),
21794
+ updated_at timestamptz NOT NULL DEFAULT now(),
21795
+ UNIQUE (project_id, cleanup_type)
21796
+ )
21797
+ `,
21798
+ `
21799
+ CREATE INDEX IF NOT EXISTS plan_cleanup_tasks_pending_idx
21800
+ ON plan_cleanup_tasks (completed_at, next_attempt_at, created_at)
21801
+ `
21802
+ ]
21563
21803
  })
21564
21804
  ];
21565
21805
 
@@ -24985,6 +25225,9 @@ function mapMcpError3(error) {
24985
25225
  if (error instanceof BillingApiError) {
24986
25226
  throw new Error(`mcp_tool_error:${error.code}`);
24987
25227
  }
25228
+ if (error instanceof Error && error.message.startsWith("mcp_tool_error:")) {
25229
+ throw error;
25230
+ }
24988
25231
  throw new Error("mcp_tool_error:unknown_error");
24989
25232
  }
24990
25233
  function createBillingMcpTools(api) {
@@ -25000,6 +25243,22 @@ function createBillingMcpTools(api) {
25000
25243
  mapMcpError3(error);
25001
25244
  }
25002
25245
  },
25246
+ async start_trial(input) {
25247
+ try {
25248
+ const targetPlan = input["targetPlan"] ?? input["target_plan"];
25249
+ if (targetPlan !== "solo" && targetPlan !== "team") {
25250
+ throw new Error("mcp_tool_error:invalid_arguments");
25251
+ }
25252
+ return {
25253
+ billing: await api.startTrial({
25254
+ bearerToken: String(input["bearerToken"]),
25255
+ targetPlan
25256
+ })
25257
+ };
25258
+ } catch (error) {
25259
+ mapMcpError3(error);
25260
+ }
25261
+ },
25003
25262
  async increase_capacity(input) {
25004
25263
  try {
25005
25264
  return {
@@ -26151,6 +26410,67 @@ function createRetrievalMcpTools(api) {
26151
26410
  mapMcpError12(error);
26152
26411
  }
26153
26412
  },
26413
+ async resolve_incidents(input) {
26414
+ try {
26415
+ const incidentIds = Array.from(
26416
+ new Set((Array.isArray(input["incidentIds"]) ? input["incidentIds"] : []).map((value) => String(value)))
26417
+ );
26418
+ const localIncidents = /* @__PURE__ */ new Map();
26419
+ const cloudIncidentIds = [];
26420
+ if (await shouldUseLocalSource(input)) {
26421
+ return {
26422
+ incidents: await Promise.all(
26423
+ incidentIds.map((incidentId) => resolveLocalIncident({ incidentId }))
26424
+ )
26425
+ };
26426
+ }
26427
+ if (await shouldCombineLocalAndCloudSource(input)) {
26428
+ for (const incidentId of incidentIds) {
26429
+ try {
26430
+ localIncidents.set(incidentId, await resolveLocalIncident({ incidentId }));
26431
+ } catch (error) {
26432
+ if (!isNotFoundRetrievalError(error)) {
26433
+ throw error;
26434
+ }
26435
+ cloudIncidentIds.push(incidentId);
26436
+ }
26437
+ }
26438
+ } else {
26439
+ cloudIncidentIds.push(...incidentIds);
26440
+ }
26441
+ if (cloudIncidentIds.length > 0) {
26442
+ const cloudIncidents = api.resolveIncidents === void 0 ? await Promise.all(
26443
+ cloudIncidentIds.map(
26444
+ async (incidentId) => attachSourceToRecord(
26445
+ await api.resolveIncident({
26446
+ bearerToken: await requireCloudBearerToken(input),
26447
+ incidentId
26448
+ }),
26449
+ "cloud"
26450
+ )
26451
+ )
26452
+ ) : (await api.resolveIncidents({
26453
+ bearerToken: await requireCloudBearerToken(input),
26454
+ incidentIds: cloudIncidentIds
26455
+ })).map((incident) => attachSourceToRecord(incident, "cloud"));
26456
+ for (const incident of cloudIncidents) {
26457
+ await syncCloudIncidentCacheStatus({
26458
+ incidentId: String(incident["incident_id"]),
26459
+ incident: {
26460
+ ...typeof incident["status"] === "string" ? { status: incident["status"] } : {},
26461
+ resolved_at: typeof incident["resolved_at"] === "string" || incident["resolved_at"] === null ? incident["resolved_at"] : null
26462
+ }
26463
+ });
26464
+ localIncidents.set(String(incident["incident_id"]), incident);
26465
+ }
26466
+ }
26467
+ return {
26468
+ incidents: incidentIds.map((incidentId) => localIncidents.get(incidentId))
26469
+ };
26470
+ } catch (error) {
26471
+ mapMcpError12(error);
26472
+ }
26473
+ },
26154
26474
  async reopen_incident(input) {
26155
26475
  try {
26156
26476
  if (await shouldUseLocalSource(input)) {
@@ -26196,6 +26516,67 @@ function createRetrievalMcpTools(api) {
26196
26516
  mapMcpError12(error);
26197
26517
  }
26198
26518
  },
26519
+ async reopen_incidents(input) {
26520
+ try {
26521
+ const incidentIds = Array.from(
26522
+ new Set((Array.isArray(input["incidentIds"]) ? input["incidentIds"] : []).map((value) => String(value)))
26523
+ );
26524
+ const localIncidents = /* @__PURE__ */ new Map();
26525
+ const cloudIncidentIds = [];
26526
+ if (await shouldUseLocalSource(input)) {
26527
+ return {
26528
+ incidents: await Promise.all(
26529
+ incidentIds.map((incidentId) => reopenLocalIncident({ incidentId }))
26530
+ )
26531
+ };
26532
+ }
26533
+ if (await shouldCombineLocalAndCloudSource(input)) {
26534
+ for (const incidentId of incidentIds) {
26535
+ try {
26536
+ localIncidents.set(incidentId, await reopenLocalIncident({ incidentId }));
26537
+ } catch (error) {
26538
+ if (!isNotFoundRetrievalError(error)) {
26539
+ throw error;
26540
+ }
26541
+ cloudIncidentIds.push(incidentId);
26542
+ }
26543
+ }
26544
+ } else {
26545
+ cloudIncidentIds.push(...incidentIds);
26546
+ }
26547
+ if (cloudIncidentIds.length > 0) {
26548
+ const cloudIncidents = api.reopenIncidents === void 0 ? await Promise.all(
26549
+ cloudIncidentIds.map(
26550
+ async (incidentId) => attachSourceToRecord(
26551
+ await api.reopenIncident({
26552
+ bearerToken: await requireCloudBearerToken(input),
26553
+ incidentId
26554
+ }),
26555
+ "cloud"
26556
+ )
26557
+ )
26558
+ ) : (await api.reopenIncidents({
26559
+ bearerToken: await requireCloudBearerToken(input),
26560
+ incidentIds: cloudIncidentIds
26561
+ })).map((incident) => attachSourceToRecord(incident, "cloud"));
26562
+ for (const incident of cloudIncidents) {
26563
+ await syncCloudIncidentCacheStatus({
26564
+ incidentId: String(incident["incident_id"]),
26565
+ incident: {
26566
+ ...typeof incident["status"] === "string" ? { status: incident["status"] } : {},
26567
+ resolved_at: null
26568
+ }
26569
+ });
26570
+ localIncidents.set(String(incident["incident_id"]), incident);
26571
+ }
26572
+ }
26573
+ return {
26574
+ incidents: incidentIds.map((incidentId) => localIncidents.get(incidentId))
26575
+ };
26576
+ } catch (error) {
26577
+ mapMcpError12(error);
26578
+ }
26579
+ },
26199
26580
  async get_bundle(input) {
26200
26581
  try {
26201
26582
  if (await shouldUseLocalSource(input)) {
@@ -28105,7 +28486,7 @@ var zodToJsonSchema = (schema, options) => {
28105
28486
  var package_default = {
28106
28487
  name: "@debugbundle/mcp",
28107
28488
  mcpName: "com.debugbundle/mcp",
28108
- version: "1.0.2",
28489
+ version: "1.1.1",
28109
28490
  private: false,
28110
28491
  description: "Model Context Protocol server for DebugBundle",
28111
28492
  license: "AGPL-3.0-only",
@@ -28167,6 +28548,11 @@ var incidentLookupInputSchema = external_exports.object({
28167
28548
  source: sourceSchema,
28168
28549
  incidentId: external_exports.string()
28169
28550
  });
28551
+ var bulkIncidentLookupInputSchema = external_exports.object({
28552
+ bearerToken: optionalBearerTokenSchema,
28553
+ source: sourceSchema,
28554
+ incidentIds: external_exports.array(external_exports.string()).min(1).max(1e3)
28555
+ });
28170
28556
  var improvementLookupInputSchema = external_exports.object({
28171
28557
  bearerToken: external_exports.string(),
28172
28558
  improvementId: external_exports.string()
@@ -28254,12 +28640,24 @@ var MCP_TOOL_CATALOG = [
28254
28640
  description: "Resolve an incident by incident id.",
28255
28641
  inputSchema: incidentLookupInputSchema
28256
28642
  },
28643
+ {
28644
+ name: "resolve_incidents",
28645
+ group: "retrieval",
28646
+ description: "Resolve incidents in bulk by incident id.",
28647
+ inputSchema: bulkIncidentLookupInputSchema
28648
+ },
28257
28649
  {
28258
28650
  name: "reopen_incident",
28259
28651
  group: "retrieval",
28260
- description: "Reopen a locally stored resolved incident.",
28652
+ description: "Reopen an incident by incident id.",
28261
28653
  inputSchema: incidentLookupInputSchema
28262
28654
  },
28655
+ {
28656
+ name: "reopen_incidents",
28657
+ group: "retrieval",
28658
+ description: "Reopen incidents in bulk by incident id.",
28659
+ inputSchema: bulkIncidentLookupInputSchema
28660
+ },
28263
28661
  {
28264
28662
  name: "get_bundle",
28265
28663
  group: "retrieval",
@@ -28916,6 +29314,15 @@ var MCP_TOOL_CATALOG = [
28916
29314
  bearerToken: external_exports.string()
28917
29315
  })
28918
29316
  },
29317
+ {
29318
+ name: "start_trial",
29319
+ group: "billing",
29320
+ description: "Start an eligible no-card trial for the organization.",
29321
+ inputSchema: external_exports.object({
29322
+ bearerToken: external_exports.string(),
29323
+ targetPlan: external_exports.enum(["solo", "team"])
29324
+ })
29325
+ },
28919
29326
  {
28920
29327
  name: "increase_capacity",
28921
29328
  group: "billing",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@debugbundle/mcp",
3
3
  "mcpName": "com.debugbundle/mcp",
4
- "version": "1.0.2",
4
+ "version": "1.1.1",
5
5
  "private": false,
6
6
  "description": "Model Context Protocol server for DebugBundle",
7
7
  "license": "AGPL-3.0-only",
package/server.json CHANGED
@@ -8,13 +8,13 @@
8
8
  "source": "github",
9
9
  "subfolder": "apps/mcp"
10
10
  },
11
- "version": "1.0.2",
11
+ "version": "1.1.1",
12
12
  "packages": [
13
13
  {
14
14
  "registryType": "npm",
15
15
  "registryBaseUrl": "https://registry.npmjs.org",
16
16
  "identifier": "@debugbundle/mcp",
17
- "version": "1.0.2",
17
+ "version": "1.1.1",
18
18
  "transport": {
19
19
  "type": "stdio"
20
20
  },