@frontmcp/adapters 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/esm/index.mjs +21 -3
  2. package/esm/openapi/index.mjs +21 -3
  3. package/esm/package.json +7 -7
  4. package/esm/skills/index.mjs +258 -20
  5. package/index.js +21 -3
  6. package/openapi/index.js +21 -3
  7. package/openapi/openapi.adapter.d.ts +12 -0
  8. package/openapi/openapi.adapter.d.ts.map +1 -1
  9. package/openapi/openapi.types.d.ts +8 -1
  10. package/openapi/openapi.types.d.ts.map +1 -1
  11. package/package.json +7 -7
  12. package/skills/audit/audit-config.d.ts +1 -1
  13. package/skills/audit/audit-writer.d.ts +2 -1
  14. package/skills/audit/audit-writer.d.ts.map +1 -1
  15. package/skills/bundle/bundle-diff.d.ts.map +1 -1
  16. package/skills/bundle/bundle.schema.d.ts +1 -0
  17. package/skills/bundle/bundle.schema.d.ts.map +1 -1
  18. package/skills/bundle/bundle.types.d.ts +12 -3
  19. package/skills/bundle/bundle.types.d.ts.map +1 -1
  20. package/skills/deploy/manifest-to-config.d.ts +61 -0
  21. package/skills/deploy/manifest-to-config.d.ts.map +1 -0
  22. package/skills/index.d.ts +4 -2
  23. package/skills/index.d.ts.map +1 -1
  24. package/skills/index.js +261 -20
  25. package/skills/openapi/compile-skilled-bundle.d.ts +73 -0
  26. package/skills/openapi/compile-skilled-bundle.d.ts.map +1 -0
  27. package/skills/source-options.d.ts +8 -0
  28. package/skills/source-options.d.ts.map +1 -1
  29. package/skills/sources/index.d.ts +5 -4
  30. package/skills/sources/index.d.ts.map +1 -1
  31. package/skills/sources/inline.source.d.ts +16 -0
  32. package/skills/sources/inline.source.d.ts.map +1 -0
  33. package/skills/sources/npm.source.d.ts.map +1 -1
  34. package/skills/sources/saas-pull.source.d.ts +12 -2
  35. package/skills/sources/saas-pull.source.d.ts.map +1 -1
  36. package/skills/sources/skill-bundle-source.interface.d.ts +41 -0
  37. package/skills/sources/skill-bundle-source.interface.d.ts.map +1 -1
@@ -1,6 +1,7 @@
1
1
  import type { FrontMcpLogger } from '@frontmcp/sdk';
2
+ import type { ResolvedBundle } from '../bundle/bundle.types';
2
3
  import type { SaasSourceOptions } from '../source-options';
3
- import type { BundleSourceListener, SkillBundleSource } from './skill-bundle-source.interface';
4
+ import type { BundleSourceDeps, BundleSourceListener, SkillBundleSource } from './skill-bundle-source.interface';
4
5
  /**
5
6
  * Pulls bundles from a configured SaaS endpoint via authenticated HTTPS.
6
7
  *
@@ -23,16 +24,25 @@ export declare class SaasPullSource implements SkillBundleSource {
23
24
  private readonly options;
24
25
  private readonly cacheDir;
25
26
  private readonly logger;
27
+ private readonly deps;
26
28
  readonly id: string;
27
29
  private listeners;
28
30
  private pollHandle;
29
31
  private inFlight;
30
32
  private stopped;
31
- constructor(options: SaasSourceOptions, cacheDir: string | undefined, logger: FrontMcpLogger);
33
+ constructor(options: SaasSourceOptions, cacheDir: string | undefined, logger: FrontMcpLogger, deps?: BundleSourceDeps);
32
34
  start(): Promise<void>;
33
35
  onChange(listener: BundleSourceListener): () => void;
34
36
  stop(): Promise<void>;
35
37
  private schedulePoll;
38
+ /**
39
+ * Manually pull a fresh bundle, persist it, and notify listeners. Drive this
40
+ * from a Cron Trigger / Durable Object alarm on runtimes without background
41
+ * timers (where `disablePolling` is set). Single-flight: returns `undefined`
42
+ * if a pull is already in flight; throws if the pull itself fails (the caller
43
+ * — e.g. a scheduled handler — decides how to surface it).
44
+ */
45
+ refresh(): Promise<ResolvedBundle | undefined>;
36
46
  private pollOnce;
37
47
  protected httpGet(url: string, headers: Record<string, string>): Promise<{
38
48
  status: number;
@@ -1 +1 @@
1
- {"version":3,"file":"saas-pull.source.d.ts","sourceRoot":"","sources":["../../../src/skills/sources/saas-pull.source.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAKpD,OAAO,KAAK,EAAE,iBAAiB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` resolves.
30
30
  */
31
31
  onChange(listener: BundleSourceListener): () => void;
32
+ /**
33
+ * Pull a fresh bundle on demand and notify listeners — the manual,
34
+ * externally-driven counterpart to background polling. Optional: only
35
+ * remote/pulling sources implement it. On runtimes with no background
36
+ * execution (Cloudflare Workers) a Cron Trigger / Durable Object alarm
37
+ * calls this instead of relying on an internal timer. Resolves to the new
38
+ * bundle, or `undefined` if a pull is already in flight / the source is
39
+ * stopped.
40
+ */
41
+ refresh?(): Promise<ResolvedBundle | undefined>;
32
42
  /** Halt background work; idempotent. */
33
43
  stop(): Promise<void>;
34
44
  }
35
45
  export type BundleSourceListener = (bundle: ResolvedBundle) => void;
46
+ /**
47
+ * Pluggable last-good bundle cache. The default (Node) implementation writes to
48
+ * disk; V8-isolate runtimes (Cloudflare Workers) inject a KV-backed store
49
+ * instead — there is no filesystem on a Worker.
50
+ */
51
+ export interface BundleCacheStore {
52
+ read(): Promise<ResolvedBundle | undefined>;
53
+ write(bundle: ResolvedBundle): Promise<void>;
54
+ }
55
+ /**
56
+ * Optional runtime dependencies any pulling bundle source can accept. NOT
57
+ * SaaS-specific — these are the knobs a host injects to make a source run on a
58
+ * constrained runtime:
59
+ * - `cache` replaces the on-disk last-good cache (no filesystem on a Worker),
60
+ * - `disablePolling` turns off the internal `setInterval` loop (no background
61
+ * execution on a Worker; a Cron Trigger / DO alarm drives {@link
62
+ * SkillBundleSource.refresh} instead).
63
+ */
64
+ export interface BundleSourceDeps {
65
+ /**
66
+ * Override the on-disk cache with a custom store (e.g. KV on Cloudflare).
67
+ * When provided, NO filesystem APIs are touched — required on V8 isolates.
68
+ */
69
+ cache?: BundleCacheStore;
70
+ /**
71
+ * Disable the internal `setInterval` poll loop. Use on runtimes with no
72
+ * background execution where a Cron Trigger / Durable Object alarm drives
73
+ * {@link SkillBundleSource.refresh} instead.
74
+ */
75
+ disablePolling?: boolean;
76
+ }
36
77
  //# sourceMappingURL=skill-bundle-source.interface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"skill-bundle-source.interface.d.ts","sourceRoot":"","sources":["../../../src/skills/sources/skill-bundle-source.interface.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,iBAAiB;IAChC,qEAAqE;IACrE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,IAAI,CAAC;IAErD,wCAAwC;IACxC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC"}
1
+ {"version":3,"file":"skill-bundle-source.interface.d.ts","sourceRoot":"","sources":["../../../src/skills/sources/skill-bundle-source.interface.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,iBAAiB;IAChC,qEAAqE;IACrE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,IAAI,CAAC;IAErD;;;;;;;;OAQG;IACH,OAAO,CAAC,IAAI,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAEhD,wCAAwC;IACxC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;AAEpE;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,IAAI,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAC5C,KAAK,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B"}