@jini-ai/integrations 0.7.3-next.2 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -0
  3. package/dist/api-connections/bundled-client-namespace.d.ts +24 -0
  4. package/dist/api-connections/bundled-client-namespace.js +22 -0
  5. package/dist/api-connections/connect.d.ts +2 -10
  6. package/dist/api-connections/connect.js +1 -1
  7. package/dist/api-connections/contribution.d.ts +71 -0
  8. package/dist/api-connections/contribution.js +69 -0
  9. package/dist/api-connections/form-delivery-connection.d.ts +68 -0
  10. package/dist/api-connections/form-delivery-connection.js +73 -0
  11. package/dist/api-connections/hosted-mcp/contracts.d.ts +4 -171
  12. package/dist/api-connections/hosted-mcp/index.d.ts +2 -0
  13. package/dist/api-connections/hosted-mcp/oauth-row-writes.d.ts +3 -1
  14. package/dist/api-connections/hosted-mcp/oauth-row-writes.js +6 -3
  15. package/dist/api-connections/hosted-mcp/shared-sign-in.d.ts +2 -1
  16. package/dist/api-connections/hosted-mcp/sign-in-configuration.js +1 -1
  17. package/dist/api-connections/hosted-mcp/sign-in-discovery.js +1 -1
  18. package/dist/api-connections/hosted-mcp/sign-in-flow.d.ts +9 -3
  19. package/dist/api-connections/hosted-mcp/sign-in-flow.js +6 -6
  20. package/dist/api-connections/hosted-mcp/sign-in-provider.d.ts +16 -4
  21. package/dist/api-connections/hosted-mcp/sign-in-provider.js +3 -3
  22. package/dist/api-connections/hosted-mcp/sign-in-status.d.ts +13 -2
  23. package/dist/api-connections/hosted-mcp/sign-in-status.js +17 -4
  24. package/dist/api-connections/hosted-mcp/sign-in.d.ts +1 -1
  25. package/dist/api-connections/hosted-mcp/sign-in.js +28 -30
  26. package/dist/api-connections/shared-api.d.ts +87 -0
  27. package/dist/api-connections/shared-api.js +135 -0
  28. package/dist/api-connections/shared-oauth-disconnect.d.ts +73 -0
  29. package/dist/api-connections/shared-oauth-disconnect.js +41 -0
  30. package/dist/api-connections/shared-owner.d.ts +107 -0
  31. package/dist/api-connections/shared-owner.js +79 -0
  32. package/dist/api-connections/vault-stores.d.ts +110 -0
  33. package/dist/api-connections/vault-stores.js +202 -0
  34. package/dist/credentialed-http/auth-schemes.d.ts +2 -9
  35. package/dist/credentialed-http/tools/index.d.ts +30 -0
  36. package/dist/credentialed-http/tools/index.js +19 -0
  37. package/dist/credentialed-http/tools/tool-registrations.js +0 -1
  38. package/dist/custom-credentials/agent-tools.d.ts +79 -0
  39. package/dist/custom-credentials/agent-tools.js +98 -0
  40. package/dist/custom-credentials/card-token.d.ts +15 -0
  41. package/dist/custom-credentials/card-token.js +35 -0
  42. package/dist/custom-credentials/credential-ports.d.ts +70 -0
  43. package/dist/custom-credentials/credential-ports.js +41 -0
  44. package/dist/custom-credentials/credential-recovery.d.ts +20 -0
  45. package/dist/custom-credentials/credential-recovery.js +22 -0
  46. package/dist/custom-credentials/credentialed-request.d.ts +83 -0
  47. package/dist/custom-credentials/credentialed-request.js +93 -0
  48. package/dist/custom-credentials/custom-credential-create-ui.d.ts +106 -0
  49. package/dist/custom-credentials/custom-credential-create-ui.js +136 -0
  50. package/dist/custom-credentials/custom-credential-set-token-ui.d.ts +84 -0
  51. package/dist/custom-credentials/custom-credential-set-token-ui.js +104 -0
  52. package/dist/custom-credentials/delete-request-confirmation-ui.d.ts +33 -0
  53. package/dist/custom-credentials/delete-request-confirmation-ui.js +35 -0
  54. package/dist/custom-credentials/provider-settings-card.d.ts +109 -0
  55. package/dist/custom-credentials/provider-settings-card.js +166 -0
  56. package/dist/custom-credentials/write-files-validation.d.ts +102 -0
  57. package/dist/custom-credentials/write-files-validation.js +202 -0
  58. package/dist/media-providers/catalog-projection.d.ts +29 -0
  59. package/dist/media-providers/catalog-projection.js +45 -0
  60. package/dist/media-providers/catalog.d.ts +6 -3
  61. package/dist/media-providers/catalog.js +4 -3
  62. package/dist/media-providers/configurable-catalog.d.ts +9 -0
  63. package/dist/media-providers/configurable-catalog.js +70 -0
  64. package/dist/media-providers/dispatch/builtin-vendors.js +0 -2
  65. package/dist/media-providers/dispatch/credentials.d.ts +4 -1
  66. package/dist/media-providers/dispatch/credentials.js +3 -2
  67. package/dist/media-providers/dispatch/engine.d.ts +1 -1
  68. package/dist/media-providers/dispatch/engine.js +17 -5
  69. package/dist/media-providers/dispatch/index.d.ts +3 -2
  70. package/dist/media-providers/dispatch/index.js +2 -2
  71. package/dist/media-providers/dispatch/media-provider-registry.d.ts +23 -4
  72. package/dist/media-providers/dispatch/media-provider-registry.js +26 -11
  73. package/dist/media-providers/dispatch/media-wire.d.ts +14 -0
  74. package/dist/media-providers/dispatch/media-wire.js +22 -0
  75. package/dist/media-providers/dispatch/node.d.ts +5 -0
  76. package/dist/media-providers/dispatch/node.js +5 -1
  77. package/dist/media-providers/dispatch/openai-compatible.d.ts +3 -1
  78. package/dist/media-providers/dispatch/openai-compatible.js +1 -1
  79. package/dist/media-providers/dispatch/operation-runtime.js +5 -4
  80. package/dist/media-providers/dispatch/outbound.d.ts +28 -3
  81. package/dist/media-providers/dispatch/outbound.js +10 -3
  82. package/dist/media-providers/dispatch/providers/custom-image.js +1 -1
  83. package/dist/media-providers/dispatch/providers/imagerouter.js +1 -1
  84. package/dist/media-providers/dispatch/providers/nanobanana.js +1 -1
  85. package/dist/media-providers/dispatch/providers/openrouter.js +1 -1
  86. package/dist/media-providers/dispatch/ssrf-guard.js +2 -2
  87. package/dist/media-providers/dispatch/types.d.ts +13 -4
  88. package/dist/media-providers/dispatch/vendor-adapter.js +2 -2
  89. package/dist/media-providers/index.d.ts +2 -0
  90. package/dist/media-providers/providers.d.ts +9 -5
  91. package/dist/media-providers/providers.js +9 -12
  92. package/dist/media-providers/sqlite-task-store.d.ts +4 -4
  93. package/dist/media-providers/task-store.d.ts +1 -1
  94. package/dist/media-providers/task-store.js +1 -1
  95. package/dist/media-providers/types.d.ts +0 -36
  96. package/dist/media-providers/ui-defaults.js +0 -4
  97. package/dist/react/admin-credentials/AdminByokKeyPanel.d.ts +130 -0
  98. package/dist/react/admin-credentials/AdminByokKeyPanel.js +115 -0
  99. package/dist/react/admin-credentials/byok-footer-status.d.ts +37 -0
  100. package/dist/react/admin-credentials/byok-footer-status.js +25 -0
  101. package/dist/react/credentials/OtherCredentialsSection.d.ts +36 -0
  102. package/dist/react/credentials/OtherCredentialsSection.hooks.d.ts +55 -0
  103. package/dist/react/credentials/OtherCredentialsSection.hooks.js +26 -0
  104. package/dist/react/credentials/OtherCredentialsSection.js +120 -0
  105. package/dist/react/credentials/access-token-forms.d.ts +219 -0
  106. package/dist/react/credentials/access-token-forms.js +114 -0
  107. package/dist/react/credentials/credential-copy.d.ts +17 -0
  108. package/dist/react/credentials/credential-copy.js +7 -0
  109. package/dist/react/credentials/other-credential-stores.d.ts +115 -0
  110. package/dist/react/credentials/other-credential-stores.js +76 -0
  111. package/dist/react/site-key/SiteKeyRecoveryCard.d.ts +16 -0
  112. package/dist/react/site-key/SiteKeyRecoveryCard.js +36 -0
  113. package/dist/react/site-key/SiteKeyTab.d.ts +100 -0
  114. package/dist/react/site-key/SiteKeyTab.js +127 -0
  115. package/dist/react/site-key/hooks/use-site-key-recovery.hooks.d.ts +77 -0
  116. package/dist/react/site-key/hooks/use-site-key-recovery.hooks.js +126 -0
  117. package/dist/react/site-key/hooks/use-site-key.hooks.d.ts +120 -0
  118. package/dist/react/site-key/hooks/use-site-key.hooks.js +95 -0
  119. package/dist/react/webhooks/IntegrationDeliveries.d.ts +41 -0
  120. package/dist/react/webhooks/IntegrationDeliveries.js +24 -0
  121. package/dist/react/webhooks/Integrations.d.ts +73 -0
  122. package/dist/react/webhooks/Integrations.js +97 -0
  123. package/dist/react/webhooks/hooks/use-integration-deliveries.hooks.d.ts +59 -0
  124. package/dist/react/webhooks/hooks/use-integration-deliveries.hooks.js +11 -0
  125. package/dist/react/webhooks/hooks/use-integrations.hooks.d.ts +119 -0
  126. package/dist/react/webhooks/hooks/use-integrations.hooks.js +129 -0
  127. package/dist/react/webhooks/rules.d.ts +118 -0
  128. package/dist/react/webhooks/rules.js +103 -0
  129. package/dist/saved-requests/execute.js +2 -3
  130. package/dist/saved-requests/types.d.ts +4 -1
  131. package/dist/secrets/index.d.ts +3 -0
  132. package/dist/secrets/index.js +3 -0
  133. package/dist/secrets/ports.d.ts +25 -0
  134. package/dist/secrets/ports.js +2 -0
  135. package/dist/secrets/types.d.ts +10 -0
  136. package/dist/secrets/types.js +2 -0
  137. package/dist/vendor-credentials/abort-guarded-repo.d.ts +14 -0
  138. package/dist/vendor-credentials/abort-guarded-repo.js +41 -0
  139. package/dist/vendor-credentials/project-scope.d.ts +43 -0
  140. package/dist/vendor-credentials/project-scope.js +32 -0
  141. package/dist/vendor-credentials/vault-adapter.d.ts +157 -0
  142. package/dist/vendor-credentials/vault-adapter.js +220 -0
  143. package/dist/web-screenshot/capture-files.d.ts +44 -0
  144. package/dist/web-screenshot/capture-files.js +62 -0
  145. package/dist/web-screenshot/capture-retention.d.ts +157 -0
  146. package/dist/web-screenshot/capture-retention.js +134 -0
  147. package/dist/web-screenshot/capture-root-file-lock.d.ts +20 -0
  148. package/dist/web-screenshot/capture-root-file-lock.js +15 -0
  149. package/dist/web-screenshot/desktop-page-capture.d.ts +37 -0
  150. package/dist/web-screenshot/desktop-page-capture.js +62 -0
  151. package/dist/web-screenshot/own-site-opener.d.ts +40 -0
  152. package/dist/web-screenshot/own-site-opener.js +27 -0
  153. package/dist/web-screenshot/screenshot-image.d.ts +11 -0
  154. package/dist/web-screenshot/screenshot-image.js +12 -0
  155. package/dist/web-screenshot/web-screenshot.d.ts +188 -0
  156. package/dist/web-screenshot/web-screenshot.js +329 -0
  157. package/dist/webhooks/delivery.d.ts +16 -0
  158. package/dist/webhooks/delivery.js +41 -1
  159. package/dist/webhooks/ports.d.ts +1 -29
  160. package/dist/webhooks/signing.keyring.d.ts +1 -1
  161. package/dist/webhooks/site/delivery.d.ts +60 -0
  162. package/dist/webhooks/site/delivery.js +45 -0
  163. package/dist/webhooks/site/http.memory.d.ts +51 -0
  164. package/dist/webhooks/site/http.memory.js +28 -0
  165. package/dist/webhooks/site/repo.memory.d.ts +136 -0
  166. package/dist/webhooks/site/repo.memory.js +215 -0
  167. package/dist/webhooks/site/seal-aad-invariant.d.ts +26 -0
  168. package/dist/webhooks/site/seal-aad-invariant.js +61 -0
  169. package/dist/webhooks/site/seal-aad-invariant.node.d.ts +42 -0
  170. package/dist/webhooks/site/seal-aad-invariant.node.js +52 -0
  171. package/dist/webhooks/site/signing.d.ts +28 -0
  172. package/dist/webhooks/site/signing.js +27 -0
  173. package/dist/webhooks/site/signing.keyring.d.ts +29 -0
  174. package/dist/webhooks/site/signing.keyring.js +30 -0
  175. package/dist/webhooks/site/subscriptions.d.ts +118 -0
  176. package/dist/webhooks/site/subscriptions.js +98 -0
  177. package/dist/webhooks/sql/index.d.ts +4 -0
  178. package/dist/webhooks/sql/index.js +2 -0
  179. package/dist/webhooks/sql/repo.rows.d.ts +47 -0
  180. package/dist/webhooks/sql/repo.rows.js +2 -0
  181. package/dist/webhooks/sql/webhook-repo.d.ts +152 -0
  182. package/dist/webhooks/sql/webhook-repo.js +308 -0
  183. package/dist/webhooks/subscriptions.d.ts +3 -1
  184. package/dist/webhooks/subscriptions.js +4 -1
  185. package/dist/webhooks/tools/tool-handlers.js +2 -1
  186. package/dist/webhooks/types.d.ts +6 -10
  187. package/package.json +517 -12
  188. package/dist/media-providers/dispatch/providers/grok.d.ts +0 -55
  189. package/dist/media-providers/dispatch/providers/grok.js +0 -116
@@ -0,0 +1,22 @@
1
+ import { absentWhen, orFallbackSync } from "@jini-ai/core/errors/idioms";
2
+ import { CustomCredentialNotFoundError } from "../credentialed-http/sets/store.js";
3
+ /** Preserve provider output, while offering the credential card the failing call can actually use. */
4
+ export async function withCustomCredentialSetup({ invoke, label, url, verification = false, issueCredentialSetup }, _optional = {}) {
5
+ // Only a missing credential becomes a setup card; every other failure is rethrown unchanged.
6
+ const settled = await absentWhen({ work: async () => ({ result: await invoke() }), codes: [], kinds: [CustomCredentialNotFoundError] });
7
+ if (!settled) {
8
+ const prefill = { kind: "api", label };
9
+ // The card collects a valid URL; an unknown label is resolved before request validation.
10
+ const baseUrl = url ? orFallbackSync({ work: () => new URL(url).origin, fallback: undefined, step: "credential-setup-base-url" }) : undefined;
11
+ if (baseUrl)
12
+ prefill.baseUrl = baseUrl;
13
+ return { executed: false, credentialSetup: issueCredentialSetup({ setupToolId: "credential_save", prefill }, {}) };
14
+ }
15
+ const { result } = settled;
16
+ const output = result;
17
+ // A scoped key can get a request 401 while still working for its intended purpose.
18
+ // Only explicit verification can establish invalidity and offer replacement.
19
+ const rotation = verification && output.status === "invalid";
20
+ return rotation ? { credentialSetup: issueCredentialSetup({ setupToolId: "credential_save", prefill: { kind: "api", target: label } }, {}), ...result } : result;
21
+ }
22
+ //# sourceMappingURL=credential-recovery.js.map
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @file The host's custom-credential request operations over the guarded credentialed-http pipeline.
3
+ * `credentialed-http` owns validation, header injection, response redaction and audit-entry shape; this
4
+ * module binds that pipeline to a host's saved-credential store, its HTTP client ABI, its egress-refusal
5
+ * class and its remedy wording, and returns the `(deps, input)` operations that
6
+ * `bindCredentialedRequestPort` (`./credential-ports.ts`) consumes as `operations`.
7
+ */
8
+ import type { Clock, HttpClientPort, HttpRequest, HttpResponse } from "@jini-ai/core/primitives";
9
+ import type { CredentialSchemeRule } from "../credentialed-http/auth-schemes.js";
10
+ import type { CredentialTarget, ResolvedCredential } from "../credentialed-http/ports.js";
11
+ import { type CredentialConnectionProbeInput, type CredentialConnectionProbeStatus, type CredentialedRequestAuditEntry, type CredentialedRequestExecutedResult, type CredentialedRequestOptions, type CustomCredentialVerificationResult, type MakeCredentialedRequestInput } from "../credentialed-http/credentialed-request.js";
12
+ import type { EgressRefusedErrorClass } from "./credential-ports.js";
13
+ /** The host's dependency bag: its store `repo`, its guarded `httpClient`, a clock, an optional
14
+ * positional audit sink and its installed auth-scheme loader. Extra fields (a sealer) pass through. */
15
+ export interface CustomCredentialRequestHostDeps {
16
+ readonly repo: unknown;
17
+ readonly httpClient: unknown;
18
+ readonly clock: Clock;
19
+ readonly audit?: {
20
+ record(entry: CredentialedRequestAuditEntry): void;
21
+ };
22
+ readonly loadAuthSchemes: (ctx: {
23
+ readonly workspaceId: string;
24
+ }) => Promise<readonly CredentialSchemeRule[]>;
25
+ }
26
+ /** What the host injects: its store reads, its client's send, its egress class, its default audit sink
27
+ * and the remedy sentence appended to a saved-hosts refusal. */
28
+ export interface CustomCredentialRequestHost<Deps extends CustomCredentialRequestHostDeps> {
29
+ /** Non-decrypting label lookup (origins only). */
30
+ readonly describe: (deps: Pick<Deps, "repo">, input: {
31
+ workspaceId: string;
32
+ label: string;
33
+ }) => Promise<CredentialTarget | null>;
34
+ /** Decrypting label lookup through the host's sealed store. */
35
+ readonly resolve: (deps: Deps, input: {
36
+ workspaceId: string;
37
+ label: string;
38
+ }) => Promise<ResolvedCredential | null>;
39
+ /** One send through the host's guarded client, forwarding the redirect policy unchanged. */
40
+ readonly send: (required: {
41
+ httpClient: Deps["httpClient"];
42
+ request: HttpRequest;
43
+ }, optional?: Parameters<HttpClientPort["send"]>[1]) => Promise<HttpResponse>;
44
+ readonly EgressRefusedError: EgressRefusedErrorClass;
45
+ /** The audit sink used when `deps.audit` is omitted. */
46
+ readonly defaultAudit: () => {
47
+ record(entry: CredentialedRequestAuditEntry): void;
48
+ };
49
+ /** Appended (after " — ") to a "not one of this credential's saved hosts" refusal. */
50
+ readonly savedHostRemedy: string;
51
+ }
52
+ /** The host's request input: the pipeline's required fields plus optional headers/body. */
53
+ export type CustomCredentialRequestInput = MakeCredentialedRequestInput & Pick<CredentialedRequestOptions, "headers" | "body">;
54
+ /** The four `(deps, input)` operations a host exposes to its tool handlers. */
55
+ export interface CustomCredentialRequestOperations<Deps extends CustomCredentialRequestHostDeps> {
56
+ readonly makeCredentialedRequest: (deps: Deps, input: CustomCredentialRequestInput) => Promise<CredentialedRequestExecutedResult>;
57
+ readonly resolveRequestTarget: (deps: Pick<Deps, "repo">, input: {
58
+ workspaceId: string;
59
+ label: string;
60
+ url: unknown;
61
+ }) => Promise<{
62
+ label: string;
63
+ url: URL;
64
+ }>;
65
+ readonly verifyCustomCredential: (deps: Deps, input: {
66
+ workspaceId: string;
67
+ label: unknown;
68
+ }) => Promise<CustomCredentialVerificationResult>;
69
+ readonly probeCredentialConnection: (required: CredentialConnectionProbeInput, options: {
70
+ httpClient: Deps["httpClient"];
71
+ }) => Promise<CredentialConnectionProbeStatus>;
72
+ }
73
+ /** Bind the credentialed-http pipeline to a host's store, client, egress class and remedy wording.
74
+ * @param required.host Everything host-specific (see {@link CustomCredentialRequestHost}).
75
+ * @returns `resolveRequestTarget` (non-decrypting DELETE-target check), `verifyCustomCredential`,
76
+ * `makeCredentialedRequest` and `probeCredentialConnection`, each `(deps, input)`.
77
+ * @complexity O(1) to build; each operation costs one store read plus at most one bounded HTTP request.
78
+ * @example const ops = bindCustomCredentialRequestOperations({ host }); await ops.verifyCustomCredential(deps, { workspaceId, label });
79
+ */
80
+ export declare function bindCustomCredentialRequestOperations<Deps extends CustomCredentialRequestHostDeps>({ host }: {
81
+ host: CustomCredentialRequestHost<Deps>;
82
+ }, _optional?: {}): CustomCredentialRequestOperations<Deps>;
83
+ //# sourceMappingURL=credentialed-request.d.ts.map
@@ -0,0 +1,93 @@
1
+ import { CredentialNotFoundError, CredentialedRequestValidationError, makeCredentialedRequest as requestWithCredential, probeCredentialConnection as probeConnection, resolveRequestTarget as resolveCredentialTarget, verifyCustomCredential as verifyCredential, } from "../credentialed-http/credentialed-request.js";
2
+ import { CustomCredentialNotFoundError } from "../credentialed-http/sets/store.js";
3
+ /** Translate body/audit arguments without changing the guarded transport or plugin trust gates. */
4
+ function adaptRequestDeps({ deps, host }, _optional = {}) {
5
+ const audit = deps.audit ?? host.defaultAudit();
6
+ return {
7
+ // The describe path never decrypts; resolve uses the existing host AAD/store boundary.
8
+ resolver: { describe: (input) => host.describe({ repo: deps.repo }, input), resolve: (input) => host.resolve(deps, input) },
9
+ // Forward the policy so a pre-save probe cannot follow redirects through the legacy host ABI.
10
+ httpClient: { send: ({ request }, options) => host.send({ httpClient: deps.httpClient, request }, options) },
11
+ clock: deps.clock,
12
+ audit: { record: ({ entry }) => audit.record(entry) },
13
+ // Keep installed-plugin digest trust checks in the host; generic scheme precedence needs no
14
+ // provider catalog. One loaded rule set is shared by header building and failure diagnostics.
15
+ schemeRegistry: {
16
+ load: async (input) => deps.loadAuthSchemes(input),
17
+ },
18
+ };
19
+ }
20
+ /** Return authentication facts without inferring a provider's required scheme from a 401.
21
+ * The credential recovery adapter owns secure token rotation; only provider documentation can
22
+ * establish a need for Basic authentication. Pure, O(1) time and space.
23
+ */
24
+ function mapDiagnostic({ diagnostic }, _optional = {}) {
25
+ return { schemeSent: diagnostic.schemeSent, usernameStored: diagnostic.usernameStored };
26
+ }
27
+ // An egress refusal is a caller-fixable target rejection, not a DNS/timeout crash. Preserve its
28
+ // instanceof identity so the tool layer can publish the safe reason instead of INTERNAL_ERROR.
29
+ function requestPolicy({ EgressRefusedError }, _optional = {}) {
30
+ return {
31
+ errorPolicy: {
32
+ isEgressRefusal: ({ error }) => error instanceof EgressRefusedError,
33
+ describeEgressRefusal: ({ error }) => error instanceof EgressRefusedError ? error.message : "",
34
+ },
35
+ diagnosticMapper: mapDiagnostic,
36
+ };
37
+ }
38
+ /** Keep the store's not-found identity and the host's remedy wording at the adapter boundary. */
39
+ function rethrowHostError({ error, savedHostRemedy }, _optional = {}) {
40
+ if (error instanceof CredentialNotFoundError)
41
+ throw new CustomCredentialNotFoundError(error.message);
42
+ if (error instanceof CredentialedRequestValidationError && error.message.includes("which is not one of this credential's saved hosts (")) {
43
+ throw new CredentialedRequestValidationError({ message: `${error.message} — ${savedHostRemedy}` });
44
+ }
45
+ throw error;
46
+ }
47
+ /** Bind the credentialed-http pipeline to a host's store, client, egress class and remedy wording.
48
+ * @param required.host Everything host-specific (see {@link CustomCredentialRequestHost}).
49
+ * @returns `resolveRequestTarget` (non-decrypting DELETE-target check), `verifyCustomCredential`,
50
+ * `makeCredentialedRequest` and `probeCredentialConnection`, each `(deps, input)`.
51
+ * @complexity O(1) to build; each operation costs one store read plus at most one bounded HTTP request.
52
+ * @example const ops = bindCustomCredentialRequestOperations({ host }); await ops.verifyCustomCredential(deps, { workspaceId, label });
53
+ */
54
+ export function bindCustomCredentialRequestOperations({ host }, _optional = {}) {
55
+ const policy = requestPolicy({ EgressRefusedError: host.EgressRefusedError });
56
+ const rethrow = (error) => rethrowHostError({ error, savedHostRemedy: host.savedHostRemedy });
57
+ return {
58
+ // DELETE confirmation validates and renders its target without decryption: a human's "no" must not
59
+ // cost a secret read. The persisted base URL/additional hosts alone define what can be requested.
60
+ resolveRequestTarget: async (deps, input) => {
61
+ try {
62
+ return await resolveCredentialTarget({ resolver: { describe: (required) => host.describe({ repo: deps.repo }, required) }, input });
63
+ }
64
+ catch (error) {
65
+ return rethrow(error);
66
+ }
67
+ },
68
+ verifyCustomCredential: async (deps, input) => {
69
+ try {
70
+ return await verifyCredential({ deps: adaptRequestDeps({ deps, host }), input }, policy);
71
+ }
72
+ catch (error) {
73
+ return rethrow(error);
74
+ }
75
+ },
76
+ // The host gates DELETE with its own confirmation; GET/POST/PUT/PATCH retain parity with site
77
+ // operations without a plan/confirm/execute ceremony. This adapter executes only after its
78
+ // caller's policy allows it and deliberately has no independent confirmation state.
79
+ makeCredentialedRequest: async (deps, input) => {
80
+ const { headers, body, ...requiredInput } = input;
81
+ try {
82
+ return await requestWithCredential({ deps: adaptRequestDeps({ deps, host }), input: requiredInput }, { ...policy, headers, body });
83
+ }
84
+ catch (error) {
85
+ return rethrow(error);
86
+ }
87
+ },
88
+ // Adapt the guarded host client to the bodyless, redirect-refusing GET probe; no transport error
89
+ // or response body escapes.
90
+ probeCredentialConnection: (required, options) => probeConnection({ ...required, httpClient: { send: ({ request }, redirectPolicy) => host.send({ httpClient: options.httpClient, request }, redirectPolicy) } }),
91
+ };
92
+ }
93
+ //# sourceMappingURL=credentialed-request.js.map
@@ -0,0 +1,106 @@
1
+ import type { SecretCardForm, SurfaceCardApp, SurfaceOutcomeSpec } from "@jini-ai/core/contracts/cards";
2
+ /**
3
+ * @file The MCP-UI surfaces `tool-registrations.ts` raises for `custom_credential_create`
4
+ * (2026-09-03) — a multi-field in-chat form for creating a brand-new saved custom credential (label,
5
+ * base URL, category, optional username, and the token), and the result document that replaces it
6
+ * once the save actually finishes.
7
+ *
8
+ * Closes a gap `custom_credential_set_token`'s own header names but does not itself solve: that tool
9
+ * can only ROTATE a token on a credential that already exists (it resolves an existing row by `label`
10
+ * before ever opening its form) — until this file, there was no way for the assistant to create the
11
+ * ROW itself, so an agent that found no saved credential for a provider had to dead-end the human with
12
+ * "go to Admin -> Access Tokens -> Add custom provider" instead of finishing the job in chat. This
13
+ * surface is the rotation card's sibling for the CREATE case, holding up the SAME property
14
+ * that whole mechanism exists for — "a token must never pass through the model's context" — see
15
+ * the Jini secret-card engine's header for the shared reasoning (a human typing a token into
16
+ * ordinary chat text would land in `ai_chat_messages`, the model's own context, and the CLI's session
17
+ * history; this form is the escape from that). Extended with the two fields a NEW row additionally
18
+ * needs that a rotation does not: `baseUrl` and `category` (a closed enum — the Access Tokens page's
19
+ * own filter set, `types.ts`'s `CUSTOM_CREDENTIAL_CATEGORIES`).
20
+ *
21
+ * Structurally closer to `deployment_propose_custom_provider_credential`'s own multi-field form
22
+ * (the host's `buildProposeCredentialForm`) than to
23
+ * `custom_credential_set_token`'s single-field one — both collect several non-secret fields alongside
24
+ * one secret. Driven by the engine's `askThenReport`, like `custom_credential_set_token`: the shared
25
+ * engine's documented premature-Done defect applies here too (a submission's `tools/call` round trip resolving the instant the
26
+ * exchange DELIVERS the click, before `createCustomCredential` has actually run), and this tool sits
27
+ * directly beside `custom_credential_set_token` in `tool-registrations.ts`, so it follows that
28
+ * sibling's precedent rather than the cross-feature one.
29
+ *
30
+ * ## Why the URI carries only the exchange id
31
+ *
32
+ * Same reasoning the rotation card and deployment credential card give: a CREATE has no existing
33
+ * row/version to key against at the point the form is raised — the row does not exist until the human submits — so the exchange id is
34
+ * the only stable handle a fresh form instance has.
35
+ */
36
+ /** Non-secret pre-fill hints the model-issued call may carry — see `credential-save-tool.ts`'s
37
+ * API creation schema for the exact three fields this accepts. All three are optional; an
38
+ * absent field renders its form control blank rather than pre-filled. */
39
+ /** The host's works-for suggester (`suggestCredentialWorksFor` from `@jini-ai/platform/secrets/credential-sets`). */
40
+ export type SuggestWorksFor = (required: {
41
+ label: string;
42
+ providers: readonly {
43
+ id: string;
44
+ vendorId: string;
45
+ }[];
46
+ }) => string[];
47
+ export interface CreateCredentialPrefill {
48
+ readonly label?: string;
49
+ readonly baseUrl?: string;
50
+ readonly category?: string;
51
+ readonly worksFor?: string[];
52
+ }
53
+ /** Shared by the form and its later outcome document — see this file's header, "Why the URI carries
54
+ * only the exchange id". Reusing the SAME uri for both is what makes the outcome REPLACE the form
55
+ * in the transcript instead of opening a second card. */
56
+ /**
57
+ * Renders the credential-creation form: label, base URL, category (a closed select drawn from
58
+ * `CUSTOM_CREDENTIAL_CATEGORIES`, defaulting to `"general"` when unprefilled), an optional username,
59
+ * and the masked token field — the ONLY place the token exists outside the sealed ciphertext it
60
+ * becomes a moment later. It is typed directly into this iframe and posted straight to
61
+ * `mcp-ui-tool-calls-route.ts`, never through the assistant's own text channel. A prefilled `category`
62
+ * that does not match one of the fixed options simply starts unselected (`renderSelect`'s own
63
+ * documented behavior) — never a rendering error.
64
+ *
65
+ * @param spec.app - The host's card identity for this form (`CredentialCardIdentity.appNames.create`).
66
+ * @param spec.categories - The host's closed category set (its `CUSTOM_CREDENTIAL_CATEGORIES`).
67
+ * @param spec.baseUrlHint - The host's help text for the Base URL field (its example URL is host copy).
68
+ * @complexity O(1) — a fixed five-field form (`CUSTOM_CREDENTIAL_CATEGORIES.length` is a small,
69
+ * compile-time-fixed constant, so the category options list is effectively O(1) too).
70
+ */
71
+ export declare function buildCreateForm(spec: {
72
+ prefill: CreateCredentialPrefill;
73
+ providers?: readonly {
74
+ id: string;
75
+ vendorId: string;
76
+ label?: string;
77
+ }[];
78
+ app: SurfaceCardApp;
79
+ categories: readonly string[];
80
+ suggestWorksFor: SuggestWorksFor;
81
+ baseUrlHint: string;
82
+ }, _optional?: {}): SecretCardForm & {
83
+ preferredFrameSize: readonly [string, string];
84
+ };
85
+ /**
86
+ * Renders the RESULT of a submitted create — what replaces the form once the engine's domain
87
+ * save port (`saveCreateCard`, `tool-registrations.ts`) has actually run `createCustomCredential`
88
+ * (or refused to, e.g. a duplicate label or an invalid category). See this file's header for the
89
+ * mechanism and why the engine supplies the same `uri` to both projections.
90
+ *
91
+ * `message` is caller-controlled and must never carry the token itself — enforced by construction at
92
+ * every call site in `tool-registrations.ts`, never by this function, which only renders what it is
93
+ * given (the same division of responsibility as the rotation card's outcome projection).
94
+ *
95
+ * @param spec.app - The host's card identity for the outcome (`CredentialCardIdentity.appNames.createOutcome`).
96
+ * @complexity O(1) — fixed-size field reads.
97
+ */
98
+ export declare function buildCreateOutcome(spec: {
99
+ label: string;
100
+ state: "success" | "failure";
101
+ message: string;
102
+ app: SurfaceCardApp;
103
+ }, _optional?: {}): SurfaceOutcomeSpec & {
104
+ preferredFrameSize: readonly [string, string];
105
+ };
106
+ //# sourceMappingURL=custom-credential-create-ui.d.ts.map
@@ -0,0 +1,136 @@
1
+ function buildCredentialCategoryField(prefill, categories) {
2
+ return {
3
+ kind: "enum",
4
+ name: "category",
5
+ label: "Category",
6
+ required: true,
7
+ options: categories.map((id) => ({ value: id })),
8
+ // Defaults to "general" (the closed set's catch-all) when the model supplied no prefill hint —
9
+ // mirrors the admin Access Tokens page's own "Add custom provider" form
10
+ // (the host admin's `emptyCustomAddForm`),
11
+ // which has always defaulted this field the same way. Without this, `renderSelect` (required +
12
+ // no `value`) renders a genuinely blank, blocking required select — a human with no obvious
13
+ // category for e.g. a hosting provider's deploy token had nothing sensible to pick. Still freely changeable before
14
+ // submit; a bad/unrecognized prefill still starts unselected, per this file's own header.
15
+ value: prefill.category ?? "general",
16
+ };
17
+ }
18
+ /** Shared by the form and its later outcome document — see this file's header, "Why the URI carries
19
+ * only the exchange id". Reusing the SAME uri for both is what makes the outcome REPLACE the form
20
+ * in the transcript instead of opening a second card. */
21
+ // The engine now supplies that shared exchange-keyed URI to both projections.
22
+ /**
23
+ * Renders the credential-creation form: label, base URL, category (a closed select drawn from
24
+ * `CUSTOM_CREDENTIAL_CATEGORIES`, defaulting to `"general"` when unprefilled), an optional username,
25
+ * and the masked token field — the ONLY place the token exists outside the sealed ciphertext it
26
+ * becomes a moment later. It is typed directly into this iframe and posted straight to
27
+ * `mcp-ui-tool-calls-route.ts`, never through the assistant's own text channel. A prefilled `category`
28
+ * that does not match one of the fixed options simply starts unselected (`renderSelect`'s own
29
+ * documented behavior) — never a rendering error.
30
+ *
31
+ * @param spec.app - The host's card identity for this form (`CredentialCardIdentity.appNames.create`).
32
+ * @param spec.categories - The host's closed category set (its `CUSTOM_CREDENTIAL_CATEGORIES`).
33
+ * @param spec.baseUrlHint - The host's help text for the Base URL field (its example URL is host copy).
34
+ * @complexity O(1) — a fixed five-field form (`CUSTOM_CREDENTIAL_CATEGORIES.length` is a small,
35
+ * compile-time-fixed constant, so the category options list is effectively O(1) too).
36
+ */
37
+ export function buildCreateForm(spec, _optional = {}) {
38
+ const { prefill, providers = [], app, categories, suggestWorksFor, baseUrlHint } = spec;
39
+ const worksForField = buildWorksForField({ prefill, providers, suggestWorksFor });
40
+ return {
41
+ title: "Save an API credential",
42
+ description: "Fill in the credential's label, base URL, and category, and type its token directly into the field below. " +
43
+ "The token is sealed on the server the moment you submit — the assistant never sees it, and it is never " +
44
+ "written to the chat transcript.",
45
+ submitLabel: "Save credential",
46
+ fields: [
47
+ {
48
+ kind: "string",
49
+ name: "label",
50
+ label: "Label",
51
+ hint: "A short display name, e.g. 'repository' or 'registrar'. Must be unique in this workspace.",
52
+ required: true,
53
+ ...(prefill.label !== undefined ? { value: prefill.label } : {}),
54
+ },
55
+ {
56
+ kind: "string",
57
+ name: "baseUrl",
58
+ label: "Base URL",
59
+ hint: baseUrlHint,
60
+ required: true,
61
+ ...(prefill.baseUrl !== undefined ? { value: prefill.baseUrl } : {}),
62
+ },
63
+ buildCredentialCategoryField(prefill, categories),
64
+ ...(worksForField ? [worksForField] : []),
65
+ {
66
+ kind: "string",
67
+ name: "username",
68
+ label: "Username (optional)",
69
+ hint: "An account identifier, if this provider needs one alongside the token — never a secret.",
70
+ },
71
+ {
72
+ kind: "string",
73
+ name: "token",
74
+ label: "Token",
75
+ hint: "Pasted or typed here only — never shown to the assistant.",
76
+ required: true,
77
+ secret: true,
78
+ },
79
+ ],
80
+ app,
81
+ preferredFrameSize: ["100%", "560px"],
82
+ };
83
+ }
84
+ /** Categories whose credentials the deploy/source-control catalog in `providers` can use. */
85
+ const CATALOG_CATEGORIES = new Set(["hosting", "source-control"]);
86
+ /**
87
+ * The "Works for" picker, or `undefined` when nothing makes it relevant. `providers` is the deploy
88
+ * and source-control catalog, so its hosts are offered only for a hosting/source-control credential
89
+ * (by category, or by a prefilled/suggested target in the catalog). Otherwise only targets the
90
+ * prefill names are offered, and a credential with none — e.g. a mail API key — gets no picker at
91
+ * all instead of every deploy host (2026-10-22, a mail key listed vercel, netlify, s3…). An absent
92
+ * field saves as `worksFor: []`, the same as an empty selection.
93
+ *
94
+ * @complexity O(p + w) in the provider and target counts.
95
+ */
96
+ function buildWorksForField({ prefill, providers, suggestWorksFor }) {
97
+ const worksFor = prefill.worksFor ?? suggestWorksFor({ label: prefill.label ?? "", providers });
98
+ const catalog = providers.flatMap(provider => [provider.id, provider.vendorId]);
99
+ const catalogRelevant = CATALOG_CATEGORIES.has(prefill.category ?? "") || worksFor.some(id => catalog.includes(id));
100
+ const options = [...new Set([...(catalogRelevant ? catalog : []), ...worksFor])];
101
+ if (options.length === 0)
102
+ return undefined;
103
+ return {
104
+ kind: "multi-enum",
105
+ name: "worksFor",
106
+ label: "Works for (optional)",
107
+ hint: "Also use this key for deploying? Leave this empty unless this is a hosting or deploy key.",
108
+ options: options.map(id => ({ value: id })),
109
+ value: worksFor,
110
+ };
111
+ }
112
+ /**
113
+ * Renders the RESULT of a submitted create — what replaces the form once the engine's domain
114
+ * save port (`saveCreateCard`, `tool-registrations.ts`) has actually run `createCustomCredential`
115
+ * (or refused to, e.g. a duplicate label or an invalid category). See this file's header for the
116
+ * mechanism and why the engine supplies the same `uri` to both projections.
117
+ *
118
+ * `message` is caller-controlled and must never carry the token itself — enforced by construction at
119
+ * every call site in `tool-registrations.ts`, never by this function, which only renders what it is
120
+ * given (the same division of responsibility as the rotation card's outcome projection).
121
+ *
122
+ * @param spec.app - The host's card identity for the outcome (`CredentialCardIdentity.appNames.createOutcome`).
123
+ * @complexity O(1) — fixed-size field reads.
124
+ */
125
+ export function buildCreateOutcome(spec, _optional = {}) {
126
+ const { label, state, message, app } = spec;
127
+ return {
128
+ title: state === "success" ? "Credential saved" : "Credential not saved",
129
+ details: [{ label: "Label", value: label }],
130
+ state,
131
+ message,
132
+ app,
133
+ preferredFrameSize: ["100%", "240px"],
134
+ };
135
+ }
136
+ //# sourceMappingURL=custom-credential-create-ui.js.map
@@ -0,0 +1,84 @@
1
+ import type { SecretCardForm, SurfaceCardApp, SurfaceOutcomeSpec } from "@jini-ai/core/contracts/cards";
2
+ /**
3
+ * @file The MCP-UI surfaces `tool-registrations.ts` raises for `custom_credential_set_token`
4
+ * (2026-09-01) — a masked, in-chat form for typing a saved custom credential's TOKEN, and the
5
+ * result document that replaces it once the save actually finishes.
6
+ *
7
+ * ## The property this whole tool exists to hold up
8
+ *
9
+ * "A token must never pass through the model's context" — not merely "an agent must never write
10
+ * one". Those come apart: if a human typed a token into ordinary chat text, it would land in
11
+ * `ai_chat_messages` in plaintext, in the model's own context (so, the provider), and in the CLI's
12
+ * session history — three copies, which is exactly why every OTHER credential-rotation path in this
13
+ * codebase ends in "now go rotate it". This form is the escape from that: the human's keystrokes go
14
+ * browser -> `mcp-ui-tool-calls-route.ts` -> `SurfaceExchangeStore` -> this parked tool call, entirely
15
+ * inside the host's own process, and never through the spawned agent CLI's stdio at all. There is
16
+ * therefore nothing to rotate afterward.
17
+ *
18
+ * `setTokenForm`'s field list has exactly one entry (`token`) — deliberately not a
19
+ * `username` field too: `custom_credential_set_username` already owns that plaintext, non-secret
20
+ * column, and folding it in here would blur which of the two tools is the one that can never accept a
21
+ * secret's sibling metadata. `saveSetToken` (`tool-registrations.ts`) reads the submitted
22
+ * `token` from the engine-filtered fields and carries the credential's EXISTING `username` forward into the
23
+ * fresh `connection` it seals — see that function's own doc for why forgetting that would silently
24
+ * clear a saved username.
25
+ *
26
+ * ## Form, then a replacing result — not a bare confirm/cancel
27
+ *
28
+ * Structurally this is `buildProposeCredentialForm`'s sibling (the host's deployment
29
+ * agent tools) more than `delete-request-confirmation-ui.ts`'s: a form collecting a
30
+ * secret field, not a yes/no dialog naming a destructive action. Unlike that S3-compatible form,
31
+ * though, `tool-registrations.ts` drives this one through `askThenReport`, not `askOnce` — see that
32
+ * function's own doc for the defect this avoids (a submission's `tools/call` round trip resolving
33
+ * the instant the exchange DELIVERS the click, before the save has actually run). `setTokenOutcome`
34
+ * is the correction: sent under the SAME `ui://` URI the form used
35
+ * (the engine-owned URI), so `McpUiSurfaceCard` (`@jini-ai/chat`) replaces the form in place with
36
+ * the true result rather than leaving a stale "Done." next to buttons that already fired.
37
+ *
38
+ * ## Why the URI carries only the exchange id
39
+ *
40
+ * Same reasoning `delete-request-confirmation-ui.ts` and `customProviderCredentialFormUri`
41
+ * (`publish-agent-tools.ts`) both give: this is a live in-chat action, not an edit to an existing
42
+ * host-owned row with its own id/version to key against, so the exchange id is the only stable handle
43
+ * a fresh form instance has.
44
+ */
45
+ /** Shared by the form and its later outcome document — see this file's header, "Why the URI carries
46
+ * only the exchange id". Reusing the SAME uri for both is what makes the outcome REPLACE the form
47
+ * in the transcript instead of opening a second card. */
48
+ /**
49
+ * Renders the masked token-entry form. The rendered field is the ONLY place the token exists outside
50
+ * the sealed ciphertext it becomes a moment later — it is typed directly into this iframe and posted
51
+ * straight to `mcp-ui-tool-calls-route.ts`, never through the assistant's own text channel.
52
+ *
53
+ * @param required.app - The host's card identity for this form (its `CredentialCardIdentity.appNames.setToken`).
54
+ * @param required.secretField - The host's secret marker for the token field (its `credential_save`
55
+ * secret-form definition), so the callback gate and this form derive "secret" from one source.
56
+ * @complexity O(1) — a fixed one-field form.
57
+ */
58
+ export declare function setTokenForm({ label, app, secretField }: {
59
+ label: string;
60
+ app: SurfaceCardApp;
61
+ secretField: {
62
+ readonly secret: true;
63
+ } | undefined;
64
+ }, _optional?: {}): SecretCardForm;
65
+ /**
66
+ * Renders the RESULT of a submitted token — what replaces the form once `askThenReport`'s `handle`
67
+ * callback (`saveSetToken`, `tool-registrations.ts`) has actually run `updateCustomCredential`
68
+ * (or refused to, e.g. a blank submission). See this file's header for the mechanism and why the `uri`
69
+ * MUST equal the engine-owned URI for the same exchange id.
70
+ *
71
+ * `message` is caller-controlled and must never carry the token itself — enforced by construction at
72
+ * every call site in `tool-registrations.ts`, never by this function, which only renders what it is
73
+ * given (same division of responsibility `@jini-ai/ui`'s own `SurfaceOutcomeSpec.message` doc states).
74
+ *
75
+ * @param required.app - The host's card identity for the outcome (`CredentialCardIdentity.appNames.setTokenOutcome`).
76
+ * @complexity O(1) — fixed-size field reads.
77
+ */
78
+ export declare function setTokenOutcome({ label, state, message, app }: {
79
+ label: string;
80
+ state: "success" | "failure";
81
+ message: string;
82
+ app: SurfaceCardApp;
83
+ }, _optional?: {}): SurfaceOutcomeSpec;
84
+ //# sourceMappingURL=custom-credential-set-token-ui.d.ts.map
@@ -0,0 +1,104 @@
1
+ /**
2
+ * @file The MCP-UI surfaces `tool-registrations.ts` raises for `custom_credential_set_token`
3
+ * (2026-09-01) — a masked, in-chat form for typing a saved custom credential's TOKEN, and the
4
+ * result document that replaces it once the save actually finishes.
5
+ *
6
+ * ## The property this whole tool exists to hold up
7
+ *
8
+ * "A token must never pass through the model's context" — not merely "an agent must never write
9
+ * one". Those come apart: if a human typed a token into ordinary chat text, it would land in
10
+ * `ai_chat_messages` in plaintext, in the model's own context (so, the provider), and in the CLI's
11
+ * session history — three copies, which is exactly why every OTHER credential-rotation path in this
12
+ * codebase ends in "now go rotate it". This form is the escape from that: the human's keystrokes go
13
+ * browser -> `mcp-ui-tool-calls-route.ts` -> `SurfaceExchangeStore` -> this parked tool call, entirely
14
+ * inside the host's own process, and never through the spawned agent CLI's stdio at all. There is
15
+ * therefore nothing to rotate afterward.
16
+ *
17
+ * `setTokenForm`'s field list has exactly one entry (`token`) — deliberately not a
18
+ * `username` field too: `custom_credential_set_username` already owns that plaintext, non-secret
19
+ * column, and folding it in here would blur which of the two tools is the one that can never accept a
20
+ * secret's sibling metadata. `saveSetToken` (`tool-registrations.ts`) reads the submitted
21
+ * `token` from the engine-filtered fields and carries the credential's EXISTING `username` forward into the
22
+ * fresh `connection` it seals — see that function's own doc for why forgetting that would silently
23
+ * clear a saved username.
24
+ *
25
+ * ## Form, then a replacing result — not a bare confirm/cancel
26
+ *
27
+ * Structurally this is `buildProposeCredentialForm`'s sibling (the host's deployment
28
+ * agent tools) more than `delete-request-confirmation-ui.ts`'s: a form collecting a
29
+ * secret field, not a yes/no dialog naming a destructive action. Unlike that S3-compatible form,
30
+ * though, `tool-registrations.ts` drives this one through `askThenReport`, not `askOnce` — see that
31
+ * function's own doc for the defect this avoids (a submission's `tools/call` round trip resolving
32
+ * the instant the exchange DELIVERS the click, before the save has actually run). `setTokenOutcome`
33
+ * is the correction: sent under the SAME `ui://` URI the form used
34
+ * (the engine-owned URI), so `McpUiSurfaceCard` (`@jini-ai/chat`) replaces the form in place with
35
+ * the true result rather than leaving a stale "Done." next to buttons that already fired.
36
+ *
37
+ * ## Why the URI carries only the exchange id
38
+ *
39
+ * Same reasoning `delete-request-confirmation-ui.ts` and `customProviderCredentialFormUri`
40
+ * (`publish-agent-tools.ts`) both give: this is a live in-chat action, not an edit to an existing
41
+ * host-owned row with its own id/version to key against, so the exchange id is the only stable handle
42
+ * a fresh form instance has.
43
+ */
44
+ /** Shared by the form and its later outcome document — see this file's header, "Why the URI carries
45
+ * only the exchange id". Reusing the SAME uri for both is what makes the outcome REPLACE the form
46
+ * in the transcript instead of opening a second card. */
47
+ // The published secret-card engine now supplies and reuses that URI.
48
+ /**
49
+ * Renders the masked token-entry form. The rendered field is the ONLY place the token exists outside
50
+ * the sealed ciphertext it becomes a moment later — it is typed directly into this iframe and posted
51
+ * straight to `mcp-ui-tool-calls-route.ts`, never through the assistant's own text channel.
52
+ *
53
+ * @param required.app - The host's card identity for this form (its `CredentialCardIdentity.appNames.setToken`).
54
+ * @param required.secretField - The host's secret marker for the token field (its `credential_save`
55
+ * secret-form definition), so the callback gate and this form derive "secret" from one source.
56
+ * @complexity O(1) — a fixed one-field form.
57
+ */
58
+ export function setTokenForm({ label, app, secretField }, _optional = {}) {
59
+ return {
60
+ title: `Replace the saved key for '${label}'?`,
61
+ description: "This REPLACES the saved key. Only continue if you want to replace it. Type the new key directly into the field below. It is sealed on the server the moment you submit — " +
62
+ "the assistant never sees it, and it is never written to the chat transcript. Any saved username for " +
63
+ "this credential is kept as-is.",
64
+ submitLabel: "Replace saved key",
65
+ fields: [
66
+ {
67
+ kind: "string",
68
+ name: "token",
69
+ label: "Token",
70
+ hint: "Pasted or typed here only — never shown to the assistant.",
71
+ required: false,
72
+ allowBlank: true,
73
+ ...secretField,
74
+ },
75
+ ],
76
+ cancelLabel: "Cancel",
77
+ app,
78
+ preferredFrameSize: ["100%", "360px"],
79
+ };
80
+ }
81
+ /**
82
+ * Renders the RESULT of a submitted token — what replaces the form once `askThenReport`'s `handle`
83
+ * callback (`saveSetToken`, `tool-registrations.ts`) has actually run `updateCustomCredential`
84
+ * (or refused to, e.g. a blank submission). See this file's header for the mechanism and why the `uri`
85
+ * MUST equal the engine-owned URI for the same exchange id.
86
+ *
87
+ * `message` is caller-controlled and must never carry the token itself — enforced by construction at
88
+ * every call site in `tool-registrations.ts`, never by this function, which only renders what it is
89
+ * given (same division of responsibility `@jini-ai/ui`'s own `SurfaceOutcomeSpec.message` doc states).
90
+ *
91
+ * @param required.app - The host's card identity for the outcome (`CredentialCardIdentity.appNames.setTokenOutcome`).
92
+ * @complexity O(1) — fixed-size field reads.
93
+ */
94
+ export function setTokenOutcome({ label, state, message, app }, _optional = {}) {
95
+ return {
96
+ title: state === "success" ? "Token saved" : "Token not saved",
97
+ details: [{ label: "Credential", value: label }],
98
+ state,
99
+ message,
100
+ app,
101
+ preferredFrameSize: ["100%", "240px"],
102
+ };
103
+ }
104
+ //# sourceMappingURL=custom-credential-set-token-ui.js.map