@wootsup/mcp 0.1.0 → 0.4.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 (208) hide show
  1. package/CHANGELOG.md +157 -83
  2. package/README.md +31 -27
  3. package/SECURITY.md +15 -6
  4. package/dist/auth/keychain.d.ts +27 -1
  5. package/dist/auth/keychain.js +48 -2
  6. package/dist/auth/keychain.js.map +1 -1
  7. package/dist/catalog/build-catalog.d.ts +31 -0
  8. package/dist/catalog/build-catalog.js +68 -0
  9. package/dist/catalog/build-catalog.js.map +1 -0
  10. package/dist/cli-hint.d.ts +22 -0
  11. package/dist/cli-hint.js +55 -0
  12. package/dist/cli-hint.js.map +1 -0
  13. package/dist/index.js +129 -22
  14. package/dist/index.js.map +1 -1
  15. package/dist/install-skill.js +1 -1
  16. package/dist/modules/apimapper/auto-layout.d.ts +21 -0
  17. package/dist/modules/apimapper/auto-layout.js +54 -0
  18. package/dist/modules/apimapper/auto-layout.js.map +1 -0
  19. package/dist/modules/apimapper/cache.js +25 -17
  20. package/dist/modules/apimapper/cache.js.map +1 -1
  21. package/dist/modules/apimapper/client.d.ts +115 -4
  22. package/dist/modules/apimapper/client.js +699 -304
  23. package/dist/modules/apimapper/client.js.map +1 -1
  24. package/dist/modules/apimapper/connections-format.d.ts +31 -1
  25. package/dist/modules/apimapper/connections-format.js +97 -5
  26. package/dist/modules/apimapper/connections-format.js.map +1 -1
  27. package/dist/modules/apimapper/connections.d.ts +9 -7
  28. package/dist/modules/apimapper/connections.js +449 -127
  29. package/dist/modules/apimapper/connections.js.map +1 -1
  30. package/dist/modules/apimapper/credential-sanitizer.d.ts +5 -0
  31. package/dist/modules/apimapper/credential-sanitizer.js +60 -1
  32. package/dist/modules/apimapper/credential-sanitizer.js.map +1 -1
  33. package/dist/modules/apimapper/credentials.js +105 -61
  34. package/dist/modules/apimapper/credentials.js.map +1 -1
  35. package/dist/modules/apimapper/diagnose.js +21 -2
  36. package/dist/modules/apimapper/diagnose.js.map +1 -1
  37. package/dist/modules/apimapper/elicitation.d.ts +29 -0
  38. package/dist/modules/apimapper/elicitation.js +62 -0
  39. package/dist/modules/apimapper/elicitation.js.map +1 -1
  40. package/dist/modules/apimapper/example-extract.d.ts +13 -0
  41. package/dist/modules/apimapper/example-extract.js +111 -0
  42. package/dist/modules/apimapper/example-extract.js.map +1 -0
  43. package/dist/modules/apimapper/filter-operators.d.ts +24 -0
  44. package/dist/modules/apimapper/filter-operators.js +103 -0
  45. package/dist/modules/apimapper/filter-operators.js.map +1 -0
  46. package/dist/modules/apimapper/flows-format.js +92 -22
  47. package/dist/modules/apimapper/flows-format.js.map +1 -1
  48. package/dist/modules/apimapper/flows.d.ts +8 -7
  49. package/dist/modules/apimapper/flows.js +275 -120
  50. package/dist/modules/apimapper/flows.js.map +1 -1
  51. package/dist/modules/apimapper/gateway/advanced-read-tool.d.ts +9 -0
  52. package/dist/modules/apimapper/gateway/advanced-read-tool.js +172 -0
  53. package/dist/modules/apimapper/gateway/advanced-read-tool.js.map +1 -0
  54. package/dist/modules/apimapper/gateway/advanced-tool.js +66 -106
  55. package/dist/modules/apimapper/gateway/advanced-tool.js.map +1 -1
  56. package/dist/modules/apimapper/gateway/collect-module-tools.d.ts +17 -0
  57. package/dist/modules/apimapper/gateway/collect-module-tools.js +44 -0
  58. package/dist/modules/apimapper/gateway/collect-module-tools.js.map +1 -0
  59. package/dist/modules/apimapper/gateway/essentials.d.ts +1 -1
  60. package/dist/modules/apimapper/gateway/essentials.js +21 -2
  61. package/dist/modules/apimapper/gateway/essentials.js.map +1 -1
  62. package/dist/modules/apimapper/gateway/gateway-shared.d.ts +21 -0
  63. package/dist/modules/apimapper/gateway/gateway-shared.js +124 -0
  64. package/dist/modules/apimapper/gateway/gateway-shared.js.map +1 -0
  65. package/dist/modules/apimapper/gateway/test-support.d.ts +1 -17
  66. package/dist/modules/apimapper/gateway/test-support.js +4 -33
  67. package/dist/modules/apimapper/gateway/test-support.js.map +1 -1
  68. package/dist/modules/apimapper/get-skill-cores.d.ts +4 -0
  69. package/dist/modules/apimapper/get-skill-cores.js +220 -0
  70. package/dist/modules/apimapper/get-skill-cores.js.map +1 -0
  71. package/dist/modules/apimapper/get-skill.d.ts +1 -1
  72. package/dist/modules/apimapper/get-skill.js +74 -9
  73. package/dist/modules/apimapper/get-skill.js.map +1 -1
  74. package/dist/modules/apimapper/graph-builder.d.ts +85 -2
  75. package/dist/modules/apimapper/graph-builder.js +151 -15
  76. package/dist/modules/apimapper/graph-builder.js.map +1 -1
  77. package/dist/modules/apimapper/graph.js +152 -48
  78. package/dist/modules/apimapper/graph.js.map +1 -1
  79. package/dist/modules/apimapper/index.js +27 -13
  80. package/dist/modules/apimapper/index.js.map +1 -1
  81. package/dist/modules/apimapper/jmespath-test.d.ts +4 -0
  82. package/dist/modules/apimapper/jmespath-test.js +152 -0
  83. package/dist/modules/apimapper/jmespath-test.js.map +1 -0
  84. package/dist/modules/apimapper/library.js +553 -88
  85. package/dist/modules/apimapper/library.js.map +1 -1
  86. package/dist/modules/apimapper/license.js +12 -36
  87. package/dist/modules/apimapper/license.js.map +1 -1
  88. package/dist/modules/apimapper/list-footer.d.ts +27 -0
  89. package/dist/modules/apimapper/list-footer.js +57 -0
  90. package/dist/modules/apimapper/list-footer.js.map +1 -0
  91. package/dist/modules/apimapper/local-sources.js +100 -57
  92. package/dist/modules/apimapper/local-sources.js.map +1 -1
  93. package/dist/modules/apimapper/mcp-client-identity.d.ts +32 -0
  94. package/dist/modules/apimapper/mcp-client-identity.js +70 -0
  95. package/dist/modules/apimapper/mcp-client-identity.js.map +1 -0
  96. package/dist/modules/apimapper/merge-constants.d.ts +6 -0
  97. package/dist/modules/apimapper/merge-constants.js +26 -0
  98. package/dist/modules/apimapper/merge-constants.js.map +1 -0
  99. package/dist/modules/apimapper/misc.js +13 -27
  100. package/dist/modules/apimapper/misc.js.map +1 -1
  101. package/dist/modules/apimapper/node-schema.d.ts +52 -2
  102. package/dist/modules/apimapper/node-schema.js +95 -4
  103. package/dist/modules/apimapper/node-schema.js.map +1 -1
  104. package/dist/modules/apimapper/onboarding.d.ts +59 -1
  105. package/dist/modules/apimapper/onboarding.js +231 -28
  106. package/dist/modules/apimapper/onboarding.js.map +1 -1
  107. package/dist/modules/apimapper/read-cache.d.ts +16 -3
  108. package/dist/modules/apimapper/read-cache.js +59 -4
  109. package/dist/modules/apimapper/read-cache.js.map +1 -1
  110. package/dist/modules/apimapper/render/index.js +26 -5
  111. package/dist/modules/apimapper/render/index.js.map +1 -1
  112. package/dist/modules/apimapper/resource-id.d.ts +13 -0
  113. package/dist/modules/apimapper/resource-id.js +69 -0
  114. package/dist/modules/apimapper/resource-id.js.map +1 -0
  115. package/dist/modules/apimapper/schema.js +9 -18
  116. package/dist/modules/apimapper/schema.js.map +1 -1
  117. package/dist/modules/apimapper/settings.js +49 -52
  118. package/dist/modules/apimapper/settings.js.map +1 -1
  119. package/dist/modules/apimapper/sites-tools.d.ts +29 -0
  120. package/dist/modules/apimapper/sites-tools.js +165 -0
  121. package/dist/modules/apimapper/sites-tools.js.map +1 -0
  122. package/dist/modules/apimapper/tool-result.d.ts +66 -0
  123. package/dist/modules/apimapper/tool-result.js +125 -0
  124. package/dist/modules/apimapper/tool-result.js.map +1 -0
  125. package/dist/modules/apimapper/toolslist-size.d.ts +12 -11
  126. package/dist/modules/apimapper/toolslist-size.js +34 -21
  127. package/dist/modules/apimapper/toolslist-size.js.map +1 -1
  128. package/dist/modules/apimapper/types.d.ts +34 -0
  129. package/dist/modules/apimapper/types.js +1 -1
  130. package/dist/modules/apimapper/types.js.map +1 -1
  131. package/dist/modules/apimapper/whitelist-drift.d.ts +85 -0
  132. package/dist/modules/apimapper/whitelist-drift.js +375 -0
  133. package/dist/modules/apimapper/whitelist-drift.js.map +1 -0
  134. package/dist/modules/apimapper/workflows.js +302 -58
  135. package/dist/modules/apimapper/workflows.js.map +1 -1
  136. package/dist/modules/apimapper/yootheme-binding.d.ts +35 -0
  137. package/dist/modules/apimapper/yootheme-binding.js +267 -0
  138. package/dist/modules/apimapper/yootheme-binding.js.map +1 -0
  139. package/dist/platform/index.d.ts +56 -0
  140. package/dist/platform/index.js +158 -2
  141. package/dist/platform/index.js.map +1 -1
  142. package/dist/proxy/bridge.d.ts +35 -0
  143. package/dist/proxy/bridge.js +129 -0
  144. package/dist/proxy/bridge.js.map +1 -0
  145. package/dist/proxy/mode.d.ts +9 -0
  146. package/dist/proxy/mode.js +20 -0
  147. package/dist/proxy/mode.js.map +1 -0
  148. package/dist/setup/detect-clients.d.ts +40 -1
  149. package/dist/setup/detect-clients.js +148 -1
  150. package/dist/setup/detect-clients.js.map +1 -1
  151. package/dist/setup/probe-auth.d.ts +51 -0
  152. package/dist/setup/probe-auth.js +141 -0
  153. package/dist/setup/probe-auth.js.map +1 -0
  154. package/dist/setup/probe-handshake.js +40 -7
  155. package/dist/setup/probe-handshake.js.map +1 -1
  156. package/dist/setup/remove-config.d.ts +8 -0
  157. package/dist/setup/remove-config.js +145 -0
  158. package/dist/setup/remove-config.js.map +1 -0
  159. package/dist/setup/uninstall.d.ts +34 -0
  160. package/dist/setup/uninstall.js +147 -0
  161. package/dist/setup/uninstall.js.map +1 -0
  162. package/dist/setup-cli.d.ts +16 -0
  163. package/dist/setup-cli.js +63 -1
  164. package/dist/setup-cli.js.map +1 -1
  165. package/dist/sites/loader.d.ts +48 -0
  166. package/dist/sites/loader.js +134 -0
  167. package/dist/sites/loader.js.map +1 -0
  168. package/dist/sites/schema.d.ts +69 -0
  169. package/dist/sites/schema.js +71 -0
  170. package/dist/sites/schema.js.map +1 -0
  171. package/dist/sites/secret-resolver.d.ts +47 -0
  172. package/dist/sites/secret-resolver.js +150 -0
  173. package/dist/sites/secret-resolver.js.map +1 -0
  174. package/dist/skill-instructions.d.ts +14 -1
  175. package/dist/skill-instructions.js +35 -6
  176. package/dist/skill-instructions.js.map +1 -1
  177. package/dist/transports/stdio.js +4 -4
  178. package/dist/transports/stdio.js.map +1 -1
  179. package/dist/uninstall-skill.d.ts +27 -0
  180. package/dist/uninstall-skill.js +89 -0
  181. package/dist/uninstall-skill.js.map +1 -0
  182. package/docs/architecture.md +21 -21
  183. package/docs/customgraph-internal-migration.md +4 -4
  184. package/docs/security.md +2 -21
  185. package/docs/tools.md +40 -12
  186. package/manifest.json +77 -79
  187. package/package.json +69 -65
  188. package/skills/apimapper/SKILL.md +128 -7
  189. package/skills/apimapper/reference/conditional-style-multi-items.md +114 -0
  190. package/skills/apimapper/reference/dynamize-existing-layout.md +158 -0
  191. package/skills/apimapper/reference/jmespath-cookbook.md +241 -0
  192. package/skills/apimapper/reference/jmespath-pitfalls.md +189 -0
  193. package/skills/apimapper/reference/joomla.md +1 -1
  194. package/skills/apimapper/reference/library-template-discovery.md +65 -0
  195. package/skills/apimapper/reference/merge-two-sources-on-key.md +204 -0
  196. package/skills/apimapper/reference/oauth.md +143 -52
  197. package/skills/apimapper/reference/troubleshooting.md +22 -2
  198. package/skills/apimapper/reference/yootheme-source-to-builder-handoff.md +348 -0
  199. package/skills/apimapper/reference/yootheme.md +75 -44
  200. package/dist/auth/oauth-provider.d.ts +0 -68
  201. package/dist/auth/oauth-provider.js +0 -232
  202. package/dist/auth/oauth-provider.js.map +0 -1
  203. package/dist/server-http.d.ts +0 -22
  204. package/dist/server-http.js +0 -159
  205. package/dist/server-http.js.map +0 -1
  206. package/dist/transports/http.d.ts +0 -29
  207. package/dist/transports/http.js +0 -267
  208. package/dist/transports/http.js.map +0 -1
@@ -0,0 +1,165 @@
1
+ // src/modules/apimapper/sites-tools.ts — Phase 3.
2
+ //
3
+ // Sites-file-backed implementations of the profile tools. When a sites-file is
4
+ // active (APIMAPPER_SITES_FILE set + non-empty), index.ts wires THESE registrars
5
+ // under the canonical tool names (apimapper_list_profiles / apimapper_use_profile)
6
+ // instead of the keychain ProfileStore versions in use-profile.ts. The tool
7
+ // names + response shapes stay identical so the agent surface is unchanged —
8
+ // only the backing store differs (sites-file entries vs keychain profiles).
9
+ //
10
+ // `apimapper_use_profile(name)` calls `setActiveSite(name)` on the client, which
11
+ // resets the resolution memo so the NEXT request() retargets the chosen site.
12
+ // `setActiveSite` runs BEFORE the optional identity probe so the probe hits the
13
+ // newly-activated site.
14
+ import { z } from "zod";
15
+ import { formatResult, mutating, readOnly } from "@getimo/mcp-toolkit";
16
+ import { request } from "./client.js";
17
+ export function registerSitesListProfilesTool(server, deps) {
18
+ const registrar = server;
19
+ registrar.registerTool("apimapper_list_profiles", {
20
+ title: "List Configured Profiles",
21
+ description: "List all configured site profiles (name, siteUrl, platform) with an " +
22
+ "is_active flag indicating which one is currently active. " +
23
+ "Backed by your sites-file (APIMAPPER_SITES_FILE). " +
24
+ "Use this to discover available profile names before calling " +
25
+ "apimapper_use_profile to switch the active site. " +
26
+ "Read-only — does not contact any site." +
27
+ "\n\nResponse shape:\n" +
28
+ " { profile_count, active_profile, profiles: [{ name, siteUrl, platform, is_active }] }",
29
+ inputSchema: {},
30
+ annotations: readOnly({ title: "List Configured Profiles", openWorld: false }),
31
+ }, async () => {
32
+ const reg = deps.getRegistry();
33
+ const active = deps.getActiveSiteId();
34
+ // When no explicit pointer is set, the default entry is the active one.
35
+ const activeName = active ?? reg.getDefault().site_id;
36
+ const profiles = reg.list().map((entry) => ({
37
+ name: entry.site_id,
38
+ siteUrl: entry.url,
39
+ platform: entry.platform,
40
+ is_active: entry.site_id === activeName,
41
+ }));
42
+ return formatResult({
43
+ profile_count: profiles.length,
44
+ active_profile: activeName,
45
+ source: "sites-file",
46
+ profiles,
47
+ }, false, { maxChars: 3000 });
48
+ });
49
+ }
50
+ /**
51
+ * Default probe: switch already happened (setActiveSite ran first), so the
52
+ * legacy `request("identity")` now resolves to the freshly-activated site.
53
+ */
54
+ async function defaultSitesProbeIdentity(_entry) {
55
+ const r = await request("/identity");
56
+ if (!r.success) {
57
+ throw new Error(r.error ?? "identity probe failed");
58
+ }
59
+ return normaliseIdentity(r.data);
60
+ }
61
+ function normaliseIdentity(data) {
62
+ if (!data || typeof data !== "object") {
63
+ throw new Error("identity response missing object body");
64
+ }
65
+ const o = data;
66
+ const plugin_version = typeof o.plugin_version === "string" ? o.plugin_version : "";
67
+ const plugin_hash = typeof o.plugin_hash === "string" ? o.plugin_hash : "";
68
+ const site_url = (typeof o.site_url === "string" && o.site_url) ||
69
+ (typeof o.siteurl === "string" && o.siteurl) ||
70
+ "";
71
+ const caps = Array.isArray(o.capabilities)
72
+ ? o.capabilities.filter((c) => typeof c === "string")
73
+ : [];
74
+ if (!plugin_version || !plugin_hash) {
75
+ throw new Error("identity response missing required fields");
76
+ }
77
+ return { plugin_version, plugin_hash, site_url, capabilities: caps };
78
+ }
79
+ export function registerSitesUseProfileTool(server, deps) {
80
+ const probe = deps.probeIdentity ?? defaultSitesProbeIdentity;
81
+ const registrar = server;
82
+ registrar.registerTool("apimapper_use_profile", {
83
+ title: "Switch Active Profile",
84
+ description: "Activate a configured site (from your sites-file) and probe its identity " +
85
+ "endpoint to confirm the site is reachable and the plugin is installed. " +
86
+ "Switching retargets every subsequent tool call at the chosen site. " +
87
+ "Use `noProbe: true` to skip the network probe for offline activation." +
88
+ "\n\nExample:\n apimapper_use_profile({ name: 'prod', noProbe: false })",
89
+ inputSchema: {
90
+ name: z
91
+ .string()
92
+ .min(1)
93
+ .describe('Site_id to activate (e.g., "dev", "client-x-prod"). Use apimapper_list_profiles to discover.'),
94
+ noProbe: z
95
+ .boolean()
96
+ .default(false)
97
+ .describe("Skip the live /identity probe. Use for offline activation when the site is unreachable."),
98
+ },
99
+ // Mutating: flips the active-site pointer (changes which backend every
100
+ // subsequent request targets). Closed-world — bounded to the local
101
+ // sites-file selection + an internal /identity call.
102
+ annotations: mutating({ title: "Switch Active Profile", openWorld: false }),
103
+ }, async (args) => {
104
+ const { name, noProbe = false } = args;
105
+ const reg = deps.getRegistry();
106
+ const entry = reg.get(name);
107
+ if (!entry) {
108
+ return formatResult({
109
+ error: `Site "${name}" not found in sites-file`,
110
+ context: { name, known: reg.listIds() },
111
+ hint: "Use apimapper_list_profiles to see configured sites.",
112
+ }, true);
113
+ }
114
+ // Switch FIRST so the (default) identity probe targets the new site.
115
+ try {
116
+ deps.setActiveSite(name);
117
+ }
118
+ catch (e) {
119
+ const msg = e instanceof Error ? e.message : String(e);
120
+ return formatResult({
121
+ error: `Failed to activate site "${name}": ${msg}`,
122
+ context: { name },
123
+ hint: "Verify APIMAPPER_SITES_FILE is set and the site_id exists.",
124
+ }, true);
125
+ }
126
+ if (noProbe) {
127
+ return formatResult({
128
+ activated: true,
129
+ profile: { name: entry.site_id, siteUrl: entry.url, platform: entry.platform },
130
+ noProbe: true,
131
+ source: "sites-file",
132
+ warnings: [
133
+ "Identity probe skipped (noProbe=true). Plugin reachability not verified.",
134
+ ],
135
+ }, false, { maxChars: 2500 });
136
+ }
137
+ let identity;
138
+ try {
139
+ identity = await probe(entry);
140
+ }
141
+ catch (e) {
142
+ const msg = e instanceof Error ? e.message : String(e);
143
+ return formatResult({
144
+ // The switch already happened; surface that the probe (not the
145
+ // switch) failed so the agent knows the active site DID change.
146
+ error: `Site "${name}" activated, but identity probe failed: ${msg}`,
147
+ context: { name, siteUrl: entry.url, platform: entry.platform },
148
+ hint: "Verify the site is reachable and the plugin is installed/active. " +
149
+ "Re-run with `noProbe: true` to activate without probing.",
150
+ }, true);
151
+ }
152
+ return formatResult({
153
+ activated: true,
154
+ profile: { name: entry.site_id, siteUrl: entry.url, platform: entry.platform },
155
+ source: "sites-file",
156
+ identity: {
157
+ plugin_version: identity.plugin_version,
158
+ plugin_hash: identity.plugin_hash,
159
+ capabilities: identity.capabilities,
160
+ site_url: identity.site_url,
161
+ },
162
+ }, false, { maxChars: 3000 });
163
+ });
164
+ }
165
+ //# sourceMappingURL=sites-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sites-tools.js","sourceRoot":"","sources":["../../../src/modules/apimapper/sites-tools.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,EAAE;AACF,+EAA+E;AAC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,KAAK,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,GAAG,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACvD,OAAO,YAAY,CACjB;gBACE,+DAA+D;gBAC/D,gEAAgE;gBAChE,KAAK,EAAE,SAAS,IAAI,2CAA2C,GAAG,EAAE;gBACpE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE;gBAC/D,IAAI,EACF,mEAAmE;oBACnE,0DAA0D;aAC7D,EACD,IAAI,CACL,CAAC;QACJ,CAAC;QAED,OAAO,YAAY,CACjB;YACE,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE;YAC9E,MAAM,EAAE,YAAY;YACpB,QAAQ,EAAE;gBACR,cAAc,EAAE,QAAQ,CAAC,cAAc;gBACvC,WAAW,EAAE,QAAQ,CAAC,WAAW;gBACjC,YAAY,EAAE,QAAQ,CAAC,YAAY;gBACnC,QAAQ,EAAE,QAAQ,CAAC,QAAQ;aAC5B;SACF,EACD,KAAK,EACL,EAAE,QAAQ,EAAE,IAAI,EAAE,CACnB,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,66 @@
1
+ import type { StructuredCallToolResult } from "@getimo/mcp-toolkit";
2
+ import { type ApiErrorCode } from "./client.js";
3
+ /**
4
+ * The minimal slice of a response this helper reads. `ExtApiResponse` (the
5
+ * shared client return type) is a structural superset, and the graph
6
+ * hydration object `{ error, status?, errorCode? }` also satisfies it, so
7
+ * both can flow through `restErrorResult` without a cast.
8
+ */
9
+ export interface RestErrorLike {
10
+ /** Human-readable error from the upstream response, if any. */
11
+ error?: string;
12
+ /** Coarse error classification used for the recovery hint + code fallback. */
13
+ errorCode?: ApiErrorCode | string;
14
+ /** HTTP status, used as the `code` fallback when `errorCode` is absent. */
15
+ status?: number;
16
+ /**
17
+ * F11 (2026-06-09): the parsed JSON body of a non-2xx response (the WP +
18
+ * Joomla platform paths thread it through as `errorBody`). When the server
19
+ * returns a STRUCTURED domain error — e.g. the 400 `invalid_content_type`
20
+ * payload `{error_code, valid_types, suggestion}` — we surface those fields
21
+ * VERBATIM instead of the coarse `errorCode`/`hintFor()` defaults. Absent for
22
+ * non-JSON errors and for the legacy paths that never set it.
23
+ */
24
+ errorBody?: Record<string, unknown>;
25
+ }
26
+ /** Per-site overrides for the canonical REST-error mapping. */
27
+ export interface RestErrorOpts {
28
+ /**
29
+ * Fallback message when `response.error` is absent. Mirrors the per-tool
30
+ * `r.error ?? "<fallback>"` string each site used inline.
31
+ */
32
+ message?: string;
33
+ /**
34
+ * Bespoke suggestion that overrides the default `hintFor(response.errorCode)`.
35
+ * Use only where a site intentionally pinned a tool-specific recovery hint.
36
+ */
37
+ suggestion?: string;
38
+ /**
39
+ * Bespoke `code` fallback that overrides the default `String(status)` when
40
+ * `response.errorCode` is absent. Use only where a site pinned a domain code.
41
+ */
42
+ code?: string;
43
+ /**
44
+ * F6 (2026-06-09): opt-in scope-aware 403 handling. Set by tools whose 403
45
+ * means "your key lacks the required scope" rather than "your key is
46
+ * invalid" — e.g. the *_delete tools (delete needs admin scope; a valid
47
+ * read+write key still 403s). When true AND the response is a 403 (or the
48
+ * body signals insufficient scope), the suggestion becomes a scope-upgrade
49
+ * hint instead of the generic key-recovery walkthrough. A 401 always stays a
50
+ * genuine bad-key auth failure even under scopeAware. Leave unset everywhere
51
+ * else so non-delete tools keep the legacy auth hint byte-for-byte.
52
+ */
53
+ scopeAware?: boolean;
54
+ }
55
+ /**
56
+ * Build the canonical structured error result for a failed REST request.
57
+ *
58
+ * Behaviour-preserving replacement for the 67× inline
59
+ * `errorResult({ message: r.error ?? …, code: …, suggestion: hintFor(…), details })`
60
+ * block. See the file header for the exact mapping and the opts contract.
61
+ *
62
+ * @param response the failed response (`!response.success` already checked by the caller)
63
+ * @param details the structured `details` payload (typically the echoed input params)
64
+ * @param opts per-site overrides — see {@link RestErrorOpts}
65
+ */
66
+ export declare function restErrorResult(response: RestErrorLike, details?: Record<string, unknown>, opts?: RestErrorOpts): StructuredCallToolResult;
@@ -0,0 +1,125 @@
1
+ // src/modules/apimapper/tool-result.ts — shared REST-error result builder.
2
+ //
3
+ // A1 (Wave-B audit, 2026-06-03): ~67 tool handlers across the apimapper
4
+ // modules hand-wrote the IDENTICAL post-request error block:
5
+ //
6
+ // if (!r.success) {
7
+ // return errorResult({
8
+ // message: r.error ?? "<per-tool fallback>",
9
+ // code: r.errorCode ?? (r.status ? String(r.status) : undefined),
10
+ // suggestion: hintFor(r.errorCode),
11
+ // details: { ...inputParams },
12
+ // });
13
+ // }
14
+ //
15
+ // `restErrorResult(r, details?, opts?)` collapses that block to a single
16
+ // call while preserving the output BYTE-FOR-BYTE. The mapping is:
17
+ //
18
+ // message → r.error ?? opts.message ?? "request failed"
19
+ // code → r.errorCode ?? (r.status ? String(r.status) : undefined)
20
+ // suggestion → opts.suggestion ?? hintFor(r.errorCode)
21
+ // details → details (passed through verbatim; computed by the caller)
22
+ //
23
+ // Per-site nuance is preserved through `opts`:
24
+ // - opts.message : the per-tool fallback string when `r.error` is absent.
25
+ // - opts.suggestion : a bespoke suggestion that overrides hintFor() (used by
26
+ // the few sites that want a tool-specific recovery hint
27
+ // regardless of the error code).
28
+ // - opts.code : a bespoke `code` fallback that overrides the
29
+ // `r.status`-derived default when `r.errorCode` is absent
30
+ // (used by sites that pin a domain code like
31
+ // "credential_lookup_failed").
32
+ //
33
+ // Sites whose error is NOT a `!response.success` REST failure (e.g. a
34
+ // post-success "entity not found" semantic check, or a `bad_request`
35
+ // validation guard with a hardcoded message/code/suggestion) deliberately
36
+ // stay on the raw `errorResult({...})` form — they are documented per-site
37
+ // and must NOT be funnelled through this helper, because their message/code
38
+ // do not derive from the response shape.
39
+ import { errorResult } from "@getimo/mcp-toolkit";
40
+ import { hintFor } from "./client.js";
41
+ /**
42
+ * Build the canonical structured error result for a failed REST request.
43
+ *
44
+ * Behaviour-preserving replacement for the 67× inline
45
+ * `errorResult({ message: r.error ?? …, code: …, suggestion: hintFor(…), details })`
46
+ * block. See the file header for the exact mapping and the opts contract.
47
+ *
48
+ * @param response the failed response (`!response.success` already checked by the caller)
49
+ * @param details the structured `details` payload (typically the echoed input params)
50
+ * @param opts per-site overrides — see {@link RestErrorOpts}
51
+ */
52
+ export function restErrorResult(response, details, opts = {}) {
53
+ const errorCode = response.errorCode;
54
+ const body = response.errorBody;
55
+ // F11: structured server-error passthrough. When the server attached a
56
+ // domain error_code (e.g. invalid_content_type), prefer it for `code`, lift
57
+ // its `suggestion` over the coarse hintFor(), and thread its `valid_types`
58
+ // (and any other primitive hint) into `details` so the agent can
59
+ // self-correct. Only engages when the body actually carries a string
60
+ // `error_code` — so a plain `{success:false, error}` body keeps the legacy
61
+ // path byte-for-byte.
62
+ const serverErrorCode = body && typeof body.error_code === "string" && body.error_code !== ""
63
+ ? body.error_code
64
+ : undefined;
65
+ const serverSuggestion = body && typeof body.suggestion === "string" && body.suggestion !== ""
66
+ ? body.suggestion
67
+ : undefined;
68
+ const serverValidTypes = body && Array.isArray(body.valid_types) ? body.valid_types : undefined;
69
+ // F6: scope-aware 403. A delete tool (scopeAware:true) that gets a 403 — or
70
+ // any body signalling insufficient scope — is missing the admin scope, not
71
+ // holding a bad key. A 401 is always a genuine bad-key failure regardless.
72
+ const bodyScopeSignal = body &&
73
+ ((typeof body.error_code === "string" && /scope/i.test(body.error_code)) ||
74
+ (typeof body.required_scope === "string" && body.required_scope !== ""));
75
+ const isScopeFailure = response.status !== 401 &&
76
+ (opts.scopeAware === true || bodyScopeSignal === true) &&
77
+ (response.status === 403 || bodyScopeSignal === true);
78
+ // F204 — distinguish an OWNERSHIP denial from a plain missing-admin-scope
79
+ // denial. `insufficient_scope_ownership` means the write-scope key tried to
80
+ // delete a flow it did NOT create; the remedy is "delete only your own flows,
81
+ // or use an admin key", not just "create an admin key".
82
+ const isOwnershipFailure = body && typeof body.error_code === "string" && body.error_code === "insufficient_scope_ownership";
83
+ const scopeSuggestion = isOwnershipFailure
84
+ ? "This write-scope key can only delete flows they created (the flow's owner " +
85
+ "kid must match the key's kid). This flow was created by a different key or " +
86
+ "via the dashboard, so it needs the admin scope. Use an admin-scope key " +
87
+ "(API Mapper → ⋮ menu → Settings → MCP Access → New API key, grant the admin " +
88
+ "scope, then re-run `npx -y @wootsup/mcp setup`), or delete it from the dashboard."
89
+ : isScopeFailure
90
+ ? "Your key lacks the admin scope required for delete/destructive operations. " +
91
+ "Create an admin-scope key (API Mapper → ⋮ menu → Settings → MCP Access → New API key, " +
92
+ "grant the admin scope) and re-run `npx -y @wootsup/mcp setup`, or perform the deletion " +
93
+ "from the dashboard."
94
+ : undefined;
95
+ // Suggestion precedence: explicit opts.suggestion → server suggestion (F11)
96
+ // → scope hint (F6) → coarse/message-driven hintFor(). The first three are
97
+ // intentional overrides; hintFor() is the legacy default. F83: pass the
98
+ // upstream `error` message so a JMESPath depth-limit 422 (which classifies to
99
+ // "unknown") routes to the two-transform-split remedy instead of the generic
100
+ // health hint. The depth detection only fires on the depth-limit wording, so
101
+ // every other message keeps the code-based hint byte-for-byte.
102
+ const suggestion = opts.suggestion ??
103
+ serverSuggestion ??
104
+ scopeSuggestion ??
105
+ hintFor(errorCode, response.error);
106
+ // Code precedence: server domain error_code (F11) → coarse errorCode →
107
+ // opts.code → status. The server code is the most specific, so it wins over
108
+ // the coarse classification (which is often just "unknown" for a 400).
109
+ const code = serverErrorCode ??
110
+ (errorCode !== undefined && errorCode !== ""
111
+ ? String(errorCode)
112
+ : opts.code ?? (response.status ? String(response.status) : undefined));
113
+ // Merge server hint fields (valid_types) into details so they reach the
114
+ // agent. Caller-supplied details win on key collision.
115
+ const mergedDetails = serverValidTypes !== undefined
116
+ ? { valid_types: serverValidTypes, ...(details ?? {}) }
117
+ : details;
118
+ return errorResult({
119
+ message: response.error ?? opts.message ?? "request failed",
120
+ code,
121
+ suggestion,
122
+ ...(mergedDetails !== undefined ? { details: mergedDetails } : {}),
123
+ });
124
+ }
125
+ //# sourceMappingURL=tool-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-result.js","sourceRoot":"","sources":["../../../src/modules/apimapper/tool-result.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,EAAE;AACF,wEAAwE;AACxE,6DAA6D;AAC7D,EAAE;AACF,sBAAsB;AACtB,2BAA2B;AAC3B,mDAAmD;AACnD,wEAAwE;AACxE,0CAA0C;AAC1C,qCAAqC;AACrC,UAAU;AACV,MAAM;AACN,EAAE;AACF,yEAAyE;AACzE,kEAAkE;AAClE,EAAE;AACF,6DAA6D;AAC7D,0EAA0E;AAC1E,yDAAyD;AACzD,2EAA2E;AAC3E,EAAE;AACF,+CAA+C;AAC/C,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,uDAAuD;AACvD,qEAAqE;AACrE,gFAAgF;AAChF,mEAAmE;AACnE,qDAAqD;AACrD,EAAE;AACF,sEAAsE;AACtE,qEAAqE;AACrE,0EAA0E;AAC1E,2EAA2E;AAC3E,4EAA4E;AAC5E,yCAAyC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,OAAO,EAAqB,MAAM,aAAa,CAAC;AAwDzD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAuB,EACvB,OAAiC,EACjC,OAAsB,EAAE;IAExB,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;IACrC,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAC;IAEhC,uEAAuE;IACvE,4EAA4E;IAC5E,2EAA2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AO,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACnE,CAAC,CAAC;AACL,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type CollectedTool } from "./gateway/test-support.js";
1
+ import { type CollectedTool } from "./gateway/collect-module-tools.js";
2
2
  /**
3
3
  * The minimal `tools/list`-relevant slice of a registered tool: the fields the
4
4
  * MCP client receives and the LLM reads as part of the static catalog.
@@ -23,9 +23,9 @@ export interface ToolsListMeasurement {
23
23
  }
24
24
  /** The full Task-B result: the post-W3 and pre-W3-equivalent surfaces. */
25
25
  export interface ToolsListComparison {
26
- /** Post-W3 `tools/list` — the 17 surface tools the server exposes today. */
26
+ /** Post-W3 `tools/list` — the 21 surface tools the server exposes today. */
27
27
  postW3: ToolsListMeasurement;
28
- /** Pre-W3-equivalent `tools/list` — all 76 tools exposed flat (no gateway). */
28
+ /** Pre-W3-equivalent `tools/list` — all 79 tools exposed flat (no gateways). */
29
29
  preW3Flat: ToolsListMeasurement;
30
30
  /** Absolute byte reduction (preW3Flat.totalBytes − postW3.totalBytes). */
31
31
  bytesSaved: number;
@@ -39,17 +39,18 @@ export interface ToolsListComparison {
39
39
  */
40
40
  export declare function toCatalogEntry(name: string, tool: Pick<CollectedTool, "description" | "inputSchema" | "annotations">): ToolCatalogEntry;
41
41
  /**
42
- * Builds the full 77-tool catalog from the current build and measures the
42
+ * Builds the full 81-tool catalog from the current build and measures the
43
43
  * post-W3 vs pre-W3-equivalent `tools/list` payload sizes.
44
44
  *
45
- * Surface composition (verified against `gateway/essentials.ts` + `src/index.ts`):
46
- * - module tools : 13 essentials + `apimapper_advanced` = 14 (on the real
47
- * McpServer) + 60 advanced (gateway registry) = 74
45
+ * Surface composition (verified against `gateway/essentials.ts` + `src/index.ts`,
46
+ * pinned live in `gateway/gateway.test.ts` A2):
47
+ * - module tools : 16 essentials + `apimapper_advanced` + `apimapper_advanced_read`
48
+ * = 18 (on the real McpServer) + 60 advanced (gateway registry) = 78
48
49
  * - top-level tools: rest_modules_status + use_profile + list_profiles = 3
49
- * total = 77
50
+ * total = 81
50
51
  *
51
- * POST-W3 `tools/list` = the 14 module-real tools + the 3 top-level tools = 17.
52
- * PRE-W3 flat `tools/list` = the 16 non-gateway surface tools + the 60 advanced
53
- * tools = 76 (the `apimapper_advanced` gateway did not exist pre-W3).
52
+ * POST-W3 `tools/list` = the 18 module-real tools + the 3 top-level tools = 21.
53
+ * PRE-W3 flat `tools/list` = the 19 non-gateway surface tools + the 60 advanced
54
+ * tools = 79 (neither gateway existed pre-W3).
54
55
  */
55
56
  export declare function measureToolsList(): Promise<ToolsListComparison>;
@@ -4,17 +4,26 @@
4
4
  // JSON schemas an MCP client receives once per session, before any tool is
5
5
  // called. This is the DOMINANT token cost center of an API Mapper session.
6
6
  //
7
- // Two figures, both derived from the CURRENT build:
7
+ // Two figures, both derived from the CURRENT build (canonical counts asserted
8
+ // live in gateway/gateway.test.ts — A2, 2026-06-03):
8
9
  //
9
- // - POST-W3 `tools/list` — the 17 surface tools the server now exposes
10
- // (13 module essentials + `apimapper_advanced`
11
- // + the 3 src/index.ts top-level tools).
12
- // - PRE-W3-equivalent `tools/list` — what `tools/list` WOULD be if all 77
10
+ // - POST-W3 `tools/list` — the 21 surface tools the server now exposes
11
+ // (16 module essentials + `apimapper_advanced`
12
+ // + `apimapper_advanced_read` + the 3
13
+ // src/index.ts top-level tools).
14
+ // - PRE-W3-equivalent `tools/list` — what `tools/list` WOULD be if all 79
13
15
  // tools were exposed flat (the pre-Gateway
14
- // state): the 17 surface tools minus the
15
- // gateway tool, plus the 60 advanced-registry
16
- // tool configs — 76 flat tools. (Pre-W3 the
17
- // `apimapper_advanced` gateway did not exist.)
16
+ // state): the 21 surface tools minus the TWO
17
+ // gateway tools, plus the 60 advanced-registry
18
+ // tool configs — 79 flat tools. (Pre-W3 neither
19
+ // gateway existed.)
20
+ // F115 (2026-06-11): apimapper_health promoted
21
+ // advanced→essential — surface 19→20, advanced
22
+ // 60→59 then 60. F200b (2026-06-12):
23
+ // apimapper_advanced_read added as a 2nd
24
+ // module-real gateway — surface 20→21; the flat
25
+ // total stays 79 (a gateway is a routing entry,
26
+ // never a flat tool).
18
27
  //
19
28
  // Per-tool serialization mirrors what the MCP SDK puts on the wire for one
20
29
  // `tools/list` entry: `{ name, description, inputSchema, annotations }`, where
@@ -32,7 +41,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
32
41
  import { loadModules } from "@getimo/mcp-toolkit";
33
42
  import { z } from "zod";
34
43
  import { apimapperRestModule } from "./index.js";
35
- import { collectModuleTools } from "./gateway/test-support.js";
44
+ import { collectModuleTools } from "./gateway/collect-module-tools.js";
36
45
  import { registerListProfilesTool, registerUseProfileTool, } from "./use-profile.js";
37
46
  import { ProfileStore } from "../../auth/profiles.js";
38
47
  /**
@@ -136,18 +145,19 @@ function captureTopLevelTools() {
136
145
  return captured;
137
146
  }
138
147
  /**
139
- * Builds the full 77-tool catalog from the current build and measures the
148
+ * Builds the full 81-tool catalog from the current build and measures the
140
149
  * post-W3 vs pre-W3-equivalent `tools/list` payload sizes.
141
150
  *
142
- * Surface composition (verified against `gateway/essentials.ts` + `src/index.ts`):
143
- * - module tools : 13 essentials + `apimapper_advanced` = 14 (on the real
144
- * McpServer) + 60 advanced (gateway registry) = 74
151
+ * Surface composition (verified against `gateway/essentials.ts` + `src/index.ts`,
152
+ * pinned live in `gateway/gateway.test.ts` A2):
153
+ * - module tools : 16 essentials + `apimapper_advanced` + `apimapper_advanced_read`
154
+ * = 18 (on the real McpServer) + 60 advanced (gateway registry) = 78
145
155
  * - top-level tools: rest_modules_status + use_profile + list_profiles = 3
146
- * total = 77
156
+ * total = 81
147
157
  *
148
- * POST-W3 `tools/list` = the 14 module-real tools + the 3 top-level tools = 17.
149
- * PRE-W3 flat `tools/list` = the 16 non-gateway surface tools + the 60 advanced
150
- * tools = 76 (the `apimapper_advanced` gateway did not exist pre-W3).
158
+ * POST-W3 `tools/list` = the 18 module-real tools + the 3 top-level tools = 21.
159
+ * PRE-W3 flat `tools/list` = the 19 non-gateway surface tools + the 60 advanced
160
+ * tools = 79 (neither gateway existed pre-W3).
151
161
  */
152
162
  export async function measureToolsList() {
153
163
  const server = new McpServer({
@@ -173,9 +183,12 @@ export async function measureToolsList() {
173
183
  for (const [name, tool] of topLevelTools) {
174
184
  postEntries.push(toCatalogEntry(name, tool));
175
185
  }
176
- // PRE-W3-equivalent flat surface: the post-W3 surface MINUS the gateway tool
177
- // (it did not exist pre-W3) PLUS every advanced tool exposed flat.
178
- const preEntries = postEntries.filter((e) => e.name !== "apimapper_advanced");
186
+ // PRE-W3-equivalent flat surface: the post-W3 surface MINUS the gateway tools
187
+ // (neither existed pre-W3) PLUS every advanced tool exposed flat. F200b added
188
+ // the apimapper_advanced_read gateway it is a routing entry like
189
+ // apimapper_advanced, not a flat tool, so it is excluded from the pre-W3 flat
190
+ // catalog too (the flat surface still totals 79 real tools).
191
+ const preEntries = postEntries.filter((e) => e.name !== "apimapper_advanced" && e.name !== "apimapper_advanced_read");
179
192
  for (const [name, tool] of Object.entries(moduleTools)) {
180
193
  if (!advancedNames.has(name))
181
194
  continue; // only the advanced tools
@@ -1 +1 @@
1
- {"version":3,"file":"toolslist-size.js","sourceRoot":"","sources":["../../../src/modules/apimapper/toolslist-size.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,8EAA8E;AAC9E,2EAA2E;AAC3E,2EAA2E;AAC3E,EAAE;AACF,oDAAoD;AACpD,EAAE;AACF,gFAAgF;AAChF,iFAAiF;AACjF,2EAA2E;AAC3E,4EAA4E;AAC5E,6EAA6E;AAC7E,2EAA2E;AAC3E,gFAAgF;AAChF,8EAA8E;AAC9E,iFAAiF;AACjF,EAAE;AACF,2EAA2E;AAC3E,+EAA+E;AAC/E,2EAA2E;AAC3E,4EAA4E;AAC5E,+EAA+E;AAC/E,+EAA+E;AAC/E,6EAA6E;AAC7E,EAAE;AACF,8EAA8E;AAC9E,oCAAoC;AAEp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AAI,EAAE,IAAI,CAAC,IAAI,aAAa,EAAE,CAAC;QACzC,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,8EAA8E;IAC9E,8EAA8E;IAC9E,mEAAmE;IACnE,8EAA8E;IAC9E,6DAA6D;IAC7D,MAAM,UAAU,GAAuB,WAAW,CAAC,MAAM,CACvD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,oBAAoB,IAAI,CAAC,CAAC,IAAI,KAAK,yBAAyB,CAC/E,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QACvD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,SAAS,CAAC,0BAA0B;QAClE,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAC5D,MAAM,aAAa,GACjB,SAAS,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAEnE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;AAC1D,CAAC"}
@@ -32,6 +32,11 @@ export interface Connection {
32
32
  template_fields?: Record<string, unknown>;
33
33
  origin_hash?: string;
34
34
  origin_id?: string | null;
35
+ health?: {
36
+ status?: string | null;
37
+ message?: string | null;
38
+ [k: string]: unknown;
39
+ } | null;
35
40
  }
36
41
  export interface Credential {
37
42
  id: string;
@@ -39,6 +44,27 @@ export interface Credential {
39
44
  auth_type: string;
40
45
  oauth_provider?: string | null;
41
46
  oauth_token_expires_at?: string | null;
47
+ /**
48
+ * Wave-12 F1 (Cold-AI #6) — canonical token-validity surface emitted by the
49
+ * PHP `/credentials` endpoint (`CredentialRepository::calculateStatus`).
50
+ * Values: 'active' | 'expiring' | 'expired' | 'broken'.
51
+ *
52
+ * - 'active' covers credentials with a refresh-token even if their
53
+ * short-lived access token's `oauth_token_expires_at` is in the past —
54
+ * they auto-renew on next use.
55
+ * - 'expired' is the only state where the customer truly needs to reconnect.
56
+ *
57
+ * The onboarding suggestion engine MUST prefer this field over the raw
58
+ * `oauth_token_expires_at` heuristic to avoid false-positive reconnect
59
+ * prompts for refreshable tokens (Google, GitHub, etc.).
60
+ */
61
+ status?: "active" | "expiring" | "expired" | "broken" | string | null;
62
+ /**
63
+ * Hard-expiry timestamp emitted ONLY for credentials WITHOUT a refresh-token
64
+ * (e.g. Meta/Instagram 60-day expiry). When this field is null/absent on an
65
+ * OAuth credential, the token is auto-refreshable and not user-visibly expirable.
66
+ */
67
+ token_hard_expires_at?: string | null;
42
68
  provider?: string | null;
43
69
  created_at?: string;
44
70
  updated_at?: string;
@@ -74,6 +100,13 @@ export interface Flow {
74
100
  version?: number;
75
101
  updated_at?: string;
76
102
  created_at?: string;
103
+ created_by?: string | null;
104
+ last_execution?: {
105
+ at?: string;
106
+ output_count?: number;
107
+ step_count?: number;
108
+ had_error?: boolean;
109
+ };
77
110
  }
78
111
  export interface LibraryItem {
79
112
  id: string;
@@ -85,6 +118,7 @@ export interface LibraryItem {
85
118
  is_activated?: boolean;
86
119
  logo_svg?: string;
87
120
  logo_hex?: string;
121
+ featured?: boolean;
88
122
  }
89
123
  export interface NodeSnapshot {
90
124
  id: string;
@@ -7,7 +7,7 @@
7
7
  // - Credential wire format = snake_case (auth_type, auth_data, oauth_provider)
8
8
  // - Graph wire format = camelCase (targetNodeId, forceRefresh)
9
9
  // - Library wire format = snake_case (extra_fields, library_connection)
10
- // - LocalSource wire fmt = camelCase (contentType) with "platform/type" id ("wordpress/posts")
10
+ // - LocalSource wire fmt = camelCase (contentType) with "platform/type" id ("wordpress/post")
11
11
  //
12
12
  // These types reflect the actual REST contract verified against the PHP controllers.
13
13
  // =============================================================================
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modules/apimapper/types.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,EAAE;AACF,yEAAyE;AACzE,iGAAiG;AACjG,oFAAoF;AACpF,wEAAwE;AACxE,iFAAiF;AACjF,sEAAsE;AACtE,6EAA6E;AAC7E,mGAAmG;AACnG,EAAE;AACF,qFAAqF;AA8HrF,gFAAgF;AAChF,iEAAiE;AACjE,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,MAAM,CAAmB,KAAmB;IAC1D,OAAO,KAAwD,CAAC;AAClE,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modules/apimapper/types.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,EAAE;AACF,yEAAyE;AACzE,iGAAiG;AACjG,oFAAoF;AACpF,wEAAwE;AACxE,iFAAiF;AACjF,sEAAsE;AACtE,6EAA6E;AAC7E,kGAAkG;AAClG,EAAE;AACF,qFAAqF;AA+KrF,gFAAgF;AAChF,iEAAiE;AACjE,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,MAAM,CAAmB,KAAmB;IAC1D,OAAO,KAAwD,CAAC;AAClE,CAAC"}