baller-maester 0.3.0 → 0.4.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/index.d.ts CHANGED
@@ -59,6 +59,7 @@ declare const SourceSchema: z.ZodObject<{
59
59
  path: string;
60
60
  state?: "draft" | "canon" | undefined;
61
61
  })[] | undefined;
62
+ description?: string | undefined;
62
63
  ref?: string | undefined;
63
64
  auth?: {
64
65
  type: "none";
@@ -67,7 +68,6 @@ declare const SourceSchema: z.ZodObject<{
67
68
  envVar: string;
68
69
  } | undefined;
69
70
  destination?: string | undefined;
70
- description?: string | undefined;
71
71
  tags?: string[] | undefined;
72
72
  }, {
73
73
  name: string;
@@ -76,6 +76,7 @@ declare const SourceSchema: z.ZodObject<{
76
76
  path: string;
77
77
  state?: "draft" | "canon" | undefined;
78
78
  })[] | undefined;
79
+ description?: string | undefined;
79
80
  ref?: string | undefined;
80
81
  auth?: {
81
82
  type: "none";
@@ -84,9 +85,56 @@ declare const SourceSchema: z.ZodObject<{
84
85
  envVar: string;
85
86
  } | undefined;
86
87
  destination?: string | undefined;
87
- description?: string | undefined;
88
88
  tags?: string[] | undefined;
89
89
  }>;
90
+ /**
91
+ * Per-connector entry in `CitadelConfig.connectors`. Per-type `config` payload
92
+ * is validated by the registered type's `configSchema` in `.superRefine` below.
93
+ */
94
+ declare const ConnectorBaseSchema: z.ZodObject<{
95
+ name: z.ZodString;
96
+ type: z.ZodString;
97
+ auth: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
98
+ type: z.ZodLiteral<"none">;
99
+ }, "strict", z.ZodTypeAny, {
100
+ type: "none";
101
+ }, {
102
+ type: "none";
103
+ }>, z.ZodObject<{
104
+ type: z.ZodLiteral<"token">;
105
+ envVar: z.ZodString;
106
+ }, "strict", z.ZodTypeAny, {
107
+ type: "token";
108
+ envVar: string;
109
+ }, {
110
+ type: "token";
111
+ envVar: string;
112
+ }>]>>;
113
+ description: z.ZodOptional<z.ZodString>;
114
+ config: z.ZodOptional<z.ZodUnknown>;
115
+ }, "strict", z.ZodTypeAny, {
116
+ type: string;
117
+ name: string;
118
+ description?: string | undefined;
119
+ auth?: {
120
+ type: "none";
121
+ } | {
122
+ type: "token";
123
+ envVar: string;
124
+ } | undefined;
125
+ config?: unknown;
126
+ }, {
127
+ type: string;
128
+ name: string;
129
+ description?: string | undefined;
130
+ auth?: {
131
+ type: "none";
132
+ } | {
133
+ type: "token";
134
+ envVar: string;
135
+ } | undefined;
136
+ config?: unknown;
137
+ }>;
90
138
  declare const CitadelConfigSchema: z.ZodEffects<z.ZodObject<{
91
139
  schemaVersion: z.ZodLiteral<1>;
92
140
  baseDir: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
@@ -130,6 +178,7 @@ declare const CitadelConfigSchema: z.ZodEffects<z.ZodObject<{
130
178
  path: string;
131
179
  state?: "draft" | "canon" | undefined;
132
180
  })[] | undefined;
181
+ description?: string | undefined;
133
182
  ref?: string | undefined;
134
183
  auth?: {
135
184
  type: "none";
@@ -138,7 +187,6 @@ declare const CitadelConfigSchema: z.ZodEffects<z.ZodObject<{
138
187
  envVar: string;
139
188
  } | undefined;
140
189
  destination?: string | undefined;
141
- description?: string | undefined;
142
190
  tags?: string[] | undefined;
143
191
  }, {
144
192
  name: string;
@@ -147,6 +195,7 @@ declare const CitadelConfigSchema: z.ZodEffects<z.ZodObject<{
147
195
  path: string;
148
196
  state?: "draft" | "canon" | undefined;
149
197
  })[] | undefined;
198
+ description?: string | undefined;
150
199
  ref?: string | undefined;
151
200
  auth?: {
152
201
  type: "none";
@@ -155,9 +204,52 @@ declare const CitadelConfigSchema: z.ZodEffects<z.ZodObject<{
155
204
  envVar: string;
156
205
  } | undefined;
157
206
  destination?: string | undefined;
158
- description?: string | undefined;
159
207
  tags?: string[] | undefined;
160
208
  }>, "many">>>;
209
+ connectors: z.ZodOptional<z.ZodArray<z.ZodObject<{
210
+ name: z.ZodString;
211
+ type: z.ZodString;
212
+ auth: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
213
+ type: z.ZodLiteral<"none">;
214
+ }, "strict", z.ZodTypeAny, {
215
+ type: "none";
216
+ }, {
217
+ type: "none";
218
+ }>, z.ZodObject<{
219
+ type: z.ZodLiteral<"token">;
220
+ envVar: z.ZodString;
221
+ }, "strict", z.ZodTypeAny, {
222
+ type: "token";
223
+ envVar: string;
224
+ }, {
225
+ type: "token";
226
+ envVar: string;
227
+ }>]>>;
228
+ description: z.ZodOptional<z.ZodString>;
229
+ config: z.ZodOptional<z.ZodUnknown>;
230
+ }, "strict", z.ZodTypeAny, {
231
+ type: string;
232
+ name: string;
233
+ description?: string | undefined;
234
+ auth?: {
235
+ type: "none";
236
+ } | {
237
+ type: "token";
238
+ envVar: string;
239
+ } | undefined;
240
+ config?: unknown;
241
+ }, {
242
+ type: string;
243
+ name: string;
244
+ description?: string | undefined;
245
+ auth?: {
246
+ type: "none";
247
+ } | {
248
+ type: "token";
249
+ envVar: string;
250
+ } | undefined;
251
+ config?: unknown;
252
+ }>, "many">>;
161
253
  }, "strict", z.ZodTypeAny, {
162
254
  sources: {
163
255
  name: string;
@@ -166,6 +258,7 @@ declare const CitadelConfigSchema: z.ZodEffects<z.ZodObject<{
166
258
  path: string;
167
259
  state?: "draft" | "canon" | undefined;
168
260
  })[] | undefined;
261
+ description?: string | undefined;
169
262
  ref?: string | undefined;
170
263
  auth?: {
171
264
  type: "none";
@@ -174,10 +267,21 @@ declare const CitadelConfigSchema: z.ZodEffects<z.ZodObject<{
174
267
  envVar: string;
175
268
  } | undefined;
176
269
  destination?: string | undefined;
177
- description?: string | undefined;
178
270
  tags?: string[] | undefined;
179
271
  }[];
180
272
  schemaVersion: 1;
273
+ connectors?: {
274
+ type: string;
275
+ name: string;
276
+ description?: string | undefined;
277
+ auth?: {
278
+ type: "none";
279
+ } | {
280
+ type: "token";
281
+ envVar: string;
282
+ } | undefined;
283
+ config?: unknown;
284
+ }[] | undefined;
181
285
  baseDir?: string | undefined;
182
286
  }, {
183
287
  schemaVersion: 1;
@@ -188,6 +292,7 @@ declare const CitadelConfigSchema: z.ZodEffects<z.ZodObject<{
188
292
  path: string;
189
293
  state?: "draft" | "canon" | undefined;
190
294
  })[] | undefined;
295
+ description?: string | undefined;
191
296
  ref?: string | undefined;
192
297
  auth?: {
193
298
  type: "none";
@@ -196,9 +301,20 @@ declare const CitadelConfigSchema: z.ZodEffects<z.ZodObject<{
196
301
  envVar: string;
197
302
  } | undefined;
198
303
  destination?: string | undefined;
199
- description?: string | undefined;
200
304
  tags?: string[] | undefined;
201
305
  }[] | undefined;
306
+ connectors?: {
307
+ type: string;
308
+ name: string;
309
+ description?: string | undefined;
310
+ auth?: {
311
+ type: "none";
312
+ } | {
313
+ type: "token";
314
+ envVar: string;
315
+ } | undefined;
316
+ config?: unknown;
317
+ }[] | undefined;
202
318
  baseDir?: string | undefined;
203
319
  }>, {
204
320
  sources: {
@@ -208,6 +324,7 @@ declare const CitadelConfigSchema: z.ZodEffects<z.ZodObject<{
208
324
  path: string;
209
325
  state?: "draft" | "canon" | undefined;
210
326
  })[] | undefined;
327
+ description?: string | undefined;
211
328
  ref?: string | undefined;
212
329
  auth?: {
213
330
  type: "none";
@@ -216,10 +333,21 @@ declare const CitadelConfigSchema: z.ZodEffects<z.ZodObject<{
216
333
  envVar: string;
217
334
  } | undefined;
218
335
  destination?: string | undefined;
219
- description?: string | undefined;
220
336
  tags?: string[] | undefined;
221
337
  }[];
222
338
  schemaVersion: 1;
339
+ connectors?: {
340
+ type: string;
341
+ name: string;
342
+ description?: string | undefined;
343
+ auth?: {
344
+ type: "none";
345
+ } | {
346
+ type: "token";
347
+ envVar: string;
348
+ } | undefined;
349
+ config?: unknown;
350
+ }[] | undefined;
223
351
  baseDir?: string | undefined;
224
352
  }, {
225
353
  schemaVersion: 1;
@@ -230,6 +358,7 @@ declare const CitadelConfigSchema: z.ZodEffects<z.ZodObject<{
230
358
  path: string;
231
359
  state?: "draft" | "canon" | undefined;
232
360
  })[] | undefined;
361
+ description?: string | undefined;
233
362
  ref?: string | undefined;
234
363
  auth?: {
235
364
  type: "none";
@@ -238,13 +367,25 @@ declare const CitadelConfigSchema: z.ZodEffects<z.ZodObject<{
238
367
  envVar: string;
239
368
  } | undefined;
240
369
  destination?: string | undefined;
241
- description?: string | undefined;
242
370
  tags?: string[] | undefined;
243
371
  }[] | undefined;
372
+ connectors?: {
373
+ type: string;
374
+ name: string;
375
+ description?: string | undefined;
376
+ auth?: {
377
+ type: "none";
378
+ } | {
379
+ type: "token";
380
+ envVar: string;
381
+ } | undefined;
382
+ config?: unknown;
383
+ }[] | undefined;
244
384
  baseDir?: string | undefined;
245
385
  }>;
246
386
  type AuthRef = z.infer<typeof AuthRefSchema>;
247
387
  type Source = z.infer<typeof SourceSchema>;
388
+ type Connector = z.infer<typeof ConnectorBaseSchema>;
248
389
  type CitadelConfig = z.infer<typeof CitadelConfigSchema>;
249
390
 
250
391
  declare const PublishedDocumentSchema: z.ZodObject<{
@@ -255,14 +396,14 @@ declare const PublishedDocumentSchema: z.ZodObject<{
255
396
  state: z.ZodOptional<z.ZodEnum<["draft", "canon"]>>;
256
397
  }, "strict", z.ZodTypeAny, {
257
398
  path: string;
258
- state?: "draft" | "canon" | undefined;
259
399
  description?: string | undefined;
400
+ state?: "draft" | "canon" | undefined;
260
401
  tags?: string[] | undefined;
261
402
  category?: string | undefined;
262
403
  }, {
263
404
  path: string;
264
- state?: "draft" | "canon" | undefined;
265
405
  description?: string | undefined;
406
+ state?: "draft" | "canon" | undefined;
266
407
  tags?: string[] | undefined;
267
408
  category?: string | undefined;
268
409
  }>;
@@ -276,26 +417,26 @@ declare const MaesterConfigSchema: z.ZodObject<{
276
417
  state: z.ZodOptional<z.ZodEnum<["draft", "canon"]>>;
277
418
  }, "strict", z.ZodTypeAny, {
278
419
  path: string;
279
- state?: "draft" | "canon" | undefined;
280
420
  description?: string | undefined;
421
+ state?: "draft" | "canon" | undefined;
281
422
  tags?: string[] | undefined;
282
423
  category?: string | undefined;
283
424
  }, {
284
425
  path: string;
285
- state?: "draft" | "canon" | undefined;
286
426
  description?: string | undefined;
427
+ state?: "draft" | "canon" | undefined;
287
428
  tags?: string[] | undefined;
288
429
  category?: string | undefined;
289
430
  }>, "many">, {
290
431
  path: string;
291
- state?: "draft" | "canon" | undefined;
292
432
  description?: string | undefined;
433
+ state?: "draft" | "canon" | undefined;
293
434
  tags?: string[] | undefined;
294
435
  category?: string | undefined;
295
436
  }[], {
296
437
  path: string;
297
- state?: "draft" | "canon" | undefined;
298
438
  description?: string | undefined;
439
+ state?: "draft" | "canon" | undefined;
299
440
  tags?: string[] | undefined;
300
441
  category?: string | undefined;
301
442
  }[]>;
@@ -303,8 +444,8 @@ declare const MaesterConfigSchema: z.ZodObject<{
303
444
  schemaVersion: 1;
304
445
  documents: {
305
446
  path: string;
306
- state?: "draft" | "canon" | undefined;
307
447
  description?: string | undefined;
448
+ state?: "draft" | "canon" | undefined;
308
449
  tags?: string[] | undefined;
309
450
  category?: string | undefined;
310
451
  }[];
@@ -312,8 +453,8 @@ declare const MaesterConfigSchema: z.ZodObject<{
312
453
  schemaVersion: 1;
313
454
  documents: {
314
455
  path: string;
315
- state?: "draft" | "canon" | undefined;
316
456
  description?: string | undefined;
457
+ state?: "draft" | "canon" | undefined;
317
458
  tags?: string[] | undefined;
318
459
  category?: string | undefined;
319
460
  }[];
@@ -446,6 +587,12 @@ type SkillInstallOutcome = {
446
587
  installedVersion?: string;
447
588
  error?: string;
448
589
  };
590
+ type SkillMcpRegistrationOutcome = {
591
+ host: SkillTargetId;
592
+ filePath: string;
593
+ action: "written" | "unchanged" | "skipped" | "failed";
594
+ error?: string;
595
+ };
449
596
  type SkillInstallResult = {
450
597
  outcomes: SkillInstallOutcome[];
451
598
  counts: {
@@ -454,6 +601,12 @@ type SkillInstallResult = {
454
601
  unchanged: number;
455
602
  failed: number;
456
603
  };
604
+ /**
605
+ * Per-host MCP server registration outcomes from the refresh step. Empty
606
+ * when no MCP-capable target is involved (e.g. install was scoped to
607
+ * `agents-md`) or when running an upgrade `--check`.
608
+ */
609
+ mcpRegistrations: SkillMcpRegistrationOutcome[];
457
610
  };
458
611
  type SkillStatusOutcomeState = "up-to-date" | "outdated" | "not-installed";
459
612
  type SkillStatusOutcome = {
@@ -487,7 +640,7 @@ type SkillTarget = {
487
640
  readonly label: string;
488
641
  /** Repo-relative paths this target writes. */
489
642
  readonly artifactPaths: readonly string[];
490
- /** Writers backing different ids may share an implementation (codex + agents-md). */
643
+ /** Writers backing different ids may share an implementation; ids with distinct writerKeys produce separate file artifacts. */
491
644
  readonly writerKey: string;
492
645
  write(input: SkillWriteInput): Promise<SkillWriteOutcome>;
493
646
  /** Read the installed version marker from disk, if any. */
@@ -511,6 +664,197 @@ declare function runSkillStatus(repoRoot: string): Promise<SkillStatusResult>;
511
664
 
512
665
  declare const SKILL_VERSION: string;
513
666
 
667
+ type ResolvedAuth = {
668
+ type: "delegated";
669
+ } | {
670
+ type: "token";
671
+ value: string;
672
+ envVar: string;
673
+ };
674
+
675
+ declare const ENVELOPE_SCHEMA_VERSION: 1;
676
+ type ConnectorErrorCode = "missing-env-var" | "connector-not-found" | "unknown-operation" | "invalid-argument" | "auth-failed" | "remote-error" | "internal-error";
677
+ declare const CONNECTOR_ERROR_CODES: readonly ConnectorErrorCode[];
678
+ /**
679
+ * Context passed to a connector operation handler. The dispatcher resolves the
680
+ * per-type config and auth before invocation; the handler never reads env vars
681
+ * or parses the raw connector entry.
682
+ */
683
+ type ConnectorContext<TConfig = unknown> = {
684
+ /** Validated per-type config (already parsed by the type's configSchema). */
685
+ readonly config: TConfig;
686
+ /** Auth token value when the entry declared token auth; undefined otherwise. */
687
+ readonly token: string | undefined;
688
+ /** Resolved auth descriptor for handlers that need to know the mode. */
689
+ readonly auth: ResolvedAuth;
690
+ };
691
+ /**
692
+ * One operation exposed by a connector type. The same definition drives MCP
693
+ * tool registration (via argsSchema → JSON Schema) and runtime dispatch.
694
+ */
695
+ type ConnectorOperation<TConfig = unknown, TArgs = unknown, TData = unknown> = {
696
+ /** Operation name, kebab-case (e.g. `list-issues`). */
697
+ readonly name: string;
698
+ /**
699
+ * Validates the operation's args object. Used for both runtime + inputSchema.
700
+ * The third generic is intentionally `unknown` so schemas with `.default()`
701
+ * or `.optional()` (where the input type differs from the output type) are
702
+ * accepted — the dispatcher always parses `unknown` input.
703
+ */
704
+ readonly argsSchema: z.ZodType<TArgs, z.ZodTypeDef, unknown>;
705
+ /** Per-type data shape version embedded in success payloads. */
706
+ readonly dataSchemaVersion: number;
707
+ /** Pure handler — receives validated args + context; returns `{ data }` or throws. */
708
+ readonly handler: (args: TArgs, ctx: ConnectorContext<TConfig>) => Promise<{
709
+ data: TData;
710
+ }>;
711
+ };
712
+ /**
713
+ * A connector type registered with the framework. The registry is the only
714
+ * place that imports per-type modules; everything else consults the registry.
715
+ *
716
+ * `operations` is intentionally an `any`-bounded record: each entry has its
717
+ * own concrete TArgs/TData via `defineConnectorOperation`, and the framework
718
+ * never touches the per-operation types directly — it routes through the
719
+ * operation's `argsSchema` for validation and its `handler` for execution.
720
+ */
721
+ type AnyOperation<TConfig> = ConnectorOperation<TConfig, any, any>;
722
+ type ConnectorType<TConfig = unknown> = {
723
+ /** Stable identifier used as the `type` value in citadel.yaml. */
724
+ readonly id: string;
725
+ /** Short human-readable name (e.g. "GitLab Issues"). */
726
+ readonly label: string;
727
+ /**
728
+ * Validates one connector entry's per-type config object. Input is
729
+ * intentionally `unknown` so schemas with `.default()` are accepted — the
730
+ * citadel-schema `.superRefine` always parses `unknown` config payloads.
731
+ */
732
+ readonly configSchema: z.ZodType<TConfig, z.ZodTypeDef, unknown>;
733
+ /** Map of operation name → operation definition. */
734
+ readonly operations: Readonly<Record<string, AnyOperation<TConfig>>>;
735
+ /**
736
+ * Returns the per-operation description rendered into `tools/list`. The
737
+ * framework prepends the connector entry's `description` (when set) — types
738
+ * do not do that composition themselves.
739
+ */
740
+ readonly describeTool: (operation: AnyOperation<TConfig>, resolvedConfig: TConfig) => string;
741
+ };
742
+ /**
743
+ * The success envelope shared by MCP tool results and the fallback CLI.
744
+ */
745
+ type ConnectorSuccessEnvelope<TData = unknown> = {
746
+ readonly schema: typeof ENVELOPE_SCHEMA_VERSION;
747
+ readonly connector: string;
748
+ readonly operation: string;
749
+ readonly ok: true;
750
+ readonly data: TData & {
751
+ readonly dataSchema: number;
752
+ };
753
+ };
754
+ type ConnectorErrorPayload = {
755
+ readonly code: ConnectorErrorCode;
756
+ readonly message: string;
757
+ readonly details?: Record<string, unknown>;
758
+ };
759
+ type ConnectorFailureEnvelope = {
760
+ readonly schema: typeof ENVELOPE_SCHEMA_VERSION;
761
+ readonly connector: string;
762
+ readonly operation: string;
763
+ readonly ok: false;
764
+ readonly error: ConnectorErrorPayload;
765
+ };
766
+ type ConnectorResultEnvelope<TData = unknown> = ConnectorSuccessEnvelope<TData> | ConnectorFailureEnvelope;
767
+ /**
768
+ * Shape of a single MCP tool descriptor returned to clients during `tools/list`.
769
+ * The framework owns this composition; types provide pieces.
770
+ */
771
+ type ConnectorToolDescriptor = {
772
+ readonly name: string;
773
+ readonly description: string;
774
+ readonly inputSchema: Record<string, unknown>;
775
+ };
776
+ /**
777
+ * Helper for declaring an operation with TypeScript inference for args / data
778
+ * types — `ConnectorOperation` defaults the generics to `unknown`, which
779
+ * defeats inference at the call site. Use this in per-type modules instead of
780
+ * the bare object literal.
781
+ */
782
+ declare function defineConnectorOperation<TConfig, TArgs, TData>(opts: {
783
+ name: string;
784
+ argsSchema: z.ZodType<TArgs, z.ZodTypeDef, unknown>;
785
+ dataSchemaVersion: number;
786
+ handler: (args: TArgs, ctx: ConnectorContext<TConfig>) => Promise<{
787
+ data: TData;
788
+ }>;
789
+ }): ConnectorOperation<TConfig, TArgs, TData>;
790
+
791
+ type InvokeOperationInput = {
792
+ /** The connector entry from `citadel.yaml` (already validated). */
793
+ connector: Connector;
794
+ /** Operation name as it appears on the type (kebab-case, e.g. "list-issues"). */
795
+ operationName: string;
796
+ /** Raw arguments object supplied by the caller (MCP `arguments` or CLI flags). */
797
+ args: unknown;
798
+ /** Optional environment override — defaults to `process.env`. */
799
+ env?: NodeJS.ProcessEnv;
800
+ };
801
+ /**
802
+ * The only call path that runs a connector handler. Both the MCP server
803
+ * (`src/core/mcp/server.ts`) and the fallback CLI (`src/cli/commands/connector.ts`)
804
+ * go through it. Every outcome is wrapped in the documented envelope.
805
+ */
806
+ declare function invokeOperation(input: InvokeOperationInput): Promise<ConnectorResultEnvelope>;
807
+ /**
808
+ * Compose the human/agent-facing description for a single connector operation.
809
+ * Per Gap 48: if the entry carries a `description`, prepend it (trimmed) with
810
+ * a single space separator; otherwise return the type's description alone.
811
+ */
812
+ declare function buildToolDescription(connector: Connector, operation: ConnectorOperation, resolvedConfig: unknown, type: ConnectorType): string;
813
+ /**
814
+ * Build the full `tools/list` descriptor set from a validated citadel config.
815
+ * Used by both the MCP server (live) and `maester connector list` (debug).
816
+ *
817
+ * Configs with unknown connector types or per-type config validation failures
818
+ * are surfaced as `Error` throws — the citadel schema's `.superRefine` should
819
+ * have caught these at load time; reaching this function with an unknown type
820
+ * means a registry mutation happened after load.
821
+ */
822
+ declare function listConnectorTools(config: CitadelConfig): ConnectorToolDescriptor[];
823
+ /**
824
+ * Helper: find a connector and operation by their `(connectorName, operationName)`
825
+ * pair without dispatching. Used by the MCP server's `tools/call` handler to
826
+ * resolve the tool name back to a connector before invoking it.
827
+ *
828
+ * Returns `undefined` when either side is unknown — callers turn that into the
829
+ * appropriate `connector-not-found` / `unknown-operation` envelope.
830
+ */
831
+ declare function findOperationByToolName(config: CitadelConfig, candidateToolName: string): {
832
+ connector: Connector;
833
+ operationName: string;
834
+ type: ConnectorType;
835
+ } | undefined;
836
+
837
+ declare function listConnectorTypes(): ConnectorType<unknown>[];
838
+ declare function lookupConnectorType(id: string): ConnectorType<unknown> | undefined;
839
+ declare function hasConnectorType(id: string): boolean;
840
+ /**
841
+ * Add a type to the production registry. Called once per type from a per-type
842
+ * module's top-level import effect (e.g. `src/core/connectors/types/<id>/index.ts`).
843
+ * Re-registering the same id throws — type identifiers are write-once.
844
+ */
845
+ declare function registerConnectorType<T>(type: ConnectorType<T>): void;
846
+
847
+ /**
848
+ * Error thrown by connector handlers to signal a known failure mode. The
849
+ * dispatcher catches it and wraps it in the documented error envelope. Any
850
+ * other exception is treated as `internal-error`.
851
+ */
852
+ declare class ConnectorError extends Error {
853
+ readonly code: ConnectorErrorCode;
854
+ readonly details: Record<string, unknown> | undefined;
855
+ constructor(code: ConnectorErrorCode, message: string, details?: Record<string, unknown>);
856
+ }
857
+
514
858
  declare class MaesterError extends Error {
515
859
  readonly code: string;
516
860
  readonly cause?: unknown;
@@ -543,4 +887,4 @@ declare class DestinationBlockedError extends MaesterError {
543
887
  constructor(destination: string, message: string);
544
888
  }
545
889
 
546
- export { AuthError, type AuthRef, type BehindReason, type CitadelConfig, ConfigError, DestinationBlockedError, type MaesterConfig, MaesterError, type ProgressEvent, type PublishedDocument, RefNotFoundError, SKILL_VERSION, type SkillAction, type SkillInstallOutcome, type SkillInstallResult, type SkillStatusOutcome, type SkillStatusResult, type SkillTarget, type SkillTargetId, type Source, type StatusCounts, type StatusOptions, type StatusOutcome, type StatusResult, type StatusVerdict, type SyncOptions, type SyncOutcome, type SyncResult, type SyncStatus, listSkillTargets, loadCitadelConfig, loadMaesterConfig, runSkillInstall, runSkillStatus, runSkillUpgrade, runStatus, runSync };
890
+ export { AuthError, type AuthRef, type BehindReason, CONNECTOR_ERROR_CODES, type CitadelConfig, ConfigError, type Connector, type ConnectorContext, ConnectorError, type ConnectorErrorCode, type ConnectorErrorPayload, type ConnectorFailureEnvelope, type ConnectorOperation, type ConnectorResultEnvelope, type ConnectorSuccessEnvelope, type ConnectorToolDescriptor, type ConnectorType, DestinationBlockedError, ENVELOPE_SCHEMA_VERSION, type MaesterConfig, MaesterError, type ProgressEvent, type PublishedDocument, RefNotFoundError, SKILL_VERSION, type SkillAction, type SkillInstallOutcome, type SkillInstallResult, type SkillStatusOutcome, type SkillStatusResult, type SkillTarget, type SkillTargetId, type Source, type StatusCounts, type StatusOptions, type StatusOutcome, type StatusResult, type StatusVerdict, type SyncOptions, type SyncOutcome, type SyncResult, type SyncStatus, buildToolDescription, defineConnectorOperation, findOperationByToolName, hasConnectorType, invokeOperation, listConnectorTools, listConnectorTypes, listSkillTargets, loadCitadelConfig, loadMaesterConfig, lookupConnectorType, registerConnectorType, runSkillInstall, runSkillStatus, runSkillUpgrade, runStatus, runSync };