diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock new file mode 100644 index 00000000..515e8844 --- /dev/null +++ b/.speakeasy/gen.lock @@ -0,0 +1,2493 @@ +lockVersion: 2.0.0 +id: 872dfdc4-0389-4924-af1d-59c01198f0e8 +management: + docChecksum: 2c18f093cc323a0fb59addea26ab310f + docVersion: 1.0.0 + speakeasyVersion: 1.739.0 + generationVersion: 2.846.1 + releaseVersion: 0.0.1 + configChecksum: e16b146372fcb347e0b0ee2c11cca424 + published: true +persistentEdits: + generation_id: 4ebc1acf-1fe6-4188-bebc-ae51c4589b3b + pristine_commit_hash: 56fec3b6153f56e8f5317b944bd1ed0b6b3b5001 + pristine_tree_hash: 88fc5279625db08f21fa68a7f28bbe6b7de13bdf +features: + mcp-typescript: + additionalDependencies: 0.1.0 + constsAndDefaults: 0.1.2 + core: 1.2.20 + defaultEnabledRetries: 0.1.0 + enumUnions: 0.1.0 + globalSecurity: 0.1.2 + globalSecurityCallbacks: 0.0.0 + globalServerURLs: 0.1.2 + methodSecurity: 0.1.1 + nullables: 0.1.0 + oauth2ClientCredentials: 1.1.7 + responseFormat: 0.1.1 + retries: 0.1.0 + sdkHooks: 0.3.0 + unions: 0.2.0 +trackedFiles: + .dxtignore: + id: 0ee1c4f92736 + last_write_checksum: sha1:0cbab1b303d9060f6324f6a9cddabe13c2cfa7c9 + pristine_git_object: 21eeace1d85822ffb013f6c0667a19f35c33cee0 + .gitattributes: + id: 24139dae6567 + last_write_checksum: sha1:26d16d8297b104945139da8c25bd38feeaad3e25 + pristine_git_object: 113eead5093c17d43a46159132885318f281a68a + .npmignore: + id: aa70c1f807c3 + last_write_checksum: sha1:aa14435f0c166ebc0edbf1ae6f65128e33dc8c97 + pristine_git_object: 0bc901db2a899e4b8f0bdcbea7fd547ef18e2fd9 + eslint.config.mjs: + id: 461c8d07f6da + last_write_checksum: sha1:576025302d3d8650f37276bc9075f6ade3842cc7 + pristine_git_object: 4f9e60a9462fc4def738d60c3aaadf8232ef185f + manifest.json: + id: ca642a226869 + last_write_checksum: sha1:2f091e806c7bdc683ebbfe5ff4ce5a6b34ccc34d + pristine_git_object: ed47e511727899986174d8a24a32cf469a25075a + package.json: + id: 7030d0b2f71b + last_write_checksum: sha1:25bb0451f568fe5b374b79ed8c830b2fc1fa60a3 + pristine_git_object: 5db3a3a9003530dced83b511f53b90d82c03bd28 + src/core.ts: + id: f431fdbcd144 + last_write_checksum: sha1:ce840032c45608f5f4022b32bcce32cb69c5ed26 + pristine_git_object: c4486e4ac5f122d666243b52072232a064716999 + src/funcs/agentsArchiveAgentConversation.ts: + id: 0f38b4e674fa + last_write_checksum: sha1:f701a538da61e0d0855cc218f773a7f03a91e297 + pristine_git_object: 597682910d427ced33f0338cf3b8e186e75436d6 + src/funcs/agentsCreateAgent.ts: + id: 51073dbdf0f4 + last_write_checksum: sha1:7694a41429bd784b0b9f694332f02ee7fc9b0782 + pristine_git_object: 0268dcff5ab98098c49cd3b76aaaf4e8185efc83 + src/funcs/agentsDeleteAgent.ts: + id: 64be5e2a4a1c + last_write_checksum: sha1:7763e1b177ee8ac8e89b19639c9e7dea81eeac8b + pristine_git_object: efaf5a4128caf18a5900ac7475b8326d45b1dcd4 + src/funcs/agentsDeleteAgentConversationById.ts: + id: e33ce236ebc8 + last_write_checksum: sha1:859a9d28c6036708c4fd99f855fd7484423de87d + pristine_git_object: 13765a173a60c0f28a16e9e5155f3e7c5e33db91 + src/funcs/agentsDeleteAgentConversationChatAttachment.ts: + id: 814b70e73972 + last_write_checksum: sha1:26d908122c7789ba5d8ed36f06483037ea28fcac + pristine_git_object: 195ba6bb822ea0b467c5d75d2e0b329110d724e3 + src/funcs/agentsGetAgent.ts: + id: b10b176a954d + last_write_checksum: sha1:a2b1d2a305f9152496ecdcaffc064e258e2aa1c5 + pristine_git_object: 16b7bd13832f316b8bd342e87e623a2d6f9101c8 + src/funcs/agentsGetAgentConversationById.ts: + id: ce8563bf35a1 + last_write_checksum: sha1:234a37d68f872a10d840f45fde575be1d8b2357a + pristine_git_object: dd0e3a3e4f64ef5564106b0169d1cb988c947a60 + src/funcs/agentsListAgentArchivedConversationsGrouped.ts: + id: ca0e2ce995b0 + last_write_checksum: sha1:45f27c6134fa3064d992c3de4cc813a8d2458677 + pristine_git_object: 18e83fd5b8c41ff04933c6f19f5874bd018a86ec + src/funcs/agentsListAgentConversationArchives.ts: + id: 2c2bd2a33031 + last_write_checksum: sha1:a64d144713e96989a2fc8d89d834fa77b4365c34 + pristine_git_object: c8782c7b1a34a49a83bb44119ff2d780b6622393 + src/funcs/agentsListAgentConversations.ts: + id: d43c3f477ca2 + last_write_checksum: sha1:949ee67ffc3b3f632284c25995e2c33c84efc265 + pristine_git_object: 9a95aacd710ac47ab8d75a0a25556948e6d6e3d8 + src/funcs/agentsListAgents.ts: + id: 4ef7b06f56a2 + last_write_checksum: sha1:456056d3f8c9e81a10844d0b1d9500ce5545207b + pristine_git_object: e83043851af4bff679798fda5b1764b8aed365ad + src/funcs/agentsUnarchiveAgentConversation.ts: + id: 599df9699179 + last_write_checksum: sha1:b6a20ba9c55fe1bc05676ee5798a9394991e4097 + pristine_git_object: b444b659b04009a54d3e87d82caf111987da5ee9 + src/funcs/agentsUpdateAgent.ts: + id: 046c9537601e + last_write_checksum: sha1:6ea5fc23281aedf8bc40239182dccb35b8429d96 + pristine_git_object: f2fa5e587f46ec99a30a08bce291c3a7ab710d41 + src/funcs/agentsUpdateAgentConversationMessageFeedback.ts: + id: 97f645689a71 + last_write_checksum: sha1:da5b67b7485c7d8a32a330133da1e6fb17122a12 + pristine_git_object: 5a22bf32471a34a8b615df41c560be95dfd276c7 + src/funcs/agentsUpdateAgentConversationTitle.ts: + id: ea29e420d6f8 + last_write_checksum: sha1:3cd11ca6f19bd94df394f07bb9e8a4f4bc7ca1dc + pristine_git_object: cb95d22047731abbfaa219bfedd63d080357a0b5 + src/funcs/agentsUploadAgentConversationChatAttachments.ts: + id: 3b1c15413918 + last_write_checksum: sha1:63c6e2499bdd566fd528ea851a9819065f9a8c38 + pristine_git_object: b78977c75fad77fbe053efae9edfe5940cfc971a + src/funcs/aiModelsProvidersGetAvailableModelsByType.ts: + id: a07f117089a5 + last_write_checksum: sha1:c674cb3ff308248c19ad80f6fb6d4a87db1775a0 + pristine_git_object: 30be2ace828e1597f3864aedeb26ac1589a711e0 + src/funcs/conversationsArchiveConversation.ts: + id: d36743863716 + last_write_checksum: sha1:99167b66ef2e14d71c8643b6b7e12d928c842266 + pristine_git_object: d388951edd588e8b764cb384db16b29b3bc9aea7 + src/funcs/conversationsDeleteConversationById.ts: + id: c27c69fc3d6b + last_write_checksum: sha1:34859537b024fa22d2934a5a31b57aebac6b771a + pristine_git_object: 4d9d78fe4daed72de857e7697cb5e018e0e71cd4 + src/funcs/conversationsGetAllConversations.ts: + id: 30e892e1a117 + last_write_checksum: sha1:86713ae3484b96a81ff878bf0953b8627f0abd07 + pristine_git_object: 8d4036abbb5602b9c05a2d5cfef1f84feb943e73 + src/funcs/conversationsGetArchivedConversations.ts: + id: bd13c780ab67 + last_write_checksum: sha1:50abc80d1438ed49c8d5437663e319e00a2fea24 + pristine_git_object: 2bf50e2932261139df22ef046bad08a448d3366e + src/funcs/conversationsGetConversationById.ts: + id: 676f3c785a85 + last_write_checksum: sha1:effa2df88800fb5e2de15ae28e02e7b8537fb4bb + pristine_git_object: da6b08e1dcfef614f75fcccb1ee56a6036c3f250 + src/funcs/conversationsSearchArchivedConversations.ts: + id: 61e53cebea66 + last_write_checksum: sha1:1e569ee6485521d0b285e1fe8a10f66cf83ea9fa + pristine_git_object: 76e83ca1dfc07b13fe63046dc342b90df992d0f8 + src/funcs/conversationsUnarchiveConversation.ts: + id: a660c2fb171c + last_write_checksum: sha1:4b878bca32641b70e851c60f40c16199e042df5b + pristine_git_object: efcd9d9085644a07913e204578650ea1b1fc5f0c + src/funcs/conversationsUpdateConversationTitle.ts: + id: 38f9833650ca + last_write_checksum: sha1:54f2070749b4df51d1f45fae9f3661f5e5965de2 + pristine_git_object: 1bdb085e55bd30537d78ce893c17c3b401279de6 + src/funcs/conversationsUpdateMessageFeedback.ts: + id: 5f9d99e39437 + last_write_checksum: sha1:6104b7401daecf854b86d48349eedf19f5e551b6 + pristine_git_object: 1302fda61c308622f869391b0d9d63081b75e10f + src/funcs/knowledgeHubGetKnowledgeHubChildNodes.ts: + id: 0cab9ea86703 + last_write_checksum: sha1:b77ce3d5681b36075df5472c9592feb989b30dff + pristine_git_object: 9e69e86be567cae4ad9af4ef4c7227a5901d440b + src/funcs/knowledgeHubGetKnowledgeHubRootNodes.ts: + id: de4ff4bc7588 + last_write_checksum: sha1:fb606dacb862701321838ca2e0e84027822a7077 + pristine_git_object: 3099d409fe6944c29973b0e6f6d366b15028168a + src/funcs/oAuthAppsActivateOAuthApp.ts: + id: 832927f23b01 + last_write_checksum: sha1:e9f7557ad10da3ed8ea43e2b5977864860be1226 + pristine_git_object: f8b2c5590a045656ee83f3bb4d54d019dac8dfc1 + src/funcs/oAuthAppsCreateOAuthApp.ts: + id: e89b3375c7af + last_write_checksum: sha1:f08c2269d7e502607fa9814a5268a108d8e143a0 + pristine_git_object: 408feb9d3174bf10c6dbff5336a0f61f8fb9b5d1 + src/funcs/oAuthAppsDeleteOAuthApp.ts: + id: 8334f3a80ecf + last_write_checksum: sha1:81b1b39f8bd3debc43878bab28c2137413cc0e7c + pristine_git_object: 98f91e8e6323a84fd4029340f0ad447b26f66ef9 + src/funcs/oAuthAppsGetOAuthApp.ts: + id: 3c5e9694173a + last_write_checksum: sha1:2d5dc0490a4b86a9d9c6a6e1b90081242c2f294b + pristine_git_object: 230feb15d81f47d722bedeebcd456a7e23c07661 + src/funcs/oAuthAppsListOAuthAppTokens.ts: + id: 5d7924efea3f + last_write_checksum: sha1:5e8dc8262c6a8c30bd4fb7154a372630b21aa59c + pristine_git_object: b82ca71432a057bc7aa074e97a433f4072ac4bad + src/funcs/oAuthAppsListOAuthApps.ts: + id: 72353fb21ab9 + last_write_checksum: sha1:86a16eb89bfc934d1a79db0c40327c287bd136e5 + pristine_git_object: 568145c8471c9c5ff6df94bd74cb4b2a8322f81d + src/funcs/oAuthAppsListOAuthScopes.ts: + id: a82dc0535e18 + last_write_checksum: sha1:68f146f437ec83313cfd382ee6c87e9715902651 + pristine_git_object: 288ded363478c7f792f1e601e1174b76268a530c + src/funcs/oAuthAppsRegenerateOAuthAppSecret.ts: + id: 4338fb903715 + last_write_checksum: sha1:c54112da80b5aa13d475a1c80dd790afaaa688ed + pristine_git_object: 18fa4121791831ecf52ee139f7b0691965093786 + src/funcs/oAuthAppsRevokeAllOAuthAppTokens.ts: + id: 387a52df6a91 + last_write_checksum: sha1:e33a933d4bb85694e19acc400e0dbc5451a96f34 + pristine_git_object: 555e9f7d80d3248174feac1d6a880034ddefdb6c + src/funcs/oAuthAppsSuspendOAuthApp.ts: + id: 9677fa5a1d14 + last_write_checksum: sha1:9e3fa04edfda31e7791f5941896cd80482525f63 + pristine_git_object: f5a2665314d123a0c023e0aa95426c996c66ec3f + src/funcs/oAuthAppsUpdateOAuthApp.ts: + id: 6c8e8dfc593b + last_write_checksum: sha1:b573907dcee0151ac29da82bbc3283c6814bf86c + pristine_git_object: 5f1cd6d3c539ce0adce6de1f994a0f51029b02ca + src/funcs/oAuthProviderOauthIntrospect.ts: + id: 1ae8aa292b1d + last_write_checksum: sha1:1c0e318ee3b2ad4d0c91402571e10b3d075c976e + pristine_git_object: 773a2e0c31406b978deacf48dd5b77a251940d15 + src/funcs/oAuthProviderOauthRevoke.ts: + id: f01b717fc174 + last_write_checksum: sha1:abcdef5af560fe3408fdfaee2e915a3a19e8ab0c + pristine_git_object: c44aadb8d0ade3f5b547f5115ae66e7d21448478 + src/funcs/oAuthProviderOauthToken.ts: + id: e37000d380d4 + last_write_checksum: sha1:2257f84d2e4c7a2eb1b0dcbdf24e8bda5856e391 + pristine_git_object: 31102418c17c1e21af3917a5837ad5c155bafdbe + src/funcs/openIDConnectOauthUserInfo.ts: + id: 4a8e6fc07e1b + last_write_checksum: sha1:ded67d61eb061c044d04fc0c2d70851fa0b345df + pristine_git_object: 3e2c99f2c8565f695f21b7754c2a7f0570755874 + src/funcs/organizationAuthConfigGetAuthMethods.ts: + id: ec0656b42b4d + last_write_checksum: sha1:70d0a3d85c06d94a77f2305f6862613c118325ac + pristine_git_object: d13b188a62c6192fdd9df36d06e736a68826ee03 + src/funcs/organizationAuthConfigSetUpAuthConfig.ts: + id: eed54920eaa8 + last_write_checksum: sha1:ba8fc967fe08c39f654776ce42c7adfa8a35b874 + pristine_git_object: f1d506e0c0fb36ed3332e17efc4654826fa30f55 + src/funcs/organizationAuthConfigUpdateAuthMethod.ts: + id: 7e8c8d718bfb + last_write_checksum: sha1:f30e4b0bdd5d7de99eecb80927ace960e4022b92 + pristine_git_object: 24a82ecbd99773b5c1e7289f4e72449e5472154b + src/funcs/organizationsGetCurrentOrganization.ts: + id: 728de3a241b2 + last_write_checksum: sha1:13667f067dedff6bc820e87b22309ecb856cfa9d + pristine_git_object: 2db05cf0056158c00ec92dd17034435a1f806f4c + src/funcs/semanticSearchArchiveSearch.ts: + id: e2950ba46570 + last_write_checksum: sha1:12993d22e8c531f1eddbe749020b04987f2eb2cf + pristine_git_object: 68e9b6d44d6a88417c87c450d2c9be32c35ec7a2 + src/funcs/semanticSearchDeleteSearchById.ts: + id: 7fbe7189520c + last_write_checksum: sha1:27e48682392151a8f8e4003148a8d7916051604a + pristine_git_object: 2581dd142b6b4fd87143c7a2bcb8ccc22b7559fb + src/funcs/semanticSearchDeleteSearchHistory.ts: + id: 79c7e78f6c4f + last_write_checksum: sha1:149d6fa2cdc9847fd88826d9996bed66ad37c710 + pristine_git_object: a5c0f9b066fb7775b884fec64da2b763a25f8bb9 + src/funcs/semanticSearchGetSearchById.ts: + id: dbd90d26ebb7 + last_write_checksum: sha1:35e43fb5ba8bfc0a667e5ef65cdcc8859c8ee197 + pristine_git_object: 93542aa1368306acd12b051dad062c96dd8db1ef + src/funcs/semanticSearchSearch.ts: + id: 09b4d786592c + last_write_checksum: sha1:b2e82e35859fe7124b8724e9a0266dd230bcd665 + pristine_git_object: b7b097be508aa5a6561d9146296e22c2f4617543 + src/funcs/semanticSearchSearchHistory.ts: + id: 1279c625134e + last_write_checksum: sha1:21e78752b0f78533cfdabe7acf9cb4e15f6bbd32 + pristine_git_object: c2d9fb2e4631d65975674a60d1aa31c350aa94ea + src/funcs/semanticSearchUnarchiveSearch.ts: + id: 1696f1859254 + last_write_checksum: sha1:6425337a102f611017566dcabcba8b06f1c2198c + pristine_git_object: bd8cffec9fdc1a2e2d5067c4875fcc818255ac00 + src/funcs/userAccountAuthenticate.ts: + id: 525ae6b33c95 + last_write_checksum: sha1:b5d54432859a9bd8bc9cd8dbcb1225f1a114db41 + pristine_git_object: f56d1ce2e490407726e4477dd0b4adb9483cbac6 + src/funcs/userAccountInitAuth.ts: + id: 5b82a1f44a81 + last_write_checksum: sha1:5e1805165cc7d3a6ef49a53624985fcacb9039bc + pristine_git_object: 423b865a1fbe28e33a6c5352e257e623a45a75a9 + src/funcs/userAccountRefreshToken.ts: + id: 2a115cbb8d69 + last_write_checksum: sha1:c5dca19379c313ab1cc65baaed95f8cc51f3cf6d + pristine_git_object: 9aefdda0d1856f7a7f2a901698d1305d52f23ac9 + src/funcs/userAccountResetPassword.ts: + id: 5ad1023036f2 + last_write_checksum: sha1:0c8a9a8fe57620e9622a77b351b84fddfa4bbf31 + pristine_git_object: c9893a482780a1f9b22d6fe64bb2339032bb7516 + src/funcs/webSearchGetWebSearchProviders.ts: + id: 7e105ac8f0b3 + last_write_checksum: sha1:40946bbf8c74708608f0f22aa1699ae914122246 + pristine_git_object: cf055c9730aa40ad2a19d85cc9de82b281158fd6 + src/hooks/clientcredentials.ts: + id: 81c2e30380d8 + last_write_checksum: sha1:1525b7f66823df8454ec9a0bddd1f07437dd09af + pristine_git_object: 10cc591a4564f55be0d36bee36247a97fdb3372a + src/hooks/hooks.ts: + id: a2463fc6f69b + last_write_checksum: sha1:1d5dbdbbe04da8c557afa5ab01fbb2409457921e + pristine_git_object: 4ef4e97f0af025a4d0b04e8704659d6df823b19a + src/hooks/oauth2scopes.ts: + id: a709b8ce2ddb + last_write_checksum: sha1:136d857157481205f108c681d67309fdce2fc49a + pristine_git_object: 3db7a333068b56875e5f764874238247528d0fb3 + src/hooks/types.ts: + id: 2a02d86ec24f + last_write_checksum: sha1:27a3444c4839bec58ae89820fd8c2483edafc3f4 + pristine_git_object: 9c36bf01332084f735909a71036c3544cc4c7e3a + src/landing-page.ts: + id: ef64a6ee46d7 + last_write_checksum: sha1:feba2617094768780692da17f3edb2cea74afd12 + pristine_git_object: fd08517b103eaee189986cf2b4671b897be53364 + src/lib/base64.ts: + id: "598522066688" + last_write_checksum: sha1:e9f04a037018040361043104960982f7c22db52d + pristine_git_object: d4bd8b341290e7a828a171d840bd0b0fff7c7cd7 + src/lib/config.ts: + id: 320761608fb3 + last_write_checksum: sha1:3ffb1e06cf07107921d913adb1d480c76968eeab + pristine_git_object: 2090e330cbfb0c68405f800c7e048df9826ae93a + src/lib/dlv.ts: + id: b1988214835a + last_write_checksum: sha1:1dd3e3fbb4550c4bf31f5ef997faff355d6f3250 + pristine_git_object: e81091f5e536f82739f71379b1fddc2d147c49e2 + src/lib/encodings.ts: + id: 3bd8ead98afd + last_write_checksum: sha1:c042529292568e18a69a04c1be7e18588ccd3821 + pristine_git_object: 4495783e008be951066aee565964077cac1321d7 + src/lib/files.ts: + id: e5efa54fcb95 + last_write_checksum: sha1:d0f325f445b8d22e7d73baf052c585ec2dd24841 + pristine_git_object: 0344cd046d033f9e8a55de02f7935c5cec5dc30b + src/lib/http.ts: + id: 63a80782d37e + last_write_checksum: sha1:797cbf16d3c7c4d62d3ba0eedb08617524938457 + pristine_git_object: 13cf1fd7894a89f727b8d2db2ad24313a94f68c7 + src/lib/is-plain-object.ts: + id: b9862591096a + last_write_checksum: sha1:df687f25a9590b6fd95d39df41a652ae3fd4e517 + pristine_git_object: 61070d3d7c7e5e95b1ed7e7ea21869eb0767db77 + src/lib/logger.ts: + id: 7ee7741a02bf + last_write_checksum: sha1:0ec9d3a2a34c362746b767e4f9a746c055d57a7b + pristine_git_object: d181f2937d4128afbe9b0327e0f81d1fa9c877b7 + src/lib/oauth2-sessions.ts: + id: 537b7294cec0 + last_write_checksum: sha1:5dd800929f75f5006fcbaba031a0c21e5f9d9ee9 + pristine_git_object: 932c170f5c0ab5d76cf789838bd3fe8cba33ba44 + src/lib/primitives.ts: + id: 74859f750b28 + last_write_checksum: sha1:d5fbb4e2feef5747fc8071046bdd4122c87bd066 + pristine_git_object: 668ab9d500d77bee730a619c5fda4a1d3cd1d16c + src/lib/result.ts: + id: ab7a4c1c4c71 + last_write_checksum: sha1:d24994d58f37a1ca106847fcc6d2e976c6f1c093 + pristine_git_object: ccbe51eac69dfb0da5131f14fd753c4b47c1d527 + src/lib/retries.ts: + id: b24a69d15639 + last_write_checksum: sha1:f3da74dffcbe2756c69393f8600205aa1dc06e68 + pristine_git_object: e3ce9aba72150fc3c18f3105d39b21aba809377b + src/lib/schemas.ts: + id: deb4b531fae1 + last_write_checksum: sha1:7c7ba40781682f6d44bb585b5016e2527b52660e + pristine_git_object: 542d9972403c5bc4aa70619f8c4b0af3ef2ce679 + src/lib/sdks.ts: + id: 8a6d91f1218d + last_write_checksum: sha1:2be2abf6cc046a8de887e87f2423fc3f1455726d + pristine_git_object: 366041fbd9443cdbe0eb258b5f4bee8d594dd6e4 + src/lib/security.ts: + id: 0502afa7922e + last_write_checksum: sha1:7103f389e68fc00eeaf275af139cd9dcf3625e10 + pristine_git_object: 5226c7d1cff6a6937553a044082ba9d880e8f307 + src/lib/url.ts: + id: b0057e24ed76 + last_write_checksum: sha1:9550819577dc1e514e61496167aefcc137238aaf + pristine_git_object: 6bc6356e222c4f2c20fda5616e00be6dadfa80f8 + src/mcp-server/build.mts: + id: f7a2ed2de4d7 + last_write_checksum: sha1:9f98fe2b333bd6211cfffa008a9b6ee95d523596 + pristine_git_object: e8114fbaed6521c628b7cf58a22cdb65e61a5483 + src/mcp-server/cli.ts: + id: 4ade0ef98b00 + last_write_checksum: sha1:7331efddde881832342fa8779d23be7445d4480c + pristine_git_object: b878d8de9f2a0275c3cdbfdcaed48a31092e558a + src/mcp-server/cli/serve/command.ts: + id: 7cd4394c80e8 + last_write_checksum: sha1:3031e44621ca7bf190e1c5bf040f66b4963a4cb8 + pristine_git_object: 09e5f6d6dca681df04287f137ca6b24c07090ee7 + src/mcp-server/cli/serve/impl.ts: + id: 03e83f226068 + last_write_checksum: sha1:73ded4a95afa2339acb283a7a5d24213d693ae2a + pristine_git_object: 0e470e850c3397c3efb76fce2435af77ebed6eed + src/mcp-server/cli/start/command.ts: + id: b3e53408ccb4 + last_write_checksum: sha1:f550f86c1435ba78f61b445355bdce18be5ce918 + pristine_git_object: 9d7e33321ec9b23f1f974bdcbefd419fc3cee11b + src/mcp-server/cli/start/impl.ts: + id: 37494f674015 + last_write_checksum: sha1:6d6773224857f4de63ffa562bbeee4d81cf1209f + pristine_git_object: 7cc9f572adbdcecfd091018da32beb78a2ad17a9 + src/mcp-server/console-logger.ts: + id: 57aff4ff2e15 + last_write_checksum: sha1:0c4b9b7c79ad0a81359210cb31b9ee4d887d5de1 + pristine_git_object: 640bca96dc5acf142b0a25dedad7ffb5d55c6375 + src/mcp-server/extensions.ts: + id: 3d9d20ff158f + last_write_checksum: sha1:27de1e2b8aaedc8965d1d4c4d4c500df1f28b483 + pristine_git_object: 78394e413ea070824f370b829eaf1416883e6680 + src/mcp-server/flags.ts: + id: 0167e624a516 + last_write_checksum: sha1:27d2feecb6e92b9c2a339c84cb2148b897b31518 + pristine_git_object: f737eda058b75bc6316cf34e53f59228cdf8b11e + src/mcp-server/mcp-server.ts: + id: aabbc4ab07c1 + last_write_checksum: sha1:6d4719e3e2a858d323dd23b113461625af60962a + pristine_git_object: 5cbc4d82567cd17b91a0f3ed3d944b448523c69a + src/mcp-server/prompts.ts: + id: 26f3d73cbf31 + last_write_checksum: sha1:d5928503611775dde2dcc5272e35f8065b35b920 + pristine_git_object: 0015bbdb54db3b96cf3675411f178e98d0fad24a + src/mcp-server/resources.ts: + id: cb0c57ebeaea + last_write_checksum: sha1:13dc124e896d588f80a3711f4e32fc170416552e + pristine_git_object: 274007f7a6302322ad131a30d3a8658973bcb319 + src/mcp-server/scopes.ts: + id: 8966d24256b2 + last_write_checksum: sha1:77d0eb95785e84f9fd0b27c4612f8c6470489fe4 + pristine_git_object: c25696d4c4f70e081fa5d87ad6891874c509a577 + src/mcp-server/server.ts: + id: 2784dd48e82a + last_write_checksum: sha1:89824ed35bd8c2d20b6b779bc3c9da5b708281cb + pristine_git_object: 3997c012f49f4958d5cf18b4a0c16af3b1f3906c + src/mcp-server/shared.ts: + id: 074e80d4be1e + last_write_checksum: sha1:19c9034032819a14f15c430de4350c8aba99d725 + pristine_git_object: bb74a74788ebd7d11262f5f63b8fdd29ab817f48 + src/mcp-server/tools.ts: + id: 654d5d1f2062 + last_write_checksum: sha1:a4ae788372d76413210a7d432ada667ad9facce4 + pristine_git_object: bab4c12462985b4060936acdbadbfd91fd02ba45 + src/mcp-server/tools/agentsArchiveAgentConversation.ts: + id: 24b3f441da10 + last_write_checksum: sha1:28a6127893e55fd41f6e7df709ac04f5615a3524 + pristine_git_object: 47a23af19a9079a7ca5a5af83c23ccaf36b6616b + src/mcp-server/tools/agentsCreateAgent.ts: + id: 7b9bdb384e17 + last_write_checksum: sha1:635a1c5e836d7784cbd7db84038d2ab2fb1121fc + pristine_git_object: d89a1ddbc2f5ef2a8018c67f73f89305d36cd161 + src/mcp-server/tools/agentsDeleteAgent.ts: + id: abcc61a0fe56 + last_write_checksum: sha1:4774784c9a6b116a74ed35fa6fcee458b2e69abc + pristine_git_object: 7b80de876a7a54f3e02215f234340f3576f87e26 + src/mcp-server/tools/agentsDeleteAgentConversationById.ts: + id: 4bc32cfcbd49 + last_write_checksum: sha1:917c51bc97da0c1ea28fec5fc9102f6d95d16849 + pristine_git_object: 28d9310f6527bb823da536b7dab8e1ec9f5a4dc3 + src/mcp-server/tools/agentsDeleteAgentConversationChatAttachment.ts: + id: a0a47c5a65a8 + last_write_checksum: sha1:f8dffaaa5cca570ea30dd9af3bf8b278d4f8f33d + pristine_git_object: 81c8d2be336edfaf512bd173b6048578a97ffbbf + src/mcp-server/tools/agentsGetAgent.ts: + id: 8a5dbb8aa49f + last_write_checksum: sha1:42e346ce9964adc93a68f197ae1b3f2895f3b9c8 + pristine_git_object: e8ca5b14f9dcc0f4d501b65d5ea83485a51651f6 + src/mcp-server/tools/agentsGetAgentConversationById.ts: + id: 381e60fb3ef7 + last_write_checksum: sha1:b3110025b1eee9edf6e9f5f814933441229ebbce + pristine_git_object: f112b70e7cd1fd9470bf6fdbac1661cdf1614e0b + src/mcp-server/tools/agentsListAgentArchivedConversationsGrouped.ts: + id: 3fa12526d130 + last_write_checksum: sha1:bfe05bcea38c1de435e3b7e2d853ca0fd2f9c140 + pristine_git_object: 68dcf7abaa10d779ba08f200544f14750117f488 + src/mcp-server/tools/agentsListAgentConversationArchives.ts: + id: d5923d4cdea0 + last_write_checksum: sha1:2e03fa2de57f810aeca3b98b1b74d63b283d50b5 + pristine_git_object: 6633b4d5e4068e3760a22781027d6d76257900c3 + src/mcp-server/tools/agentsListAgentConversations.ts: + id: c41900371810 + last_write_checksum: sha1:db98d350b5faae4a35aac1013867c5ba4799998c + pristine_git_object: c18abe4924961992b6089596b9cccb3ead550a9e + src/mcp-server/tools/agentsListAgents.ts: + id: 0700e8a407b3 + last_write_checksum: sha1:50801cacd44e3d33d8f3e79a2a7927bfbe937b92 + pristine_git_object: b2645a675c540eeed5b8600dc5112c9ae5d11230 + src/mcp-server/tools/agentsUnarchiveAgentConversation.ts: + id: f2a08518ee4a + last_write_checksum: sha1:86f01fa212462fd28dd348474eca8bcdf7b86e59 + pristine_git_object: 7f84d1995a7d6910e8f34cebaf479654c6fdf44b + src/mcp-server/tools/agentsUpdateAgent.ts: + id: 07665bd4555d + last_write_checksum: sha1:a7f4df1308f0c7f59aa2d6e53c7f858ffd71ee09 + pristine_git_object: e6c4e6a22ca3d9cca567698282941491378a8c39 + src/mcp-server/tools/agentsUpdateAgentConversationMessageFeedback.ts: + id: f6fbe0ee8910 + last_write_checksum: sha1:22ed2ed476d751a6c2ef24b092e3135d82a9e060 + pristine_git_object: 6fb0f07a180526ef57ebe70ebf7acefac957fa34 + src/mcp-server/tools/agentsUpdateAgentConversationTitle.ts: + id: 7948e39bd1a1 + last_write_checksum: sha1:bdbf1ab822944b713bd889875ab7e731304e3e17 + pristine_git_object: 58a0ca8847771dda9b319412da3d019c7f5f6bc4 + src/mcp-server/tools/agentsUploadAgentConversationChatAttachments.ts: + id: d34681ad1e32 + last_write_checksum: sha1:ad4d0f80fd977c8590130f1a062e291b11f2294f + pristine_git_object: cdad22433f3f29d012ca333d43fe6c9c6ef75af0 + src/mcp-server/tools/aiModelsProvidersGetAvailableModelsByType.ts: + id: 40bdbd5fd524 + last_write_checksum: sha1:0c1e6806a4eacb35d1b89d5df56ea0b62d0a6e98 + pristine_git_object: 17bf0a95b1c95e12e22e315772f8d50dba97fe24 + src/mcp-server/tools/conversationsArchiveConversation.ts: + id: 8af946c55925 + last_write_checksum: sha1:7fbfa667cab6d84c570a7b0f67bea91a98ba4150 + pristine_git_object: 4a39aec991e9f1938fe8eae472274a3b40735220 + src/mcp-server/tools/conversationsDeleteConversationById.ts: + id: b3c6fa95ea0c + last_write_checksum: sha1:a439caf57811e9889c7a5c821f733935cbd7b2cc + pristine_git_object: f8c730ddc244e8156112abc06b924e15595fe3bc + src/mcp-server/tools/conversationsGetAllConversations.ts: + id: 568cb375fdd6 + last_write_checksum: sha1:17c0b23154e03239b731b1042fc10612052f42b3 + pristine_git_object: f7999ac737866512b77a5970ca8fefeed0759d5d + src/mcp-server/tools/conversationsGetArchivedConversations.ts: + id: 2b18f494671e + last_write_checksum: sha1:65cb5144b66f7d92aee71245be481ef0c22472a1 + pristine_git_object: b9bfa649a71b59ee638c3917f91bd92b34979fa3 + src/mcp-server/tools/conversationsGetConversationById.ts: + id: 6bd21dfde7ba + last_write_checksum: sha1:d8a9a190c27fc1eca547762d8e29f4abeab83df8 + pristine_git_object: 6443752590714b86b96d883d2f73fab911212ae3 + src/mcp-server/tools/conversationsSearchArchivedConversations.ts: + id: c1279da05bbb + last_write_checksum: sha1:6a52544b506f725c666a3804de9055b14a64ebcd + pristine_git_object: 8ee5d68354d396789ce93e3af8fc0ed18aedcbd6 + src/mcp-server/tools/conversationsUnarchiveConversation.ts: + id: 9cbf3cec8afc + last_write_checksum: sha1:74898ae2f6984f6ca05d1e109768ee6e5a3919f9 + pristine_git_object: f97bfda3958c0b87e32e8397e1e6328f263bf5ad + src/mcp-server/tools/conversationsUpdateConversationTitle.ts: + id: 8d740a6c2d90 + last_write_checksum: sha1:15bf99ebbb1a59b0af384d66e1555a7b7be10634 + pristine_git_object: 651be953b6b95ef26a1bb5e9521da8963a9f3d84 + src/mcp-server/tools/conversationsUpdateMessageFeedback.ts: + id: f0f5da731e0c + last_write_checksum: sha1:5994df33e567cdbda8d258f957fd0c11bd5186fe + pristine_git_object: 49e56e2816f6fa69d431144bdcc68030523e08be + src/mcp-server/tools/knowledgeHubGetKnowledgeHubChildNodes.ts: + id: 476bdaa74004 + last_write_checksum: sha1:c7a17b7fc57147ea56e7f656f04b250c64d0aa88 + pristine_git_object: 06e4713a2c6a5b7720ad7c6df55cb3710eb29a8b + src/mcp-server/tools/knowledgeHubGetKnowledgeHubRootNodes.ts: + id: 66aa0a90acf3 + last_write_checksum: sha1:ec8c6aaa43f02755e727b31dc24f5f33a1af2940 + pristine_git_object: fa2cfe5a371cce3af35a51871668aea99d087e48 + src/mcp-server/tools/oAuthAppsActivateOAuthApp.ts: + id: 71a867ada09d + last_write_checksum: sha1:1e2f21805e2b4c19b279bef86e56ca6045d44b32 + pristine_git_object: dff8e8221c06862e600b257de369a8a0dc1b5eba + src/mcp-server/tools/oAuthAppsCreateOAuthApp.ts: + id: 84d9e1e07c15 + last_write_checksum: sha1:228507e01f9fa27514d97ff4599a3449f197d680 + pristine_git_object: 579d01eacbc101e2da15ac1303709099f8560e26 + src/mcp-server/tools/oAuthAppsDeleteOAuthApp.ts: + id: 1d817ec0b47d + last_write_checksum: sha1:45e9e9bd8b6075f09b53e1c3398bbb1fbd02db3b + pristine_git_object: 5dfce3ecf704d784d013f2df592ac9d00737fa85 + src/mcp-server/tools/oAuthAppsGetOAuthApp.ts: + id: 5d6719396382 + last_write_checksum: sha1:e60bdcd016f3afa4a08adae676b80ac37fddc6cd + pristine_git_object: 062652adc66e129e52b6e04cf244fc493f03e51e + src/mcp-server/tools/oAuthAppsListOAuthAppTokens.ts: + id: 940551f153ad + last_write_checksum: sha1:d4e1df3d1abdb7b9b0951816d42f6e178c328989 + pristine_git_object: 655dfddf329c9a940236822a48581f38d2372d9c + src/mcp-server/tools/oAuthAppsListOAuthApps.ts: + id: aa9c06e741a4 + last_write_checksum: sha1:38ef592bd17722cf86fb015585f07a88d450bb13 + pristine_git_object: 5e7bcf8b95355285c4e0a799eba23c17afebf497 + src/mcp-server/tools/oAuthAppsListOAuthScopes.ts: + id: fbdeedda8ace + last_write_checksum: sha1:3624d8a294e2dd7358a5db5641a30e160642b92a + pristine_git_object: e6a35b30487a4feaa5445260003995f75e7fcb7a + src/mcp-server/tools/oAuthAppsRegenerateOAuthAppSecret.ts: + id: e4d0e4141f3a + last_write_checksum: sha1:1bb07e54a0cd97944b71bdbcde2e7a4014d19ecd + pristine_git_object: 4b553fbbabacb200f8d6a07b18be2616354afa14 + src/mcp-server/tools/oAuthAppsRevokeAllOAuthAppTokens.ts: + id: edb51cf4bc9c + last_write_checksum: sha1:454239fba664c3d016dbb57bccc99e38c4714546 + pristine_git_object: 4f9ee7220d62ecce45b58211ea4abd13664e85e0 + src/mcp-server/tools/oAuthAppsSuspendOAuthApp.ts: + id: bac747071f08 + last_write_checksum: sha1:479a7c8530c2a191c6db3cd22b740d96f5efaaf6 + pristine_git_object: b5e21755469d93a01803c503d7511d0cf1c2230d + src/mcp-server/tools/oAuthAppsUpdateOAuthApp.ts: + id: d541d2849fd8 + last_write_checksum: sha1:9ce7aa55eeb1833de645448de51752d6327b8a00 + pristine_git_object: 2d44c5cbf267b2132f467165e4915d7c1404812b + src/mcp-server/tools/oAuthProviderOauthIntrospect.ts: + id: 70ee059e8af6 + last_write_checksum: sha1:d4be6768c982e493e760cdc384fea0e7fd8a0def + pristine_git_object: dbd12b535a88666e262fa129a72d95b1dc2e35b7 + src/mcp-server/tools/oAuthProviderOauthRevoke.ts: + id: 8f344f57f6a4 + last_write_checksum: sha1:1a0fd625303b185dde12f99ab268d65fedd06193 + pristine_git_object: e8b16fdfaa761a798b412c18d54d74053912e58c + src/mcp-server/tools/oAuthProviderOauthToken.ts: + id: 8a8f4358900d + last_write_checksum: sha1:eba5e3db4d6a25d1f138ff14f9533ffc8e01bae1 + pristine_git_object: e6bb932c0434e947d1ae05b0cd52e9eff4cb44ab + src/mcp-server/tools/openIDConnectOauthUserInfo.ts: + id: b7e944dd6f2a + last_write_checksum: sha1:c2c31cd3aa375da1c7f6c0d1672b125a165d142c + pristine_git_object: 785b94b0002301f88c625a7e06a9f7a81b860931 + src/mcp-server/tools/organizationAuthConfigGetAuthMethods.ts: + id: 446f203c2b7c + last_write_checksum: sha1:5da0383744c2e10f62759657b322ffab3c149f1b + pristine_git_object: f93975d6bbeb88c1e6c7ff9182f37b09daa45026 + src/mcp-server/tools/organizationAuthConfigSetUpAuthConfig.ts: + id: e5e87bafa9e5 + last_write_checksum: sha1:ddb6ff86bb2ea99a2126c62bc695d4115ec5868e + pristine_git_object: 337eb554d14d5f6f38ba496e24b8f907ad6cffb9 + src/mcp-server/tools/organizationAuthConfigUpdateAuthMethod.ts: + id: 5020809158f8 + last_write_checksum: sha1:d28119cbfd6b34787bfc1de121ec6bc646cba138 + pristine_git_object: 1aad32fee03815be560a4585eeb3586654a0be1f + src/mcp-server/tools/organizationsGetCurrentOrganization.ts: + id: b8925eee8466 + last_write_checksum: sha1:f1d3d59b2049a897d9a4c5860ecc6f41a772e3ec + pristine_git_object: 65dddd5c3dde2f4efcfb847542244225d8861bf8 + src/mcp-server/tools/semanticSearchArchiveSearch.ts: + id: aeeea2912ed6 + last_write_checksum: sha1:6e28826379d97986b55a466f5a7612678a266667 + pristine_git_object: ecbf79a03c8f77c72c97937488345ead149f1910 + src/mcp-server/tools/semanticSearchDeleteSearchById.ts: + id: b2f0adc86c8b + last_write_checksum: sha1:05def85f759396b4fe3813c71e31c21e41162e10 + pristine_git_object: c4edcd8d8093aa2a04e009bb906a7a9df18a085a + src/mcp-server/tools/semanticSearchDeleteSearchHistory.ts: + id: 45c758bafa40 + last_write_checksum: sha1:f79252af6717a0da37de6cc61a153e663627155c + pristine_git_object: 338dd6b94ae1a3e312a9dee7f1a6f34c9b4cf882 + src/mcp-server/tools/semanticSearchGetSearchById.ts: + id: ba264708e59b + last_write_checksum: sha1:1bf91aedfad4c79ec8091798facdf3945b269339 + pristine_git_object: 28785de16ed9c5fe8b2afe8283f8653a0bf8c47d + src/mcp-server/tools/semanticSearchSearch.ts: + id: 25bdc6dae0f0 + last_write_checksum: sha1:e3f539eb537e3aaa4b473e96712470374b4eeaa3 + pristine_git_object: 5cb6560060fa257d17762f5b0a1a578f1a16e82f + src/mcp-server/tools/semanticSearchSearchHistory.ts: + id: d1ae96cf1552 + last_write_checksum: sha1:f48d8496f9ad9d3b1590047a33368fee6e6378d2 + pristine_git_object: 91f7b769ba0d8854fc8012fa8c3bcf0c30db8432 + src/mcp-server/tools/semanticSearchUnarchiveSearch.ts: + id: 7c5bb33fc698 + last_write_checksum: sha1:59abe1276476bed0d7c5499624bfad98b33cf045 + pristine_git_object: f72fcf608fde863f1fef6eeb81a03100d43178ab + src/mcp-server/tools/userAccountAuthenticate.ts: + id: 62847d82c5cc + last_write_checksum: sha1:5a8338b06f47b6f61655a3b33e7d404b2d00a6aa + pristine_git_object: c30c747aee54dcd9f9f392873850f79796000016 + src/mcp-server/tools/userAccountInitAuth.ts: + id: 61c20ffd2656 + last_write_checksum: sha1:0055d93a8117e1e9799ce8127ffaf5fee0473f2c + pristine_git_object: 4c6895a71f2c9efb045b4bc897013246046257bd + src/mcp-server/tools/userAccountResetPassword.ts: + id: 22a77b3f811a + last_write_checksum: sha1:3ab7a8531565944a23249e4199cd3a9e34dde7ef + pristine_git_object: d123b175ed7e9f456eadf238740ae699fc778fe9 + src/mcp-server/tools/webSearchGetWebSearchProviders.ts: + id: 44a9167af943 + last_write_checksum: sha1:cce7dcb2acbd18ef68bb98941b39043b1916b14f + pristine_git_object: 9ace1c135668896dc0aaebdc6c9182c8a904bec8 + src/models/activateoauthappop.ts: + id: d074f0000588 + last_write_checksum: sha1:003a5689ddb8f8ce260d08c7d68f09ad36343216 + pristine_git_object: e78dfaa973e7b40bcbbf6bbaa2760ab5c154f427 + src/models/activateoauthappresponse.ts: + id: 50695c2cae16 + last_write_checksum: sha1:504ccf12e388b7935baf8fe8ba0185b21c9bbc35 + pristine_git_object: 804894bd27884375145f0b5ffaa67e72c68d3158 + src/models/address.ts: + id: 9aaa1acc6c0b + last_write_checksum: sha1:0b9f5094653af6a6cf141e33b4b9c5d615224f53 + pristine_git_object: cbeaacb8bb6786c604040a5cef5dfa9193382c12 + src/models/agent.ts: + id: a498b7c4ee51 + last_write_checksum: sha1:aef511af5dbe7bf4713dc291842113b1a42c4416 + pristine_git_object: 058c33b74b95a90d2d81201af9c6251c40960364 + src/models/agentarchivedconversationgroup.ts: + id: 2006ac452e4b + last_write_checksum: sha1:c48287e48fb0c8f431081fe4699fd3daa99ec8f1 + pristine_git_object: a6a2106c6fefbb142db6144615bcc4b3bb58fb5f + src/models/agentarchivedconversationlistresponse.ts: + id: d65161b7a47a + last_write_checksum: sha1:cefb7d5be79b1594e2c77e1c26762d1950f55776 + pristine_git_object: 7109f0eecc75603e2b3b36758e3f58c17640324e + src/models/agentarchivedconversationsummary.ts: + id: 29a1daa5cd51 + last_write_checksum: sha1:b9ea61c92044dd6e8f962061f0b2cc855e2bfa4d + pristine_git_object: b98807365a15a92b7fc6004008418dbad8ef64d7 + src/models/agentarchivedgroupsresponse.ts: + id: 2d3c37f70211 + last_write_checksum: sha1:468adeb6989da25abfa2fcb05b9f04a12f1ef135 + pristine_git_object: fea0ca22eb66cee16c3c2822e4d761f4d3941535 + src/models/agentconversationarchivemeta.ts: + id: d3c19cbbc989 + last_write_checksum: sha1:fc79e85d7974f24f80b82645116eee0e8fce12bb + pristine_git_object: 4ed68fb34066e5f488558c86fafd77b8b430fc23 + src/models/agentconversationarchiveresponse.ts: + id: efd70117747e + last_write_checksum: sha1:af0128c5140f3529fd26ec6ac31453fcb54f473f + pristine_git_object: 16f619e819acd178f24e6eb6974712a4f0f691b0 + src/models/agentconversationdeleteresponse.ts: + id: 4d18aac54229 + last_write_checksum: sha1:6140cf24261809dc90ee36d2fd75dab319216abf + pristine_git_object: fc98979217f83e5117e985dafb9784f17be5e1b3 + src/models/agentconversationdetail.ts: + id: 0792e5f96ea6 + last_write_checksum: sha1:b11e7e5d4745f586be0d978be200476c9ad07e37 + pristine_git_object: 79cf6dc971f4b85b445ae527c1da1ec84fd88fe9 + src/models/agentconversationdetailaccess.ts: + id: 54c5f20d3bc4 + last_write_checksum: sha1:beafee3a03f947e705e9a1f4fd0ae99b73b96988 + pristine_git_object: 16e4e229737bbd6e765bb41de6dbd2ccfb02e32d + src/models/agentconversationdetailmessage.ts: + id: d7e9138a8c62 + last_write_checksum: sha1:5663dd286f8ef895edd626b62b60af8450f794c7 + pristine_git_object: 1688afdbca9496cd090f4653dbed0becb8ea0df4 + src/models/agentconversationdetailmessagecitation.ts: + id: 98b9b6e7def7 + last_write_checksum: sha1:c5fbe44bde26d1c986664d60fafa5c76d5a330db + pristine_git_object: 502a3810bdd45e4763493940656684346474a385 + src/models/agentconversationdetailmeta.ts: + id: 864b73eba8fe + last_write_checksum: sha1:254133149dcf70a664d6451060a89a1125a86ae9 + pristine_git_object: 7459911fd379d46ec862a4fcb3921594a486eba6 + src/models/agentconversationdetailpagination.ts: + id: 1250ba52f8df + last_write_checksum: sha1:0944107c28e7d84200c4c96aea049a389acd1af4 + pristine_git_object: e135a972e3540cad121815aec87aa1c65a972f41 + src/models/agentconversationdetailresponse.ts: + id: f214785ceebc + last_write_checksum: sha1:f59cc352b435130991f8839ad47fbc9ab054a5aa + pristine_git_object: 32e24b69b397e0e28654c45e87f579e84be17135 + src/models/agentconversationlistitem.ts: + id: c8098c533a8b + last_write_checksum: sha1:3f2ff2bcf219b0304eed98863a265806e7adee83 + pristine_git_object: bf2b2ae18ae5bd7b54c0afb3ea88e82819d14a8d + src/models/agentconversationlistresponse.ts: + id: b0287ede0275 + last_write_checksum: sha1:df83e8ab9006a3b0aba2a63ea57db3746cea3d86 + pristine_git_object: 62c9cc07922bcaa1d45c8a668e260f58ab6de8d2 + src/models/agentconversationtitleupdateresponse.ts: + id: 75bc84fb27eb + last_write_checksum: sha1:95a33ea7fede971f5823ace63a4597d8e46d7d25 + pristine_git_object: b1821cac7e4c108f8f43eb8de24a4215aa139869 + src/models/agentconversationunarchivemeta.ts: + id: da62fd044765 + last_write_checksum: sha1:5d813cb2ac4fe1f9b7e879b22e4a3979caae6a79 + pristine_git_object: 3cbc6acecc1d3f3b05b9a7dd80bdc12e2bfdf94e + src/models/agentconversationunarchiveresponse.ts: + id: 56844f61e0e8 + last_write_checksum: sha1:e7d784beb139eea6e290e936664613ade54e8b93 + pristine_git_object: 45be71d37ec203fdf17cfb97c419c5c93f79f3d8 + src/models/agentcreateknowledge.ts: + id: f6b2c014e0cf + last_write_checksum: sha1:03819a1fbf13146c704fdcd1a7892a23da614787 + pristine_git_object: 353478bd1cd9819e9c7e36629648b15d8bbe080b + src/models/agentcreatemodelentryunion.ts: + id: 63cc9297f486 + last_write_checksum: sha1:2aedaf510b0abac913391a910092966f3e4aecb9 + pristine_git_object: 2497da725e01f9c932496f46f6eda5d643357f6f + src/models/agentcreaterequest.ts: + id: e5523b5d7754 + last_write_checksum: sha1:a0071f8bb164c08c04e54a49d9c393290544cadd + pristine_git_object: d9aa43408aa9c6696059ff252dcba91510f74bcd + src/models/agentcreateresponse.ts: + id: 4b869e490643 + last_write_checksum: sha1:be0637a527740d3578f4555be948722ae4d442e8 + pristine_git_object: abb608f77bc85f082bd4fa70a2413a986e0e064f + src/models/agentcreateresponseagent.ts: + id: 59f14762ddc5 + last_write_checksum: sha1:94ef7ea39974361ab271efd935a0d99b8a3a16c0 + pristine_git_object: c11680bcf98228e5ad3be17136b9a23f473e3c2d + src/models/agentcreateresponseknowledge.ts: + id: 0475b47b817b + last_write_checksum: sha1:b99888e513f507418fad8fc4ad3336895b28c3a9 + pristine_git_object: c924729c80fd75769099e135cbeda66f119c72db + src/models/agentcreateresponsetool.ts: + id: aea94d2e0e0e + last_write_checksum: sha1:faf810e4a862bbeade9cbc69e93693aa15137d15 + pristine_git_object: 7b90ff673cab6194bec7b977390dfc49c0cdf34a + src/models/agentcreateresponsetoolset.ts: + id: a89519745b82 + last_write_checksum: sha1:de514155f9292c0536d2bed67b3133be76cd6990 + pristine_git_object: c82427abeda25f9f631e133f7605dc471af87018 + src/models/agentcreatetoolref.ts: + id: ce68e4d08ca6 + last_write_checksum: sha1:9ee05586f4e7c9849a2b46bceeaf331ef4b7a300 + pristine_git_object: 6224e1a628b248111c8b9d04e488858c0963baf6 + src/models/agentcreatetoolset.ts: + id: 43875a2f3273 + last_write_checksum: sha1:24af0d53586ff78e2c913c96efadc603786318dc + pristine_git_object: 75f4715916dcff1c8b5613c96c6bc2cf2a57c505 + src/models/agentcreatetoolsetname.ts: + id: ddc855ad4315 + last_write_checksum: sha1:cbca9624847f78b2e7f77046cb789567331e700c + pristine_git_object: 1810b6651aa38b5c9a6d779775388fdbc8676a30 + src/models/agentcreatewarning.ts: + id: 7361f63f4996 + last_write_checksum: sha1:6f3998316cf54ed31a53b83543dde17c1c72340e + pristine_git_object: d670c453ed43cc4190d650b4b6a21459e11d5279 + src/models/agentcreatewebsearchunion.ts: + id: 21aa4bd5959a + last_write_checksum: sha1:abdfd04eab3448cdb469cbc1bb7ac1bce822a96e + pristine_git_object: 5d740c93985fcbf37366c2b7a10eba55ad51eac3 + src/models/agentdeleteresponse.ts: + id: 88e3a4e446be + last_write_checksum: sha1:9018ece7a03515bf3c0e94b321ebffb41a535f15 + pristine_git_object: 355113a6cf8a90a64bba271e597a38e0442837cf + src/models/agentknowledgefiltersparsed.ts: + id: 136bf2e50ba3 + last_write_checksum: sha1:953c424c1c75991e3120d7000b9a8baa2d620541 + pristine_git_object: f6b121b05fe5f442f121a71c6163759c02022047 + src/models/agentlistitem.ts: + id: d1887de28f55 + last_write_checksum: sha1:11b0c5c6743e1f783140f2cfa366b5ed47aa7ac2 + pristine_git_object: b953f7f469469daeb27c9945b8fde3ca7172a7f2 + src/models/agentlistpagination.ts: + id: e26fb70b5f7d + last_write_checksum: sha1:57429ea28734de096311b249eb956d908470b37d + pristine_git_object: b4b9e5fe2496dea214003f1710873665f60c3197 + src/models/agentlistresponse.ts: + id: 24dda80966bc + last_write_checksum: sha1:5aa28accfab3594c4c125aba5e5c38413da5c912 + pristine_git_object: 2b3a9689dacd0aace35110422e67dd3465883f29 + src/models/agentupdaterequest.ts: + id: c79d7d9b5d5f + last_write_checksum: sha1:9a2ea9169c2ee3fdb382c72414e61e0071785fef + pristine_git_object: 8f1eea124769e90a227157b3b70bfb3150d83036 + src/models/agentupdateresponse.ts: + id: 301e8fbcca9e + last_write_checksum: sha1:19c2e6c9801855d3976ec8e5ccfa5ddf61b52bb2 + pristine_git_object: 040b7597176078f607f36ebb17b079ec49b13d91 + src/models/applicationjsonerrorresponse.ts: + id: 74e3b27d0310 + last_write_checksum: sha1:c9148b4ded8b32bd292bdc33f471d97ef69378fb + pristine_git_object: b20d9e0f9aec47f954c2bd5c1a05d46f3cfb0ddc + src/models/appliedfilternode.ts: + id: e56f4fce94eb + last_write_checksum: sha1:53ae6811b5f5f9df35dda44557eda0591be41745 + pristine_git_object: a36f67327a0dcb5ed18607bc7ff9b69060df6949 + src/models/appliedfilters.ts: + id: 1cc4383a58e9 + last_write_checksum: sha1:43ec17fafd0362dc64c8fca7a0629719fd73cbd5 + pristine_git_object: dc16dc9c72dea7891bc733f4ef25a8daa23beb89 + src/models/archiveagentconversationop.ts: + id: e72158202a22 + last_write_checksum: sha1:2fc17fd6a119d82a16e8ab62230e27260609f9d6 + pristine_git_object: 922cc70dc9647ca51ff50cbe063c88a86eec1a83 + src/models/archiveconversationop.ts: + id: 4f43f75380fb + last_write_checksum: sha1:d7a1b6109f0841a1277f1f964f1b97cf5374c81e + pristine_git_object: c7a1b2f0f196e7e23dc54ceeade3eb639923ede9 + src/models/archivesearchop.ts: + id: c607e49bcf4c + last_write_checksum: sha1:28760b41f8854669786344bd52795449a66e3418 + pristine_git_object: 9003e3020ba37f9fc0cae61a4254f28fa76ffc1f + src/models/authconfig.ts: + id: e6f14abb1a21 + last_write_checksum: sha1:d48508792ad41e20a1718e8dc9242a608398278b + pristine_git_object: 4b54b8ff3a560f01372e1c1a1a71058ebe0c91d6 + src/models/authenticatedpasswordresetresponse.ts: + id: b28372a323e5 + last_write_checksum: sha1:757effaa81ac63a6093cf62925a031b053c8e690 + pristine_git_object: 9d55aecff486acf119e8155d2b369c9bfb918730 + src/models/authenticatefinalresponse.ts: + id: 9e4970437bf5 + last_write_checksum: sha1:b0ef2e5533fcf9373253eb0ab0a6990d5834faec + pristine_git_object: abaf5facca294da05b3b915ebaeec43d70f128bb + src/models/authenticatemultistepresponse.ts: + id: e8048ae76620 + last_write_checksum: sha1:95e2cbd4f8f0fe1f0c98f089a6d4b41b36f43768 + pristine_git_object: 1f3d85950bd08e5bcdd938a4ad2d41806b946d00 + src/models/authenticateop.ts: + id: 046ecd9c445b + last_write_checksum: sha1:dfaa80cdb4f4d1ee365f7d1132446e596c16ffcf + pristine_git_object: 6e7f85e55eb93dc23674829536cbdfaba032e844 + src/models/authenticaterequest.ts: + id: 391d5afaf3c9 + last_write_checksum: sha1:1f91e9a56a5a6b370f9809dc7bcf9934580e4c0f + pristine_git_object: 3ecf58a9746f9f8bd264a93dd857c891c8ec518d + src/models/authenticateresponse.ts: + id: 361fc24aee89 + last_write_checksum: sha1:ff011e16b6ee4dbe9d74a1f514914775c5a29c47 + pristine_git_object: ec9e1ca361877583916064202a59fe09aa821e48 + src/models/authmethod.ts: + id: 560607b378c6 + last_write_checksum: sha1:cc2ca9bf303a08517872b1abbd856315406b73ca + pristine_git_object: 2b35c8075431309c3b2ba625258d318cb21f85bf + src/models/authproviderazureadpublicconfig.ts: + id: fd4d3559dc91 + last_write_checksum: sha1:71570842a61f3f141d86c395f38df03ec03e02d4 + pristine_git_object: 704e938f3a75eb07314c2e0e5e77b9dcc1ef2c15 + src/models/authprovidergooglepublicconfig.ts: + id: 044b95e7c0b6 + last_write_checksum: sha1:034651955a79f08e896e8f8373583911ab5e2da9 + pristine_git_object: a187652f5ad3bb15db35fa2012863f84a3d5d8ee + src/models/authprovidermicrosoftpublicconfig.ts: + id: c02148f8c0fc + last_write_checksum: sha1:406b1a0c3bd7984588ee9c943cb4562d4cb0b482 + pristine_git_object: dd7e35b8bd65d7aebd2c3108770f31ed5f08f0dc + src/models/authprovideroauthpublicconfig.ts: + id: 9b275afb296d + last_write_checksum: sha1:590c8fe60955ebc32aab1561bb7779017236ac05 + pristine_git_object: 761a9c2f292dc24dc9cb7998a9748554dd549eaf + src/models/authproviders.ts: + id: 070d8a17e32e + last_write_checksum: sha1:128c638a8c3e4928d1941397610799533c74aca5 + pristine_git_object: 462dc86fd7aee7d9072d88b6a665ab7b25415458 + src/models/authstep.ts: + id: 113e5b2b56e3 + last_write_checksum: sha1:093b2651a9f783207f91a2a6c14b36f788797db7 + pristine_git_object: abebed001b72a803d93155115aac366d9c97bb83 + src/models/chatattachmentref.ts: + id: d11e552386d5 + last_write_checksum: sha1:e3efb0b303275e1eeccb78dde30cfdcbfd9a98e0 + pristine_git_object: d1667010051029748e2e9f165bd8302ce3545a52 + src/models/chatattachmentuploadref.ts: + id: d81d0846d00b + last_write_checksum: sha1:9af08ea31b449fc71c58b62c0258fb73019458b5 + pristine_git_object: bc43bde5ba7b0541461fc2a6efd4136bcdc6200b + src/models/chatattachmentuploadresponse.ts: + id: 8a301333bbf1 + last_write_checksum: sha1:d0308c70c6f38296de3d931b3a8c19f021ad6318 + pristine_git_object: b92e3b7cacd825c3f4d3a76a716db7491dc57037 + src/models/citation.ts: + id: 169ea9f8162f + last_write_checksum: sha1:c8abc668b07c3ff721737fbcefabca0d7edc210d + pristine_git_object: 6c02d8fed40ab7c5495405af2f6903679c71c87d + src/models/citationreference.ts: + id: 1d749448f24f + last_write_checksum: sha1:b7ef8d56f5ce5dc1af939e33b3d6e47342e0f131 + pristine_git_object: bdf47c058d5ee9d6ed295bd3bb30caa22f57b03d + src/models/conversationlistitem.ts: + id: 6bee92ad13d1 + last_write_checksum: sha1:7f9440df652ef10d577962772de5fd16d45c9b03 + pristine_git_object: 36c6b5f064502a19d831e79d9a87560388b06486 + src/models/conversationmodelinfo.ts: + id: 4e0a7fa81fb5 + last_write_checksum: sha1:dfe22a7218cfe0bed757f92a1148b006d70a9e34 + pristine_git_object: ef6e32b05cf4a711a44ac88fb9986621ebcf3455 + src/models/conversationtitleupdaterequest.ts: + id: ec67f91b7e04 + last_write_checksum: sha1:312a20600d31035cd25ace7d8f7dd4ebb6da5272 + pristine_git_object: 20644511eb0100f7a4b9ff2953ade6b469cb0826 + src/models/createoauthappop.ts: + id: ff9f36fe3da4 + last_write_checksum: sha1:45f71aa7acb6a5ad8fd8566d2fc96500e77e0bd1 + pristine_git_object: 0e4c3456cf13bf5247b147a33ab9458bf593cd03 + src/models/createoauthapprequest.ts: + id: 36877010f9c8 + last_write_checksum: sha1:9751550fde895a32d17ef7cb3742daa4abd20c22 + pristine_git_object: e95312f0e0db45ee379d132b5a89f74a53c883e0 + src/models/createoauthappresponse.ts: + id: 77670a264bb6 + last_write_checksum: sha1:25c80959bd610a7417327b77ba85636030534cf7 + pristine_git_object: bb86ef415cb3995ba93d3a8d42cc42b99d733c5a + src/models/deleteagentconversationbyidop.ts: + id: dc906a81feca + last_write_checksum: sha1:e3b084e24786ccd96ab035f6b7dcffdc43aebed0 + pristine_git_object: ad6cffa064e6d905a9d16b98df68ecceea72db7b + src/models/deleteagentconversationchatattachmentop.ts: + id: 8015fe0c151e + last_write_checksum: sha1:02b5a087a019b9d9cdd5dd7d41fe3819b61c84f1 + pristine_git_object: 61e51e9ca53e09347f0c052c624d071b6f3163e0 + src/models/deleteagentop.ts: + id: 83318a009553 + last_write_checksum: sha1:5deb597302c3b51c19197ea256750a95cda9fec2 + pristine_git_object: dbef96c923c74bad7b8536169880e7fdefe86db6 + src/models/deleteconversationbyidop.ts: + id: 0d09d2bcaec1 + last_write_checksum: sha1:6465a1d99e3d92c2e34e19bb489ab12e5ffcada3 + pristine_git_object: 34066ff6f6eb712c0b866456ac3a952ff3dcb7f0 + src/models/deleteoauthappop.ts: + id: ae6541ce05f3 + last_write_checksum: sha1:3a8f50367ce53e160bae31293d8b77ab9843d250 + pristine_git_object: 4b6b08c8bec29fff8e23a85d89ee02cf4d4ed240 + src/models/deletesearchbyidop.ts: + id: 984dd9c96b0e + last_write_checksum: sha1:53744c29d9f8525ab4935dc197a30d2c03f22a2d + pristine_git_object: 98972b76d854411c01cce78bb37652c0c2ac95d2 + src/models/deletesearchhistoryop.ts: + id: 4db6fc92c461 + last_write_checksum: sha1:d1bcefc57e5a1178e2befdbeea63e9af3186f225 + pristine_git_object: d4a101a643cb22133b120b5da0cf12be73fa8408 + src/models/errorresponse.ts: + id: 55a21b891851 + last_write_checksum: sha1:7449ffac102536f112c062d7f97e201667004df2 + pristine_git_object: 0ac3456b74188440c16d8c4305510554dbefbf1b + src/models/errors/apierror.ts: + id: e2280e075454 + last_write_checksum: sha1:1a4199dec47757c19b2e88dbd767d7f24ab9522a + pristine_git_object: 7e098c1187dbd81288c0d2cd8802dfff25a295bf + src/models/errors/httpclienterrors.ts: + id: 6948de76af99 + last_write_checksum: sha1:994ced121c54fecd0af038ccfb7855fbfd3868ec + pristine_git_object: b34f612124c797c2a1106b9735708f679a90b74f + src/models/errors/sdkvalidationerror.ts: + id: fb6b2b49c445 + last_write_checksum: sha1:ce8bb73a1243f8ea8fa3b71a181e586e29dd02c9 + pristine_git_object: 7749cf32c29ba2d44124253d9f07fbb1913b89f6 + src/models/filteroption.ts: + id: ce88ca2fe6dd + last_write_checksum: sha1:716aea6859d0cd77b4fedbaa6e50b95aae4807b1 + pristine_git_object: a71d20132744cc4f5c9df295f22202b78c754c28 + src/models/filters.ts: + id: c8e9eb666f76 + last_write_checksum: sha1:01f9c8d8ac3d4e918b6a4548c6fd6ad29b6c508d + pristine_git_object: cb0b9753af70bf6ceca382d071d882cfc1a0b951 + src/models/followupquestion.ts: + id: aa45231dd0a1 + last_write_checksum: sha1:1cbbbe3219f0e2cfd7e915a2684bae7bfe13fd47 + pristine_git_object: 56a958a62eb1d9bdbc71c6355ff329c158ce0e40 + src/models/getagentconversationbyidop.ts: + id: 9d3ca1f2c534 + last_write_checksum: sha1:304aa6abd0a72adb3ce3860e7d75e6b39c772588 + pristine_git_object: aa93abf4de8817a1bcb6b6c50ad119caaf4a38c0 + src/models/getagentop.ts: + id: 8f3ebbb08590 + last_write_checksum: sha1:79ef55ac86ed936e022816070727714772974624 + pristine_git_object: 13ae19cc49c6c47c830eade50e647906b57e5dc3 + src/models/getagentresponse.ts: + id: 365a9d8b8f93 + last_write_checksum: sha1:c49bde6f631293933261c25369daca1b386681b8 + pristine_git_object: 7249f405a4d8325d6031c008259350981e2f5257 + src/models/getallconversationsop.ts: + id: 3c7b6cfa2244 + last_write_checksum: sha1:7596a59b630c5aeff45782f0e2b784ac3af564b6 + pristine_git_object: fe06091d4db2a53d5fdfd36ad7b7131b320197f9 + src/models/getarchivedconversationsop.ts: + id: 8a2c2f0af52e + last_write_checksum: sha1:d3d0bda8cd39697c5c1a44bd96b3abb90aba0d76 + pristine_git_object: c0454dc668ef4315b3aaa1c75b7363281d466f49 + src/models/getauthmethodsop.ts: + id: 6d600e201136 + last_write_checksum: sha1:6a486e5c1f46669c837ea2b781f1d098ff554335 + pristine_git_object: 0da590b32c0d9bcb82334d4a6f7948391040232f + src/models/getavailablemodelsbytypeop.ts: + id: 18abdd3f2f20 + last_write_checksum: sha1:8f13972c4523ddf10361c364d2158dfcb78029e9 + pristine_git_object: b6d3e0fb4742182cfec8d2c089de2852fec673b6 + src/models/getconversationbyidop.ts: + id: 6f48af44b979 + last_write_checksum: sha1:b8e6c0c29488e111cc9286f62a8cc8a5497ff9c9 + pristine_git_object: 718414d749a84e36eec5eda136cf87e6a13b975e + src/models/getcurrentorganizationop.ts: + id: 1e6203447758 + last_write_checksum: sha1:cd734615db2b8493cb137bb3138e38cddbe0aca4 + pristine_git_object: 38bb55b610f1fc3412a6c7a23e03b7165d6327b4 + src/models/getknowledgehubchildnodesop.ts: + id: 6431121cb3d5 + last_write_checksum: sha1:1c10b2b8fc530ae214289767691ff938f923e721 + pristine_git_object: f97feaafa211ca47790340e97ea2baccea732714 + src/models/getknowledgehubrootnodesop.ts: + id: 0586209fc19d + last_write_checksum: sha1:cfaf6f796497770f4aee99104670235ad1f10082 + pristine_git_object: 173edca9a12044e1f9bdfba82db38f55ac634fd2 + src/models/getoauthappop.ts: + id: 64efe1b2483f + last_write_checksum: sha1:14fc27a9d5dceb2cb9f5a85c50ff40d710ff1ea2 + pristine_git_object: 2f38912e1fe6c3feffbe5c4d9170c999014e291f + src/models/getsearchbyidop.ts: + id: ee5bee831c0f + last_write_checksum: sha1:db49f97480dcf53dbac247914fe3cec5f994dd59 + pristine_git_object: 9ff5304179eab8d1367b1ac614167c280fcfaadc + src/models/getwebsearchprovidersop.ts: + id: 452d38fcad7a + last_write_checksum: sha1:4ba0fa1300d7924f978ed6b5de5b02a25d308ef3 + pristine_git_object: 7e5b59dd7cae71bc8977d214d5528f05bdb86dd0 + src/models/initauthop.ts: + id: 81a0bdfee39e + last_write_checksum: sha1:e00dcdd3116fd47514f7b05fd99bcb05b7e3966a + pristine_git_object: a041a23d0b26bfd56a0eeb985da13c83055d54ff + src/models/initauthrequest.ts: + id: c361de20123c + last_write_checksum: sha1:72244f19274262a5c1aa025393c32126cc8b65b5 + pristine_git_object: f53e9065527d0704fc07da47fa62bfb6f2446d41 + src/models/initauthresponse.ts: + id: 023d88ae55a9 + last_write_checksum: sha1:8419e90d9b78ee1067acf6b5cf0e5011a3e070ec + pristine_git_object: e2f8b33258e3326b0d6cd177e4bc981bcbf4a764 + src/models/knowledgehubnode.ts: + id: b38969e78a95 + last_write_checksum: sha1:fd7ed2e53fec84c17dda115f2f754d8e9b9c4555 + pristine_git_object: 04ac8044ad3c187a390c8c7bb1f9bcdf035e4cc9 + src/models/knowledgehubnodesresponse.ts: + id: b62397c1d3ab + last_write_checksum: sha1:ce827034d73de9c02229af7e66c3c74856d1aa57 + pristine_git_object: 629ab0cb0e423d2c6bce3b2a093bfdcc458d5685 + src/models/listagentarchivedconversationsgroupedop.ts: + id: b3fd4e65b2f7 + last_write_checksum: sha1:0ce6b03b058ff3f908d21dae3722c7cb293ff60c + pristine_git_object: 10e9940e437b0addfeee552f569cc74a0e323d7e + src/models/listagentconversationarchivesop.ts: + id: 43512aeb05e8 + last_write_checksum: sha1:b772bc5db8e3d0058444517bebe123e7972eecb5 + pristine_git_object: e4fc245167c4343a4d4297f116e9b382c1e04c9b + src/models/listagentconversationsop.ts: + id: 6d7dd98bcfd1 + last_write_checksum: sha1:90c537a747e41e5b1e49f8b042ab5bdbbb7ea0ac + pristine_git_object: f4db2ee2b863f938eb467d03f8ddc73cb0b9e09d + src/models/listagentsop.ts: + id: b471b1391bb4 + last_write_checksum: sha1:c721032a5aef86eaa268f16ab444895fa6664986 + pristine_git_object: a5af5044b62032fa8bfe065adb41cce1382c0ed8 + src/models/listoauthappsop.ts: + id: a0f94575ce7e + last_write_checksum: sha1:e46a995b030ab2ffe4447f809264e360cdb249a8 + pristine_git_object: ce41dbbbe74f0a03a674436d51885a32e6a6b0b2 + src/models/listoauthapptokensop.ts: + id: 04a5fab30224 + last_write_checksum: sha1:744e3652b7d485d1ed1fd2d8f5529732790f077c + pristine_git_object: 3e7d88b2849d6cb2741f70abc0505e4d932ac8a3 + src/models/listoauthscopesop.ts: + id: 9445ebd9a6dc + last_write_checksum: sha1:4ea837d06f9121a0ca59730de8defba819e2bc2f + pristine_git_object: acb1f5a01bdb6d3f0f0c557fd9f3ccf6cdde6017 + src/models/message.ts: + id: 34645e53d993 + last_write_checksum: sha1:ed4452cd4e6eafec22661dad0cb12a6ccf7c33e8 + pristine_git_object: 6f847a0d3a4edb55c1fea005fcdb495743037c4b + src/models/messagefeedback.ts: + id: b90c6ff4644a + last_write_checksum: sha1:975cc0d823a22c39c48ce68ee9842abcf9b0edfc + pristine_git_object: 9444766f2a1735f75618d90ffdfd89a8f6121454 + src/models/messagefeedbackappendentry.ts: + id: be276157f7cd + last_write_checksum: sha1:9c3e22b25939494f7c0acf0c3db4567079638c2c + pristine_git_object: 967d5ab81e3edc54db38c17ebea80ea7517f15e2 + src/models/messagefeedbackappendmetrics.ts: + id: 29d428396c95 + last_write_checksum: sha1:8ab0ffda917895f5fc3dac93e2f5be4b5addfd0f + pristine_git_object: d13609dd3fc4a337b0331394016da9d87b62218b + src/models/messagefeedbacksubmitrequest.ts: + id: 0a04f946c90b + last_write_checksum: sha1:3ae46e239334d84bc442fa35791398395324909c + pristine_git_object: aa24a89e119b292e5ab0a620aff0c83f5efbf0cb + src/models/messagefeedbackupdateresponse.ts: + id: a17f7525cea9 + last_write_checksum: sha1:f475bb1260ef4a04f0c49a386e8d19d35e5f5e2a + pristine_git_object: 97d3f131894cccac22b000367778cab7bc82cff2 + src/models/modeltype.ts: + id: 9b70d48515b1 + last_write_checksum: sha1:963383707f4be68d7d6205951aee186e2691a66b + pristine_git_object: 3fda29944cc57138425f08f961c3c8971f1ab080 + src/models/oauthapplistresponse.ts: + id: da4ab2912f3e + last_write_checksum: sha1:6985c5ff7f50991784292ca86181305f08eac282 + pristine_git_object: 412b4697f184a9f3041e9f1c506d01f4aaf2eaf1 + src/models/oauthappresponse.ts: + id: 76059951ea05 + last_write_checksum: sha1:fbc0d0270ca698fc167ff44c00f24073dd478367 + pristine_git_object: ac2951d94165c1a8d684bec50c2acb4d3bd0348c + src/models/oauthapptokenslistresponse.ts: + id: 7014d92bae13 + last_write_checksum: sha1:f30bb4f5e68a0b7fa829047c7686ed99cf8516a0 + pristine_git_object: 9c511108ae38c27e789a4b1c4a2d4c7723c94700 + src/models/oauthappwithsecret.ts: + id: f2379efbc80c + last_write_checksum: sha1:4edcc9811a1d684ce60a0f54fb75b457c9ec3d23 + pristine_git_object: 938b955c1850210682fbf7054186f0e7599a1fe4 + src/models/oauthclientmanagementratelimiterror.ts: + id: 04ce89e468a4 + last_write_checksum: sha1:0716fa9d2c89e654eefdbc1d024393b8d8c4e9d1 + pristine_git_object: 14714d0b077d596332c82fa7b77a7a1a4cb2a532 + src/models/oauthcredentials.ts: + id: 23c70140e155 + last_write_checksum: sha1:5986716f2b62a14518f6ccd45982b98ba0c99d96 + pristine_git_object: 856f40c332a06079cf4f316f956de68a43b9bc04 + src/models/oautherrorresponse.ts: + id: 2e54250dbb09 + last_write_checksum: sha1:b86f62edbf497c6925a82307c3b8f1b710ddf943 + pristine_git_object: 60ec7b1cc37c912d5d6645ba3b79d495967055c5 + src/models/oauthintrospectop.ts: + id: eac8517b9e1b + last_write_checksum: sha1:542b418f558aebb7d036b23e059b2cc4d0577fc2 + pristine_git_object: 8bf29183fe1b14f24ef72fabb1b32cbd91caa40e + src/models/oauthintrospectrequest.ts: + id: 68417e2f31ea + last_write_checksum: sha1:955e948c6bee19bf10c458315f1b41d905646190 + pristine_git_object: 723b0b46d94b9d628ace64ccf4c3475fbec9cb10 + src/models/oauthintrospectresponse.ts: + id: e35ade21d9e6 + last_write_checksum: sha1:5ff52752a53adc3368acf46ab0436f086b204b76 + pristine_git_object: 2d9a49ea9996d6d5a62de3c1baa463a55d11ab2b + src/models/oauthrevokeop.ts: + id: d3262a6ed990 + last_write_checksum: sha1:eb4c75592ecfc80480a92959ffd25d5e2a1f4bd8 + pristine_git_object: 01e749e9559a1b518128728cfa0fba0697023af7 + src/models/oauthrevokerequest.ts: + id: acbd6e37233c + last_write_checksum: sha1:bf35691ed44bd8ed99f420cf7b9de6dea577aa0f + pristine_git_object: ee54a91461310fc6826b0dc7f35472e58ac8074a + src/models/oauthscopeinfo.ts: + id: 83bdbc89f161 + last_write_checksum: sha1:70a6dfdc877a5f3247721ea5d5cccdfc6d96d0de + pristine_git_object: bb1326cd501ade02c6a696b5d68e26e047f732fd + src/models/oauthscopesgroupedresponse.ts: + id: e225d5494ed3 + last_write_checksum: sha1:1238bffbccf97bb60fe2e96cfcaace06f96742c4 + pristine_git_object: 3f0d901f33c43df8027157e9f3fcdd1149a1ab0b + src/models/oauthtokenlistitem.ts: + id: 4eca5b53f0ed + last_write_checksum: sha1:02d9e112bc3b431b6e24528d3b72568bad34725b + pristine_git_object: 1c20241ed4997b5830aa82c72fdede83e14109bd + src/models/oauthtokenop.ts: + id: a0f932395885 + last_write_checksum: sha1:971bdce53076149886e885b8568d09b6c8b0e822 + pristine_git_object: 05193b750e08686183322aca6aba97d5b91fee1e + src/models/oauthtokenrequest.ts: + id: bcd811841157 + last_write_checksum: sha1:ae296a067fec4c0167cfe3b1cd5aab4c99ec366b + pristine_git_object: c07f83a69f9ef6aa9157b0a4a077533d2419bdcb + src/models/oauthtokenresponse.ts: + id: 432d43162b3c + last_write_checksum: sha1:ff208a4ff0fa1706592a8e2f49a2fa9ff3722663 + pristine_git_object: 28d0024afe3454c065b941129b9223d2620f1fdd + src/models/oauthuserinforesponse.ts: + id: 7f54a9310f79 + last_write_checksum: sha1:8afc6584ddf40b82a7d7f15132038b744769823c + pristine_git_object: 8ceb78219355ed06046b8d255b6aed53f62da2a2 + src/models/organization.ts: + id: 78b4c179a167 + last_write_checksum: sha1:2b098a7da8c739ab99402351f6132d46f648ba0d + pristine_git_object: ea97238f6ffed433711d3d341ff128ca74653c6f + src/models/orgauthconfigcreaterequest.ts: + id: 4143d322f01a + last_write_checksum: sha1:26b0ca28f0f64719f63dc8d6c5532270bb7e92eb + pristine_git_object: fad02f992fd88cac3c12ca1da7af8ce7aa88947f + src/models/orgauthconfigsetupresponse.ts: + id: e34e43a60a80 + last_write_checksum: sha1:f4051096e147b8754611bb2fb214474abec9e8bf + pristine_git_object: 4a0096eede4dda0e13394e6c505ab2dea405980f + src/models/otpcredentials.ts: + id: 0edbd14f8305 + last_write_checksum: sha1:6350c11c0cb4d9ef09f2e382cfa737ebb62013d2 + pristine_git_object: 5176049d00c162e168af16377a837842f2a1947b + src/models/passwordcredentials.ts: + id: 919f36483361 + last_write_checksum: sha1:27af2bd8c425412a2bf303e54a8311047ded1b67 + pristine_git_object: d398c2012742d5a4b8f622559f3cd7692dbe3035 + src/models/persistedsemanticsearch.ts: + id: 065f54695b75 + last_write_checksum: sha1:40b35fc8eb1cb92d7a3b2e950449ba05038b6e60 + pristine_git_object: 0a7d1ac1f6141e16f74446c05d66aca2682aa154 + src/models/persistedsemanticsearchboundingbox.ts: + id: 0f5a0865962f + last_write_checksum: sha1:b096d777b764c7dd9b111073a5ccbed10d011d34 + pristine_git_object: b41e2252d1ca4aa2d6c0bb5b7996290254ccbf9a + src/models/persistedsemanticsearchcitation.ts: + id: 70ba05fdd64c + last_write_checksum: sha1:23de9d1070d63ca921eed3c46c6439d75fb2f470 + pristine_git_object: fff5373f716c87b2c4ab5ad6fc8c87b63041693f + src/models/persistedsemanticsearchcitationmetadata.ts: + id: 15dfe13a9501 + last_write_checksum: sha1:2401fff2897c87a586b244486eaec73a0d266f33 + pristine_git_object: 4d0eaf4a61ca20868e380446b794d4dc9d50c668 + src/models/persistedsemanticsearchsharedwithentry.ts: + id: d5a9afd985d3 + last_write_checksum: sha1:2195338ce1d3d94d37d7abde80436e9ae982f3cd + pristine_git_object: 6f656e4f5c1f7197f69ede4c71e5f0eb8dcb2f48 + src/models/refreshtokenop.ts: + id: 714a06bec9a7 + last_write_checksum: sha1:7668f6ff0f321958a7d9c407e8e7088e4a478175 + pristine_git_object: a746e3059a65ff798fd8898927e63bac14ebe0fd + src/models/refreshtokenresponse.ts: + id: aac894e042be + last_write_checksum: sha1:8926b0d538c6976d2b4739954f4c6b9150eabbcb + pristine_git_object: b4ceba65a0246814501ac8710877ac5303bcd8f3 + src/models/refreshtokenuser.ts: + id: f4f021a73146 + last_write_checksum: sha1:245aba7393b8ee00c98962e681beabf8ba6b16f5 + pristine_git_object: 80138a109bb5c981fd8fdcf12e611c51748271b7 + src/models/regenerateoauthappsecretop.ts: + id: 9be88e8e0959 + last_write_checksum: sha1:4df9ee66c89a11436532cfc09da1abe650881e33 + pristine_git_object: 83e21b78f58e13f89b844fa72682a12089ac4357 + src/models/regenerateoauthappsecretresponse.ts: + id: f1579f730134 + last_write_checksum: sha1:9133fdd3443348d95d66299724c8b013cb09aa36 + pristine_git_object: 6c0af455a1824c81c1335d0c618a69835db38ced + src/models/requestmeta.ts: + id: ebb765ddfa1c + last_write_checksum: sha1:89985dc6c75dcb1fd8585aea3369fef5b50b64bc + pristine_git_object: af5a4dd3d072456aef18dffdc11bd69658b00035 + src/models/resetpasswordop.ts: + id: c38aafca8172 + last_write_checksum: sha1:ee4c5cd00b90e3c23eb0e1f54208c92a9b2ba621 + pristine_git_object: af8b289390d254ab762c8caf803294db1ebf465a + src/models/revokealloauthapptokensop.ts: + id: 2d9818589de7 + last_write_checksum: sha1:5b11fcd16258321649f9177dc3009ae37f9ac934 + pristine_git_object: 8158b3a152b0878ed6a47d08a1e94b36b4f71cd9 + src/models/schemeoauth2.ts: + id: c42aa2f138eb + last_write_checksum: sha1:59e21f008f884f0b20ca9b01470f68dee3f0536f + pristine_git_object: 7511fbdbc9ce203befbcc2e8b4aa37960298550c + src/models/searcharchivedconversationsop.ts: + id: b2bd0333578e + last_write_checksum: sha1:4e130ad4f5eb607c04bf47d3ff93a5c9eb37ea17 + pristine_git_object: 449642e5540578822d701c5d60f41aac7c6d9701 + src/models/searchhistoryop.ts: + id: 5d5be0df4d2c + last_write_checksum: sha1:78681e57fa967abf18c2fcbb05004887eda3629b + pristine_git_object: 88e0685383b70ca29ec5a215782c96c38c9b2695 + src/models/security.ts: + id: d90c6c784ca5 + last_write_checksum: sha1:eeb8a26c58caed971f5d92e7421234079cfc22f7 + pristine_git_object: 52cc64c9d6a73d4b9f40edb367eb6b2b61bc73e2 + src/models/semanticsearchairesponse.ts: + id: 9bec6658522d + last_write_checksum: sha1:732089435285889fbaa7a5b743ba96c077090914 + pristine_git_object: 74f41b013a731d7c163312e6e498bd82b51e7519 + src/models/semanticsearchappliedfilters.ts: + id: f7b17f70bbd9 + last_write_checksum: sha1:ba2e74512bf0d81bfb368263fd231b1dd9512279 + pristine_git_object: 52bd2f79a514f263ce1d238fe820add8b74b3b1a + src/models/semanticsearchboundingbox.ts: + id: 446ecf8c59e4 + last_write_checksum: sha1:6b68f5d726a1f2c63c54e0bbe6c1becd0015c646 + pristine_git_object: bc8f5efcbe25eae938676e437ebb1558831eea75 + src/models/semanticsearchexecuteresponse.ts: + id: c1cb9c382118 + last_write_checksum: sha1:1dc7a3243512caed40167ee168d184679c2e0f07 + pristine_git_object: a5e558e75ef9a2c606fb154e45ed9f2efa662961 + src/models/semanticsearchgraphrecord.ts: + id: 405d9aa2d8a4 + last_write_checksum: sha1:29b87bcb8551622b0ab1b86207bc26f0d287ab0e + pristine_git_object: d4b3bcc6fe208a8194e4070f889aeff4968740bb + src/models/semanticsearchhistoryapplieddaterange.ts: + id: 46e3c28c5bf5 + last_write_checksum: sha1:378935583c1882fcde0490b8c631591026b96ce8 + pristine_git_object: 92d5aa5871cbed425a9f6db99f88c97286983b36 + src/models/semanticsearchhistorydaterange.ts: + id: 2cd2a8437548 + last_write_checksum: sha1:6825104f124589785ef7c8165335b7584af05046 + pristine_git_object: e01b2d5c72e0e60a6b606665fc085f8f58e38769 + src/models/semanticsearchhistoryfilters.ts: + id: 2ffc3464b32a + last_write_checksum: sha1:b692d7a41532a6d33cc73c5996df7423f405d10a + pristine_git_object: d25ceaf2f60a02957107b23c6862135727a3ed76 + src/models/semanticsearchhistoryfiltersapplied.ts: + id: 340ea4b50003 + last_write_checksum: sha1:1f11ec4f5daa64734439dbea40e23ea3038fae7e + pristine_git_object: 671d027916b5999970cdc7ec3cf4898e234e51ef + src/models/semanticsearchhistoryfiltersavailable.ts: + id: 98934d51fa81 + last_write_checksum: sha1:3c9ada17b8372c8ea0232a7d8f2da9f1a54d4131 + pristine_git_object: d82ee0788ac3c76bf7bad5347e04a58d8d880e86 + src/models/semanticsearchhistoryfiltertoggle.ts: + id: cad358c95969 + last_write_checksum: sha1:045a44f681c27f02425e23d9891ff174cf1d0954 + pristine_git_object: 150b3ddd99672f1d2738bf7d4633b10c7b1cde02 + src/models/semanticsearchhistoryitem.ts: + id: 24ed9bee5f3e + last_write_checksum: sha1:30bc4f5fe9f4c6cb399098a7dbca78af6fc1c3e0 + pristine_git_object: 6623a58ebeb9b764f75f876788d508859302409a + src/models/semanticsearchhistorymeta.ts: + id: 1ca0e5740492 + last_write_checksum: sha1:6f60b1f9579726f3bcd8c7c97d6b281f5b19f674 + pristine_git_object: 21ede3b970fdf994302803a030af14e2a4c946d4 + src/models/semanticsearchhistorypagination.ts: + id: 4251cd383139 + last_write_checksum: sha1:587791ff045635d484837e27d42041f69e8acb9d + pristine_git_object: 8b6a0044e9ccea0dc30dee037902a04096c0fe7a + src/models/semanticsearchhistorypaginationfield.ts: + id: 77d360f7c15c + last_write_checksum: sha1:9bf811332273b1065335ea2c0207c919e44571ef + pristine_git_object: 1b360e442725f55e2834a6e15335db31cb473c4b + src/models/semanticsearchhistoryresponse.ts: + id: 947c960bac0e + last_write_checksum: sha1:7145b5938358998b89ddc7159eb440ed496af2c5 + pristine_git_object: fb013af1d2ba9a2aa43c0916e8d9460f7de07078 + src/models/semanticsearchhistorysortfield.ts: + id: 6a77040291ce + last_write_checksum: sha1:73f746360a76e9aafcb3c073733e9dc5ad6c48d2 + pristine_git_object: 343b9362e996be372cf01f5d187b0edc35fc67a0 + src/models/semanticsearchhit.ts: + id: 05bf1da2a3d9 + last_write_checksum: sha1:e0298e8461b86d7298beab3adbc2b26f17e82020 + pristine_git_object: 29c43eed5bf234623af691e2d371a3e797ac7561 + src/models/semanticsearchhitmetadata.ts: + id: c2042f96444d + last_write_checksum: sha1:0ff5da73d5263155a9e158a7f987a9ca9c2b85b7 + pristine_git_object: 5437d1ae034132c656b3219fe1d6675f4a6bdc78 + src/models/semanticsearchrequest.ts: + id: 756c418dac82 + last_write_checksum: sha1:0ba8750b421704ab96d4414d2ca00def2d1a80a7 + pristine_git_object: 8c2697aa5fdad3aa4e21c6a8077df6c17bb831c8 + src/models/setupauthconfigop.ts: + id: d1590866812f + last_write_checksum: sha1:6de64d6f761c215422f4be8dc8d04e3e9dcfc9db + pristine_git_object: 2f75d7ecfcd91ef15d1b29e43c87818cd9eaa811 + src/models/storedagentconversation.ts: + id: ae6fcf1d4cf6 + last_write_checksum: sha1:f779590b04e4d0316705ecc021bed58f2311c80a + pristine_git_object: 8dde005facb1525749f31eac287808bda54725b1 + src/models/suspendoauthappop.ts: + id: de3c4e17703f + last_write_checksum: sha1:b6f736931a303fb42c3334121cdbbac5dc1665e9 + pristine_git_object: a6536f2c957fb789be341a485e2c80f5e3afed79 + src/models/suspendoauthappresponse.ts: + id: f638bf5d1f69 + last_write_checksum: sha1:907902109f44527dd1ff45bba40be79dd3c29c74 + pristine_git_object: d7fcefc82cedd0bb2bdc37962f3a4d2f7f5bd083 + src/models/unarchiveagentconversationop.ts: + id: 3ebe1932b243 + last_write_checksum: sha1:7eaf02a2b14275ffce36b9b5e218bb6e542d1b83 + pristine_git_object: 39befd6253a8abd8aff9fa927e2e41191e116eec + src/models/unarchiveconversationop.ts: + id: 17ae72270946 + last_write_checksum: sha1:93021fba06b475a0dc35c15993aae561d1c8b479 + pristine_git_object: 5f3d58ba3a3748a694ee466130adfbd49c123a8d + src/models/unarchivesearchop.ts: + id: 4aef4085f64a + last_write_checksum: sha1:baba25bf272563fbc809cc56318ef34c9c823bf6 + pristine_git_object: b99ce278dfe9235642e32712db0caa93cc27db1b + src/models/updateagentconversationmessagefeedbackop.ts: + id: b2994e2a5a3c + last_write_checksum: sha1:798ebb357707387ede34d7d1396589eb69cb1f5b + pristine_git_object: 52b60c8e66538cab653fd3364cc1335ef4222f0b + src/models/updateagentconversationtitleop.ts: + id: 4852d0df22dc + last_write_checksum: sha1:bb9e18dbfbf32b8204d224eabbe15c79d7f405c0 + pristine_git_object: 697a5154fdb5006391dde722501011998259136c + src/models/updateagentop.ts: + id: af302f363ba0 + last_write_checksum: sha1:57e48390fdd875f37a7993f2dce76aebcb246d52 + pristine_git_object: 0b86b9beb3a657a6f9cb5f8966ea41052457d3ed + src/models/updateauthmethodop.ts: + id: cd132220ee5a + last_write_checksum: sha1:bad4bccccf679b6e182ffdc5e1f010f86d288969 + pristine_git_object: c512a2b718060a9d1bbe0b71baf3ab39858599fd + src/models/updateauthmethodresponse.ts: + id: 5ac8635d0907 + last_write_checksum: sha1:a1e6186410021f43b38c9d95bc395fc927cfba4e + pristine_git_object: 7f12ff7a3054670dd6a9a8a1ba09da33ad4e89d6 + src/models/updateconversationtitleop.ts: + id: 61488d4a3f6d + last_write_checksum: sha1:01bef3e12fa7b105a015a886891f2bc4ce532c07 + pristine_git_object: 3c155fea5f7cbf424ea85835e32db72cbfc21e25 + src/models/updatemessagefeedbackop.ts: + id: 69cf9de432c9 + last_write_checksum: sha1:2fc01184ed634e6e79e89fdf1158ed1fc0918ff4 + pristine_git_object: 428735e08985768f191282457f7b2bb861fc39c1 + src/models/updateoauthappop.ts: + id: 965990b66435 + last_write_checksum: sha1:dbe9419475b29b9df386edad4c5b61bb2d483fda + pristine_git_object: 9086e5e28cbc633460ccf6f9c75049358d44926a + src/models/updateoauthapprequest.ts: + id: de58c1ed5864 + last_write_checksum: sha1:aec38bd11935bdfe48f00473afdfaed97b7bcc31 + pristine_git_object: cd439147e1ce2d700c5fec6fb8ee3c729fcb27e5 + src/models/updateoauthappresponse.ts: + id: 82be6c21a121 + last_write_checksum: sha1:ff85f21277a4378ad0df69a0d7339693385a647e + pristine_git_object: 5723565efef841bc5a77f821e3b80ab426505143 + src/models/uploadagentconversationchatattachmentsop.ts: + id: e3692fb45a25 + last_write_checksum: sha1:2a455eb9c7f5b45363387cac4c8106875a92c407 + pristine_git_object: 92b3ae09bfe2c5ab74b962d96e340097d22c3e2e + src/models/websearchprovideritem.ts: + id: 99773c882145 + last_write_checksum: sha1:82aa25cf919344f984f5590612e60f3d1691ef58 + pristine_git_object: 6c9bfb8525b1566b887159c1f5334085d839a4fb + src/models/websearchprovidersresponse.ts: + id: 25e3d22ff91d + last_write_checksum: sha1:866416ae805e9c43c8443308855df188b7bc0892 + pristine_git_object: 203ac65c7a76678d95d0f5d7aafbd9488854bde8 + src/models/websearchprovidertype.ts: + id: b1b8c941097b + last_write_checksum: sha1:eb30551d24882d96ee160fea6bc12cb8aa259f4d + pristine_git_object: 8ed72996a24371b2f1dbcceb3bec029c8d37d7bc + src/models/websearchsettings.ts: + id: e3ca7c84a857 + last_write_checksum: sha1:d2eace746fa75bcc48e3059d665a5fd040d2e31d + pristine_git_object: f9ec16a8ced9c21db8be812805d82b1c7f7c0cf4 + src/tool-names.ts: + id: a9977280f9eb + last_write_checksum: sha1:b00e10deb1becbd69df6f40f268fe68a26ba2d95 + pristine_git_object: a0bd5c1cb3563f56917b7f44e6cce34dc1b828b1 + src/types/async.ts: + id: fac8da972f86 + last_write_checksum: sha1:3ff07b3feaf390ec1aeb18ff938e139c6c4a9585 + pristine_git_object: 689dba5de50e8769e5f3bb913e3f42a146d15bc1 + src/types/bigint.ts: + id: 3ca6e3280e43 + last_write_checksum: sha1:58178437a7d38f022b5d9bef691ba5539fad4655 + pristine_git_object: f32ee5fe6a2dbf82bd2d1ec7c17cd2987bcff1d6 + src/types/blobs.ts: + id: f8ab9b326c86 + last_write_checksum: sha1:9cc86e0e9420999afb48d53c57d71584be745fd7 + pristine_git_object: c1cc513af4ca0e96d1525954241592e3f57711bb + src/types/enums.ts: + id: 4d03ddfe5100 + last_write_checksum: sha1:384e3fc4bee3f006cd8f39556a44b3508597b8e5 + pristine_git_object: 6fb6d9109d8a9f27160bdb3a20456a5c3a608a51 + src/types/fp.ts: + id: ae9f0fb8aab6 + last_write_checksum: sha1:d24994d58f37a1ca106847fcc6d2e976c6f1c093 + pristine_git_object: ccbe51eac69dfb0da5131f14fd753c4b47c1d527 + src/types/rfcdate.ts: + id: 9eb64906dcd6 + last_write_checksum: sha1:8e5f382e02fe21c2f2e24deb1b7bbf8cddd3dd16 + pristine_git_object: c79b3f53a3dd922aa2ace5a4191c8652cf9a8e89 + src/types/streams.ts: + id: f99be9c4bf14 + last_write_checksum: sha1:cc9ced2dd34a76c3a1bd7784ccda1cc3b37ab9a9 + pristine_git_object: a0163e7a99cea88f21d0ad4ce3af1c720180ee20 + tsconfig.json: + id: 61ebb9fd6e8c + last_write_checksum: sha1:2a1769fabf9e934fa0b118db46d3b66cb500a6b7 + pristine_git_object: 0ca48942a1b9cd923d614985dfb81f0dc7e1d298 +examples: + oauthToken: + speakeasy-default-oauth-token: + requestBody: + application/x-www-form-urlencoded: {"grant_type": "client_credentials"} + application/json: {"grant_type": "client_credentials"} + responses: + "200": + application/json: {"token_type": "Bearer", "expires_in": 3600} + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + "401": + application/json: {"error": "unsupported_grant_type"} + "429": + application/json: {"error": {"code": "TOO_MANY_REQUESTS", "message": "Too many OAuth client requests. Please try again later."}} + oauthRevoke: + speakeasy-default-oauth-revoke: + requestBody: + application/x-www-form-urlencoded: {"token": "", "client_id": ""} + application/json: {"token": "", "client_id": ""} + responses: + "401": + application/json: {"error": "access_denied"} + "429": + application/json: {"error": {"code": "TOO_MANY_REQUESTS", "message": "Too many OAuth client requests. Please try again later."}} + oauthIntrospect: + active: + requestBody: + application/x-www-form-urlencoded: {"token": "", "client_id": ""} + application/json: {"token": "", "client_id": ""} + responses: + "200": + application/json: {"active": true, "scope": "openid profile email", "client_id": "abc123", "username": "user@example.com", "token_type": "Bearer", "exp": 1735686000, "iat": 1735682400, "user_id": "user-id-123", "iss": "https://api.pipeshub.com"} + inactive: + requestBody: + application/x-www-form-urlencoded: {"token": "", "client_id": ""} + application/json: {"token": "", "client_id": ""} + responses: + "200": + application/json: {"active": false} + oauthUserInfo: + speakeasy-default-oauth-user-info: + responses: + "200": + application/json: {"user_id": ""} + listOAuthApps: + speakeasy-default-list-O-auth-apps: + parameters: + query: + page: 1 + limit: 20 + responses: + "200": + application/json: {"data": [], "pagination": {"page": 665526, "limit": 8698, "total": 245379, "totalPages": 251845}} + "401": + application/json: {"error": {"code": "", "message": ""}} + "429": + application/json: {"error": {"code": "TOO_MANY_REQUESTS", "message": "Too many OAuth client requests. Please try again later."}} + createOAuthApp: + speakeasy-default-create-O-auth-app: + requestBody: + application/json: {"name": "My Integration App", "description": "Integrates PipesHub with our internal tools", "redirectUris": ["https://myapp.com/callback", "http://localhost:3000/callback"], "allowedGrantTypes": ["authorization_code", "refresh_token"], "allowedScopes": ["openid", "profile", "read:records"], "isConfidential": true, "accessTokenLifetime": 3600, "refreshTokenLifetime": 2592000} + responses: + "201": + application/json: {"message": "OAuth app created successfully", "app": {"id": "", "slug": "", "clientId": "", "name": "", "redirectUris": ["https://burdensome-toothbrush.org/", "https://wiggly-mantua.com/"], "allowedGrantTypes": [], "allowedScopes": ["", "", ""], "status": "suspended", "isConfidential": true, "accessTokenLifetime": 226170, "refreshTokenLifetime": 856881, "createdAt": "2024-08-12T11:53:54.855Z", "updatedAt": "2025-08-27T02:49:11.757Z", "clientSecret": ""}} + "400": + application/json: {"error": {"code": "", "message": ""}} + "429": + application/json: {"error": {"code": "TOO_MANY_REQUESTS", "message": "Too many OAuth client requests. Please try again later."}} + listOAuthScopes: + speakeasy-default-list-O-auth-scopes: + responses: + "200": + application/json: {"scopes": {"key": [{"name": "openid", "description": "OpenID Connect authentication", "category": "Identity", "requiresUserConsent": false}]}} + "401": + application/json: {"error": {"code": "", "message": ""}} + "429": + application/json: {"error": {"code": "TOO_MANY_REQUESTS", "message": "Too many OAuth client requests. Please try again later."}} + getOAuthApp: + speakeasy-default-get-O-auth-app: + parameters: + path: + appId: "" + responses: + "200": + application/json: {"id": "", "slug": "", "clientId": "", "name": "", "redirectUris": ["https://vast-pine.biz", "https://immaculate-omelet.biz", "https://unwritten-remark.info"], "allowedGrantTypes": ["", ""], "allowedScopes": ["", ""], "status": "active", "isConfidential": false, "accessTokenLifetime": 51060, "refreshTokenLifetime": 816424, "createdAt": "2025-12-18T21:23:51.272Z", "updatedAt": "2024-02-01T19:53:01.309Z"} + "401": + application/json: {"error": {"code": "", "message": ""}} + "429": + application/json: {"error": {"code": "TOO_MANY_REQUESTS", "message": "Too many OAuth client requests. Please try again later."}} + updateOAuthApp: + speakeasy-default-update-O-auth-app: + parameters: + path: + appId: "" + requestBody: + application/json: {} + responses: + "200": + application/json: {"message": "OAuth app updated successfully", "app": {"id": "", "slug": "", "clientId": "", "name": "", "redirectUris": [], "allowedGrantTypes": [], "allowedScopes": ["", ""], "status": "suspended", "isConfidential": false, "accessTokenLifetime": 796842, "refreshTokenLifetime": 933505, "createdAt": "2026-05-20T17:40:33.275Z", "updatedAt": "2024-01-15T13:23:46.885Z"}} + "400": + application/json: {"error": {"code": "", "message": ""}} + "429": + application/json: {"error": {"code": "TOO_MANY_REQUESTS", "message": "Too many OAuth client requests. Please try again later."}} + deleteOAuthApp: + speakeasy-default-delete-O-auth-app: + parameters: + path: + appId: "" + responses: + "200": + application/json: {"message": "OAuth app deleted successfully"} + "401": + application/json: {"error": {"code": "", "message": ""}} + "429": + application/json: {"error": {"code": "TOO_MANY_REQUESTS", "message": "Too many OAuth client requests. Please try again later."}} + regenerateOAuthAppSecret: + speakeasy-default-regenerate-O-auth-app-secret: + parameters: + path: + appId: "" + responses: + "200": + application/json: {"message": "Client secret regenerated successfully", "clientId": "", "clientSecret": ""} + "401": + application/json: {"error": {"code": "", "message": ""}} + "429": + application/json: {"error": {"code": "TOO_MANY_REQUESTS", "message": "Too many OAuth client requests. Please try again later."}} + suspendOAuthApp: + speakeasy-default-suspend-O-auth-app: + parameters: + path: + appId: "" + responses: + "200": + application/json: {"message": "OAuth app suspended successfully", "app": {"id": "", "slug": "", "clientId": "", "name": "", "redirectUris": [], "allowedGrantTypes": [], "allowedScopes": ["", ""], "status": "revoked", "isConfidential": false, "accessTokenLifetime": 638157, "refreshTokenLifetime": 841146, "createdAt": "2026-01-06T13:23:16.693Z", "updatedAt": "2026-03-27T12:45:44.869Z"}} + "400": + application/json: {"error": {"code": "", "message": ""}} + "429": + application/json: {"error": {"code": "TOO_MANY_REQUESTS", "message": "Too many OAuth client requests. Please try again later."}} + activateOAuthApp: + speakeasy-default-activate-O-auth-app: + parameters: + path: + appId: "" + responses: + "200": + application/json: {"message": "OAuth app activated successfully", "app": {"id": "", "slug": "", "clientId": "", "name": "", "redirectUris": ["https://rowdy-starboard.com/", "https://faraway-bump.com/"], "allowedGrantTypes": ["", ""], "allowedScopes": ["", "", ""], "status": "suspended", "isConfidential": false, "accessTokenLifetime": 165300, "refreshTokenLifetime": 692162, "createdAt": "2025-02-08T04:44:03.387Z", "updatedAt": "2025-07-07T15:25:38.165Z"}} + "400": + application/json: {"error": {"code": "", "message": ""}} + "429": + application/json: {"error": {"code": "TOO_MANY_REQUESTS", "message": "Too many OAuth client requests. Please try again later."}} + listOAuthAppTokens: + speakeasy-default-list-O-auth-app-tokens: + parameters: + path: + appId: "" + responses: + "200": + application/json: {"tokens": []} + "401": + application/json: {"error": {"code": "", "message": ""}} + "429": + application/json: {"error": {"code": "TOO_MANY_REQUESTS", "message": "Too many OAuth client requests. Please try again later."}} + revokeAllOAuthAppTokens: + speakeasy-default-revoke-all-O-auth-app-tokens: + parameters: + path: + appId: "" + responses: + "200": + application/json: {"message": "All tokens revoked successfully"} + "401": + application/json: {"error": {"code": "", "message": ""}} + "429": + application/json: {"error": {"code": "TOO_MANY_REQUESTS", "message": "Too many OAuth client requests. Please try again later."}} + initAuth: + speakeasy-default-init-auth: + requestBody: + application/json: {"email": "user@example.com"} + responses: + "200": + application/json: {"currentStep": 0, "allowedMethods": ["password", "google", "otp"], "message": "Authentication initialized", "authProviders": {}, "jitEnabled": true} + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + "500": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + authenticate: + speakeasy-default-authenticate: + parameters: + header: + x-session-token: "" + requestBody: + application/json: {"method": "oauth", "credentials": {"password": "o_5N_tt72qMx3WV"}} + responses: + "200": + application/json: {"status": "success", "nextStep": 195961, "allowedMethods": ["", ""], "authProviders": {}} + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + "500": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + refreshToken: + speakeasy-default-refresh-token: + responses: + "200": + application/json: {"user": {"_id": "", "orgId": "", "email": "Quinn_Gottlieb@hotmail.com", "fullName": "Juanita Goyette", "hasLoggedIn": false, "isDeleted": false, "slug": "", "createdAt": "1725215532180", "updatedAt": "1735637592598", "__v": 530780}, "accessToken": ""} + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + "500": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + resetPassword: + speakeasy-default-reset-password: + requestBody: + application/json: {"currentPassword": "fR5Alu28cPCa984", "newPassword": "vcFGz9GLaOB88kV"} + responses: + "200": + application/json: {"data": "password reset", "accessToken": ""} + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + "500": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + getAuthMethods: + speakeasy-default-get-auth-methods: + responses: + "200": + application/json: {"authMethods": [{"order": 216367, "allowedMethods": [{"type": "azureAd"}]}]} + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + "500": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + updateAuthMethod: + speakeasy-default-update-auth-method: + requestBody: + application/json: {"authMethod": [{"order": 195644, "allowedMethods": [{"type": "samlSso"}]}]} + responses: + "200": + application/json: {"message": "Auth method updated", "authMethod": [{"order": 195644, "allowedMethods": [{"type": "samlSso"}]}]} + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + "500": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + setUpAuthConfig: + speakeasy-default-set-up-auth-config: + requestBody: + application/json: {"contactEmail": "Buster_Waelchi@yahoo.com", "registeredName": "", "adminFullName": "", "sendEmail": false} + responses: + "200": + application/json: {"message": ""} + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + "500": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + getCurrentOrganization: + speakeasy-default-get-current-organization: + responses: + "200": + application/json: {"_id": "", "slug": "", "registeredName": "", "domain": "excited-sand.info", "contactEmail": "Russell_Reichel@hotmail.com", "accountType": "individual", "onBoardingStatus": "skipped", "isDeleted": false, "__v": 240152, "createdAt": "2026-09-10T18:19:28.615Z", "updatedAt": "2025-11-27T20:16:39.356Z"} + "401": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + "500": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + getKnowledgeHubRootNodes: + speakeasy-default-get-knowledge-hub-root-nodes: + parameters: + query: + onlyContainers: false + page: 1 + limit: 50 + sortBy: "updatedAt" + sortOrder: "desc" + q: "quarterly report" + nodeTypes: "app,recordGroup" + recordTypes: "FILE,CONFLUENCE_PAGE" + origins: "CONNECTOR" + connectorIds: "f3a4b5b6-5b6c-4e85-9097-3202cfe696fc" + indexingStatus: "COMPLETED,FAILED" + createdAt: "gte:1700000000000,lte:1710000000000" + updatedAt: "gte:1700000000000,lte:1710000000000" + size: "gte:0,lte:10485760" + include: "availableFilters,counts" + responses: + "200": + application/json: {"success": true, "error": "", "id": "", "currentNode": {"id": "", "name": "", "nodeType": ""}, "parentNode": {"id": "", "name": "", "nodeType": ""}, "items": [], "pagination": {"page": 396276, "limit": 184356, "totalItems": 229967, "totalPages": 696690, "hasNext": true, "hasPrev": true}, "filters": {"applied": {"q": "", "nodeTypes": ["", ""], "recordTypes": [""], "origins": ["", "", ""], "connectorIds": [], "indexingStatus": null, "createdAt": {}, "updatedAt": {}, "size": {}, "sortBy": "", "sortOrder": ""}, "available": {"nodeTypes": [], "recordTypes": [{"id": "", "label": ""}], "origins": [], "connectors": [{"id": "", "label": ""}], "indexingStatus": [], "sortBy": [{"id": "", "label": ""}], "sortOrder": [{"id": "", "label": ""}]}}, "breadcrumbs": [{"id": "", "name": "", "nodeType": ""}], "counts": {"items": [], "total": 678158}, "permissions": {"role": "", "canUpload": true, "canCreateFolders": true, "canEdit": true, "canDelete": false, "canManagePermissions": true}} + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Search query must be at least 2 characters"}} + "401": + application/json: {"error": {"code": "HTTP_UNAUTHORIZED", "message": "Invalid token"}} + "403": + application/json: {"error": {"code": "HTTP_FORBIDDEN", "message": "Insufficient scope. Required: kb:read"}} + "500": + application/json: {"error": {"code": "HTTP_INTERNAL_SERVER_ERROR", "message": "An unexpected error occurred"}} + root_apps: + parameters: + query: + onlyContainers: false + page: 1 + limit: 50 + sortBy: "updatedAt" + sortOrder: "desc" + q: "quarterly report" + nodeTypes: "app,recordGroup" + recordTypes: "FILE,CONFLUENCE_PAGE" + origins: "CONNECTOR" + connectorIds: "f3a4b5b6-5b6c-4e85-9097-3202cfe696fc" + indexingStatus: "COMPLETED,FAILED" + createdAt: "gte:1700000000000,lte:1710000000000" + updatedAt: "gte:1700000000000,lte:1710000000000" + size: "gte:0,lte:10485760" + include: "availableFilters,counts" + responses: + "200": + application/json: {"success": true, "error": null, "id": null, "currentNode": null, "parentNode": null, "items": [{"id": "knowledgeBase_org123", "name": "Collections", "nodeType": "app", "parentId": null, "origin": "COLLECTION", "connector": null, "recordType": null, "recordGroupType": null, "indexingStatus": null, "reason": null, "isInternal": false, "createdAt": 1700000000000, "updatedAt": 1710000000000, "sizeInBytes": null, "mimeType": null, "extension": null, "webUrl": "/app/knowledgeBase_org123", "hasChildren": true, "previewRenderable": null, "permission": null, "sharingStatus": "workspace"}, {"id": "f3a4b5b6-5b6c-4e85-9097-3202cfe696fc", "name": "Google Drive", "nodeType": "app", "parentId": null, "origin": "CONNECTOR", "connector": "drive", "recordType": null, "recordGroupType": null, "indexingStatus": null, "reason": null, "isInternal": false, "createdAt": 1700000000000, "updatedAt": 1709000000000, "sizeInBytes": null, "mimeType": null, "extension": null, "webUrl": "/app/f3a4b5b6-5b6c-4e85-9097-3202cfe696fc", "hasChildren": true, "previewRenderable": null, "permission": null, "sharingStatus": null}], "pagination": {"page": 1, "limit": 20, "totalItems": 2, "totalPages": 1, "hasNext": false, "hasPrev": false}, "filters": {"applied": {"q": null, "nodeTypes": null, "recordTypes": null, "origins": null, "connectorIds": null, "indexingStatus": null, "createdAt": null, "updatedAt": null, "size": null, "sortBy": "updatedAt", "sortOrder": "desc"}, "available": {"nodeTypes": [{"id": "app", "label": "Apps"}, {"id": "recordGroup", "label": "Record Groups"}], "recordTypes": [], "origins": [{"id": "COLLECTION", "label": "Collection"}, {"id": "CONNECTOR", "label": "Connector"}], "connectors": [{"id": "f3a4b5b6-5b6c-4e85-9097-3202cfe696fc", "label": "Google Drive", "connectorType": "drive"}], "indexingStatus": [], "sortBy": [{"id": "name", "label": "Name"}, {"id": "updatedAt", "label": "Updated"}], "sortOrder": [{"id": "asc", "label": "Ascending"}, {"id": "desc", "label": "Descending"}]}}, "breadcrumbs": null, "counts": null, "permissions": null} + query_too_short: + parameters: + query: + onlyContainers: false + page: 1 + limit: 50 + sortBy: "updatedAt" + sortOrder: "desc" + q: "quarterly report" + nodeTypes: "app,recordGroup" + recordTypes: "FILE,CONFLUENCE_PAGE" + origins: "CONNECTOR" + connectorIds: "f3a4b5b6-5b6c-4e85-9097-3202cfe696fc" + indexingStatus: "COMPLETED,FAILED" + createdAt: "gte:1700000000000,lte:1710000000000" + updatedAt: "gte:1700000000000,lte:1710000000000" + size: "gte:0,lte:10485760" + include: "availableFilters,counts" + responses: + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Search query must be at least 2 characters"}} + comma_list_too_long: + parameters: + query: + onlyContainers: false + page: 1 + limit: 50 + sortBy: "updatedAt" + sortOrder: "desc" + q: "quarterly report" + nodeTypes: "app,recordGroup" + recordTypes: "FILE,CONFLUENCE_PAGE" + origins: "CONNECTOR" + connectorIds: "f3a4b5b6-5b6c-4e85-9097-3202cfe696fc" + indexingStatus: "COMPLETED,FAILED" + createdAt: "gte:1700000000000,lte:1710000000000" + updatedAt: "gte:1700000000000,lte:1710000000000" + size: "gte:0,lte:10485760" + include: "availableFilters,counts" + responses: + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Too many items in comma-separated list (max: 100, got: 142)"}} + date_range_inverted: + parameters: + query: + onlyContainers: false + page: 1 + limit: 50 + sortBy: "updatedAt" + sortOrder: "desc" + q: "quarterly report" + nodeTypes: "app,recordGroup" + recordTypes: "FILE,CONFLUENCE_PAGE" + origins: "CONNECTOR" + connectorIds: "f3a4b5b6-5b6c-4e85-9097-3202cfe696fc" + indexingStatus: "COMPLETED,FAILED" + createdAt: "gte:1700000000000,lte:1710000000000" + updatedAt: "gte:1700000000000,lte:1710000000000" + size: "gte:0,lte:10485760" + include: "availableFilters,counts" + responses: + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Date range invalid: gte must be <= lte"}} + size_exceeds_max: + parameters: + query: + onlyContainers: false + page: 1 + limit: 50 + sortBy: "updatedAt" + sortOrder: "desc" + q: "quarterly report" + nodeTypes: "app,recordGroup" + recordTypes: "FILE,CONFLUENCE_PAGE" + origins: "CONNECTOR" + connectorIds: "f3a4b5b6-5b6c-4e85-9097-3202cfe696fc" + indexingStatus: "COMPLETED,FAILED" + createdAt: "gte:1700000000000,lte:1710000000000" + updatedAt: "gte:1700000000000,lte:1710000000000" + size: "gte:0,lte:10485760" + include: "availableFilters,counts" + responses: + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Size exceeds maximum (1TB): 2199023255552"}} + getKnowledgeHubChildNodes: + speakeasy-default-get-knowledge-hub-child-nodes: + parameters: + path: + parentType: "recordGroup" + parentId: "" + query: + onlyContainers: false + page: 1 + limit: 50 + sortBy: "updatedAt" + sortOrder: "desc" + q: "quarterly report" + nodeTypes: "recordGroup" + recordTypes: "FILE,CONFLUENCE_PAGE" + origins: "CONNECTOR" + connectorIds: "f3a4b5b6-5b6c-4e85-9097-3202cfe696fc" + indexingStatus: "COMPLETED,FAILED" + createdAt: "gte:1700000000000,lte:1710000000000" + updatedAt: "gte:1700000000000,lte:1710000000000" + size: "gte:0,lte:10485760" + include: "breadcrumbs,availableFilters" + responses: + "200": + application/json: {"success": false, "error": "", "id": "", "currentNode": {"id": "", "name": "", "nodeType": ""}, "parentNode": null, "items": [], "pagination": {"page": 42048, "limit": 7874, "totalItems": 406791, "totalPages": 38532, "hasNext": false, "hasPrev": true}, "filters": {"applied": {"q": "", "nodeTypes": null, "recordTypes": [""], "origins": ["", ""], "connectorIds": [], "indexingStatus": ["", ""], "createdAt": {}, "updatedAt": {}, "size": {}, "sortBy": "", "sortOrder": ""}, "available": {"nodeTypes": [{"id": "", "label": ""}], "recordTypes": [{"id": "", "label": ""}], "origins": [], "connectors": [], "indexingStatus": [], "sortBy": [], "sortOrder": []}}, "breadcrumbs": [], "counts": {"items": [], "total": 913652}, "permissions": {"role": "", "canUpload": true, "canCreateFolders": false, "canEdit": false, "canDelete": true, "canManagePermissions": false}} + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Invalid parent_type. Must be one of: app, recordGroup, folder, record"}} + "401": + application/json: {"error": {"code": "HTTP_UNAUTHORIZED", "message": "Invalid token"}} + "403": + application/json: {"error": {"code": "HTTP_FORBIDDEN", "message": "Insufficient scope. Required: kb:read"}} + "404": + application/json: {"error": {"code": "HTTP_NOT_FOUND", "message": "Parent node not found"}} + "500": + application/json: {"error": {"code": "HTTP_INTERNAL_SERVER_ERROR", "message": "An unexpected error occurred"}} + collection_record_groups: + parameters: + path: + parentType: "app" + parentId: "" + query: + onlyContainers: false + page: 1 + limit: 50 + sortBy: "updatedAt" + sortOrder: "desc" + q: "quarterly report" + nodeTypes: "recordGroup" + recordTypes: "FILE,CONFLUENCE_PAGE" + origins: "CONNECTOR" + connectorIds: "f3a4b5b6-5b6c-4e85-9097-3202cfe696fc" + indexingStatus: "COMPLETED,FAILED" + createdAt: "gte:1700000000000,lte:1710000000000" + updatedAt: "gte:1700000000000,lte:1710000000000" + size: "gte:0,lte:10485760" + include: "breadcrumbs,availableFilters" + responses: + "200": + application/json: {"success": true, "error": null, "id": "knowledgeBase_org123", "currentNode": {"id": "knowledgeBase_org123", "name": "Collections", "nodeType": "app", "subType": null}, "parentNode": null, "items": [{"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "name": "Engineering Docs", "nodeType": "recordGroup", "parentId": "knowledgeBase_org123", "origin": "COLLECTION", "connector": null, "recordType": null, "recordGroupType": "KNOWLEDGE_BASE", "indexingStatus": null, "reason": null, "isInternal": false, "createdAt": 1700000000000, "updatedAt": 1709500000000, "sizeInBytes": null, "mimeType": null, "extension": null, "webUrl": null, "hasChildren": true, "previewRenderable": null, "permission": null, "sharingStatus": "workspace"}, {"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901", "name": "HR Policies", "nodeType": "recordGroup", "parentId": "knowledgeBase_org123", "origin": "COLLECTION", "connector": null, "recordType": null, "recordGroupType": "KNOWLEDGE_BASE", "indexingStatus": null, "reason": null, "isInternal": false, "createdAt": 1700100000000, "updatedAt": 1709400000000, "sizeInBytes": null, "mimeType": null, "extension": null, "webUrl": null, "hasChildren": true, "previewRenderable": null, "permission": null, "sharingStatus": "private"}], "pagination": {"page": 1, "limit": 20, "totalItems": 2, "totalPages": 1, "hasNext": false, "hasPrev": false}, "filters": {"applied": {"q": null, "nodeTypes": ["recordGroup"], "recordTypes": null, "origins": null, "connectorIds": null, "indexingStatus": null, "createdAt": null, "updatedAt": null, "size": null, "sortBy": "name", "sortOrder": "asc"}, "available": null}, "breadcrumbs": [{"id": "knowledgeBase_org123", "name": "Collections", "nodeType": "app", "subType": null}], "counts": null, "permissions": null} + invalid_parent_type: + parameters: + path: + parentType: "recordGroup" + parentId: "" + query: + onlyContainers: false + page: 1 + limit: 50 + sortBy: "updatedAt" + sortOrder: "desc" + q: "quarterly report" + nodeTypes: "recordGroup" + recordTypes: "FILE,CONFLUENCE_PAGE" + origins: "CONNECTOR" + connectorIds: "f3a4b5b6-5b6c-4e85-9097-3202cfe696fc" + indexingStatus: "COMPLETED,FAILED" + createdAt: "gte:1700000000000,lte:1710000000000" + updatedAt: "gte:1700000000000,lte:1710000000000" + size: "gte:0,lte:10485760" + include: "breadcrumbs,availableFilters" + responses: + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Invalid parent_type. Must be one of: app, recordGroup, folder, record"}} + invalid_parent_id: + parameters: + path: + parentType: "record" + parentId: "" + query: + onlyContainers: false + page: 1 + limit: 50 + sortBy: "updatedAt" + sortOrder: "desc" + q: "quarterly report" + nodeTypes: "recordGroup" + recordTypes: "FILE,CONFLUENCE_PAGE" + origins: "CONNECTOR" + connectorIds: "f3a4b5b6-5b6c-4e85-9097-3202cfe696fc" + indexingStatus: "COMPLETED,FAILED" + createdAt: "gte:1700000000000,lte:1710000000000" + updatedAt: "gte:1700000000000,lte:1710000000000" + size: "gte:0,lte:10485760" + include: "breadcrumbs,availableFilters" + responses: + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Invalid UUID format for parent_id: abc"}} + query_too_short: + parameters: + path: + parentType: "record" + parentId: "" + query: + onlyContainers: false + page: 1 + limit: 50 + sortBy: "updatedAt" + sortOrder: "desc" + q: "quarterly report" + nodeTypes: "recordGroup" + recordTypes: "FILE,CONFLUENCE_PAGE" + origins: "CONNECTOR" + connectorIds: "f3a4b5b6-5b6c-4e85-9097-3202cfe696fc" + indexingStatus: "COMPLETED,FAILED" + createdAt: "gte:1700000000000,lte:1710000000000" + updatedAt: "gte:1700000000000,lte:1710000000000" + size: "gte:0,lte:10485760" + include: "breadcrumbs,availableFilters" + responses: + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Search query must be at least 2 characters"}} + comma_list_too_long: + parameters: + path: + parentType: "record" + parentId: "" + query: + onlyContainers: false + page: 1 + limit: 50 + sortBy: "updatedAt" + sortOrder: "desc" + q: "quarterly report" + nodeTypes: "recordGroup" + recordTypes: "FILE,CONFLUENCE_PAGE" + origins: "CONNECTOR" + connectorIds: "f3a4b5b6-5b6c-4e85-9097-3202cfe696fc" + indexingStatus: "COMPLETED,FAILED" + createdAt: "gte:1700000000000,lte:1710000000000" + updatedAt: "gte:1700000000000,lte:1710000000000" + size: "gte:0,lte:10485760" + include: "breadcrumbs,availableFilters" + responses: + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Too many items in comma-separated list (max: 100, got: 142)"}} + date_range_inverted: + parameters: + path: + parentType: "folder" + parentId: "" + query: + onlyContainers: false + page: 1 + limit: 50 + sortBy: "updatedAt" + sortOrder: "desc" + q: "quarterly report" + nodeTypes: "recordGroup" + recordTypes: "FILE,CONFLUENCE_PAGE" + origins: "CONNECTOR" + connectorIds: "f3a4b5b6-5b6c-4e85-9097-3202cfe696fc" + indexingStatus: "COMPLETED,FAILED" + createdAt: "gte:1700000000000,lte:1710000000000" + updatedAt: "gte:1700000000000,lte:1710000000000" + size: "gte:0,lte:10485760" + include: "breadcrumbs,availableFilters" + responses: + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Date range invalid: gte must be <= lte"}} + getAllConversations: + speakeasy-default-get-all-conversations: + parameters: + query: + source: "owned" + responses: + "200": + application/json: {"conversations": [{}], "source": "owned", "pagination": {}, "filters": {"applied": {"filters": ["", "", ""], "values": {}}, "available": {"shared": {}, "tags": {}, "minMessages": {}, "search": {}, "pagination": {}, "sorting": {}, "dateFilters": {}, "messageFilters": {}, "sortingMessages": {}}}, "meta": {}} + getArchivedConversations: + speakeasy-default-get-archived-conversations: + parameters: + query: + page: 1 + limit: 20 + sortBy: "lastActivityAt" + sortOrder: "desc" + responses: + "200": + application/json: {"conversations": [{"title": "Q4 Financial Report Discussion", "isShared": false, "isArchived": false, "isDeleted": false}]} + searchArchivedConversations: + speakeasy-default-search-archived-conversations: + parameters: + query: + search: "" + page: 1 + limit: 20 + responses: + "200": + application/json: {} + getConversationById: + speakeasy-default-get-conversation-by-id: + parameters: + path: + conversationId: "507f1f77bcf86cd799439011" + query: + page: 1 + limit: 20 + sortBy: "createdAt" + sortOrder: "desc" + responses: + "200": + application/json: {} + deleteConversationById: + speakeasy-default-delete-conversation-by-id: + parameters: + path: + conversationId: "" + responses: + "200": + application/json: {} + updateConversationTitle: + speakeasy-default-update-conversation-title: + parameters: + path: + conversationId: "" + requestBody: + application/json: {"title": "Q4 Sales Analysis Discussion"} + responses: + "200": + application/json: {"conversation": {"_id": "", "userId": "", "orgId": "", "initiator": "", "messages": [{"_id": "", "messageType": "bot_response", "content": "", "contentFormat": "MARKDOWN", "citations": [], "followUpQuestions": [{}], "feedback": [], "referenceData": [], "createdAt": "2025-03-04T17:38:45.516Z", "updatedAt": "2025-10-31T13:32:26.638Z"}], "isShared": false, "sharedWith": [{"userId": "", "accessLevel": "read"}], "isArchived": false, "isDeleted": false, "conversationErrors": [{"_id": "", "message": "", "timestamp": "2024-02-12T18:11:28.752Z"}], "lastActivityAt": 286618, "createdAt": "2025-04-11T12:43:48.240Z", "updatedAt": "2024-05-29T01:38:56.895Z", "__v": 128892}, "meta": {"requestId": "", "timestamp": "2025-07-03T14:54:58.694Z", "duration": 378645}} + archiveConversation: + speakeasy-default-archive-conversation: + parameters: + path: + conversationId: "" + responses: + "200": + application/json: {} + unarchiveConversation: + speakeasy-default-unarchive-conversation: + parameters: + path: + conversationId: "" + responses: + "200": + application/json: {} + updateMessageFeedback: + speakeasy-default-update-message-feedback: + parameters: + path: + conversationId: "" + messageId: "" + requestBody: + application/json: {} + responses: + "200": + application/json: {"conversationId": "", "messageId": "", "feedback": {"feedbackProvider": "", "timestamp": 119125, "metrics": {"timeToFeedback": 5134.41}}, "meta": {"requestId": "", "timestamp": "2025-05-18T04:50:10.128Z", "duration": 997358}} + search: + simple: + requestBody: + application/json: {"query": "company vacation policy", "limit": 10} + responses: + "200": + application/json: {"searchId": "", "searchResponse": {"searchResults": [{}], "records": [], "status": "", "status_code": 718804, "message": ""}} + speakeasy-default-search: + requestBody: + application/json: {"query": "employee onboarding procedures", "limit": 10} + responses: + "200": + application/json: {"searchId": "", "searchResponse": {"searchResults": [{}], "records": [], "status": "", "status_code": 718804, "message": ""}} + searchHistory: + speakeasy-default-search-history: + parameters: + query: + page: 1 + limit: 20 + sortBy: "lastActivityAt" + sortOrder: "desc" + responses: + "200": + application/json: {"searchHistory": [{"_id": "", "__v": 27933, "query": "", "limit": 951841, "orgId": "", "userId": "", "citationIds": ["", ""], "records": {"key": "", "key1": "", "key2": ""}, "isShared": true, "sharedWith": [{"userId": "", "accessLevel": "write"}], "isArchived": false, "createdAt": "2024-12-17T18:44:18.707Z", "updatedAt": "2025-09-29T21:32:32.764Z"}], "pagination": {"page": 140773, "limit": 390720, "totalCount": 476085, "totalPages": 208248, "hasNextPage": true, "hasPrevPage": false}, "filters": {"applied": {"filters": ["search"], "values": {}}, "available": {"shared": {"description": "versus ah colorful whoa", "current": "", "applied": true}, "tags": {"description": "um seemingly which pfft faraway where boo ecstatic", "current": "", "applied": true}, "minMessages": {"description": "physical blacken motor flimsy", "current": "", "applied": false}, "search": {"description": "thorn kooky greedy um", "current": "", "applied": true}, "pagination": {"page": {"type": "", "current": 411995, "min": 576069, "max": 866204, "default": 873224, "description": "circa oh stark instead", "applied": true}, "limit": {"type": "", "current": 295082, "min": 591514, "max": 405269, "default": 503976, "description": "but whoa intensely or", "applied": false}}, "sorting": {"sortBy": {"values": ["", "", ""], "default": "", "description": "schnitzel but verify mysteriously uh-huh ah optimistic", "current": ""}, "sortOrder": {"values": [""], "default": "", "description": "absentmindedly live oddly yowza healthily buck scoop intelligent ignite", "current": ""}}, "dateFilters": {"dateRange": {"type": "", "description": "apud considering than though questionable lest", "format": "", "current": {"start": "", "end": ""}, "applied": true}}, "messageFilters": {"messageType": {"description": "coordinated fall usher readily yahoo boiling haunting extract times nutritious", "current": "", "applied": true}}, "sortingMessages": {"sortBy": {"values": ["", "", ""], "default": "", "description": "schnitzel but verify mysteriously uh-huh ah optimistic", "current": ""}, "sortOrder": {"values": [""], "default": "", "description": "absentmindedly live oddly yowza healthily buck scoop intelligent ignite", "current": ""}}}}, "meta": {"timestamp": "2026-11-23T03:49:01.198Z", "duration": 897861}} + "400": + application/json: {"error": {"code": "", "message": ""}} + "401": + application/json: {"error": {"code": "", "message": ""}} + "403": + application/json: {"error": {"code": "", "message": ""}} + "500": + application/json: {"error": {"code": "", "message": ""}} + deleteSearchHistory: + speakeasy-default-delete-search-history: + responses: + "200": + application/json: {"message": ""} + getSearchById: + speakeasy-default-get-search-by-id: + parameters: + path: + searchId: "" + responses: + "200": + application/json: [{"_id": "", "__v": 388836, "query": "", "limit": 809823, "orgId": "", "userId": "", "citationIds": [], "records": {"key": ""}, "isShared": false, "sharedWith": [{"userId": "", "accessLevel": "read"}], "isArchived": false, "createdAt": "2024-07-19T16:55:28.962Z", "updatedAt": "2024-01-16T07:03:26.713Z"}] + "400": + application/json: {"error": {"code": "VALIDATION_ERROR", "message": ""}} + "401": + application/json: {"error": {"code": "HTTP_UNAUTHORIZED", "message": ""}} + "403": + application/json: {"error": {"code": "HTTP_FORBIDDEN", "message": ""}} + "404": + application/json: {"error": {"code": "HTTP_NOT_FOUND", "message": ""}} + "500": + application/json: {"error": {"code": "INTERNAL_ERROR", "message": ""}} + deleteSearchById: + speakeasy-default-delete-search-by-id: + parameters: + path: + searchId: "" + responses: + "200": + application/json: {"message": ""} + archiveSearch: + speakeasy-default-archive-search: + parameters: + path: + searchId: "" + responses: + "200": + application/json: {"id": "65f1c0a4e2b9c4d8f3a1b2c3", "status": "archived", "archivedBy": "65f1c0a4e2b9c4d8f3a1b2c4", "archivedAt": "2026-05-10T12:34:56.789Z", "meta": {"requestId": "req_8f3a1b2c", "timestamp": "2026-05-10T12:34:56.789Z", "duration": 42}} + unarchiveSearch: + speakeasy-default-unarchive-search: + parameters: + path: + searchId: "" + responses: + "200": + application/json: {"id": "65f1c0a4e2b9c4d8f3a1b2c3", "status": "unarchived", "unarchivedBy": "65f1c0a4e2b9c4d8f3a1b2c4", "unarchivedAt": "2026-05-10T12:34:56.789Z", "meta": {"requestId": "req_8f3a1b2c", "timestamp": "2026-05-10T12:34:56.789Z", "duration": 42}} + listAgents: + success: + parameters: + query: + page: 1 + limit: 20 + sort_by: "updatedAtTimestamp" + sort_order: "desc" + responses: + "200": + application/json: {"success": true, "agents": [{"_id": "agentInstances/11111111-2222-3333-4444-555555555555", "_key": "11111111-2222-3333-4444-555555555555", "_rev": "_exampleRev---", "createdAtTimestamp": 1779792574728, "createdBy": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", "description": "AI agent for customer support workflows", "instructions": null, "isActive": true, "isDeleted": false, "isServiceAccount": false, "models": ["99999999-8888-7777-6666-555555555555_gpt-5.4-mini"], "name": "Customer Support Agent", "startMessage": "Hello! How can I help you today?", "systemPrompt": "You are a helpful assistant.", "tags": [], "updatedAtTimestamp": 1779792574728, "updatedBy": null, "webSearch": null, "shareWithOrg": false, "can_view": true, "can_share": true, "can_edit": true, "can_delete": true, "user_role": "OWNER", "access_type": "INDIVIDUAL"}], "pagination": {"currentPage": 1, "limit": 20, "totalItems": 2, "totalPages": 1, "hasNext": false, "hasPrev": false}} + createAgent: + speakeasy-default-create-agent: + requestBody: + application/json: {"name": "Product Support Agent", "models": [], "shareWithOrg": false, "isServiceAccount": false} + responses: + "201": + application/json: {"status": "success", "message": "", "agent": {"_key": "", "name": "", "description": "pfft damp while", "startMessage": "", "systemPrompt": "", "instructions": "", "models": ["", ""], "tags": [""], "webSearch": {}, "isActive": true, "isServiceAccount": true, "createdBy": "", "updatedBy": null, "createdAtTimestamp": 210011, "updatedAtTimestamp": 445709, "isDeleted": false, "toolsets": [], "knowledge": []}} + getAgent: + speakeasy-default-get-agent: + parameters: + path: + agentKey: "customer-support-agent" + responses: + "200": + application/json: {"status": "success", "message": "Agent retrieved successfully", "agent": {"_id": "agentInstances/e6f848ca-e2ab-4594-9925-e1136629f474", "_key": "e6f848ca-e2ab-4594-9925-e1136629f474", "_rev": "_lkNlcOm---", "name": "Customer Support Assistant", "createdBy": "", "models": [{"modelKey": "f3a4b5b6-5b6c-4e85-9097-3202cfe696fc", "modelName": "gpt-5.4-mini", "provider": "azureOpenAI", "isReasoning": true, "isMultimodal": true, "isDefault": true, "modelType": "llm", "modelFriendlyName": "GPT 5.4 mini"}], "toolsets": [{}], "knowledge": [], "shareWithOrg": false, "webSearch": {"provider": "serper"}, "tags": ["", "", ""], "createdAtTimestamp": 30926, "updatedAtTimestamp": 392228, "isActive": true, "isDeleted": true, "isServiceAccount": true, "access_type": "INDIVIDUAL", "user_role": "OWNER", "can_view": false, "can_share": false, "can_edit": false, "can_delete": false}} + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + "500": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + updateAgent: + speakeasy-default-update-agent: + parameters: + path: + agentKey: "customer-support-agent" + requestBody: + application/json: {"name": "Renamed Agent", "shareWithOrg": false, "isServiceAccount": false} + responses: + "200": + application/json: {"status": "success", "message": "Agent updated successfully"} + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + "500": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + deleteAgent: + speakeasy-default-delete-agent: + parameters: + path: + agentKey: "customer-support-agent" + responses: + "200": + application/json: {"status": "success", "message": "Agent deleted successfully", "deleted": {"agents": 1, "toolsets": 0, "tools": 0, "knowledge": 0, "edges": 0}} + "401": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + "500": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + listAgentArchivedConversationsGrouped: + speakeasy-default-list-agent-archived-conversations-grouped: + parameters: + query: + agentPage: 1 + agentLimit: 5 + responses: + "200": + application/json: {"groups": [{"agentKey": "", "conversations": [{}], "pagination": {"page": 271629, "limit": 567402, "totalCount": 256651, "totalPages": 502493, "hasNextPage": false, "hasPrevPage": false}}], "agentPagination": {"page": 730075, "limit": 720137, "totalCount": 76803, "totalPages": 428424, "hasNextPage": true, "hasPrevPage": true}, "meta": {"timestamp": "2026-01-24T10:59:22.606Z", "duration": 835706}} + listAgentConversationArchives: + speakeasy-default-list-agent-conversation-archives: + parameters: + path: + agentKey: "" + query: + page: 1 + limit: 20 + responses: + "200": + application/json: {"conversations": [], "pagination": {"page": 785206, "limit": 731638, "totalCount": 424802, "totalPages": 11981, "hasNextPage": false, "hasPrevPage": true}, "filters": {"applied": {"filters": [], "values": {}}, "available": {"shared": {"description": "underplay other smart dimly synthesise own past", "current": "", "applied": false}, "tags": {"description": "pfft before boohoo cease abscond duster incidentally marten", "current": "", "applied": false}, "minMessages": {"description": "decouple upset lucky descent colorfully doubtfully", "current": "", "applied": true}, "search": {"description": "regulate supposing around", "current": "", "applied": true}, "pagination": {"page": {"type": "", "current": 362463, "min": 649080, "max": 229846, "default": 356639, "description": "if ick blowgun afore muddy clinking", "applied": true}, "limit": {"type": "", "current": 793466, "min": 189881, "max": 202682, "default": 5927, "description": "till ashamed busily vibration gracious distinct roadway pertinent", "applied": false}}, "sorting": {"sortBy": {"values": ["", "", ""], "default": "", "description": "armchair aha where neatly rubbery outdo courtroom anenst tall", "current": ""}, "sortOrder": {"values": [""], "default": "", "description": "uselessly unwieldy palatable sandy whenever daddy phrase lest memorable", "current": ""}}, "dateFilters": {"dateRange": {"type": "", "description": "dense whose anti extroverted radiant ack chap approximate", "format": "", "current": {"start": "", "end": ""}, "applied": true}}, "messageFilters": {"messageType": {"description": "so who ah upon connect", "current": "", "applied": true}}, "sortingMessages": {"sortBy": {"values": ["", "", ""], "default": "", "description": "armchair aha where neatly rubbery outdo courtroom anenst tall", "current": ""}, "sortOrder": {"values": [""], "default": "", "description": "uselessly unwieldy palatable sandy whenever daddy phrase lest memorable", "current": ""}}}}, "summary": {}, "meta": {"timestamp": "2026-08-08T23:24:56.927Z", "duration": 177770}} + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + uploadAgentConversationChatAttachments: + speakeasy-default-upload-agent-conversation-chat-attachments: + parameters: + path: + agentKey: "" + requestBody: + multipart/form-data: {"files": []} + responses: + "200": + application/json: {"conversationId": "", "attachments": [{"recordId": "", "recordName": "", "mimeType": "", "extension": "gif", "virtualRecordId": ""}]} + deleteAgentConversationChatAttachment: + speakeasy-default-delete-agent-conversation-chat-attachment: + parameters: + path: + agentKey: "" + recordId: "" + responses: + "400": + application/json: {"error": "recordId is required"} + updateAgentConversationMessageFeedback: + speakeasy-default-update-agent-conversation-message-feedback: + parameters: + path: + agentKey: "" + conversationId: "" + messageId: "" + requestBody: + application/json: {} + responses: + "200": + application/json: {"conversationId": "", "messageId": "", "feedback": {"feedbackProvider": "", "timestamp": 609284, "metrics": {"timeToFeedback": 6820.92}}, "meta": {"requestId": "", "timestamp": "2025-02-21T03:20:40.086Z", "duration": 398510}} + archiveAgentConversation: + speakeasy-default-archive-agent-conversation: + parameters: + path: + agentKey: "" + conversationId: "" + responses: + "200": + application/json: {"id": "", "status": "archived", "archivedBy": "", "archivedAt": "2024-09-10T01:27:00.043Z", "meta": {"timestamp": "2025-08-04T22:41:12.596Z", "duration": 336748}} + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + unarchiveAgentConversation: + speakeasy-default-unarchive-agent-conversation: + parameters: + path: + agentKey: "" + conversationId: "" + responses: + "200": + application/json: {"id": "", "status": "unarchived", "unarchivedBy": "", "unarchivedAt": "2025-10-18T07:28:47.423Z", "meta": {"timestamp": "2024-12-21T20:34:18.141Z", "duration": 15797}} + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + updateAgentConversationTitle: + speakeasy-default-update-agent-conversation-title: + parameters: + path: + agentKey: "" + conversationId: "" + requestBody: + application/json: {"title": "ABC News Follow-up"} + responses: + "200": + application/json: {"conversation": {}, "meta": {"timestamp": "2024-12-31T04:40:35.772Z", "duration": 584339}} + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + deleteAgentConversationById: + speakeasy-default-delete-agent-conversation-by-id: + parameters: + path: + agentKey: "" + conversationId: "" + responses: + "200": + application/json: {"message": "Conversation deleted successfully", "conversation": {}} + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + "500": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + getAgentConversationById: + speakeasy-default-get-agent-conversation-by-id: + parameters: + path: + agentKey: "" + conversationId: "" + query: + page: 1 + limit: 20 + sortBy: "createdAt" + sortOrder: "desc" + responses: + "200": + application/json: {"conversation": {"id": "", "createdAt": "2024-07-29T17:51:05.802Z", "isShared": true, "sharedWith": [{}], "messages": [{}], "pagination": {"page": 266109, "limit": 237414, "totalCount": 244178, "totalPages": 384290, "hasNextPage": false, "hasPrevPage": false, "messageRange": {"start": 384672, "end": 182479}}, "access": {}}, "filters": {"applied": {"filters": [], "values": {}}, "available": {"shared": {"description": "an accessorise after misguided quantify", "current": null, "applied": true}, "tags": {"description": "given whoever accredit blissfully giggle until ham plus bah", "current": "", "applied": true}, "minMessages": {"description": "yogurt chiffonier towards scaly forager dish mmm than marten", "current": "", "applied": false}, "search": {"description": "if communicate below anenst", "current": "", "applied": true}, "pagination": {"page": {"type": "", "current": 886704, "min": 693046, "max": 456434, "default": 891213, "description": "times politely what under", "applied": false}, "limit": {"type": "", "current": 349607, "min": 650475, "max": 968170, "default": 53300, "description": "vice optimal linear acclaimed", "applied": true}}, "sorting": {"sortBy": {"values": [], "default": "", "description": "flustered cleverly up", "current": ""}, "sortOrder": {"values": ["", "", ""], "default": "", "description": "after rosy aboard cap less upbeat unbearably long", "current": ""}}, "dateFilters": {"dateRange": {"type": "", "description": "the possible consequently reasoning impish corrupt dimly", "format": "", "current": {"start": "", "end": ""}, "applied": false}}, "messageFilters": {"messageType": {"description": "valiantly until kooky hypothesise phooey resolve whether along bah swath", "current": "", "applied": false}}, "sortingMessages": {"sortBy": {"values": [], "default": "", "description": "flustered cleverly up", "current": ""}, "sortOrder": {"values": ["", "", ""], "default": "", "description": "after rosy aboard cap less upbeat unbearably long", "current": ""}}}}, "meta": {"timestamp": "2025-05-14T03:26:43.339Z", "duration": 838800, "conversationId": "", "messageCount": 297618}} + listAgentConversations: + speakeasy-default-list-agent-conversations: + parameters: + path: + agentKey: "" + query: + page: 1 + limit: 20 + startDate: "2026-05-26T00:00:00.000Z" + endDate: "2026-05-27T00:00:00.000Z" + responses: + "200": + application/json: {"conversations": [], "sharedWithMeConversations": [{}], "pagination": {"page": 634474, "limit": 256613, "totalCount": 833925, "totalPages": 896158, "hasNextPage": true, "hasPrevPage": false}, "filters": {"applied": {"filters": [], "values": {}}, "available": {"shared": {"description": "incidentally hmph quarrel manner fledgling pish", "current": "", "applied": true}, "tags": {"description": "questioningly factorize fond slushy jealous beautifully", "current": "", "applied": false}, "minMessages": {"description": "unnaturally pfft phooey bah though", "current": "", "applied": false}, "search": {"description": "key to provided", "current": "", "applied": true}, "pagination": {"page": {"type": "", "current": 504035, "min": 127202, "max": 525119, "default": 418494, "description": "bus plus confiscate", "applied": true}, "limit": {"type": "", "current": 374342, "min": 424949, "max": 632342, "default": 418576, "description": "throughout viciously foolishly", "applied": true}}, "sorting": {"sortBy": {"values": ["", ""], "default": "", "description": "colorfully amused fondly", "current": ""}, "sortOrder": {"values": [], "default": "", "description": "lovable duh solace hippodrome wrongly tomorrow customise but", "current": ""}}, "dateFilters": {"dateRange": {"type": "", "description": "contrail yuck tired likewise tomorrow", "format": "", "current": {"start": "", "end": ""}, "applied": false}}, "messageFilters": {"messageType": {"description": "winding for longingly both draw", "current": "", "applied": true}}, "sortingMessages": {"sortBy": {"values": ["", ""], "default": "", "description": "colorfully amused fondly", "current": ""}, "sortOrder": {"values": [], "default": "", "description": "lovable duh solace hippodrome wrongly tomorrow customise but", "current": ""}}}}, "meta": {"timestamp": "2025-09-28T23:33:27.255Z", "duration": 536577}} + "400": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} + getAvailableModelsByType: + two_llm_models: + parameters: + path: + modelType: "embedding" + responses: + "200": + application/json: {"status": "success", "message": "Found 2 llm models", "models": [{"modelType": "llm", "provider": "azureOpenAI", "modelName": "gpt-5.4-mini", "modelKey": "f3a4b5b6-5b6c-4e85-9097-3202cfe696fc", "isMultimodal": true, "isReasoning": true, "isDefault": true}, {"modelType": "llm", "provider": "azureOpenAI", "modelName": "gpt-5.4", "modelKey": "7af8d3a7-ad2e-43a1-8716-ae95e4fbc888", "isMultimodal": true, "isReasoning": true, "isDefault": false, "modelFriendlyName": "Reasoning model"}]} + no_models_configured: + parameters: + path: + modelType: "llm" + responses: + "200": + application/json: {"status": "success", "message": "Found 0 ocr models", "models": []} + speakeasy-default-get-available-models-by-type: + parameters: + path: + modelType: "imageGeneration" + responses: + "200": + application/json: {"status": "success", "message": "Found 2 llm models", "models": []} + "400": + application/json: {"error": {"code": "VALIDATION_ERROR", "message": "Validation failed", "metadata": {"errors": []}}} + "401": + application/json: {"error": {"code": "HTTP_UNAUTHORIZED", "message": "Invalid token"}} + "403": + application/json: {"error": {"code": "HTTP_FORBIDDEN", "message": "Insufficient scope. Required: config:read"}} + "500": + application/json: {"error": {"code": "HTTP_INTERNAL_SERVER_ERROR", "message": "An unexpected error occurred"}} + getWebSearchProviders: + speakeasy-default-get-web-search-providers: + responses: + "200": + application/json: {"status": "success", "providers": [], "settings": {"includeImages": true}, "message": ""} + "401": + application/json: {"error": {"code": "HTTP_BAD_REQUEST", "message": "Admin access required"}} +examplesVersion: 1.0.2 diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml new file mode 100644 index 00000000..8cf138e3 --- /dev/null +++ b/.speakeasy/gen.yaml @@ -0,0 +1,53 @@ +configVersion: 2.0.0 +generation: + sdkClassName: SDK + maintainOpenAPIOrder: true + usageSnippets: + optionalPropertyRendering: withExample + sdkInitStyle: constructor + useClassNamesForArrayFields: true + fixes: + nameResolutionDec2023: true + nameResolutionFeb2025: true + parameterOrderingFeb2024: true + requestResponseComponentNamesFeb2024: true + securityFeb2025: true + sharedErrorComponentsApr2025: true + sharedNestedComponentsJan2026: true + nameOverrideFeb2026: true + auth: + oAuth2ClientCredentialsEnabled: true + oAuth2PasswordEnabled: true + hoistGlobalSecurity: true + inferSSEOverload: true + sdkHooksConfigAccess: true + schemas: + allOfMergeStrategy: shallowMerge + requestBodyFieldName: body + versioningStrategy: automatic + persistentEdits: {} + tests: + generateTests: false + generateNewTests: true + skipResponseBodyAssertions: false +mcp-typescript: + version: 0.0.1 + additionalDependencies: + dependencies: {} + devDependencies: {} + peerDependencies: {} + advancedFlags: [] + author: Speakeasy + baseErrorName: SDKError + cloudflareEnabled: false + defaultErrorName: SDKDefaultError + formStringArrayEncodeMode: array + gramEnabled: false + inferUnionDiscriminators: true + inputModelSuffix: input + maxMethodParams: 0 + multipartArrayFormat: standard + outputModelSuffix: output + packageName: mcp + responseFormat: flat + validateResponse: false diff --git a/README.md b/README.md index f72e9f14..a8d021fe 100644 --- a/README.md +++ b/README.md @@ -783,3 +783,229 @@ Then connect to `PIPESHUB_INSTANCE_URL/mcp` with a Bearer token to test the endp + + +## Summary + +PipesHub API: Unified API documentation for PipesHub services. + +PipesHub is an enterprise-grade platform providing: +- User authentication and management +- Document storage and version control +- Knowledge base management +- Enterprise search and conversational AI +- Third-party integrations via connectors +- System configuration management +- Crawling job scheduling +- Email services + +## Authentication +Most endpoints require JWT Bearer token authentication. Some internal endpoints use scoped tokens for service-to-service communication. + +**OAuth 2.0 Bearer tokens** from `POST /oauth2/token` use the same `Authorization: Bearer` header. For **`client_credentials`**, machine tokens may encode `userId === client_id` in the JWT; the **Node API gateway** resolves the OAuth **app creator**, sets the authenticated user accordingly, and forwards **`x-oauth-user-id`** to Python services on proxied calls. Do not send **`x-oauth-user-id`** yourself—the gateway removes untrusted values on ingress. See the **OAuth Provider** tag for full behavior. + +## Base URLs +All endpoints use the `/api/v1` prefix unless otherwise noted. + + + +## Table of Contents + +* [Connecting MCP Clients to PipesHub MCP Server](#connecting-mcp-clients-to-pipeshub-mcp-server) + * [Prerequisites](#prerequisites) + * [Step 1: Create an OAuth App in PipesHub](#step-1-create-an-oauth-app-in-pipeshub) + * [Placeholders](#placeholders) + * [Remote MCP Setup](#remote-mcp-setup) +* [List servers and their auth status](#list-servers-and-their-auth-status) +* [Authenticate with PipesHub (opens browser for login)](#authenticate-with-pipeshub-opens-browser-for-login) +* [Re-authenticate if tokens expire](#re-authenticate-if-tokens-expire) +* [List all configured servers](#list-all-configured-servers) +* [Remove the server](#remove-the-server) +* [Temporarily disable/enable](#temporarily-disableenable) + + + + +## Installation + +
+Claude Desktop + +Install the MCP server as a Desktop Extension using the pre-built [`mcp-server.mcpb`](./mcp-server.mcpb) file: + +Simply drag and drop the [`mcp-server.mcpb`](./mcp-server.mcpb) file onto Claude Desktop to install the extension. + +The MCP bundle package includes the MCP server and all necessary configuration. Once installed, the server will be available without additional setup. + +> [!NOTE] +> MCP bundles provide a streamlined way to package and distribute MCP servers. Learn more about [Desktop Extensions](https://www.anthropic.com/engineering/desktop-extensions). + +
+ +
+Cursor + +[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](cursor://anysphere.cursor-deeplink/mcp/install?name=SDK&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJtY3AiLCJzdGFydCIsIi0tc2VydmVyLWluZGV4IiwiMCIsIi0taW5zdGFuY2UtdXJsIiwiaHR0cHM6Ly9hcHAucGlwZXNodWIuY29tIiwiLS1iZWFyZXItYXV0aCIsIiIsIi0tY2xpZW50LWlkIiwiIiwiLS1jbGllbnQtc2VjcmV0IiwiIiwiLS10b2tlbi11cmwiLCIvYXBpL3YxL29hdXRoMi90b2tlbiJdfQ==) + +Or manually: + +1. Open Cursor Settings +2. Select Tools and Integrations +3. Select New MCP Server +4. If the configuration file is empty paste the following JSON into the MCP Server Configuration: + +```json +{ + "command": "npx", + "args": [ + "mcp", + "start", + "--server-index", + "0", + "--instance-url", + "https://app.pipeshub.com", + "--bearer-auth", + "", + "--client-id", + "", + "--client-secret", + "", + "--token-url", + "/api/v1/oauth2/token" + ] +} +``` + +
+ +
+Claude Code CLI + +```bash +claude mcp add SDK -- npx -y mcp start --server-index 0 --instance-url https://app.pipeshub.com --bearer-auth --client-id --client-secret --token-url /api/v1/oauth2/token +``` + +
+
+Gemini + +```bash +gemini mcp add SDK -- npx -y mcp start --server-index 0 --instance-url https://app.pipeshub.com --bearer-auth --client-id --client-secret --token-url /api/v1/oauth2/token +``` + +
+
+Windsurf + +Refer to [Official Windsurf documentation](https://docs.windsurf.com/windsurf/cascade/mcp#adding-a-new-mcp-plugin) for latest information + +1. Open Windsurf Settings +2. Select Cascade on left side menu +3. Click on `Manage MCPs`. (To Manage MCPs you should be signed in with a Windsurf Account) +4. Click on `View raw config` to open up the mcp configuration file. +5. If the configuration file is empty paste the full json + +```bash +{ + "command": "npx", + "args": [ + "mcp", + "start", + "--server-index", + "0", + "--instance-url", + "https://app.pipeshub.com", + "--bearer-auth", + "", + "--client-id", + "", + "--client-secret", + "", + "--token-url", + "/api/v1/oauth2/token" + ] +} +``` +
+
+VS Code + +[![Install in VS Code](https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20SDK%20MCP&color=0098FF)](vscode://ms-vscode.vscode-mcp/install?name=SDK&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJtY3AiLCJzdGFydCIsIi0tc2VydmVyLWluZGV4IiwiMCIsIi0taW5zdGFuY2UtdXJsIiwiaHR0cHM6Ly9hcHAucGlwZXNodWIuY29tIiwiLS1iZWFyZXItYXV0aCIsIiIsIi0tY2xpZW50LWlkIiwiIiwiLS1jbGllbnQtc2VjcmV0IiwiIiwiLS10b2tlbi11cmwiLCIvYXBpL3YxL29hdXRoMi90b2tlbiJdfQ==) + +Or manually: + +Refer to [Official VS Code documentation](https://code.visualstudio.com/api/extension-guides/ai/mcp) for latest information + +1. Open [Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) +1. Search and open `MCP: Open User Configuration`. This should open mcp.json file +2. If the configuration file is empty paste the full json + +```bash +{ + "command": "npx", + "args": [ + "mcp", + "start", + "--server-index", + "0", + "--instance-url", + "https://app.pipeshub.com", + "--bearer-auth", + "", + "--client-id", + "", + "--client-secret", + "", + "--token-url", + "/api/v1/oauth2/token" + ] +} +``` + +
+
+ Stdio installation via npm +To start the MCP server, run: + +```bash +npx mcp start --server-index 0 --instance-url https://app.pipeshub.com --bearer-auth --client-id --client-secret --token-url /api/v1/oauth2/token +``` + +For a full list of server arguments, run: + +``` +npx mcp --help +``` + +
+ + + +## Progressive Discovery + +MCP servers with many tools can bloat LLM context windows, leading to increased token usage and tool confusion. Dynamic mode solves this by exposing only a small set of meta-tools that let agents progressively discover and invoke tools on demand. + +To enable dynamic mode, pass the `--mode dynamic` flag when starting your server: + +```jsonc +{ + "mcpServers": { + "SDK": { + "command": "npx", + "args": ["mcp", "start", "--mode", "dynamic"], + // ... other server arguments + } + } +} +``` + +In dynamic mode, the server registers only the following meta-tools instead of every individual tool: + +- **`list_tools`**: Lists all available tools with their names and descriptions. +- **`describe_tool`**: Returns the input schema for one or more tools by name. +- **`execute_tool`**: Executes a tool by name with the provided input parameters. + +This approach significantly reduces the number of tokens sent to the LLM on each request, which is especially useful for servers with a large number of tools. + + + diff --git a/manifest.json b/manifest.json index 9a8c0906..ed47e511 100644 --- a/manifest.json +++ b/manifest.json @@ -1,9 +1,9 @@ { "manifest_version": "0.3", "name": "mcp", - "version": "0.0.4", + "version": "0.0.1", "description": "", - "long_description": "PipesHub API: # PipesHub MCP — read-only tool set\n\nThis server exposes 10 read-style tools over the PipesHub workplace AI\nplatform. All tools require a bearer token (or OAuth `read` scope).\n\n## Discovery (call first if you don't already have these ids)\n\n- `pipeshub-list-sources` — root nodes of the knowledge hub. Each item's\n `id` is exactly the value to put in `filters.apps` on a chat or search\n request. At the root you'll see one entry per connector instance\n (e.g. Box, Drive) with id = a UUID, plus the synthetic\n `knowledgeBase_` entry (`connector: \"KB\"`) representing the\n org's knowledge base.\n- `pipeshub-list-models` — configured AI models of a given `modelType`\n (default: `llm`). Each item's `modelKey` is what to pass on chat /\n search requests. Pick `isDefault: true` unless the user asked for a\n specific model.\n\n## Chat with the user's enterprise data\n\n1. **Start a chat** with `pipeshub-chat` (POST /conversations/create).\n Pass the user's question in `query`. For source scoping, populate\n `filters.apps` with ids from `pipeshub-list-sources` (mix connector\n UUIDs and the `knowledgeBase_` synthetic id freely).\n Always leave `filters.kb` as `[]` — the server scopes via `apps`.\n2. **Continue the chat** with `pipeshub-chat-continue`\n (POST /conversations/{conversationId}/messages). Pass the\n `conversationId` you captured from the previous response and the\n user's next question in `query`. Server-side context is preserved on\n the conversation; do NOT call `pipeshub-chat` again unless the user\n explicitly asks to start over.\n3. The AI's reply is the last `bot_response` message in\n `conversation.messages`. Citations on that message tell you which\n records the answer was grounded in\n (`citations[*].metadata.recordId`).\n\n## Find and download documents\n\n- `pipeshub-search` (POST /search) does semantic search across the org's\n indexed records. Use it to resolve a filename / topic into a\n `recordId`. Read\n `searchResponse.searchResults[*].metadata.recordId`. Same `apps`\n scoping rules as chat — get ids from `pipeshub-list-sources`.\n- `pipeshub-download-record`\n (GET /knowledgeBase/stream/record/{recordId}) streams the file bytes.\n Get the `recordId` from a chat citation OR from a search result.\n- For \"download the file the AI just cited\": pull `recordId` straight\n from the chat's `citations[*].metadata.recordId`, no extra search call\n needed.\n\n## Look up people, groups, and teams\n\n- `pipeshub-list-users` (GET /users) — list / search org users. Pass\n `search=` to match by name or email.\n- `pipeshub-get-user` (GET /users/{id}) — full profile for one user,\n including the authenticated user themself (decode the JWT `userId`\n claim to find their id, or list-and-match-on-email).\n- `pipeshub-list-user-groups` (GET /userGroups) — list user groups.\n- `pipeshub-list-my-teams` (GET /teams/user/teams) — teams the caller\n belongs to.\n\n## Behavior hints\n\n- These tools are **read / query**; none of them is destructive. The\n three POST tools (`pipeshub-chat`, `pipeshub-chat-continue`,\n `pipeshub-search`) persist a conversation / search record but never\n mutate org data.\n- `filters.apps` accepts both connector instance UUIDs AND the\n `knowledgeBase_` synthetic id — never pass connector type\n names (`\"drive\"`, `\"gmail\"`, ...). `filters.kb` is unused; keep it\n `[]`.\n- `Conversation.status` values are mixed-case\n (`Complete`, `Failed`, `Inprogress`, `None`). `Message.confidence`\n values are `High`, `Medium`, `Low`, `Very High`, `Unknown`.\n", + "long_description": "PipesHub API: Unified API documentation for PipesHub services.\n\nPipesHub is an enterprise-grade platform providing:\n- User authentication and management\n- Document storage and version control\n- Knowledge base management\n- Enterprise search and conversational AI\n- Third-party integrations via connectors\n- System configuration management\n- Crawling job scheduling\n- Email services\n\n## Authentication\nMost endpoints require JWT Bearer token authentication. Some internal endpoints use scoped tokens for service-to-service communication.\n\n**OAuth 2.0 Bearer tokens** from `POST /oauth2/token` use the same `Authorization: Bearer` header. For **`client_credentials`**, machine tokens may encode `userId === client_id` in the JWT; the **Node API gateway** resolves the OAuth **app creator**, sets the authenticated user accordingly, and forwards **`x-oauth-user-id`** to Python services on proxied calls. Do not send **`x-oauth-user-id`** yourself—the gateway removes untrusted values on ingress. See the **OAuth Provider** tag for full behavior.\n\n## Base URLs\nAll endpoints use the `/api/v1` prefix unless otherwise noted.\n", "author": { "name": "Speakeasy" }, @@ -33,77 +33,56 @@ "display_name": "Mcp", "prompts": [], "keywords": [ - "mcp", - "pipeshub", - "api", - "read" - ], + "mcp", + "pipeshub", + "api", + "unified", + "documentation" + ], "user_config": { - "server_index": { - "type": "number", - "title": "Server Index", - "description": "Available servers: [https://{instance_url}/api/v1, https://{instance_url}]", - "required": false, - "default": "0", - "max": 1 - }, - "instance_url": { - "type": "string", - "title": "instance_url", - "description": "Base server URL Templated in https://{instance_url}.", - "required": false, - "default": "https://app.pipeshub.com" - }, - "bearer_auth": { - "type": "string", - "title": "bearerAuth", - "description": "The bearerAuth to use for the request", - "required": false, - "sensitive": true - }, - "client_id": { - "type": "string", - "title": "ClientID", - "description": "The ClientID to use for the request", - "required": true, - "sensitive": true - }, - "client_secret": { - "type": "string", - "title": "ClientSecret", - "description": "The ClientSecret to use for the request", - "required": true, - "sensitive": true - }, - "token_url": { - "type": "string", - "title": "TokenURL", - "description": "The TokenURL to use for the request", - "required": true, - "default": "/api/v1/oauth2/token", - "sensitive": true + "server_index": { + "type": "number", + "title": "Server Index", + "description": "Available servers: [https://{instance_url}/api/v1, https://{instance_url}]", + "required": false, + "default": "0", + "max": 1 + }, + "instance_url": { + "type": "string", + "title": "instance_url", + "description": "Base server URL Templated in https://{instance_url}.", + "required": false, + "default": "https://app.pipeshub.com" + }, + "bearer_auth": { + "type": "string", + "title": "bearerAuth", + "description": "The bearerAuth to use for the request", + "required": false, + "sensitive": true + }, + "client_id": { + "type": "string", + "title": "ClientID", + "description": "The ClientID to use for the request", + "required": true, + "sensitive": true + }, + "client_secret": { + "type": "string", + "title": "ClientSecret", + "description": "The ClientSecret to use for the request", + "required": true, + "sensitive": true + }, + "token_url": { + "type": "string", + "title": "TokenURL", + "description": "The TokenURL to use for the request", + "required": true, + "default": "/api/v1/oauth2/token", + "sensitive": true + } } - }, - "tools": [ - { - "name": "pipeshub_sources", - "description": "Discover available chat sources and AI models in one call.\n\nReturns up to three sections:\n\n- `sources` — every connector instance the org has wired up plus the\n synthetic `knowledgeBase_` entry for the org's KB. Each\n item's `id` is exactly the value to put in `pipeshub_chat`'s or\n `pipeshub_search`'s `apps` filter.\n- `llmModels` — chat / generation models. Each item's `modelKey`\n is the value to pass on `pipeshub_chat` / `pipeshub_search` as\n `modelKey`. Pick `isDefault: true` unless the user asks for a\n specific model.\n- `embeddingModels` — vector embedding models (only fetched when\n explicitly requested via `include`).\n\nCall this once at the start of a session and cache the result —\nsources and models change infrequently. `sources` and `llmModels`\nare returned by default; pass `include` to override." - }, - { - "name": "pipeshub_chat", - "description": "**Default tool for anything PipesHub-related.** Use this whenever the\nuser asks about their documents, files, knowledge base, company\npolicies, or anything that could plausibly be answered by content in\ntheir PipesHub-indexed sources (Drive, Box, Confluence, Slack, Gmail,\nJira, the org's KB, ...). Do NOT answer those from your own knowledge —\n`pipeshub_chat` grounds the answer in the user's actual data and\nreturns citations.\n\n**When to pick this over other tools:**\n- \"What does say about X?\" → `pipeshub_chat` (NOT search;\n search is only for locating files by name).\n- \"Summarize .\" → `pipeshub_chat`.\n- \"What's our policy on Y?\" → `pipeshub_chat`.\n- \"What do we know about Z?\" → `pipeshub_chat`.\n- \"Find / locate the file named X\" → `pipeshub_search` (then\n `pipeshub_download_record` if the user wants the bytes).\n\n**Conversation lifecycle** — one tool, both start and continue:\n\n- **First turn**: omit `conversationId`. The server creates a new\n conversation; capture `conversationId` from the response.\n- **Follow-up turn**: pass the `conversationId` from the previous\n response. Server-side context is preserved — do NOT replay earlier\n messages, and `filters` is ignored on follow-ups (set once at\n creation).\n\nOnly re-omit `conversationId` (start a fresh conversation) when the\nuser explicitly asks to start over / clear context.\n\nThe response contains the AI's `answer` plus `citations`. To download a\ncited document, take `citations[*].recordId` and call\n`pipeshub_download_record`." - }, - { - "name": "pipeshub_search", - "description": "Vector / semantic search across the org's indexed documents.\n\n**Use this only when the user wants to LOCATE a document** — by name,\ntopic, or a phrase to grep for. For \"what does the document say about\nX?\" or any open-ended question, use `pipeshub_chat` instead, which\ndoes the retrieval internally and grounds the answer in citations.\n\nTypical uses:\n- Resolve a filename / phrase into a `recordId` for\n `pipeshub_download_record`.\n- Show the user a ranked list of matching files when they ask \"find /\n search for X\".\n\nThe response is trimmed to one row per hit:\n`{ recordId, recordName, score, snippet, mimeType, webUrl, ... }`.\nHighest `score` first; multiple hits may share the same `recordId`\n(different chunks of the same record)." - }, - { - "name": "pipeshub_download_record", - "description": "Stream the binary content of a single record from PipesHub.\n\nTypical sources for the `recordId`:\n- A chat citation:\n `pipeshub_chat` response → `citations[*].recordId`.\n- A search result:\n `pipeshub_search` response → `hits[*].recordId` /\n `uniqueRecords[*].recordId`.\n\nResponse `Content-Type` is forwarded from the upstream service —\n`application/pdf`, `application/octet-stream`, etc. Binary content is\nreturned base64-encoded; text content is returned inline." - }, - { - "name": "pipeshub_directory", - "description": "Look up people, groups, and teams in PipesHub. One tool with five\nactions — pick the right `action`:\n\n- `whoami` — who is the caller? Use this whenever you need the\n authenticated user's own id, email, or full name (e.g. before\n `get_user` on themselves).\n- `list_users` — search / page through org users.\n- `get_user` — full `User` document for one user (requires `userId`).\n- `list_groups` — list user groups with `userCount`.\n- `list_my_teams` — teams the caller belongs to, with capability flags\n (`canEdit` / `canDelete` / `canManageMembers`).\n\nOutput shape varies by action; see each action's docs above." - } - ] } \ No newline at end of file diff --git a/package.json b/package.json index 605f918b..5db3a3a9 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,10 @@ { - "name": "@pipeshub-ai/mcp", - "version": "2.0.1", - "author": "Pipeshub", + "name": "mcp", + "version": "0.0.1", + "author": "Speakeasy", "type": "module", "sideEffects": false, "bin": { - "@aashil/mcp": "bin/mcp-server.js", "mcp": "bin/mcp-server.js" }, "scripts": { diff --git a/src/core.ts b/src/core.ts index 0d57d471..c4486e4a 100644 --- a/src/core.ts +++ b/src/core.ts @@ -10,4 +10,4 @@ import { ClientSDK } from "./lib/sdks.js"; * application and passed around through some dependency injection mechanism to * parts of an application that need to make SDK calls. */ -export class PipeshubCore extends ClientSDK {} +export class SDKCore extends ClientSDK {} diff --git a/src/funcs/conversationsStreamMessage.ts b/src/funcs/agentsArchiveAgentConversation.ts similarity index 70% rename from src/funcs/conversationsStreamMessage.ts rename to src/funcs/agentsArchiveAgentConversation.ts index d9a525aa..59768291 100644 --- a/src/funcs/conversationsStreamMessage.ts +++ b/src/funcs/agentsArchiveAgentConversation.ts @@ -1,22 +1,18 @@ -// Hand-written supplement (NOT generated). Mirrors -// `conversationsAddMessage.ts` but POSTs to -// `/conversations/{conversationId}/messages/stream` and asks for an SSE -// response. The body shape is identical to the non-streaming sibling, so -// we reuse `AddMessageRequestRequest`'s zod schema. Returns the raw -// streaming `Response`; the caller is expected to parse `text/event-stream` -// line-by-line. +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ -import { PipeshubCore } from "../core.js"; -import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import { SDKCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; import { compactMap } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; import { RequestOptions } from "../lib/sdks.js"; import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; import { pathToFunc } from "../lib/url.js"; import { - AddMessageRequestRequest, - AddMessageRequestRequest$zodSchema, -} from "../models/addmessageop.js"; + ArchiveAgentConversationRequest, + ArchiveAgentConversationRequest$zodSchema, +} from "../models/archiveagentconversationop.js"; import { APIError } from "../models/errors/apierror.js"; import { ConnectionError, @@ -29,9 +25,15 @@ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import { APICall, APIPromise } from "../types/async.js"; import { Result } from "../types/fp.js"; -export function conversationsStreamMessage( - client$: PipeshubCore, - request: AddMessageRequestRequest, +/** + * Archive an agent conversation + * + * @remarks + * Marks the conversation as archived for the authenticated owner. + */ +export function agentsArchiveAgentConversation( + client$: SDKCore, + request: ArchiveAgentConversationRequest, options?: RequestOptions, ): APIPromise< Result< @@ -45,12 +47,16 @@ export function conversationsStreamMessage( | ConnectionError > > { - return new APIPromise($do(client$, request, options)); + return new APIPromise($do( + client$, + request, + options, + )); } async function $do( - client$: PipeshubCore, - request: AddMessageRequestRequest, + client$: SDKCore, + request: ArchiveAgentConversationRequest, options?: RequestOptions, ): Promise< [ @@ -69,28 +75,33 @@ async function $do( > { const parsed$ = safeParse( request, - (value$) => AddMessageRequestRequest$zodSchema.parse(value$), + (value$) => ArchiveAgentConversationRequest$zodSchema.parse(value$), "Input validation failed", ); if (!parsed$.ok) { return [parsed$, { status: "invalid" }]; } const payload$ = parsed$.value; - const body$ = encodeJSON("body", payload$.body, { explode: true }); + const body$ = null; const pathParams$ = { + agentKey: encodeSimple("agentKey", payload$.agentKey, { + explode: false, + charEncoding: "percent", + }), conversationId: encodeSimple("conversationId", payload$.conversationId, { explode: false, charEncoding: "percent", }), }; const path$ = pathToFunc( - "/conversations/{conversationId}/messages/stream", - )(pathParams$); + "/agents/{agentKey}/conversations/{conversationId}/archive", + )( + pathParams$, + ); const headers$ = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "text/event-stream", + Accept: "application/json", })); const securityInput = await extractSecurity(client$._options.security); const requestSecurity = resolveGlobalSecurity(securityInput); @@ -98,8 +109,8 @@ async function $do( const context = { options: client$._options, baseURL: options?.serverURL ?? client$._baseURL ?? "", - operationID: "streamAddMessage", - oAuth2Scopes: ["conversation:chat"], + operationID: "archiveAgentConversation", + oAuth2Scopes: ["agent:write"], resolvedSecurity: requestSecurity, securitySource: client$._options.security, retryConfig: options?.retries @@ -122,7 +133,8 @@ async function $do( headers: headers$, body: body$, userAgent: client$._options.userAgent, - timeoutMs: options?.timeoutMs || -1, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, }, options); if (!requestRes.ok) { return [requestRes, { status: "invalid" }]; diff --git a/src/funcs/agentsCreateAgent.ts b/src/funcs/agentsCreateAgent.ts new file mode 100644 index 00000000..0268dcff --- /dev/null +++ b/src/funcs/agentsCreateAgent.ts @@ -0,0 +1,160 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeJSON } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + AgentCreateRequest, + AgentCreateRequest$zodSchema, +} from "../models/agentcreaterequest.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Create agent + * + * @remarks + * Create a new custom AI agent. + * + * **Overview:** + * Agents are specialized AI assistants configured for specific tasks. + * They can have custom system prompts, access to specific tools, and + * be limited to certain knowledge bases. + * + * **Agent Configuration:** + * - **System prompt:** Instructions that define agent behavior + * - **Tools:** Capabilities like web search, code execution, etc. + * - **Knowledge bases:** Data sources the agent can access + * - **Model config:** AI model settings (temperature, max tokens) + * + * **Use Cases:** + * - Customer support bot with product knowledge + * - Code review assistant with repository access + * - HR assistant with policy documents + */ +export function agentsCreateAgent( + client$: SDKCore, + request: AgentCreateRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: AgentCreateRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => AgentCreateRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = encodeJSON("body", payload$, { explode: true }); + const path$ = pathToFunc("/agents/create")(); + + const headers$ = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "createAgent", + oAuth2Scopes: ["agent:write"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/agentsDeleteAgent.ts b/src/funcs/agentsDeleteAgent.ts new file mode 100644 index 00000000..efaf5a41 --- /dev/null +++ b/src/funcs/agentsDeleteAgent.ts @@ -0,0 +1,169 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + DeleteAgentRequest, + DeleteAgentRequest$zodSchema, +} from "../models/deleteagentop.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Delete agent + * + * @remarks + * Soft-delete an agent (tombstone) in the graph database. + * + * **Overview:** + * The Python query service marks the agent instance deleted inside a transaction. + * List and search endpoints exclude tombstoned agents. Toolsets, tools, and + * knowledge linked to the agent are not removed by this call. + * + * **Permissions:** + * Only the agent owner may delete (`can_delete` on the permission check). + * + * **Warning:** + * All conversations with this agent will become inaccessible. + * + * **Observed gateway behavior (localhost integration tests):** + * Unknown `agentKey`, deleting an already-deleted agent, and `GET /agents/{agentKey}` + * after delete currently return **HTTP 500** with an `ErrorResponse` body (message + * often mentions the agent or "not found"), not 404. The Python backend raises 404 + * for not-found when called directly; the Node proxy may surface 500 instead. + */ +export function agentsDeleteAgent( + client$: SDKCore, + request: DeleteAgentRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: DeleteAgentRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => DeleteAgentRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + agentKey: encodeSimple("agentKey", payload$.agentKey, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/agents/{agentKey}")( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "deleteAgent", + oAuth2Scopes: ["agent:write"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "DELETE", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/agentsDeleteAgentConversationById.ts b/src/funcs/agentsDeleteAgentConversationById.ts new file mode 100644 index 00000000..13765a17 --- /dev/null +++ b/src/funcs/agentsDeleteAgentConversationById.ts @@ -0,0 +1,166 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + DeleteAgentConversationByIdRequest, + DeleteAgentConversationByIdRequest$zodSchema, +} from "../models/deleteagentconversationbyidop.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Delete an agent conversation + * + * @remarks + * Soft-deletes an agent conversation owned by the authenticated user. + * + * The controller scopes the lookup by `_id`, `orgId`, `userId`, and + * `agentKey`. If no matching writable conversation is found, the route is + * intentionally a no-op and still returns HTTP 200 with `conversation: null`. + * + * This makes the operation idempotent: + * + * - deleting a nonexistent conversation returns success with `null` + * - deleting through a different `agentKey` returns success with `null` + * - deleting an already deleted conversation returns success with `null` + */ +export function agentsDeleteAgentConversationById( + client$: SDKCore, + request: DeleteAgentConversationByIdRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: DeleteAgentConversationByIdRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => DeleteAgentConversationByIdRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + agentKey: encodeSimple("agentKey", payload$.agentKey, { + explode: false, + charEncoding: "percent", + }), + conversationId: encodeSimple("conversationId", payload$.conversationId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/agents/{agentKey}/conversations/{conversationId}")( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "deleteAgentConversationById", + oAuth2Scopes: ["agent:write"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "DELETE", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/agentsDeleteAgentConversationChatAttachment.ts b/src/funcs/agentsDeleteAgentConversationChatAttachment.ts new file mode 100644 index 00000000..195ba6bb --- /dev/null +++ b/src/funcs/agentsDeleteAgentConversationChatAttachment.ts @@ -0,0 +1,166 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + DeleteAgentConversationChatAttachmentRequest, + DeleteAgentConversationChatAttachmentRequest$zodSchema, +} from "../models/deleteagentconversationchatattachmentop.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Delete an agent chat attachment + * + * @remarks + * Deletes a previously uploaded attachment by proxying `DELETE` to the query service + * (`/api/v1/chat/attachments/{recordId}`). The Node handler always ends the response **without + * a JSON body** on success (empty body); the **status code** is the upstream status, or **204** + * if none is returned. + * + * On validation failure in the gateway (invalid / blank path params), the response is **400** + * with a small JSON error object. Same fire-and-forget semantics as + * `DELETE /conversations/attachments/{recordId}` on the client. + */ +export function agentsDeleteAgentConversationChatAttachment( + client$: SDKCore, + request: DeleteAgentConversationChatAttachmentRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: DeleteAgentConversationChatAttachmentRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => + DeleteAgentConversationChatAttachmentRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + agentKey: encodeSimple("agentKey", payload$.agentKey, { + explode: false, + charEncoding: "percent", + }), + recordId: encodeSimple("recordId", payload$.recordId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc( + "/agents/{agentKey}/conversations/attachments/{recordId}", + )( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "deleteAgentConversationChatAttachment", + oAuth2Scopes: ["agent:execute"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "DELETE", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/usersGetUserById.ts b/src/funcs/agentsGetAgent.ts similarity index 67% rename from src/funcs/usersGetUserById.ts rename to src/funcs/agentsGetAgent.ts index 27fd1807..16b7bd13 100644 --- a/src/funcs/usersGetUserById.ts +++ b/src/funcs/agentsGetAgent.ts @@ -2,7 +2,7 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { PipeshubCore } from "../core.js"; +import { SDKCore } from "../core.js"; import { encodeSimple } from "../lib/encodings.js"; import { compactMap } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; @@ -19,42 +19,27 @@ import { } from "../models/errors/httpclienterrors.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import { - GetUserByIdRequest, - GetUserByIdRequest$zodSchema, -} from "../models/getuserbyidop.js"; + GetAgentRequest, + GetAgentRequest$zodSchema, +} from "../models/getagentop.js"; import { APICall, APIPromise } from "../types/async.js"; import { Result } from "../types/fp.js"; /** - * Get user by ID + * Get agent * * @remarks - * Retrieve detailed information about a specific user by their unique identifier.

- * Overview:
- * This endpoint returns the complete user profile for the specified user ID. Use this to display user details in profiles, settings pages, or when you need full user information.

- * Response Data:
- *
    - *
  • Basic info: fullName, firstName, lastName, email
  • - *
  • Contact: mobile, address
  • - *
  • Professional: designation
  • - *
  • Status: hasLoggedIn, isDeleted, accountStatus
  • - *
  • Metadata: createdAt, updatedAt, createdBy
  • - *
- * Privacy Notes:
- *
    - *
  • Email may be masked for non-admin users based on org settings
  • - *
  • Password and sensitive tokens are never returned
  • - *
  • Display picture URL returned if set
  • - *
- * Related Endpoints:
- *
    - *
  • GET /users/{id}/email - Get just the email (admin only)
  • - *
  • GET /users/fetch/with-groups - Get user with group memberships
  • - *
+ * Retrieve agent details by its unique key. + * + * **Observed gateway behavior (localhost integration tests):** + * Unknown `agentKey`, lookup after soft-delete, and other AI-backend failures + * currently return **HTTP 500** with an `ErrorResponse` body (message often + * mentions the agent or "not found"), not 404. The Python query service may + * return 404 when called directly; the Node proxy surfaces 500 instead. */ -export function usersGetUserById( - client$: PipeshubCore, - request: GetUserByIdRequest, +export function agentsGetAgent( + client$: SDKCore, + request: GetAgentRequest, options?: RequestOptions, ): APIPromise< Result< @@ -76,8 +61,8 @@ export function usersGetUserById( } async function $do( - client$: PipeshubCore, - request: GetUserByIdRequest, + client$: SDKCore, + request: GetAgentRequest, options?: RequestOptions, ): Promise< [ @@ -96,7 +81,7 @@ async function $do( > { const parsed$ = safeParse( request, - (value$) => GetUserByIdRequest$zodSchema.parse(value$), + (value$) => GetAgentRequest$zodSchema.parse(value$), "Input validation failed", ); if (!parsed$.ok) { @@ -106,12 +91,12 @@ async function $do( const body$ = null; const pathParams$ = { - id: encodeSimple("id", payload$.id, { + agentKey: encodeSimple("agentKey", payload$.agentKey, { explode: false, charEncoding: "percent", }), }; - const path$ = pathToFunc("/users/{id}")( + const path$ = pathToFunc("/agents/{agentKey}")( pathParams$, ); @@ -124,8 +109,8 @@ async function $do( const context = { options: client$._options, baseURL: options?.serverURL ?? client$._baseURL ?? "", - operationID: "getUserById", - oAuth2Scopes: ["user:read"], + operationID: "getAgent", + oAuth2Scopes: ["agent:read"], resolvedSecurity: requestSecurity, securitySource: client$._options.security, retryConfig: options?.retries diff --git a/src/funcs/agentsGetAgentConversationById.ts b/src/funcs/agentsGetAgentConversationById.ts new file mode 100644 index 00000000..dd0e3a3e --- /dev/null +++ b/src/funcs/agentsGetAgentConversationById.ts @@ -0,0 +1,175 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeFormQuery, encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + GetAgentConversationByIdRequest, + GetAgentConversationByIdRequest$zodSchema, +} from "../models/getagentconversationbyidop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Get agent conversation by ID + * + * @remarks + * Returns the conversation with paginated/sorted messages and filter metadata. + * + * **Message Pagination:** + * + * Messages are paginated newest-first: `page=1` returns the most recent + * batch. Increment `page` to load older batches (used by the infinite-scroll + * "load older messages" feature). + * + * - `page`: Page number (default: 1) + * - `limit`: Messages per page (default: 20, max: 100) + */ +export function agentsGetAgentConversationById( + client$: SDKCore, + request: GetAgentConversationByIdRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: GetAgentConversationByIdRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => GetAgentConversationByIdRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + agentKey: encodeSimple("agentKey", payload$.agentKey, { + explode: false, + charEncoding: "percent", + }), + conversationId: encodeSimple("conversationId", payload$.conversationId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/agents/{agentKey}/conversations/{conversationId}")( + pathParams$, + ); + const query$ = encodeFormQuery({ + "endDate": payload$.endDate, + "limit": payload$.limit, + "messageType": payload$.messageType, + "page": payload$.page, + "sortBy": payload$.sortBy, + "sortOrder": payload$.sortOrder, + "startDate": payload$.startDate, + }); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "getAgentConversationById", + oAuth2Scopes: ["agent:read"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + query: query$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/agentsListAgentArchivedConversationsGrouped.ts b/src/funcs/agentsListAgentArchivedConversationsGrouped.ts new file mode 100644 index 00000000..18e83fd5 --- /dev/null +++ b/src/funcs/agentsListAgentArchivedConversationsGrouped.ts @@ -0,0 +1,153 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeFormQuery } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + ListAgentArchivedConversationsGroupedRequest, + ListAgentArchivedConversationsGroupedRequest$zodSchema, +} from "../models/listagentarchivedconversationsgroupedop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * List archived agent conversations grouped by agent + * + * @remarks + * Returns archived agent conversations for the current user, grouped by + * `agentKey`, with pagination over agent groups. Excludes conversations + * whose agent was soft-deleted upstream. + */ +export function agentsListAgentArchivedConversationsGrouped( + client$: SDKCore, + request?: ListAgentArchivedConversationsGroupedRequest | undefined, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request?: ListAgentArchivedConversationsGroupedRequest | undefined, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => + ListAgentArchivedConversationsGroupedRequest$zodSchema.optional().parse( + value$, + ), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + const path$ = pathToFunc("/agents/conversations/show/archives")(); + const query$ = encodeFormQuery({ + "agentLimit": payload$?.agentLimit, + "agentPage": payload$?.agentPage, + }); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "listAgentArchivedConversationsGrouped", + oAuth2Scopes: ["agent:read"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + query: query$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/agentsListAgentConversationArchives.ts b/src/funcs/agentsListAgentConversationArchives.ts new file mode 100644 index 00000000..c8782c7b --- /dev/null +++ b/src/funcs/agentsListAgentConversationArchives.ts @@ -0,0 +1,162 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeFormQuery, encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + ListAgentConversationArchivesRequest, + ListAgentConversationArchivesRequest$zodSchema, +} from "../models/listagentconversationarchivesop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * List archived conversations for an agent + * + * @remarks + * Paginated list of archived conversations for the given agent key. + */ +export function agentsListAgentConversationArchives( + client$: SDKCore, + request: ListAgentConversationArchivesRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: ListAgentConversationArchivesRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => ListAgentConversationArchivesRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + agentKey: encodeSimple("agentKey", payload$.agentKey, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/agents/{agentKey}/conversations/show/archives")( + pathParams$, + ); + const query$ = encodeFormQuery({ + "endDate": payload$.endDate, + "limit": payload$.limit, + "page": payload$.page, + "search": payload$.search, + "sortBy": payload$.sortBy, + "sortOrder": payload$.sortOrder, + "startDate": payload$.startDate, + }); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "listAgentConversationArchives", + oAuth2Scopes: ["agent:read"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + query: query$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/agentsListAgentConversations.ts b/src/funcs/agentsListAgentConversations.ts new file mode 100644 index 00000000..9a95aacd --- /dev/null +++ b/src/funcs/agentsListAgentConversations.ts @@ -0,0 +1,165 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeFormQuery, encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + ListAgentConversationsRequest, + ListAgentConversationsRequest$zodSchema, +} from "../models/listagentconversationsop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * List agent conversations + * + * @remarks + * Paginated list of conversations for the agent (owned and shared-with-me), + * excluding archived threads. + */ +export function agentsListAgentConversations( + client$: SDKCore, + request: ListAgentConversationsRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: ListAgentConversationsRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => ListAgentConversationsRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + agentKey: encodeSimple("agentKey", payload$.agentKey, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/agents/{agentKey}/conversations")( + pathParams$, + ); + const query$ = encodeFormQuery({ + "endDate": payload$.endDate, + "isArchived": payload$.isArchived, + "limit": payload$.limit, + "page": payload$.page, + "search": payload$.search, + "sortBy": payload$.sortBy, + "sortOrder": payload$.sortOrder, + "startDate": payload$.startDate, + "status": payload$.status, + }); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "listAgentConversations", + oAuth2Scopes: ["agent:read"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + query: query$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/userGroupsGetAllUserGroups.ts b/src/funcs/agentsListAgents.ts similarity index 72% rename from src/funcs/userGroupsGetAllUserGroups.ts rename to src/funcs/agentsListAgents.ts index d801735f..e8304385 100644 --- a/src/funcs/userGroupsGetAllUserGroups.ts +++ b/src/funcs/agentsListAgents.ts @@ -2,7 +2,7 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { PipeshubCore } from "../core.js"; +import { SDKCore } from "../core.js"; import { encodeFormQuery } from "../lib/encodings.js"; import { compactMap } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; @@ -19,35 +19,36 @@ import { } from "../models/errors/httpclienterrors.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import { - GetAllUserGroupsRequest, - GetAllUserGroupsRequest$zodSchema, -} from "../models/getallusergroupsop.js"; + ListAgentsRequest, + ListAgentsRequest$zodSchema, +} from "../models/listagentsop.js"; import { APICall, APIPromise } from "../types/async.js"; import { Result } from "../types/fp.js"; /** - * Get all user groups + * List agents * * @remarks - * Retrieve all user groups in the organization.

- * Response Details:
- *
    - *
  • Returns all groups including admin, standard, everyone, and custom types
  • - *
  • Groups are returned with their member counts
  • - *
  • Soft-deleted groups are excluded by default
  • - *
  • Each user in the users array is returned as an object with _id and profilePicture (base64 data URI or null)
  • - *
- * Use Cases:
- *
    - *
  • Populating group selection dropdowns
  • - *
  • Managing group memberships
  • - *
  • Access control configuration
  • - *
  • Rendering user avatars in group member lists
  • - *
+ * Retrieve a paginated list of agents available to the authenticated user. + * + * **Overview** + * + * Returns agents accessible through direct, team, or org-level permissions. + * Search is performed across agent name, description, and tags. Sorting and + * pagination are applied by the AI backend and the resulting envelope is + * forwarded unchanged by the Node gateway. + * + * **Gateway contract** + * + * The Node route supports only these query params: `page`, `limit`, `search`, + * `sort_by`, and `sort_order`. + * + * The Python backend also understands `isDeleted`, but this gateway route + * does not forward it, so it is not part of the public API contract here. */ -export function userGroupsGetAllUserGroups( - client$: PipeshubCore, - request?: GetAllUserGroupsRequest | undefined, +export function agentsListAgents( + client$: SDKCore, + request?: ListAgentsRequest | undefined, options?: RequestOptions, ): APIPromise< Result< @@ -69,8 +70,8 @@ export function userGroupsGetAllUserGroups( } async function $do( - client$: PipeshubCore, - request?: GetAllUserGroupsRequest | undefined, + client$: SDKCore, + request?: ListAgentsRequest | undefined, options?: RequestOptions, ): Promise< [ @@ -89,7 +90,7 @@ async function $do( > { const parsed$ = safeParse( request, - (value$) => GetAllUserGroupsRequest$zodSchema.optional().parse(value$), + (value$) => ListAgentsRequest$zodSchema.optional().parse(value$), "Input validation failed", ); if (!parsed$.ok) { @@ -97,11 +98,13 @@ async function $do( } const payload$ = parsed$.value; const body$ = null; - const path$ = pathToFunc("/userGroups")(); + const path$ = pathToFunc("/agents")(); const query$ = encodeFormQuery({ "limit": payload$?.limit, "page": payload$?.page, "search": payload$?.search, + "sort_by": payload$?.sort_by, + "sort_order": payload$?.sort_order, }); const headers$ = new Headers(compactMap({ @@ -113,8 +116,8 @@ async function $do( const context = { options: client$._options, baseURL: options?.serverURL ?? client$._baseURL ?? "", - operationID: "getAllUserGroups", - oAuth2Scopes: [], + operationID: "listAgents", + oAuth2Scopes: ["agent:read"], resolvedSecurity: requestSecurity, securitySource: client$._options.security, retryConfig: options?.retries diff --git a/src/funcs/agentsUnarchiveAgentConversation.ts b/src/funcs/agentsUnarchiveAgentConversation.ts new file mode 100644 index 00000000..b444b659 --- /dev/null +++ b/src/funcs/agentsUnarchiveAgentConversation.ts @@ -0,0 +1,158 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + UnarchiveAgentConversationRequest, + UnarchiveAgentConversationRequest$zodSchema, +} from "../models/unarchiveagentconversationop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Unarchive an agent conversation + * + * @remarks + * Restores an archived agent conversation to the active list. + */ +export function agentsUnarchiveAgentConversation( + client$: SDKCore, + request: UnarchiveAgentConversationRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: UnarchiveAgentConversationRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => UnarchiveAgentConversationRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + agentKey: encodeSimple("agentKey", payload$.agentKey, { + explode: false, + charEncoding: "percent", + }), + conversationId: encodeSimple("conversationId", payload$.conversationId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc( + "/agents/{agentKey}/conversations/{conversationId}/unarchive", + )( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "unarchiveAgentConversation", + oAuth2Scopes: ["agent:write"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/agentsUpdateAgent.ts b/src/funcs/agentsUpdateAgent.ts new file mode 100644 index 00000000..f2fa5e58 --- /dev/null +++ b/src/funcs/agentsUpdateAgent.ts @@ -0,0 +1,177 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + UpdateAgentRequest, + UpdateAgentRequest$zodSchema, +} from "../models/updateagentop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Update agent + * + * @remarks + * Apply a partial update to an existing agent configuration. + * + * **Gateway contract** + * + * The Node gateway validates the request body via Zod middleware before + * forwarding to the Python agent service. The `agentKey` path param and + * the request body are both validated. Query parameters are ignored by + * the controller. + * + * **Update semantics** + * + * Only fields present in the request body are updated. When `models` is + * included, the gateway Zod middleware requires at least one model entry + * and at least one object entry with `isReasoning: true`. + * + * **Permissions** + * + * The authenticated user must have `can_edit` on the agent (typically the + * owner). Service-account and `shareWithOrg` transitions follow additional + * Python business rules. + * + * **Success response** + * + * Returns a lightweight success envelope only. Use + * `GET /agents/{agentKey}` to read the persisted agent after an update. + */ +export function agentsUpdateAgent( + client$: SDKCore, + request: UpdateAgentRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: UpdateAgentRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => UpdateAgentRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = encodeJSON("body", payload$.body, { explode: true }); + + const pathParams$ = { + agentKey: encodeSimple("agentKey", payload$.agentKey, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/agents/{agentKey}")( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "updateAgent", + oAuth2Scopes: ["agent:write"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "PUT", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/agentsUpdateAgentConversationMessageFeedback.ts b/src/funcs/agentsUpdateAgentConversationMessageFeedback.ts new file mode 100644 index 00000000..5a22bf32 --- /dev/null +++ b/src/funcs/agentsUpdateAgentConversationMessageFeedback.ts @@ -0,0 +1,167 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + UpdateAgentConversationMessageFeedbackRequest, + UpdateAgentConversationMessageFeedbackRequest$zodSchema, +} from "../models/updateagentconversationmessagefeedbackop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Submit feedback for an agent message + * + * @remarks + * Append structured feedback to a bot-response message in an agent + * conversation. Uses the same request body shape as + * `updateMessageFeedback` (helpfulness, categories, comments). Feedback + * can only be submitted on `bot_response` messages. + */ +export function agentsUpdateAgentConversationMessageFeedback( + client$: SDKCore, + request: UpdateAgentConversationMessageFeedbackRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: UpdateAgentConversationMessageFeedbackRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => + UpdateAgentConversationMessageFeedbackRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = encodeJSON("body", payload$.body, { explode: true }); + + const pathParams$ = { + agentKey: encodeSimple("agentKey", payload$.agentKey, { + explode: false, + charEncoding: "percent", + }), + conversationId: encodeSimple("conversationId", payload$.conversationId, { + explode: false, + charEncoding: "percent", + }), + messageId: encodeSimple("messageId", payload$.messageId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc( + "/agents/{agentKey}/conversations/{conversationId}/message/{messageId}/feedback", + )( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "updateAgentConversationMessageFeedback", + oAuth2Scopes: ["agent:execute"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/agentsUpdateAgentConversationTitle.ts b/src/funcs/agentsUpdateAgentConversationTitle.ts new file mode 100644 index 00000000..cb95d220 --- /dev/null +++ b/src/funcs/agentsUpdateAgentConversationTitle.ts @@ -0,0 +1,167 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + UpdateAgentConversationTitleRequest, + UpdateAgentConversationTitleRequest$zodSchema, +} from "../models/updateagentconversationtitleop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Update agent conversation title + * + * @remarks + * Updates the display title for an agent conversation owned by the caller. + * + * The controller looks up the conversation by `_id`, `orgId`, `userId`, + * `agentKey`, and `isDeleted: false`. + * + * The request body uses the shared title validator (`1..200` chars), and + * the controller trims the incoming title before saving it. A whitespace-only + * title can therefore still return HTTP 400 even if the raw string is + * non-empty. + */ +export function agentsUpdateAgentConversationTitle( + client$: SDKCore, + request: UpdateAgentConversationTitleRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: UpdateAgentConversationTitleRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => UpdateAgentConversationTitleRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = encodeJSON("body", payload$.body, { explode: true }); + + const pathParams$ = { + agentKey: encodeSimple("agentKey", payload$.agentKey, { + explode: false, + charEncoding: "percent", + }), + conversationId: encodeSimple("conversationId", payload$.conversationId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc( + "/agents/{agentKey}/conversations/{conversationId}/title", + )( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "updateAgentConversationTitle", + oAuth2Scopes: ["agent:write"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "PATCH", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/agentsUploadAgentConversationChatAttachments.ts b/src/funcs/agentsUploadAgentConversationChatAttachments.ts new file mode 100644 index 00000000..b78977c7 --- /dev/null +++ b/src/funcs/agentsUploadAgentConversationChatAttachments.ts @@ -0,0 +1,186 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { appendForm, encodeSimple } from "../lib/encodings.js"; +import { + getContentTypeFromFileName, + readableStreamToArrayBuffer, +} from "../lib/files.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + UploadAgentConversationChatAttachmentsRequest, + UploadAgentConversationChatAttachmentsRequest$zodSchema, +} from "../models/uploadagentconversationchatattachmentsop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { isBlobLike } from "../types/blobs.js"; +import { Result } from "../types/fp.js"; +import { isReadableStream } from "../types/streams.js"; + +/** + * Upload agent chat attachments + * + * @remarks + * Multipart upload of PDF, JPEG, or PNG files for agent chat. Same limits as assistant + * chat (`POST /conversations/attachments/upload`): up to 10 files, 5 MiB each. Proxies to + * the AI backend. Optional `conversationId` associates uploads with an existing agent thread. + */ +export function agentsUploadAgentConversationChatAttachments( + client$: SDKCore, + request: UploadAgentConversationChatAttachmentsRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: UploadAgentConversationChatAttachmentsRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => + UploadAgentConversationChatAttachmentsRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = new FormData(); + for (const fileItem of payload$.body.files ?? []) { + if (isBlobLike(fileItem)) { + appendForm(body$, "files", fileItem); + } else if (isReadableStream(fileItem.content)) { + const buffer = await readableStreamToArrayBuffer(fileItem.content); + const contentType = getContentTypeFromFileName(fileItem.fileName) + || "application/octet-stream"; + const blob = new Blob([buffer], { type: contentType }); + appendForm(body$, "files", blob, fileItem.fileName); + } else { + const contentType = getContentTypeFromFileName(fileItem.fileName) + || "application/octet-stream"; + appendForm( + body$, + "files", + new Blob([fileItem.content], { type: contentType }), + fileItem.fileName, + ); + } + } + if (payload$.body.conversationId !== undefined) { + appendForm(body$, "conversationId", payload$.body.conversationId); + } + + const pathParams$ = { + agentKey: encodeSimple("agentKey", payload$.agentKey, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc( + "/agents/{agentKey}/conversations/attachments/upload", + )( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "uploadAgentConversationChatAttachments", + oAuth2Scopes: ["agent:execute"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/aiModelsProvidersGetAvailableModelsByType.ts b/src/funcs/aiModelsProvidersGetAvailableModelsByType.ts index 053b3616..30be2ace 100644 --- a/src/funcs/aiModelsProvidersGetAvailableModelsByType.ts +++ b/src/funcs/aiModelsProvidersGetAvailableModelsByType.ts @@ -2,7 +2,7 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { PipeshubCore } from "../core.js"; +import { SDKCore } from "../core.js"; import { encodeSimple } from "../lib/encodings.js"; import { compactMap } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; @@ -26,28 +26,30 @@ import { APICall, APIPromise } from "../types/async.js"; import { Result } from "../types/fp.js"; /** - * List available AI models of a given type + * Get available models by type * * @remarks - * List every AI model of the requested type that the org has - * configured. Use this to discover valid `modelKey` values to pass - * on chat / search requests.

- * Typical flow for a programmatic / MCP caller: - *
    - *
  1. Call this endpoint with modelType=llm to find - * chat models. Pick the one with isDefault: true - * unless the user explicitly asked for another.
  2. - *
  3. Pass the chosen modelKey (and optionally - * modelName, modelFriendlyName) to - * POST /conversations/create / - * POST /conversations/{id}/messages / - * POST /search.
  4. - *
- * Other useful `modelType` values: `embedding` (for re-embedding), - * `ocr`, `multiModal`, `reasoning`, `imageGeneration`, `tts`, `stt`. + * Returns a **flattened list** of individual AI models of the requested type, + * suitable for use in selection dropdowns and model-picker UIs. + * + * Each provider configuration entry may specify multiple comma-separated model + * names; this endpoint expands those into one object per model name so callers + * receive a flat, enumerable collection. + * + * **Flattening rules:** + * - Only the **first** model in a multi-model provider entry is marked + * `isDefault: true`; all subsequent models from the same entry get `false`. + * - `modelFriendlyName` is included **only** when the provider entry contains + * exactly one model name (not a comma-separated list). + * - When no providers of the requested type are configured the endpoint still + * returns HTTP **200** with an empty `models` array — this is **not** an error. + * + * **Access control:** requires a valid bearer token. For OAuth tokens the + * `config:read` scope must be present; regular JWT bearer tokens pass through + * without scope enforcement. */ export function aiModelsProvidersGetAvailableModelsByType( - client$: PipeshubCore, + client$: SDKCore, request: GetAvailableModelsByTypeRequest, options?: RequestOptions, ): APIPromise< @@ -70,7 +72,7 @@ export function aiModelsProvidersGetAvailableModelsByType( } async function $do( - client$: PipeshubCore, + client$: SDKCore, request: GetAvailableModelsByTypeRequest, options?: RequestOptions, ): Promise< diff --git a/src/funcs/conversationsArchiveConversation.ts b/src/funcs/conversationsArchiveConversation.ts new file mode 100644 index 00000000..d388951e --- /dev/null +++ b/src/funcs/conversationsArchiveConversation.ts @@ -0,0 +1,167 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ArchiveConversationRequest, + ArchiveConversationRequest$zodSchema, +} from "../models/archiveconversationop.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Archive conversation + * + * @remarks + * Archive a conversation to hide it from the main list. + * + * **Overview:** + * + * Archived conversations are preserved but hidden from the default conversation list. + * Use archiving to clean up your workspace without permanently deleting conversations. + * + * **Access:** + * + * The caller must be the conversation's initiator, or be listed in `sharedWith` + * with `accessLevel: write`. Already-archived conversations return `400`. + * + * **Retrieval:** + * + * View archived conversations using `GET /conversations/show/archives`. + * Restore one with `PATCH /conversations/{conversationId}/unarchive`. + */ +export function conversationsArchiveConversation( + client$: SDKCore, + request: ArchiveConversationRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: ArchiveConversationRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => ArchiveConversationRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + conversationId: encodeSimple("conversationId", payload$.conversationId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/conversations/{conversationId}/archive")( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "archiveConversation", + oAuth2Scopes: ["conversation:write"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "PATCH", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/conversationsCreateConversation.ts b/src/funcs/conversationsCreateConversation.ts deleted file mode 100644 index edaada38..00000000 --- a/src/funcs/conversationsCreateConversation.ts +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { PipeshubCore } from "../core.js"; -import { encodeJSON } from "../lib/encodings.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { - CreateConversationRequest, - CreateConversationRequest$zodSchema, -} from "../models/createconversationrequest.js"; -import { APIError } from "../models/errors/apierror.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -/** - * Create a new AI conversation (non-streaming) - * - * @remarks - * Start a new conversation with PipesHub's AI assistant and wait for the - * full response in a single JSON body. For an interactive / token-by-token - * experience use POST /conversations/stream instead; - * the request body is identical.

- * How It Works:
- *
    - *
  1. Your query is analyzed and converted to semantic embeddings
  2. - *
  3. Relevant content is retrieved from indexed knowledge bases
  4. - *
  5. The AI generates a response using the retrieved context
  6. - *
  7. Citations link back to source documents for verification
  8. - *
  9. Follow-up questions are suggested based on the conversation
  10. - *
- * Response Shape:
- * The 201 body is { conversation, meta } — the same payload - * as the SSE complete frame from - * /conversations/stream (modelled by - * SSECompleteData). The user query and the AI's response are - * both persisted as messages on conversation.messages; - * citations are populated under each bot message.

- * Filtering Options:
- *
    - *
  • recordIds: Limit search to specific documents
  • - *
  • filters.apps: Search only specific connector apps
  • - *
  • filters.kb: Search only specific knowledge bases
  • - *
- * Model Selection:
- * Use modelKey to select different AI models configured for - * your organization. Each model may have different capabilities, speed, - * and accuracy trade-offs.

- * Failure mode:
- * On AI backend failure the conversation is still persisted (with - * status = "Failed" and a failReason) and the - * endpoint returns a 500 with a JSON error body. Callers can correlate - * with the persisted record via conversationId if they - * retain it from logs. - */ -export function conversationsCreateConversation( - client$: PipeshubCore, - request: CreateConversationRequest, - options?: RequestOptions, -): APIPromise< - Result< - Response, - | APIError - | SDKValidationError - | UnexpectedClientError - | InvalidRequestError - | RequestAbortedError - | RequestTimeoutError - | ConnectionError - > -> { - return new APIPromise($do( - client$, - request, - options, - )); -} - -async function $do( - client$: PipeshubCore, - request: CreateConversationRequest, - options?: RequestOptions, -): Promise< - [ - Result< - Response, - | APIError - | SDKValidationError - | UnexpectedClientError - | InvalidRequestError - | RequestAbortedError - | RequestTimeoutError - | ConnectionError - >, - APICall, - ] -> { - const parsed$ = safeParse( - request, - (value$) => CreateConversationRequest$zodSchema.parse(value$), - "Input validation failed", - ); - if (!parsed$.ok) { - return [parsed$, { status: "invalid" }]; - } - const payload$ = parsed$.value; - const body$ = encodeJSON("body", payload$, { explode: true }); - const path$ = pathToFunc("/conversations/create")(); - - const headers$ = new Headers(compactMap({ - "Content-Type": "application/json", - Accept: "application/json", - })); - const securityInput = await extractSecurity(client$._options.security); - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client$._options, - baseURL: options?.serverURL ?? client$._baseURL ?? "", - operationID: "createConversation", - oAuth2Scopes: ["conversation:write"], - resolvedSecurity: requestSecurity, - securitySource: client$._options.security, - retryConfig: options?.retries - || client$._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || [ - "429", - "500", - "502", - "503", - "504", - ], - }; - - const requestRes = client$._createRequest(context, { - security: requestSecurity, - method: "POST", - baseURL: options?.serverURL, - path: path$, - headers: headers$, - body: body$, - userAgent: client$._options.userAgent, - timeoutMs: options?.timeoutMs || client$._options.timeoutMs - || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req$ = requestRes.value; - - const doResult = await client$._do(req$, { - context, - errorCodes: [], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req$ }]; - } - return [doResult, { - status: "complete", - "request": req$, - response: doResult.value, - }]; -} diff --git a/src/funcs/conversationsDeleteConversationById.ts b/src/funcs/conversationsDeleteConversationById.ts new file mode 100644 index 00000000..4d9d78fe --- /dev/null +++ b/src/funcs/conversationsDeleteConversationById.ts @@ -0,0 +1,164 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + DeleteConversationByIdRequest, + DeleteConversationByIdRequest$zodSchema, +} from "../models/deleteconversationbyidop.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Delete conversation + * + * @remarks + * Delete a conversation by its ID. + * + * **Overview:** + * + * Performs a soft delete by setting `isDeleted: true`. The conversation is + * removed from listings but preserved in the database. All citations + * referenced by messages in the conversation are also soft-deleted. + * + * **Permissions:** + * + * The conversation initiator can always delete. Users the conversation has + * been shared with may delete it only when their `sharedWith.accessLevel` + * is `write`. + */ +export function conversationsDeleteConversationById( + client$: SDKCore, + request: DeleteConversationByIdRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: DeleteConversationByIdRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => DeleteConversationByIdRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + conversationId: encodeSimple("conversationId", payload$.conversationId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/conversations/{conversationId}")( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "deleteConversationById", + oAuth2Scopes: ["conversation:write"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "DELETE", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/conversationsGetAllConversations.ts b/src/funcs/conversationsGetAllConversations.ts new file mode 100644 index 00000000..8d4036ab --- /dev/null +++ b/src/funcs/conversationsGetAllConversations.ts @@ -0,0 +1,173 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeFormQuery } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + GetAllConversationsRequest, + GetAllConversationsRequest$zodSchema, +} from "../models/getallconversationsop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * List all conversations + * + * @remarks + * Retrieve paginated conversations for the authenticated user. + * + * **Overview:** + * + * Use the optional `source` query parameter to choose which list to return: + * `owned` — only conversations you own (`userId` matches the current user). + * `shared` — conversations where you have recipient access + * (`isShared` and your user appears in `sharedWith`), without the owner-only branch. + * Defaults to `owned` when omitted. Each call returns one list; call twice if you need both. + * + * **Filtering:** + * + * - Only non-archived conversations are returned by default + * - Use `/conversations/show/archives` for archived conversations + * + * **Sorting:** + * + * Conversations are sorted by last activity timestamp (most recent first) by default. + */ +export function conversationsGetAllConversations( + client$: SDKCore, + request?: GetAllConversationsRequest | undefined, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request?: GetAllConversationsRequest | undefined, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => GetAllConversationsRequest$zodSchema.optional().parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + const path$ = pathToFunc("/conversations")(); + const query$ = encodeFormQuery({ + "conversationId": payload$?.conversationId, + "endDate": payload$?.endDate, + "limit": payload$?.limit, + "page": payload$?.page, + "search": payload$?.search, + "shared": payload$?.shared, + "sortBy": payload$?.sortBy, + "sortOrder": payload$?.sortOrder, + "source": payload$?.source, + "startDate": payload$?.startDate, + }); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "getAllConversations", + oAuth2Scopes: ["conversation:read"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + query: query$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/conversationsGetArchivedConversations.ts b/src/funcs/conversationsGetArchivedConversations.ts new file mode 100644 index 00000000..2bf50e29 --- /dev/null +++ b/src/funcs/conversationsGetArchivedConversations.ts @@ -0,0 +1,173 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeFormQuery } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + GetArchivedConversationsRequest, + GetArchivedConversationsRequest$zodSchema, +} from "../models/getarchivedconversationsop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * List archived conversations + * + * @remarks + * Retrieve all archived conversations for the authenticated user. + * + * **Overview:** + * + * Archived conversations are hidden from the main list but preserved for reference. + * This endpoint returns only conversations where `isArchived: true` and `archivedBy` + * is set. Results include conversations the caller owns and those shared with them. + * + * **Filtering and sorting:** + * + * Results can be narrowed using `search`, `shared`, `startDate`, `endDate`, and + * `conversationId`. Sorting is controlled by `sortBy` and `sortOrder`. Pagination + * is controlled by `page` and `limit`. + * + * **Unarchiving:** + * + * Use `PATCH /conversations/{conversationId}/unarchive` to restore a conversation + * to the active list. + */ +export function conversationsGetArchivedConversations( + client$: SDKCore, + request?: GetArchivedConversationsRequest | undefined, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request?: GetArchivedConversationsRequest | undefined, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => + GetArchivedConversationsRequest$zodSchema.optional().parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + const path$ = pathToFunc("/conversations/show/archives")(); + const query$ = encodeFormQuery({ + "conversationId": payload$?.conversationId, + "endDate": payload$?.endDate, + "limit": payload$?.limit, + "page": payload$?.page, + "search": payload$?.search, + "shared": payload$?.shared, + "sortBy": payload$?.sortBy, + "sortOrder": payload$?.sortOrder, + "startDate": payload$?.startDate, + }); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "getArchivedConversations", + oAuth2Scopes: ["conversation:read"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + query: query$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/conversationsGetConversationById.ts b/src/funcs/conversationsGetConversationById.ts new file mode 100644 index 00000000..da6b08e1 --- /dev/null +++ b/src/funcs/conversationsGetConversationById.ts @@ -0,0 +1,182 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeFormQuery, encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + GetConversationByIdRequest, + GetConversationByIdRequest$zodSchema, +} from "../models/getconversationbyidop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Get conversation by ID + * + * @remarks + * Retrieve a specific conversation with its full message history. + * + * **Overview:** + * + * Returns the complete conversation including all messages, citations, + * feedback, and metadata. Messages can be paginated for long conversations. + * + * **Message Pagination:** + * + * For conversations with many messages, use pagination parameters: + * + * - `page`: Page number (default: 1) + * - `limit`: Messages per page (default: 10) + * - `sortBy`: Sort field (default: createdAt) + * - `sortOrder`: 'asc' or 'desc' (default: desc) + * + * **Access Control:** + * + * Users can access conversations they own or that have been shared with them. + */ +export function conversationsGetConversationById( + client$: SDKCore, + request: GetConversationByIdRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: GetConversationByIdRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => GetConversationByIdRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + conversationId: encodeSimple("conversationId", payload$.conversationId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/conversations/{conversationId}")( + pathParams$, + ); + const query$ = encodeFormQuery({ + "endDate": payload$.endDate, + "limit": payload$.limit, + "messageType": payload$.messageType, + "page": payload$.page, + "search": payload$.search, + "shared": payload$.shared, + "sortBy": payload$.sortBy, + "sortOrder": payload$.sortOrder, + "startDate": payload$.startDate, + }); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "getConversationById", + oAuth2Scopes: ["conversation:read"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + query: query$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/conversationsSearchArchivedConversations.ts b/src/funcs/conversationsSearchArchivedConversations.ts new file mode 100644 index 00000000..76e83ca1 --- /dev/null +++ b/src/funcs/conversationsSearchArchivedConversations.ts @@ -0,0 +1,171 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeFormQuery } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + SearchArchivedConversationsRequest, + SearchArchivedConversationsRequest$zodSchema, +} from "../models/searcharchivedconversationsop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Search archived conversations + * + * @remarks + * Search across all archived conversations (assistant and agent) for the authenticated user. + * + * **Overview:** + * + * Performs a case-insensitive substring match against conversation titles and message content + * across both assistant (`Conversation`) and agent (`AgentConversation`) archived collections. + * Results are merged server-side and sorted by `lastActivityAt` descending. + * + * **Search parameter:** + * + * The `search` query parameter is required, must be a non-empty string, and is capped at + * 1000 characters. Requests that omit it or exceed the cap return `400`. + * + * **Pagination:** + * + * Results are paginated using `page` and `limit`. The response includes a `pagination` + * block with total counts and a `summary` block that breaks matches down by source. + * + * **Item shape:** + * + * Each item is a conversation list entry (no `messages` payload — that field is omitted + * for performance) tagged with `source`, plus computed `isOwner`, `accessLevel`, + * `archivedAt`, and `archivedBy`. `agentKey` is present only when `source` is `agent`. + */ +export function conversationsSearchArchivedConversations( + client$: SDKCore, + request: SearchArchivedConversationsRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: SearchArchivedConversationsRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => SearchArchivedConversationsRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + const path$ = pathToFunc("/conversations/show/archives/search")(); + const query$ = encodeFormQuery({ + "limit": payload$.limit, + "page": payload$.page, + "search": payload$.search, + }); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "searchArchivedConversations", + oAuth2Scopes: ["conversation:read"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + query: query$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/conversationsUnarchiveConversation.ts b/src/funcs/conversationsUnarchiveConversation.ts new file mode 100644 index 00000000..efcd9d90 --- /dev/null +++ b/src/funcs/conversationsUnarchiveConversation.ts @@ -0,0 +1,156 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + UnarchiveConversationRequest, + UnarchiveConversationRequest$zodSchema, +} from "../models/unarchiveconversationop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Unarchive conversation + * + * @remarks + * Restore an archived conversation. + * + * - Path params: `conversationId` + * - Query params: none + * - Body: none + */ +export function conversationsUnarchiveConversation( + client$: SDKCore, + request: UnarchiveConversationRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: UnarchiveConversationRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => UnarchiveConversationRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + conversationId: encodeSimple("conversationId", payload$.conversationId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/conversations/{conversationId}/unarchive")( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "unarchiveConversation", + oAuth2Scopes: ["conversation:write"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "PATCH", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/conversationsUpdateConversationTitle.ts b/src/funcs/conversationsUpdateConversationTitle.ts new file mode 100644 index 00000000..1bdb085e --- /dev/null +++ b/src/funcs/conversationsUpdateConversationTitle.ts @@ -0,0 +1,168 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + UpdateConversationTitleRequest, + UpdateConversationTitleRequest$zodSchema, +} from "../models/updateconversationtitleop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Update conversation title + * + * @remarks + * Update the title of a conversation. + * + * **Overview:** + * + * Conversation titles are auto-generated from the first query by default. + * Use this endpoint to set a custom, more descriptive title. + * + * **Title limits:** + * + * - Minimum: 1 character + * - Maximum: 200 characters + * + * **Permissions:** + * + * The conversation must exist, belong to the calling user's organization, + * be owned by the caller (matched on `userId`), and not be soft-deleted. + */ +export function conversationsUpdateConversationTitle( + client$: SDKCore, + request: UpdateConversationTitleRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: UpdateConversationTitleRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => UpdateConversationTitleRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = encodeJSON("body", payload$.body, { explode: true }); + + const pathParams$ = { + conversationId: encodeSimple("conversationId", payload$.conversationId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/conversations/{conversationId}/title")( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "updateConversationTitle", + oAuth2Scopes: ["conversation:write"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "PATCH", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/conversationsAddMessage.ts b/src/funcs/conversationsUpdateMessageFeedback.ts similarity index 64% rename from src/funcs/conversationsAddMessage.ts rename to src/funcs/conversationsUpdateMessageFeedback.ts index 4fa204f5..1302fda6 100644 --- a/src/funcs/conversationsAddMessage.ts +++ b/src/funcs/conversationsUpdateMessageFeedback.ts @@ -2,17 +2,13 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { PipeshubCore } from "../core.js"; +import { SDKCore } from "../core.js"; import { encodeJSON, encodeSimple } from "../lib/encodings.js"; import { compactMap } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; import { RequestOptions } from "../lib/sdks.js"; import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; import { pathToFunc } from "../lib/url.js"; -import { - AddMessageRequestRequest, - AddMessageRequestRequest$zodSchema, -} from "../models/addmessageop.js"; import { APIError } from "../models/errors/apierror.js"; import { ConnectionError, @@ -22,39 +18,40 @@ import { UnexpectedClientError, } from "../models/errors/httpclienterrors.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + UpdateMessageFeedbackRequest, + UpdateMessageFeedbackRequest$zodSchema, +} from "../models/updatemessagefeedbackop.js"; import { APICall, APIPromise } from "../types/async.js"; import { Result } from "../types/fp.js"; /** - * Add message to conversation (non-streaming) + * Submit feedback on AI response * * @remarks - * Add a follow-up user message to an existing conversation and wait for - * the full AI response in a single JSON body. The non-streaming sibling - * of POST /conversations/{conversationId}/messages/stream.

- * Context Handling:
- * Prior messages on the persisted conversation are formatted server-side - * and forwarded to the AI as history — callers do not need to - * replay messages themselves. Only the new query (and - * optional model / filter overrides) goes in the request body.

- * Response Shape:
- * The 200 body is { conversation, recordsUsed, meta } - * (modelled by AddMessageResponse). The new user_query - * and bot_response are appended to - * conversation.messages; pull the last element for the - * latest reply. recordsUsed is the number of citations - * backing the new bot response.

- * Model Override:
- * Override the model for this turn via modelKey; otherwise - * the conversation's existing model is used.

- * Failure mode:
- * On AI backend failure the conversation status flips to - * Failed with a failReason, a placeholder - * bot_response is appended, and the endpoint returns 500. + * Append a feedback entry to a bot-response message. + * + * **Overview** + * + * Feedback helps improve AI response quality over time. You can record an + * overall helpfulness signal, issue categories, and free-text comments. + * Each call appends a new entry to the message; previous entries are + * preserved. + * + * **Feedback options** + * + * - `isHelpful` — overall thumbs up/down. + * - `categories` — issue or positive categories from a fixed list. + * - `comments` — free-text `positive` and `negative`. + * + * **Restrictions** + * + * Feedback can only be submitted on `bot_response` messages — user + * queries and system messages are rejected with `400`. */ -export function conversationsAddMessage( - client$: PipeshubCore, - request: AddMessageRequestRequest, +export function conversationsUpdateMessageFeedback( + client$: SDKCore, + request: UpdateMessageFeedbackRequest, options?: RequestOptions, ): APIPromise< Result< @@ -76,8 +73,8 @@ export function conversationsAddMessage( } async function $do( - client$: PipeshubCore, - request: AddMessageRequestRequest, + client$: SDKCore, + request: UpdateMessageFeedbackRequest, options?: RequestOptions, ): Promise< [ @@ -96,7 +93,7 @@ async function $do( > { const parsed$ = safeParse( request, - (value$) => AddMessageRequestRequest$zodSchema.parse(value$), + (value$) => UpdateMessageFeedbackRequest$zodSchema.parse(value$), "Input validation failed", ); if (!parsed$.ok) { @@ -110,8 +107,14 @@ async function $do( explode: false, charEncoding: "percent", }), + messageId: encodeSimple("messageId", payload$.messageId, { + explode: false, + charEncoding: "percent", + }), }; - const path$ = pathToFunc("/conversations/{conversationId}/messages")( + const path$ = pathToFunc( + "/conversations/{conversationId}/message/{messageId}/feedback", + )( pathParams$, ); @@ -125,8 +128,8 @@ async function $do( const context = { options: client$._options, baseURL: options?.serverURL ?? client$._baseURL ?? "", - operationID: "addMessage", - oAuth2Scopes: ["conversation:chat"], + operationID: "updateMessageFeedback", + oAuth2Scopes: ["conversation:write"], resolvedSecurity: requestSecurity, securitySource: client$._options.security, retryConfig: options?.retries diff --git a/src/funcs/knowledgeHubGetKnowledgeHubChildNodes.ts b/src/funcs/knowledgeHubGetKnowledgeHubChildNodes.ts new file mode 100644 index 00000000..9e69e86b --- /dev/null +++ b/src/funcs/knowledgeHubGetKnowledgeHubChildNodes.ts @@ -0,0 +1,211 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeFormQuery, encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + GetKnowledgeHubChildNodesRequest, + GetKnowledgeHubChildNodesRequest$zodSchema, +} from "../models/getknowledgehubchildnodesop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Get knowledge hub child nodes + * + * @remarks + * Returns the children of a specific node in the knowledge hub tree. + * Use this endpoint to drill down into Collections, connector app + * hierarchies, folders, and record groups. + * + * **Navigation hierarchy** + * + * The typical drill-down path is: + * 1. Root apps (`GET /knowledgeBase/knowledge-hub/nodes`) + * 2. Record groups / folders within an app (`parentType=app`) + * 3. Records within a record group (`parentType=recordGroup`) + * 4. Sub-records or attachments within a record (`parentType=record`) + * + * **Parent identification** + * + * - `parentType` must be one of: `app`, `recordGroup`, `folder`, `record` + * - `parentId` is either a standard UUID or the Collection app sentinel + * `knowledgeBase_` (e.g. `knowledgeBase_org123`) + * + * **Filtering and searching** + * + * All query-param filters from the root endpoint are available here and + * operate within the scope of the parent node's subtree. When `q` is + * provided, the search spans all descendants of the parent node. + * + * **Response extras** + * + * When `include=breadcrumbs` is set, the response contains a + * `breadcrumbs` array tracing the path from the root to the current + * node. The `currentNode` and `parentNode` objects are always populated + * for non-root requests. + * + * **Access control** + * + * Requires a valid bearer token. For OAuth tokens the `kb:read` scope + * must be present; regular JWT bearer tokens pass through without scope + * enforcement. + */ +export function knowledgeHubGetKnowledgeHubChildNodes( + client$: SDKCore, + request: GetKnowledgeHubChildNodesRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: GetKnowledgeHubChildNodesRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => GetKnowledgeHubChildNodesRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + parentId: encodeSimple("parentId", payload$.parentId, { + explode: false, + charEncoding: "percent", + }), + parentType: encodeSimple("parentType", payload$.parentType, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc( + "/knowledgeBase/knowledge-hub/nodes/{parentType}/{parentId}", + )( + pathParams$, + ); + const query$ = encodeFormQuery({ + "connectorIds": payload$.connectorIds, + "createdAt": payload$.createdAt, + "include": payload$.include, + "indexingStatus": payload$.indexingStatus, + "limit": payload$.limit, + "nodeTypes": payload$.nodeTypes, + "onlyContainers": payload$.onlyContainers, + "origins": payload$.origins, + "page": payload$.page, + "q": payload$.q, + "recordTypes": payload$.recordTypes, + "size": payload$.size, + "sortBy": payload$.sortBy, + "sortOrder": payload$.sortOrder, + "updatedAt": payload$.updatedAt, + }); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "getKnowledgeHubChildNodes", + oAuth2Scopes: ["kb:read"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + query: query$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/knowledgeHubGetKnowledgeHubRootNodes.ts b/src/funcs/knowledgeHubGetKnowledgeHubRootNodes.ts index a2496f17..3099d409 100644 --- a/src/funcs/knowledgeHubGetKnowledgeHubRootNodes.ts +++ b/src/funcs/knowledgeHubGetKnowledgeHubRootNodes.ts @@ -2,7 +2,7 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { PipeshubCore } from "../core.js"; +import { SDKCore } from "../core.js"; import { encodeFormQuery } from "../lib/encodings.js"; import { compactMap } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; @@ -26,39 +26,53 @@ import { APICall, APIPromise } from "../types/async.js"; import { Result } from "../types/fp.js"; /** - * List knowledge hub root nodes (connectors + collections) + * Get knowledge hub root nodes * * @remarks - * Retrieve the top-level "apps" in the knowledge hub — every connector - * instance the org has wired up, plus the synthetic Collections - * node representing the org's knowledge base. The id of each - * item is exactly the value to put into a chat / search request's - * filters.apps.

- * Use cases: - *
    - *
  • Resolve user phrases like "search Box" or "search the knowledge base" - * into the right `filters.apps` ids before calling chat / search.
  • - *
  • Show users which sources are available before chatting.
  • - *
  • Build a file-browser UI rooted at this list.
  • - *
- * Item id formats you'll see at the root: - *
    - *
  • Connector instance UUID — e.g. - * 7d672a98-8fe0-46d4-b170-0d5f270a2dc9 (one per - * connected source). connector is the source name - * (Box, Drive, Confluence, - * ...).
  • - *
  • Synthetic KB id — knowledgeBase_<orgId> with - * connector: "KB". Pass this in - * filters.apps to include the org's knowledge base - * as a chat / search source.
  • - *
- * Query params accept camelCase (`sortBy`, `sortOrder`, `nodeTypes`, - * `connectorIds`, etc.) — they are translated to snake_case before - * forwarding to the upstream service. + * Returns root-level nodes (connector apps and Collection apps) or, when + * filters or search are applied, a flat list of matching nodes across the + * entire knowledge hub tree. + * + * **Overview** + * + * The Knowledge Hub provides a unified view across all knowledge sources: + * - **Collection** — locally uploaded knowledge bases (`origin: COLLECTION`) + * - **Connector app** — external connector instances such as Google Drive, + * Slack, Confluence, Jira (`origin: CONNECTOR`) + * + * Use this endpoint to build file-browser UIs and sidebar navigation trees. + * + * **Browsing vs. searching** + * + * When no filters or search query are provided, only top-level app nodes + * are returned. Adding `nodeTypes`, `q`, or other filter params triggers a + * search across the full tree, returning matching nodes regardless of depth. + * + * For children of a specific node, use + * `GET /knowledgeBase/knowledge-hub/nodes/{parentType}/{parentId}`. + * + * **Pagination and sorting** + * + * Results are always paginated. Default sort is `updatedAt` descending. + * The `pagination` object in the response contains `hasNext` / `hasPrev` + * flags suitable for infinite-scroll or page-based navigation. + * + * **Expanding the response** + * + * Use the `include` parameter to request additional sections: + * - `availableFilters` — adds `filters.available` with all filter options + * - `counts` — adds a `counts` summary broken down by node type + * - `breadcrumbs` — adds the breadcrumb trail (empty at root level) + * - `permissions` — adds the caller's permission flags + * + * **Access control** + * + * Requires a valid bearer token. For OAuth tokens the `kb:read` scope + * must be present; regular JWT bearer tokens pass through without scope + * enforcement. */ export function knowledgeHubGetKnowledgeHubRootNodes( - client$: PipeshubCore, + client$: SDKCore, request?: GetKnowledgeHubRootNodesRequest | undefined, options?: RequestOptions, ): APIPromise< @@ -81,7 +95,7 @@ export function knowledgeHubGetKnowledgeHubRootNodes( } async function $do( - client$: PipeshubCore, + client$: SDKCore, request?: GetKnowledgeHubRootNodesRequest | undefined, options?: RequestOptions, ): Promise< @@ -114,12 +128,11 @@ async function $do( const query$ = encodeFormQuery({ "connectorIds": payload$?.connectorIds, "createdAt": payload$?.createdAt, - "flattened": payload$?.flattened, "include": payload$?.include, "indexingStatus": payload$?.indexingStatus, "limit": payload$?.limit, "nodeTypes": payload$?.nodeTypes, - "only_containers": payload$?.only_containers, + "onlyContainers": payload$?.onlyContainers, "origins": payload$?.origins, "page": payload$?.page, "q": payload$?.q, diff --git a/src/funcs/oAuthAppsActivateOAuthApp.ts b/src/funcs/oAuthAppsActivateOAuthApp.ts new file mode 100644 index 00000000..f8b2c559 --- /dev/null +++ b/src/funcs/oAuthAppsActivateOAuthApp.ts @@ -0,0 +1,156 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ActivateOAuthAppRequest, + ActivateOAuthAppRequest$zodSchema, +} from "../models/activateoauthappop.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Activate suspended OAuth app + * + * @remarks + * Moves a suspended OAuth app back to `status: "active"`, restoring its ability to authenticate and obtain new tokens via `POST /oauth2/token`. + * + * A revoked app cannot be reactivated (returns `400`); the only path back is to register a new app. Activating an app that is already active also returns `400`. + * + * Creator-only. + */ +export function oAuthAppsActivateOAuthApp( + client$: SDKCore, + request: ActivateOAuthAppRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: ActivateOAuthAppRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => ActivateOAuthAppRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + appId: encodeSimple("appId", payload$.appId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/oauth-clients/{appId}/activate")( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "activateOAuthApp", + oAuth2Scopes: [], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/oAuthAppsCreateOAuthApp.ts b/src/funcs/oAuthAppsCreateOAuthApp.ts new file mode 100644 index 00000000..408feb9d --- /dev/null +++ b/src/funcs/oAuthAppsCreateOAuthApp.ts @@ -0,0 +1,150 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeJSON } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + CreateOAuthAppRequest, + CreateOAuthAppRequest$zodSchema, +} from "../models/createoauthapprequest.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Create OAuth app + * + * @remarks + * Register a new OAuth app for the organization. Any authenticated org member may create apps; the creator is recorded as the app's owner and is the only user who can subsequently read, update, suspend, activate, regenerate the secret of, or delete it. + * + * The `clientSecret` is returned in this response **only** — it is stored hashed server-side and cannot be retrieved later. Persist it before exiting the create flow; if it is ever lost, rotate via `POST /oauth-clients/{appId}/regenerate-secret`. + * + * `allowedScopes` is validated against the caller's role-aware scope set (see `GET /oauth-clients/scopes`). Org admins may include admin-only scopes; non-admins requesting a restricted scope receive `400`. + * + * All `/oauth-clients/*` routes share a per-user rate limiter (default 1000 req/min, configurable via the `MAX_OAUTH_CLIENT_REQUESTS_PER_MINUTE` env var). + */ +export function oAuthAppsCreateOAuthApp( + client$: SDKCore, + request: CreateOAuthAppRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: CreateOAuthAppRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => CreateOAuthAppRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = encodeJSON("body", payload$, { explode: true }); + const path$ = pathToFunc("/oauth-clients")(); + + const headers$ = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "createOAuthApp", + oAuth2Scopes: [], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/oAuthAppsDeleteOAuthApp.ts b/src/funcs/oAuthAppsDeleteOAuthApp.ts new file mode 100644 index 00000000..98f91e8e --- /dev/null +++ b/src/funcs/oAuthAppsDeleteOAuthApp.ts @@ -0,0 +1,154 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + DeleteOAuthAppRequest, + DeleteOAuthAppRequest$zodSchema, +} from "../models/deleteoauthappop.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Delete OAuth app + * + * @remarks + * Soft-deletes an OAuth app. The app is flagged `isDeleted=true` on the `OAuthApp` document, removed from list/get responses for every caller, and all of its access and refresh tokens are revoked in the same operation. There is no restore endpoint — deletion is final. + * + * Creator-only: even org admins cannot delete apps owned by other users. + */ +export function oAuthAppsDeleteOAuthApp( + client$: SDKCore, + request: DeleteOAuthAppRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: DeleteOAuthAppRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => DeleteOAuthAppRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + appId: encodeSimple("appId", payload$.appId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/oauth-clients/{appId}")( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "deleteOAuthApp", + oAuth2Scopes: [], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "DELETE", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/oAuthAppsGetOAuthApp.ts b/src/funcs/oAuthAppsGetOAuthApp.ts new file mode 100644 index 00000000..230feb15 --- /dev/null +++ b/src/funcs/oAuthAppsGetOAuthApp.ts @@ -0,0 +1,154 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + GetOAuthAppRequest, + GetOAuthAppRequest$zodSchema, +} from "../models/getoauthappop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Get OAuth app details + * + * @remarks + * Returns the full configuration of an OAuth app you registered. The `clientSecret` is never echoed back here; if you need a new one, call `POST /oauth-clients/{appId}/regenerate-secret`. + * + * Access is creator-scoped: even org admins receive `404` for apps owned by other users. This avoids leaking app metadata across org members and keeps the read surface symmetric with `listOAuthApps`. + */ +export function oAuthAppsGetOAuthApp( + client$: SDKCore, + request: GetOAuthAppRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: GetOAuthAppRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => GetOAuthAppRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + appId: encodeSimple("appId", payload$.appId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/oauth-clients/{appId}")( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "getOAuthApp", + oAuth2Scopes: [], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/oAuthAppsListOAuthAppTokens.ts b/src/funcs/oAuthAppsListOAuthAppTokens.ts new file mode 100644 index 00000000..b82ca714 --- /dev/null +++ b/src/funcs/oAuthAppsListOAuthAppTokens.ts @@ -0,0 +1,156 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + ListOAuthAppTokensRequest, + ListOAuthAppTokensRequest$zodSchema, +} from "../models/listoauthapptokensop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * List app tokens + * + * @remarks + * Lists active access and refresh tokens currently issued to an OAuth app, sorted newest first. Useful for auditing app usage and picking specific tokens to investigate before a targeted revocation. + * + * Each entry includes the token type (`access` or `refresh`), the user the token was issued for (omitted for client-credentials access tokens), the granted scopes, the issuance and expiry timestamps, and the revocation flag. Each type is capped at 100 most-recent rows server-side (`listTokensForApp` in `oauth_token.service.ts`); revoked and expired tokens are excluded. + * + * Creator-only. + */ +export function oAuthAppsListOAuthAppTokens( + client$: SDKCore, + request: ListOAuthAppTokensRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: ListOAuthAppTokensRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => ListOAuthAppTokensRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + appId: encodeSimple("appId", payload$.appId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/oauth-clients/{appId}/tokens")( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "listOAuthAppTokens", + oAuth2Scopes: [], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/teamsGetUserTeams.ts b/src/funcs/oAuthAppsListOAuthApps.ts similarity index 73% rename from src/funcs/teamsGetUserTeams.ts rename to src/funcs/oAuthAppsListOAuthApps.ts index 47b8b80e..568145c8 100644 --- a/src/funcs/teamsGetUserTeams.ts +++ b/src/funcs/oAuthAppsListOAuthApps.ts @@ -2,7 +2,7 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { PipeshubCore } from "../core.js"; +import { SDKCore } from "../core.js"; import { encodeFormQuery } from "../lib/encodings.js"; import { compactMap } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; @@ -19,33 +19,25 @@ import { } from "../models/errors/httpclienterrors.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import { - GetUserTeamsRequest, - GetUserTeamsRequest$zodSchema, -} from "../models/getuserteamsop.js"; + ListOAuthAppsRequest, + ListOAuthAppsRequest$zodSchema, +} from "../models/listoauthappsop.js"; import { APICall, APIPromise } from "../types/async.js"; import { Result } from "../types/fp.js"; /** - * Get current user's teams + * List OAuth apps * * @remarks - * Retrieve all teams that the authenticated user is a member of.

- * Response Details:
- *
    - *
  • Includes teams where user is owner, admin, member, or viewer
  • - *
  • Returns user's role in each team
  • - *
  • Sorted by most recently accessed
  • - *
- * Use Cases:
- *
    - *
  • Populating team switcher in UI
  • - *
  • Dashboard team list
  • - *
  • Access control checks
  • - *
+ * Returns a paginated list of OAuth apps registered by the signed-in user. Access is creator-scoped — even org admins only see apps they created themselves, so this endpoint is safe to use for per-user developer dashboards without leaking org-wide app metadata. + * + * Each entry carries the full app configuration except the client secret, which is only ever returned at creation time and immediately after a regeneration. + * + * Use the `status` query parameter to filter by lifecycle state (`active`, `suspended`, `revoked`) and `search` for a case-insensitive substring match against `name` or `description`. */ -export function teamsGetUserTeams( - client$: PipeshubCore, - request?: GetUserTeamsRequest | undefined, +export function oAuthAppsListOAuthApps( + client$: SDKCore, + request?: ListOAuthAppsRequest | undefined, options?: RequestOptions, ): APIPromise< Result< @@ -67,8 +59,8 @@ export function teamsGetUserTeams( } async function $do( - client$: PipeshubCore, - request?: GetUserTeamsRequest | undefined, + client$: SDKCore, + request?: ListOAuthAppsRequest | undefined, options?: RequestOptions, ): Promise< [ @@ -87,7 +79,7 @@ async function $do( > { const parsed$ = safeParse( request, - (value$) => GetUserTeamsRequest$zodSchema.optional().parse(value$), + (value$) => ListOAuthAppsRequest$zodSchema.optional().parse(value$), "Input validation failed", ); if (!parsed$.ok) { @@ -95,14 +87,12 @@ async function $do( } const payload$ = parsed$.value; const body$ = null; - const path$ = pathToFunc("/teams/user/teams")(); + const path$ = pathToFunc("/oauth-clients")(); const query$ = encodeFormQuery({ - "created_after": payload$?.created_after, - "created_before": payload$?.created_before, - "created_by": payload$?.created_by, "limit": payload$?.limit, "page": payload$?.page, "search": payload$?.search, + "status": payload$?.status, }); const headers$ = new Headers(compactMap({ @@ -114,8 +104,8 @@ async function $do( const context = { options: client$._options, baseURL: options?.serverURL ?? client$._baseURL ?? "", - operationID: "getUserTeams", - oAuth2Scopes: ["team:read"], + operationID: "listOAuthApps", + oAuth2Scopes: [], resolvedSecurity: requestSecurity, securitySource: client$._options.security, retryConfig: options?.retries diff --git a/src/funcs/oAuthAppsListOAuthScopes.ts b/src/funcs/oAuthAppsListOAuthScopes.ts new file mode 100644 index 00000000..288ded36 --- /dev/null +++ b/src/funcs/oAuthAppsListOAuthScopes.ts @@ -0,0 +1,129 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { compactMap } from "../lib/primitives.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * List available scopes + * + * @remarks + * Returns the OAuth scopes the signed-in user is permitted to register on new or updated apps, grouped by category. Use this to populate scope-picker UIs and to validate `allowedScopes` client-side before submitting to `createOAuthApp` / `updateOAuthApp`. + * + * The result is role-aware. Org admins (members of an admin user group) receive every registered scope; everyone else is filtered to exclude admin-only scopes: `org:write`, `org:admin`, `user:invite`, `user:delete`, `usergroup:write`, `team:write`, `config:write`, `crawl:write`, `crawl:delete`. + * + * Each key in the `scopes` map matches the `category` field on the `OAuthScopeInfo` entries it contains. A category may appear with an empty array when every scope it contains is restricted for the caller — treat empty buckets as "no permitted scopes in this group", not as a missing category. + * + * Shares the per-user rate limiter applied to every `/oauth-clients/*` route (default 1000 req/min, `MAX_OAUTH_CLIENT_REQUESTS_PER_MINUTE`). + */ +export function oAuthAppsListOAuthScopes( + client$: SDKCore, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + options, + )); +} + +async function $do( + client$: SDKCore, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const path$ = pathToFunc("/oauth-clients/scopes")(); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "listOAuthScopes", + oAuth2Scopes: [], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/oAuthAppsRegenerateOAuthAppSecret.ts b/src/funcs/oAuthAppsRegenerateOAuthAppSecret.ts new file mode 100644 index 00000000..18fa4121 --- /dev/null +++ b/src/funcs/oAuthAppsRegenerateOAuthAppSecret.ts @@ -0,0 +1,156 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + RegenerateOAuthAppSecretRequest, + RegenerateOAuthAppSecretRequest$zodSchema, +} from "../models/regenerateoauthappsecretop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Regenerate client secret + * + * @remarks + * Generates a fresh client secret for an OAuth app. The previous secret is invalidated immediately — any client still presenting it will fail token exchange at `POST /oauth2/token` until updated. + * + * The new secret is returned in this response **only** and cannot be retrieved later. Pair this call with credential propagation to every integration that uses the app. If the rotation was triggered by a suspected leak, also call `POST /oauth-clients/{appId}/revoke-all-tokens` to invalidate already-issued access and refresh tokens instead of waiting for their natural expiry. + * + * Creator-only: even org admins cannot rotate secrets for other users' apps. + */ +export function oAuthAppsRegenerateOAuthAppSecret( + client$: SDKCore, + request: RegenerateOAuthAppSecretRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: RegenerateOAuthAppSecretRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => RegenerateOAuthAppSecretRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + appId: encodeSimple("appId", payload$.appId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/oauth-clients/{appId}/regenerate-secret")( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "regenerateOAuthAppSecret", + oAuth2Scopes: [], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/oAuthAppsRevokeAllOAuthAppTokens.ts b/src/funcs/oAuthAppsRevokeAllOAuthAppTokens.ts new file mode 100644 index 00000000..555e9f7d --- /dev/null +++ b/src/funcs/oAuthAppsRevokeAllOAuthAppTokens.ts @@ -0,0 +1,156 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + RevokeAllOAuthAppTokensRequest, + RevokeAllOAuthAppTokensRequest$zodSchema, +} from "../models/revokealloauthapptokensop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Revoke all app tokens + * + * @remarks + * Revokes every access and refresh token currently issued to an OAuth app, in a single operation. Use this for emergency credential rotation, suspected secret leaks, or as a follow-up to `POST /oauth-clients/{appId}/regenerate-secret` when you want existing sessions invalidated immediately rather than letting them expire naturally. + * + * The response `count` is the total number of tokens revoked across both types. Clients of this app must then obtain new tokens via the standard OAuth flow. + * + * Creator-only. + */ +export function oAuthAppsRevokeAllOAuthAppTokens( + client$: SDKCore, + request: RevokeAllOAuthAppTokensRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: RevokeAllOAuthAppTokensRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => RevokeAllOAuthAppTokensRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + appId: encodeSimple("appId", payload$.appId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/oauth-clients/{appId}/revoke-all-tokens")( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "revokeAllOAuthAppTokens", + oAuth2Scopes: [], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/oAuthAppsSuspendOAuthApp.ts b/src/funcs/oAuthAppsSuspendOAuthApp.ts new file mode 100644 index 00000000..f5a26653 --- /dev/null +++ b/src/funcs/oAuthAppsSuspendOAuthApp.ts @@ -0,0 +1,156 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + SuspendOAuthAppRequest, + SuspendOAuthAppRequest$zodSchema, +} from "../models/suspendoauthappop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Suspend OAuth app + * + * @remarks + * Moves an OAuth app to `status: "suspended"`, blocking new token issuance at `POST /oauth2/token` and the authorization-code consent flow. Tokens that have already been issued remain valid until their natural expiry — call `POST /oauth-clients/{appId}/revoke-all-tokens` immediately afterwards if you need an immediate lockout. + * + * Use this for temporary suspensions where you intend to reactivate later. For permanent removal, use `DELETE /oauth-clients/{appId}`. Suspending an app that is already suspended returns `400`. + * + * Creator-only. + */ +export function oAuthAppsSuspendOAuthApp( + client$: SDKCore, + request: SuspendOAuthAppRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: SuspendOAuthAppRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => SuspendOAuthAppRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + appId: encodeSimple("appId", payload$.appId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/oauth-clients/{appId}/suspend")( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "suspendOAuthApp", + oAuth2Scopes: [], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/oAuthAppsUpdateOAuthApp.ts b/src/funcs/oAuthAppsUpdateOAuthApp.ts new file mode 100644 index 00000000..5f1cd6d3 --- /dev/null +++ b/src/funcs/oAuthAppsUpdateOAuthApp.ts @@ -0,0 +1,159 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + UpdateOAuthAppRequestRequest, + UpdateOAuthAppRequestRequest$zodSchema, +} from "../models/updateoauthappop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Update OAuth app + * + * @remarks + * Update an OAuth app's configuration. All body fields are optional — supply only what should change. URL fields (`homepageUrl`, `privacyPolicyUrl`, `termsOfServiceUrl`) accept `null` to clear them. + * + * Creator-only: even org admins cannot edit apps owned by other users. + * + * When modifying `allowedScopes`, the new set must remain a subset of the caller's role-aware scope list (same rule as `GET /oauth-clients/scopes`). When adding `authorization_code` to `allowedGrantTypes`, `redirectUris` becomes required and must contain at least one URI; otherwise the request is rejected with `400` by the Zod refine on `updateAppSchema`. + * + * This endpoint never rotates the client secret — use `POST /oauth-clients/{appId}/regenerate-secret` for that. + */ +export function oAuthAppsUpdateOAuthApp( + client$: SDKCore, + request: UpdateOAuthAppRequestRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: UpdateOAuthAppRequestRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => UpdateOAuthAppRequestRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = encodeJSON("body", payload$.body, { explode: true }); + + const pathParams$ = { + appId: encodeSimple("appId", payload$.appId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/oauth-clients/{appId}")( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "updateOAuthApp", + oAuth2Scopes: [], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "PUT", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/oAuthProviderOauthIntrospect.ts b/src/funcs/oAuthProviderOauthIntrospect.ts new file mode 100644 index 00000000..773a2e0c --- /dev/null +++ b/src/funcs/oAuthProviderOauthIntrospect.ts @@ -0,0 +1,151 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeJSON } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + OAuthIntrospectRequest, + OAuthIntrospectRequest$zodSchema, +} from "../models/oauthintrospectrequest.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Introspect a token + * + * @remarks + * OAuth 2.0 Token Introspection Endpoint (RFC 7662). + * + * Check if a token is active and retrieve its metadata. + * + * **Use Cases:** + * - Resource servers validating tokens + * - Debugging token issues + * - Checking token scopes before processing requests + * + * **Response:** + * - Active token: Returns `active: true` with token metadata + * - Invalid/expired/revoked token: Returns only `active: false` + */ +export function oAuthProviderOauthIntrospect( + client$: SDKCore, + request: OAuthIntrospectRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: OAuthIntrospectRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => OAuthIntrospectRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = encodeJSON("body", payload$, { explode: true }); + const path$ = pathToFunc("/oauth2/introspect")(); + + const headers$ = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + })); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "oauthIntrospect", + oAuth2Scopes: null, + resolvedSecurity: null, + securitySource: null, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + method: "POST", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/oAuthProviderOauthRevoke.ts b/src/funcs/oAuthProviderOauthRevoke.ts new file mode 100644 index 00000000..c44aadb8 --- /dev/null +++ b/src/funcs/oAuthProviderOauthRevoke.ts @@ -0,0 +1,151 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeJSON } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + OAuthRevokeRequest, + OAuthRevokeRequest$zodSchema, +} from "../models/oauthrevokerequest.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Revoke an access or refresh token + * + * @remarks + * OAuth 2.0 Token Revocation Endpoint (RFC 7009). + * + * Revokes an access token or refresh token, preventing further use. + * Revoking a refresh token also invalidates associated access tokens. + * + * **Use Cases:** + * - User logs out of third-party app + * - User revokes app access from account settings + * - Security incident response + * + * **Note:** Returns 200 OK even if token was already revoked or invalid + * (per RFC 7009, to prevent token enumeration). + */ +export function oAuthProviderOauthRevoke( + client$: SDKCore, + request: OAuthRevokeRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: OAuthRevokeRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => OAuthRevokeRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = encodeJSON("body", payload$, { explode: true }); + const path$ = pathToFunc("/oauth2/revoke")(); + + const headers$ = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + })); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "oauthRevoke", + oAuth2Scopes: null, + resolvedSecurity: null, + securitySource: null, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + method: "POST", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/oAuthProviderOauthToken.ts b/src/funcs/oAuthProviderOauthToken.ts new file mode 100644 index 00000000..31102418 --- /dev/null +++ b/src/funcs/oAuthProviderOauthToken.ts @@ -0,0 +1,158 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeJSON } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + OAuthTokenRequest, + OAuthTokenRequest$zodSchema, +} from "../models/oauthtokenrequest.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Exchange authorization code for tokens + * + * @remarks + * OAuth 2.0 Token Endpoint (RFC 6749 Section 4.1.3). + * + * Exchanges an authorization code, client credentials, or refresh token for access tokens. + * + * **Grant Types:** + * - `authorization_code`: Exchange auth code for tokens (user-based) + * - `client_credentials`: Get tokens for machine-to-machine auth + * - `refresh_token`: Get new access token using refresh token + * + * For **`client_credentials`**, access tokens represent the **OAuth app creator** (the user who registered the client). The JWT may encode **`userId === client_id`**; the **Node API gateway** resolves the creator (**`createdBy`** claim or OAuth app lookup) and must not trust client-supplied **`x-oauth-user-id`** (stripped on ingress). Downstream Python services accept **`x-oauth-user-id`** only when set by the gateway — see **OAuth Provider** tag. + * + * **Client Authentication:** + * Can be provided via: + * - HTTP Basic auth: `Authorization: Basic base64(client_id:client_secret)` + * - Request body: `client_id` and `client_secret` parameters + * + * **PKCE Verification:** + * If authorization used PKCE, the `code_verifier` must be provided and will be + * verified against the stored code challenge. + */ +export function oAuthProviderOauthToken( + client$: SDKCore, + request: OAuthTokenRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: OAuthTokenRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => OAuthTokenRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = encodeJSON("body", payload$, { explode: true }); + const path$ = pathToFunc("/oauth2/token")(); + + const headers$ = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + })); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "oauthToken", + oAuth2Scopes: null, + resolvedSecurity: null, + securitySource: null, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + method: "POST", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/openIDConnectOauthUserInfo.ts b/src/funcs/openIDConnectOauthUserInfo.ts new file mode 100644 index 00000000..3e2c99f2 --- /dev/null +++ b/src/funcs/openIDConnectOauthUserInfo.ts @@ -0,0 +1,134 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { compactMap } from "../lib/primitives.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Get authenticated user information + * + * @remarks + * OpenID Connect UserInfo Endpoint. + * + * Returns claims about the authenticated user. Requires a valid access token + * with the `openid` scope. + * + * **Available Claims:** + * - `user_id` - User identifier + * - `name`, `given_name`, `family_name` - Name claims (with `profile` scope) + * - `email`, `email_verified` - Email claims (with `email` scope) + * + * **Authentication:** + * Pass the access token as a Bearer token: `Authorization: Bearer {access_token}` + */ +export function openIDConnectOauthUserInfo( + client$: SDKCore, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + options, + )); +} + +async function $do( + client$: SDKCore, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const path$ = pathToFunc("/oauth2/userinfo")(); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "oauthUserInfo", + oAuth2Scopes: [], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/organizationAuthConfigGetAuthMethods.ts b/src/funcs/organizationAuthConfigGetAuthMethods.ts new file mode 100644 index 00000000..d13b188a --- /dev/null +++ b/src/funcs/organizationAuthConfigGetAuthMethods.ts @@ -0,0 +1,142 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { compactMap } from "../lib/primitives.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Get organization authentication methods + * + * @remarks + * Retrieve the configured authentication methods for the organization. + * + * **Response Structure:** + * + * Returns an array of authentication steps, each containing: + * - `order`: Step number (1-3) + * - `allowedMethods`: Array of methods allowed for that step + * + * **Example Response:** + * + * ```json + * { + * "authMethods": [ + * { "order": 1, "allowedMethods": [{ "type": "password" }, { "type": "google" }] }, + * { "order": 2, "allowedMethods": [{ "type": "otp" }] } + * ] + * } + * ``` + * + * **Admin Access Required:** Only organization admins can view auth configuration. + */ +export function organizationAuthConfigGetAuthMethods( + client$: SDKCore, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + options, + )); +} + +async function $do( + client$: SDKCore, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const path$ = pathToFunc("/orgAuthConfig/authMethods")(); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "getAuthMethods", + oAuth2Scopes: [], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/conversationsStreamConversation.ts b/src/funcs/organizationAuthConfigSetUpAuthConfig.ts similarity index 71% rename from src/funcs/conversationsStreamConversation.ts rename to src/funcs/organizationAuthConfigSetUpAuthConfig.ts index 3eb7da07..f1d506e0 100644 --- a/src/funcs/conversationsStreamConversation.ts +++ b/src/funcs/organizationAuthConfigSetUpAuthConfig.ts @@ -1,21 +1,14 @@ -// Hand-written supplement (NOT generated). Mirrors -// `conversationsCreateConversation.ts` but POSTs to `/conversations/stream` -// and asks for an SSE response. The body shape is identical to the -// non-streaming sibling, so we reuse `CreateConversationRequest`'s zod -// schema. Returns the raw streaming `Response`; the caller is expected to -// parse `text/event-stream` line-by-line. +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ -import { PipeshubCore } from "../core.js"; +import { SDKCore } from "../core.js"; import { encodeJSON } from "../lib/encodings.js"; import { compactMap } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; import { RequestOptions } from "../lib/sdks.js"; import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; import { pathToFunc } from "../lib/url.js"; -import { - CreateConversationRequest, - CreateConversationRequest$zodSchema, -} from "../models/createconversationrequest.js"; import { APIError } from "../models/errors/apierror.js"; import { ConnectionError, @@ -25,12 +18,22 @@ import { UnexpectedClientError, } from "../models/errors/httpclienterrors.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + OrgAuthConfigCreateRequest, + OrgAuthConfigCreateRequest$zodSchema, +} from "../models/orgauthconfigcreaterequest.js"; import { APICall, APIPromise } from "../types/async.js"; import { Result } from "../types/fp.js"; -export function conversationsStreamConversation( - client$: PipeshubCore, - request: CreateConversationRequest, +/** + * Set up auth configuration + * + * @remarks + * Set up or initialize the organization's authentication configuration. + */ +export function organizationAuthConfigSetUpAuthConfig( + client$: SDKCore, + request: OrgAuthConfigCreateRequest, options?: RequestOptions, ): APIPromise< Result< @@ -44,12 +47,16 @@ export function conversationsStreamConversation( | ConnectionError > > { - return new APIPromise($do(client$, request, options)); + return new APIPromise($do( + client$, + request, + options, + )); } async function $do( - client$: PipeshubCore, - request: CreateConversationRequest, + client$: SDKCore, + request: OrgAuthConfigCreateRequest, options?: RequestOptions, ): Promise< [ @@ -68,7 +75,7 @@ async function $do( > { const parsed$ = safeParse( request, - (value$) => CreateConversationRequest$zodSchema.parse(value$), + (value$) => OrgAuthConfigCreateRequest$zodSchema.parse(value$), "Input validation failed", ); if (!parsed$.ok) { @@ -76,11 +83,11 @@ async function $do( } const payload$ = parsed$.value; const body$ = encodeJSON("body", payload$, { explode: true }); - const path$ = pathToFunc("/conversations/stream")(); + const path$ = pathToFunc("/orgAuthConfig")(); const headers$ = new Headers(compactMap({ "Content-Type": "application/json", - Accept: "text/event-stream", + Accept: "application/json", })); const securityInput = await extractSecurity(client$._options.security); const requestSecurity = resolveGlobalSecurity(securityInput); @@ -88,8 +95,8 @@ async function $do( const context = { options: client$._options, baseURL: options?.serverURL ?? client$._baseURL ?? "", - operationID: "streamConversation", - oAuth2Scopes: ["conversation:write"], + operationID: "setUpAuthConfig", + oAuth2Scopes: [], resolvedSecurity: requestSecurity, securitySource: client$._options.security, retryConfig: options?.retries @@ -112,8 +119,8 @@ async function $do( headers: headers$, body: body$, userAgent: client$._options.userAgent, - // SSE streams are long-lived; let the caller's AbortSignal cap it. - timeoutMs: options?.timeoutMs || -1, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, }, options); if (!requestRes.ok) { return [requestRes, { status: "invalid" }]; diff --git a/src/funcs/organizationAuthConfigUpdateAuthMethod.ts b/src/funcs/organizationAuthConfigUpdateAuthMethod.ts new file mode 100644 index 00000000..24a82ecb --- /dev/null +++ b/src/funcs/organizationAuthConfigUpdateAuthMethod.ts @@ -0,0 +1,184 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeJSON } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + UpdateAuthMethodRequest, + UpdateAuthMethodRequest$zodSchema, +} from "../models/updateauthmethodop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Update organization authentication methods + * + * @remarks + * Update the authentication methods configuration for an organization. + * This allows admins to configure single or multi-factor authentication. + * + * **Validation Rules:** + * - Minimum 1 step, maximum 3 steps + * - Each step must have a unique order (1, 2, or 3) + * - No duplicate methods within the same step + * - No method can appear in multiple steps + * - Each step must have at least one allowed method + * + * **Available Methods:** + * - `password`: Email/password authentication + * - `otp`: One-time password via email + * - `google`: Google OAuth 2.0 + * - `microsoft`: Microsoft OAuth 2.0 + * - `azureAd`: Azure Active Directory + * - `samlSso`: SAML 2.0 Single Sign-On + * - `oauth`: Generic OAuth 2.0 provider + * + * **Example - Single Factor (Password or Google):** + * + * ```json + * { + * "authMethod": [ + * { "order": 1, "allowedMethods": [{ "type": "password" }, { "type": "google" }] } + * ] + * } + * ``` + * + * **Example - Two Factor (Password + OTP):** + * + * ```json + * { + * "authMethod": [ + * { "order": 1, "allowedMethods": [{ "type": "password" }] }, + * { "order": 2, "allowedMethods": [{ "type": "otp" }] } + * ] + * } + * ``` + * + * **Admin Access Required:** Only organization admins can update auth configuration. + */ +export function organizationAuthConfigUpdateAuthMethod( + client$: SDKCore, + request: UpdateAuthMethodRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: UpdateAuthMethodRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => UpdateAuthMethodRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = encodeJSON("body", payload$, { explode: true }); + const path$ = pathToFunc("/orgAuthConfig/updateAuthMethod")(); + + const headers$ = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "updateAuthMethod", + oAuth2Scopes: [], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/organizationsGetCurrentOrganization.ts b/src/funcs/organizationsGetCurrentOrganization.ts new file mode 100644 index 00000000..2db05cf0 --- /dev/null +++ b/src/funcs/organizationsGetCurrentOrganization.ts @@ -0,0 +1,140 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { compactMap } from "../lib/primitives.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Get current organization + * + * @remarks + * Retrieve details about the authenticated user's organization. + * + * **Overview:** + * + * This endpoint returns the organization document for the current user's org, including profile data and configuration. + * + * **Response Includes:** + * + * - Organization profile (registeredName, shortName, contactEmail, domain) + * - Account type + * - Onboarding status + * - Permanent address + * - Creation and modification timestamps + * + * **Use Cases:** + * + * - Organization profile pages + * - Settings and configuration screens + */ +export function organizationsGetCurrentOrganization( + client$: SDKCore, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + options, + )); +} + +async function $do( + client$: SDKCore, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const path$ = pathToFunc("/org")(); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "getCurrentOrganization", + oAuth2Scopes: ["org:read"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/recordsStreamRecordBuffer.ts b/src/funcs/recordsStreamRecordBuffer.ts deleted file mode 100644 index 6973a7c8..00000000 --- a/src/funcs/recordsStreamRecordBuffer.ts +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import { PipeshubCore } from "../core.js"; -import { encodeFormQuery, encodeSimple } from "../lib/encodings.js"; -import { compactMap } from "../lib/primitives.js"; -import { safeParse } from "../lib/schemas.js"; -import { RequestOptions } from "../lib/sdks.js"; -import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; -import { pathToFunc } from "../lib/url.js"; -import { APIError } from "../models/errors/apierror.js"; -import { - ConnectionError, - InvalidRequestError, - RequestAbortedError, - RequestTimeoutError, - UnexpectedClientError, -} from "../models/errors/httpclienterrors.js"; -import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; -import { - StreamRecordBufferRequest, - StreamRecordBufferRequest$zodSchema, -} from "../models/streamrecordbufferop.js"; -import { APICall, APIPromise } from "../types/async.js"; -import { Result } from "../types/fp.js"; - -export enum StreamRecordBufferAcceptEnum { - applicationJsonAccept = "application/json", - applicationOctetStreamAccept = "application/octet-stream", - wildcardRootWildcardAccept = "*/*", -} - -/** - * Stream record content - * - * @remarks - * Stream the binary content of a record's file.

- * Overview:
- * Proxies the upstream connector backend and pipes the file bytes back - * to the caller. The response Content-Type and - * Content-Disposition are forwarded from the upstream — for - * most records this is application/octet-stream with a - * filename, but a converted file (see convertTo) returns - * the converted MIME type (e.g. application/pdf).

- * Use Cases:
- *
    - *
  • File downloads
  • - *
  • Inline document preview
  • - *
  • Content extraction pipelines
  • - *
  • Tool / MCP callers fetching a document the chat just cited
  • - *
- * How a programmatic / MCP caller obtains recordId:
- *
    - *
  1. From a prior chat (preferred). After - * POST /conversations/stream emits its complete - * SSE frame, walk - * conversation.messages[*].citations[*].metadata.recordId - * (and metadata.recordName for display) — those are the records - * the AI grounded its answer in. Pass any of those ids straight to this - * endpoint to download the underlying file.
  2. - *
  3. From a filename / topic / natural-language description. If the - * user gave you a name or topic instead of an id (e.g. "download the - * langchain doc"), call POST /search with that phrase as - * query. Read the resulting record id from - * searchResponse.searchResults[*].metadata.recordId - * (or, equivalently, any key in - * searchResponse.virtual_to_record_map). If multiple - * distinct records match, ask the user to disambiguate before - * downloading.
  4. - *
- * Format Conversion:
- * Use convertTo to convert between formats (e.g. DOCX → PDF). - * When set, the response Content-Type reflects the converted - * format, not the original.

- * Error shape:
- * On failure the endpoint returns JSON: { "error": "..." } - * with the upstream status code (e.g. 404 for unknown record, 403 if the - * caller lacks read permission on the record). - */ -export function recordsStreamRecordBuffer( - client$: PipeshubCore, - request: StreamRecordBufferRequest, - options?: RequestOptions, -): APIPromise< - Result< - Response, - | APIError - | SDKValidationError - | UnexpectedClientError - | InvalidRequestError - | RequestAbortedError - | RequestTimeoutError - | ConnectionError - > -> { - return new APIPromise($do( - client$, - request, - options, - )); -} - -async function $do( - client$: PipeshubCore, - request: StreamRecordBufferRequest, - options?: RequestOptions & { - acceptHeaderOverride?: StreamRecordBufferAcceptEnum; - }, -): Promise< - [ - Result< - Response, - | APIError - | SDKValidationError - | UnexpectedClientError - | InvalidRequestError - | RequestAbortedError - | RequestTimeoutError - | ConnectionError - >, - APICall, - ] -> { - const parsed$ = safeParse( - request, - (value$) => StreamRecordBufferRequest$zodSchema.parse(value$), - "Input validation failed", - ); - if (!parsed$.ok) { - return [parsed$, { status: "invalid" }]; - } - const payload$ = parsed$.value; - const body$ = null; - - const pathParams$ = { - recordId: encodeSimple("recordId", payload$.recordId, { - explode: false, - charEncoding: "percent", - }), - }; - const path$ = pathToFunc("/knowledgeBase/stream/record/{recordId}")( - pathParams$, - ); - const query$ = encodeFormQuery({ - "convertTo": payload$.convertTo, - }); - - const headers$ = new Headers(compactMap({ - Accept: options?.acceptHeaderOverride - || "application/json;q=1, application/octet-stream;q=0.7, */*;q=0", - })); - const securityInput = await extractSecurity(client$._options.security); - const requestSecurity = resolveGlobalSecurity(securityInput); - - const context = { - options: client$._options, - baseURL: options?.serverURL ?? client$._baseURL ?? "", - operationID: "streamRecordBuffer", - oAuth2Scopes: ["kb:read"], - resolvedSecurity: requestSecurity, - securitySource: client$._options.security, - retryConfig: options?.retries - || client$._options.retryConfig - || { strategy: "none" }, - retryCodes: options?.retryCodes || [ - "429", - "500", - "502", - "503", - "504", - ], - }; - - const requestRes = client$._createRequest(context, { - security: requestSecurity, - method: "GET", - baseURL: options?.serverURL, - path: path$, - headers: headers$, - query: query$, - body: body$, - userAgent: client$._options.userAgent, - timeoutMs: options?.timeoutMs || client$._options.timeoutMs - || -1, - }, options); - if (!requestRes.ok) { - return [requestRes, { status: "invalid" }]; - } - const req$ = requestRes.value; - - const doResult = await client$._do(req$, { - context, - errorCodes: [], - retryConfig: context.retryConfig, - retryCodes: context.retryCodes, - }); - if (!doResult.ok) { - return [doResult, { status: "request-error", request: req$ }]; - } - return [doResult, { - status: "complete", - "request": req$, - response: doResult.value, - }]; -} diff --git a/src/funcs/semanticSearchArchiveSearch.ts b/src/funcs/semanticSearchArchiveSearch.ts new file mode 100644 index 00000000..68e9b6d4 --- /dev/null +++ b/src/funcs/semanticSearchArchiveSearch.ts @@ -0,0 +1,154 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ArchiveSearchRequest, + ArchiveSearchRequest$zodSchema, +} from "../models/archivesearchop.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Archive a search + * + * @remarks + * Archive a specific search result. Archived searches are hidden + * from the default search history view but remain retrievable via + * the archive-aware listing endpoints. + */ +export function semanticSearchArchiveSearch( + client$: SDKCore, + request: ArchiveSearchRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: ArchiveSearchRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => ArchiveSearchRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + searchId: encodeSimple("searchId", payload$.searchId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/search/{searchId}/archive")( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "archiveSearch", + oAuth2Scopes: ["semantic:write"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "PATCH", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/semanticSearchDeleteSearchById.ts b/src/funcs/semanticSearchDeleteSearchById.ts new file mode 100644 index 00000000..2581dd14 --- /dev/null +++ b/src/funcs/semanticSearchDeleteSearchById.ts @@ -0,0 +1,165 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeFormQuery, encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + DeleteSearchByIdRequest, + DeleteSearchByIdRequest$zodSchema, +} from "../models/deletesearchbyidop.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Delete search by ID + * + * @remarks + * Permanently delete a single persisted search row, plus every + * citation row referenced by its `citationIds`. The caller must + * either own the row or have it shared with them. + * + * Scoped to the caller's org and limited to rows where + * `isDeleted: false` and `isArchived: false`; archived or + * already-deleted rows surface as `404`. + */ +export function semanticSearchDeleteSearchById( + client$: SDKCore, + request: DeleteSearchByIdRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: DeleteSearchByIdRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => DeleteSearchByIdRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + searchId: encodeSimple("searchId", payload$.searchId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/search/{searchId}")( + pathParams$, + ); + const query$ = encodeFormQuery({ + "endDate": payload$.endDate, + "search": payload$.search, + "shared": payload$.shared, + "startDate": payload$.startDate, + }); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "deleteSearchById", + oAuth2Scopes: ["semantic:delete"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "DELETE", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + query: query$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/semanticSearchDeleteSearchHistory.ts b/src/funcs/semanticSearchDeleteSearchHistory.ts new file mode 100644 index 00000000..a5c0f9b0 --- /dev/null +++ b/src/funcs/semanticSearchDeleteSearchHistory.ts @@ -0,0 +1,157 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeFormQuery } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + DeleteSearchHistoryRequest, + DeleteSearchHistoryRequest$zodSchema, +} from "../models/deletesearchhistoryop.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Clear all search history + * + * @remarks + * Permanently delete every persisted search row owned by, or shared + * with, the authenticated user, along with the citation rows those + * searches reference. The action cannot be undone. + * + * Scoped to the caller's org and limited to rows where + * `isDeleted: false` and `isArchived: false`. If nothing matches + * (including the case where every row is already archived), the + * endpoint returns `404` rather than a successful no-op. + */ +export function semanticSearchDeleteSearchHistory( + client$: SDKCore, + request?: DeleteSearchHistoryRequest | undefined, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request?: DeleteSearchHistoryRequest | undefined, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => DeleteSearchHistoryRequest$zodSchema.optional().parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + const path$ = pathToFunc("/search")(); + const query$ = encodeFormQuery({ + "endDate": payload$?.endDate, + "search": payload$?.search, + "shared": payload$?.shared, + "startDate": payload$?.startDate, + }); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "deleteSearchHistory", + oAuth2Scopes: ["semantic:delete"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "DELETE", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + query: query$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/semanticSearchGetSearchById.ts b/src/funcs/semanticSearchGetSearchById.ts new file mode 100644 index 00000000..93542aa1 --- /dev/null +++ b/src/funcs/semanticSearchGetSearchById.ts @@ -0,0 +1,158 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + GetSearchByIdRequest, + GetSearchByIdRequest$zodSchema, +} from "../models/getsearchbyidop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Get search by ID + * + * @remarks + * Retrieve a previously persisted search by its id, scoped to the + * caller's org. + * + * The response body is always an **array** containing zero or one + * persisted search document. An unknown id returns an empty array + * with a `200` status — callers should check array length rather + * than relying on a `404`. + */ +export function semanticSearchGetSearchById( + client$: SDKCore, + request: GetSearchByIdRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: GetSearchByIdRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => GetSearchByIdRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + searchId: encodeSimple("searchId", payload$.searchId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/search/{searchId}")( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "getSearchById", + oAuth2Scopes: ["semantic:read"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/semanticSearchSearch.ts b/src/funcs/semanticSearchSearch.ts index 13747b4b..b7b097be 100644 --- a/src/funcs/semanticSearchSearch.ts +++ b/src/funcs/semanticSearchSearch.ts @@ -2,7 +2,7 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { PipeshubCore } from "../core.js"; +import { SDKCore } from "../core.js"; import { encodeJSON } from "../lib/encodings.js"; import { compactMap } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; @@ -29,36 +29,23 @@ import { Result } from "../types/fp.js"; * Perform semantic search * * @remarks - * Execute a semantic search across your organization's knowledge base.

- * Overview:
- * Semantic search uses AI embeddings to find content based on meaning, - * not just keyword matching. This enables finding relevant information - * even when the exact words differ.

- * How It Works:
- *
    - *
  1. Your query is converted to a vector embedding
  2. - *
  3. The system finds documents with similar semantic meaning
  4. - *
  5. Results are ranked by relevance score
  6. - *
  7. Matching chunks are returned with metadata
  8. - *
- * Filtering:
- * Use filters to narrow your search: - *
    - *
  • filters.apps: Limit to specific connector apps (Google Drive, Confluence, etc.)
  • - *
  • filters.kb: Limit to specific knowledge bases
  • - *
- * Results:
- * Each result includes: - *
    - *
  • Matching content chunk
  • - *
  • Relevance score (0-1, higher is better)
  • - *
  • Source document metadata (name, URL, type)
  • - *
- * Search History:
- * All searches are saved and can be retrieved via GET /search. + * Run a semantic search across your organization's knowledge base. + * Matching is meaning-based, so relevant results surface even when + * the wording differs from the query. + * + * Use optional `filters` to narrow the scope: + * + * - `filters.apps` — restrict to specific connector apps (for + * example Google Drive or Confluence). + * - `filters.kb` — restrict to specific knowledge bases. + * + * The response returns a `searchId` for the persisted search along + * with ranked matches, each carrying a relevance score and the + * source document's metadata. Past searches can be retrieved via + * `GET /search`. */ export function semanticSearchSearch( - client$: PipeshubCore, + client$: SDKCore, request: SemanticSearchRequest, options?: RequestOptions, ): APIPromise< @@ -81,7 +68,7 @@ export function semanticSearchSearch( } async function $do( - client$: PipeshubCore, + client$: SDKCore, request: SemanticSearchRequest, options?: RequestOptions, ): Promise< diff --git a/src/funcs/usersGetAllUsers.ts b/src/funcs/semanticSearchSearchHistory.ts similarity index 67% rename from src/funcs/usersGetAllUsers.ts rename to src/funcs/semanticSearchSearchHistory.ts index b31bb8ac..c2d9fb2e 100644 --- a/src/funcs/usersGetAllUsers.ts +++ b/src/funcs/semanticSearchSearchHistory.ts @@ -2,7 +2,7 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import { PipeshubCore } from "../core.js"; +import { SDKCore } from "../core.js"; import { encodeFormQuery } from "../lib/encodings.js"; import { compactMap } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; @@ -19,42 +19,30 @@ import { } from "../models/errors/httpclienterrors.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import { - GetAllUsersRequest, - GetAllUsersRequest$zodSchema, -} from "../models/getallusersop.js"; + SearchHistoryRequest, + SearchHistoryRequest$zodSchema, +} from "../models/searchhistoryop.js"; import { APICall, APIPromise } from "../types/async.js"; import { Result } from "../types/fp.js"; /** - * Get all users + * Get search history * * @remarks - * Retrieve a paginated list of all users in the organization.

- * Overview:
- * This endpoint returns all active users in your organization. It's the primary endpoint for listing and displaying users in admin dashboards, user directories, and selection interfaces.

- * Response Data:
- *
    - *
  • User profile information (name, email, designation)
  • - *
  • Account status (active, pending invitation, disabled)
  • - *
  • Login history (hasLoggedIn flag)
  • - *
  • Timestamps (createdAt, updatedAt)
  • - *
- * Privacy Controls:
- *
    - *
  • Email addresses may be masked based on organization settings
  • - *
  • Sensitive fields (password, tokens) are never exposed
  • - *
  • Deleted users are excluded from results
  • - *
- * Performance Notes:
- *
    - *
  • Results are cached for improved performance
  • - *
  • For large organizations, consider using pagination
  • - *
  • Use /users/by-ids for fetching specific users
  • - *
+ * Retrieve the authenticated user's persisted search history. + * + * Returns searches the user owns along with searches shared with them, + * scoped to the caller's organization. Archived and deleted entries are + * excluded. Citation references on this endpoint are returned as raw + * identifier strings; use `GET /search/{searchId}` to fetch a single + * search with its citations fully expanded. + * + * Pagination defaults to `page=1, limit=20` (maximum `limit` is 100). + * Results are sorted by most recent activity by default. */ -export function usersGetAllUsers( - client$: PipeshubCore, - request?: GetAllUsersRequest | undefined, +export function semanticSearchSearchHistory( + client$: SDKCore, + request?: SearchHistoryRequest | undefined, options?: RequestOptions, ): APIPromise< Result< @@ -76,8 +64,8 @@ export function usersGetAllUsers( } async function $do( - client$: PipeshubCore, - request?: GetAllUsersRequest | undefined, + client$: SDKCore, + request?: SearchHistoryRequest | undefined, options?: RequestOptions, ): Promise< [ @@ -96,7 +84,7 @@ async function $do( > { const parsed$ = safeParse( request, - (value$) => GetAllUsersRequest$zodSchema.optional().parse(value$), + (value$) => SearchHistoryRequest$zodSchema.optional().parse(value$), "Input validation failed", ); if (!parsed$.ok) { @@ -104,11 +92,16 @@ async function $do( } const payload$ = parsed$.value; const body$ = null; - const path$ = pathToFunc("/users")(); + const path$ = pathToFunc("/search")(); const query$ = encodeFormQuery({ + "endDate": payload$?.endDate, "limit": payload$?.limit, "page": payload$?.page, "search": payload$?.search, + "shared": payload$?.shared, + "sortBy": payload$?.sortBy, + "sortOrder": payload$?.sortOrder, + "startDate": payload$?.startDate, }); const headers$ = new Headers(compactMap({ @@ -120,8 +113,8 @@ async function $do( const context = { options: client$._options, baseURL: options?.serverURL ?? client$._baseURL ?? "", - operationID: "getAllUsers", - oAuth2Scopes: ["user:read"], + operationID: "searchHistory", + oAuth2Scopes: ["semantic:read"], resolvedSecurity: requestSecurity, securitySource: client$._options.security, retryConfig: options?.retries diff --git a/src/funcs/semanticSearchUnarchiveSearch.ts b/src/funcs/semanticSearchUnarchiveSearch.ts new file mode 100644 index 00000000..bd8cffec --- /dev/null +++ b/src/funcs/semanticSearchUnarchiveSearch.ts @@ -0,0 +1,152 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + UnarchiveSearchRequest, + UnarchiveSearchRequest$zodSchema, +} from "../models/unarchivesearchop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Unarchive a search + * + * @remarks + * Restore a previously archived search result back to the active search history. + */ +export function semanticSearchUnarchiveSearch( + client$: SDKCore, + request: UnarchiveSearchRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: UnarchiveSearchRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => UnarchiveSearchRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = null; + + const pathParams$ = { + searchId: encodeSimple("searchId", payload$.searchId, { + explode: false, + charEncoding: "percent", + }), + }; + const path$ = pathToFunc("/search/{searchId}/unarchive")( + pathParams$, + ); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "unarchiveSearch", + oAuth2Scopes: ["semantic:write"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "PATCH", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/userAccountAuthenticate.ts b/src/funcs/userAccountAuthenticate.ts new file mode 100644 index 00000000..f56d1ce2 --- /dev/null +++ b/src/funcs/userAccountAuthenticate.ts @@ -0,0 +1,170 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { pathToFunc } from "../lib/url.js"; +import { + AuthenticateRequestRequest, + AuthenticateRequestRequest$zodSchema, +} from "../models/authenticateop.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Authenticate user with credentials + * + * @remarks + * Authenticate a user using the specified method and credentials. + * Requires a valid session token from `/initAuth`. + * + * **Credential Formats by Method:** + * + * - `password`: `{ "credentials": { "password": "your-password" } }` + * - `otp`: `{ "credentials": { "otp": "123456" } }` (6-digit code, valid for 10 minutes) + * - `google`: `{ "credentials": "google-id-token-string" }` + * - `microsoft`: `{ "credentials": { "accessToken": "...", "idToken": "..." } }` + * - `azureAd`: `{ "credentials": { "accessToken": "...", "idToken": "..." } }` + * - `oauth`: `{ "credentials": { "accessToken": "...", "idToken": "..." } }` + * - `samlSso`: Handled via redirect flow (use `/saml/signIn` instead) + * + * **Multi-Step Response:** + * + * If organization uses MFA, successful authentication returns: + * - `status: "success"` with `nextStep` and `allowedMethods` for next step + * + * **Fully Authenticated Response:** + * + * After completing all steps: + * - `message: "Fully authenticated"` with `accessToken` (1hr) and `refreshToken` (7d) + * + * **Security:** + * + * - Account locks after 5 consecutive failed attempts + * - CAPTCHA may be required if enabled (pass `cf-turnstile-response`) + */ +export function userAccountAuthenticate( + client$: SDKCore, + request: AuthenticateRequestRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: AuthenticateRequestRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => AuthenticateRequestRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = encodeJSON("body", payload$.body, { explode: true }); + const path$ = pathToFunc("/userAccount/authenticate")(); + + const headers$ = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "x-session-token": encodeSimple("x-session-token", payload$.xSessionToken, { + explode: false, + charEncoding: "none", + }), + })); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "authenticate", + oAuth2Scopes: null, + resolvedSecurity: null, + securitySource: null, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + method: "POST", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/userAccountInitAuth.ts b/src/funcs/userAccountInitAuth.ts new file mode 100644 index 00000000..423b865a --- /dev/null +++ b/src/funcs/userAccountInitAuth.ts @@ -0,0 +1,168 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeJSON } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + InitAuthRequest, + InitAuthRequest$zodSchema, +} from "../models/initauthrequest.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Initialize authentication session + * + * @remarks + * Start a server-side authentication session and discover which sign-in methods are + * configured for the organization. This is the first step in the multi-step login flow. + * + * **Request body (optional)** + * + * - You may omit the body, send an empty JSON object `{}`, or send `{ "email": "..." }`. + * - `email` in the body is optional and kept for legacy reasons; omitting it does not prevent + * initialization. The web client typically calls this endpoint without a body and sends + * `email` on `/authenticate` instead. + * - When provided, `email` is stored on the session for correlation with subsequent steps. + * + * **Flow:** + * + * 1. Call this endpoint (optional JSON body as above). + * 2. Receive a session token in the `x-session-token` response header. + * 3. Send that token on subsequent `/authenticate` requests (`x-session-token` header). + * 4. Use `allowedMethods` and `authProviders` from the response to render the login UI. + * + * **Session token** + * + * - Returned as header `x-session-token`. + * - Required for `/authenticate` (and related steps) until it expires. + * + * **Multi-factor authentication** + * + * If the organization has MFA, complete multiple authentication steps; each step may + * return the next step's allowed methods. + */ +export function userAccountInitAuth( + client$: SDKCore, + request?: InitAuthRequest | undefined, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request?: InitAuthRequest | undefined, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => InitAuthRequest$zodSchema.optional().parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = payload$ === undefined + ? null + : encodeJSON("body", payload$, { explode: true }); + const path$ = pathToFunc("/userAccount/initAuth")(); + + const headers$ = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + })); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "initAuth", + oAuth2Scopes: null, + resolvedSecurity: null, + securitySource: null, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + method: "POST", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/userAccountRefreshToken.ts b/src/funcs/userAccountRefreshToken.ts new file mode 100644 index 00000000..9aefdda0 --- /dev/null +++ b/src/funcs/userAccountRefreshToken.ts @@ -0,0 +1,151 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { compactMap } from "../lib/primitives.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { resolveSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { RefreshTokenSecurity } from "../models/refreshtokenop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Refresh access token + * + * @remarks + * Get a new access token using a valid refresh token. + * + * **Usage:** + * + * - Pass the refresh token as a Bearer token in the Authorization header + * - Returns a new access token and basic user information + * + * **Token Lifetimes:** + * + * - Access token: 24 hours (configurable via `ACCESS_TOKEN_EXPIRY` environment variable) + * - Refresh token: 30 days (configurable via `REFRESH_TOKEN_EXPIRY` environment variable) + * + * **Best Practices:** + * + * - Call this endpoint before the access token expires + * - Store the new access token and continue using it for authenticated requests + * - If refresh fails with 401, redirect user to login flow + */ +export function userAccountRefreshToken( + client$: SDKCore, + security: RefreshTokenSecurity, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + security, + options, + )); +} + +async function $do( + client$: SDKCore, + security: RefreshTokenSecurity, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const path$ = pathToFunc("/userAccount/refresh/token")(); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + + const requestSecurity = resolveSecurity( + [ + { + fieldName: "Authorization", + type: "http:bearer", + value: security?.scopedToken, + }, + ], + ); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "refreshToken", + oAuth2Scopes: null, + resolvedSecurity: requestSecurity, + securitySource: security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/userAccountResetPassword.ts b/src/funcs/userAccountResetPassword.ts new file mode 100644 index 00000000..c9893a48 --- /dev/null +++ b/src/funcs/userAccountResetPassword.ts @@ -0,0 +1,148 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { encodeJSON } from "../lib/encodings.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { + ResetPasswordRequest, + ResetPasswordRequest$zodSchema, +} from "../models/resetpasswordop.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Reset password + * + * @remarks + * Reset the password for the currently authenticated user. + * + * **Overview:** + * + * Allows a logged-in user to change their password by providing the current password and a new password. + */ +export function userAccountResetPassword( + client$: SDKCore, + request: ResetPasswordRequest, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + request, + options, + )); +} + +async function $do( + client$: SDKCore, + request: ResetPasswordRequest, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const parsed$ = safeParse( + request, + (value$) => ResetPasswordRequest$zodSchema.parse(value$), + "Input validation failed", + ); + if (!parsed$.ok) { + return [parsed$, { status: "invalid" }]; + } + const payload$ = parsed$.value; + const body$ = encodeJSON("body", payload$, { explode: true }); + const path$ = pathToFunc("/userAccount/password/reset")(); + + const headers$ = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "resetPassword", + oAuth2Scopes: [], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + body: body$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/funcs/webSearchGetWebSearchProviders.ts b/src/funcs/webSearchGetWebSearchProviders.ts new file mode 100644 index 00000000..cf055c97 --- /dev/null +++ b/src/funcs/webSearchGetWebSearchProviders.ts @@ -0,0 +1,126 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKCore } from "../core.js"; +import { compactMap } from "../lib/primitives.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { APIError } from "../models/errors/apierror.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Get all web search providers + * + * @remarks + * Retrieve all configured web search providers and current web search settings. + * + * **Authentication:** Session JWT or OAuth 2.0 access token via `Authorization: Bearer`. + * OAuth tokens must include the `config:read` scope. Admin role is not required. + */ +export function webSearchGetWebSearchProviders( + client$: SDKCore, + options?: RequestOptions, +): APIPromise< + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + return new APIPromise($do( + client$, + options, + )); +} + +async function $do( + client$: SDKCore, + options?: RequestOptions, +): Promise< + [ + Result< + Response, + | APIError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >, + APICall, + ] +> { + const path$ = pathToFunc("/configurationManager/web-search")(); + + const headers$ = new Headers(compactMap({ + Accept: "application/json", + })); + const securityInput = await extractSecurity(client$._options.security); + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client$._options, + baseURL: options?.serverURL ?? client$._baseURL ?? "", + operationID: "getWebSearchProviders", + oAuth2Scopes: ["config:read"], + resolvedSecurity: requestSecurity, + securitySource: client$._options.security, + retryConfig: options?.retries + || client$._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || [ + "429", + "500", + "502", + "503", + "504", + ], + }; + + const requestRes = client$._createRequest(context, { + security: requestSecurity, + method: "GET", + baseURL: options?.serverURL, + path: path$, + headers: headers$, + userAgent: client$._options.userAgent, + timeoutMs: options?.timeoutMs || client$._options.timeoutMs + || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req$ = requestRes.value; + + const doResult = await client$._do(req$, { + context, + errorCodes: [], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req$ }]; + } + return [doResult, { + status: "complete", + "request": req$, + response: doResult.value, + }]; +} diff --git a/src/hooks/oauth2scopes.ts b/src/hooks/oauth2scopes.ts index 1174ea70..3db7a333 100644 --- a/src/hooks/oauth2scopes.ts +++ b/src/hooks/oauth2scopes.ts @@ -9,6 +9,7 @@ * OAuth 2.0 authentication with fine-grained scopes. * Supports authorization_code (with PKCE) and client_credentials flows. * OAuth tokens are Bearer JWTs — use the same Authorization header as regular tokens. + * For **client_credentials**, machine JWTs may use `userId === client_id`; the Node gateway resolves the OAuth app creator and forwards **`x-oauth-user-id`** to Python where applicable — see **OAuth Provider** tag. */ export type OAuth2Scope = /** diff --git a/src/lib/config.ts b/src/lib/config.ts index 4c4940b7..2090e330 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -82,7 +82,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "1.0.0", - sdkVersion: "0.0.4", + sdkVersion: "0.0.1", genVersion: "2.846.1", - userAgent: "speakeasy-sdk/mcp-typescript 0.0.4 2.846.1 1.0.0 mcp", + userAgent: "speakeasy-sdk/mcp-typescript 0.0.1 2.846.1 1.0.0 mcp", } as const; diff --git a/src/mcp-server/cli/serve/command.ts b/src/mcp-server/cli/serve/command.ts index 80e17c1b..09e5f6d6 100644 --- a/src/mcp-server/cli/serve/command.ts +++ b/src/mcp-server/cli/serve/command.ts @@ -6,7 +6,6 @@ import { buildCommand } from "@stricli/core"; import { numberParser } from "@stricli/core"; import * as z from "zod"; import { consoleLoggerLevels } from "../../console-logger.js"; -import { mcpScopes } from "../../scopes.js"; export const serveCommand = buildCommand({ loader: async () => { @@ -44,13 +43,6 @@ export const serveCommand = buildCommand({ values: ["dynamic"], optional: true, }, - scope: { - kind: "enum", - brief: "Mount tools/resources that match given scope (repeatable flag)", - values: mcpScopes, - variadic: true, - optional: true, - }, "bearer-auth": { kind: "parsed", brief: "Sets the bearerAuth auth field for the API", diff --git a/src/mcp-server/cli/serve/impl.ts b/src/mcp-server/cli/serve/impl.ts index 7efe623c..0e470e85 100644 --- a/src/mcp-server/cli/serve/impl.ts +++ b/src/mcp-server/cli/serve/impl.ts @@ -65,7 +65,6 @@ async function startStreamableHTTP(cliFlags: ServeCommandFlags) { logger, allowedTools: cliFlags.tool, dynamic: cliFlags.mode === "dynamic", - scopes: cliFlags.scope, serverURL: cliFlags["server-url"], getSDK: () => buildSDK(headers, cliFlags, cliFlags["disable-static-auth"], logger), diff --git a/src/mcp-server/cli/start/command.ts b/src/mcp-server/cli/start/command.ts index 14ad3087..9d7e3332 100644 --- a/src/mcp-server/cli/start/command.ts +++ b/src/mcp-server/cli/start/command.ts @@ -6,7 +6,6 @@ import { buildCommand } from "@stricli/core"; import { numberParser } from "@stricli/core"; import * as z from "zod"; import { consoleLoggerLevels } from "../../console-logger.js"; -import { mcpScopes } from "../../scopes.js"; export const startCommand = buildCommand({ loader: async () => { @@ -44,13 +43,6 @@ export const startCommand = buildCommand({ values: ["dynamic"], optional: true, }, - scope: { - kind: "enum", - brief: "Mount tools/resources that match given scope (repeatable flag)", - values: mcpScopes, - variadic: true, - optional: true, - }, "bearer-auth": { kind: "parsed", brief: "Sets the bearerAuth auth field for the API", diff --git a/src/mcp-server/cli/start/impl.ts b/src/mcp-server/cli/start/impl.ts index 67ec795e..7cc9f572 100644 --- a/src/mcp-server/cli/start/impl.ts +++ b/src/mcp-server/cli/start/impl.ts @@ -52,7 +52,6 @@ async function startStdio(flags: StartCommandFlags) { logger, allowedTools: flags.tool, dynamic: flags.mode === "dynamic", - scopes: flags.scope, security: { bearerAuth: flags["bearer-auth"] ?? "", oauth2: flags["client-id"] != null && flags["client-secret"] != null @@ -117,7 +116,6 @@ async function startSSE(cliFlags: StartCommandFlags) { logger, allowedTools: flags.tool, dynamic: flags.mode === "dynamic", - scopes: flags.scope, security: { bearerAuth: flags["bearer-auth"] ?? "", oauth2: flags["client-id"] != null && flags["client-secret"] != null diff --git a/src/mcp-server/flags.ts b/src/mcp-server/flags.ts index 27c17f40..f737eda0 100644 --- a/src/mcp-server/flags.ts +++ b/src/mcp-server/flags.ts @@ -3,7 +3,6 @@ */ import { SDKOptions } from "../lib/config.js"; -import { MCPScope } from "./scopes.js"; /** * Base flags interface for MCP server configuration. @@ -12,7 +11,6 @@ import { MCPScope } from "./scopes.js"; export interface MCPServerFlags { readonly tool?: string[]; readonly mode?: "dynamic" | undefined; - readonly scope?: MCPScope[]; readonly "bearer-auth"?: string | undefined; readonly "client-id"?: string | undefined; readonly "client-secret"?: string | undefined; diff --git a/src/mcp-server/mcp-server.ts b/src/mcp-server/mcp-server.ts index 35db695d..5cbc4d82 100644 --- a/src/mcp-server/mcp-server.ts +++ b/src/mcp-server/mcp-server.ts @@ -21,7 +21,7 @@ const routes = buildRouteMap({ export const app = buildApplication(routes, { name: "mcp", versionInfo: { - currentVersion: "0.0.4", + currentVersion: "0.0.1", }, }); diff --git a/src/mcp-server/prompts.ts b/src/mcp-server/prompts.ts index 650b7b44..0015bbdb 100644 --- a/src/mcp-server/prompts.ts +++ b/src/mcp-server/prompts.ts @@ -13,7 +13,7 @@ import { ServerNotification, ServerRequest, } from "@modelcontextprotocol/sdk/types.js"; -import { PipeshubCore } from "../core.js"; +import { SDKCore } from "../core.js"; import { ConsoleLogger } from "./console-logger.js"; import { MCPScope } from "./scopes.js"; @@ -25,7 +25,7 @@ export type PromptDefinition< scopes?: MCPScope[]; args: Args; prompt: ( - client: PipeshubCore, + client: SDKCore, args: ShapeOutput, extra: RequestHandlerExtra, ) => GetPromptResult | Promise; @@ -36,7 +36,7 @@ export type PromptDefinition< scopes?: MCPScope[]; args?: undefined; prompt: ( - client: PipeshubCore, + client: SDKCore, extra: RequestHandlerExtra, ) => GetPromptResult | Promise; }; @@ -59,7 +59,7 @@ export async function formatResult(value: string): Promise { export function createRegisterPrompt( logger: ConsoleLogger, server: McpServer, - getSDK: () => PipeshubCore, + getSDK: () => SDKCore, allowedScopes: Set, ): ( prompt: PromptDefinition, diff --git a/src/mcp-server/resources.ts b/src/mcp-server/resources.ts index c9b6afb8..274007f7 100644 --- a/src/mcp-server/resources.ts +++ b/src/mcp-server/resources.ts @@ -14,13 +14,13 @@ import { ServerNotification, ServerRequest, } from "@modelcontextprotocol/sdk/types.js"; -import { PipeshubCore } from "../core.js"; +import { SDKCore } from "../core.js"; import { ConsoleLogger } from "./console-logger.js"; import { MCPScope } from "./scopes.js"; import { valueToBase64 } from "./shared.js"; export type ReadResourceCallback = ( - client: PipeshubCore, + client: SDKCore, uri: URL, extra: RequestHandlerExtra, ) => ReadResourceResult | Promise; @@ -35,7 +35,7 @@ export type ResourceDefinition = { }; export type ReadResourceTemplateCallback = ( - client: PipeshubCore, + client: SDKCore, uri: URL, vars: Variables, extra: RequestHandlerExtra, @@ -73,7 +73,7 @@ export async function formatResult( export function createRegisterResource( logger: ConsoleLogger, server: McpServer, - getSDK: () => PipeshubCore, + getSDK: () => SDKCore, allowedScopes: Set, ): (resource: ResourceDefinition) => void { return (resource: ResourceDefinition): void => { @@ -108,7 +108,7 @@ export function createRegisterResource( export function createRegisterResourceTemplate( logger: ConsoleLogger, server: McpServer, - getSDK: () => PipeshubCore, + getSDK: () => SDKCore, allowedScopes: Set, ): (resource: ResourceTemplateDefinition) => void { return (resource: ResourceTemplateDefinition): void => { diff --git a/src/mcp-server/scopes.ts b/src/mcp-server/scopes.ts index aed9de28..c25696d4 100644 --- a/src/mcp-server/scopes.ts +++ b/src/mcp-server/scopes.ts @@ -2,8 +2,6 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -export const mcpScopes = [ - "read", -] as const; +export const mcpScopes = [] as const; export type MCPScope = (typeof mcpScopes)[number]; diff --git a/src/mcp-server/server.ts b/src/mcp-server/server.ts index 5e1c5ee1..3997c012 100644 --- a/src/mcp-server/server.ts +++ b/src/mcp-server/server.ts @@ -1,66 +1,9 @@ -// Hand-written; replaces the Speakeasy-generated server.ts. Registers the -// five curated PipesHub tools instead of one tool per OpenAPI operation. +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; - -// Top-level instructions surfaced to the host LLM at server initialize. -// These set defaults so the model picks `pipeshub_chat` as the natural -// entry point for anything that touches the user's PipesHub data — -// documents, files, knowledge base content, citations, etc. -const PIPESHUB_INSTRUCTIONS = `# PipesHub MCP — instructions for the LLM - -PipesHub is the user's workplace AI platform. It indexes their documents, -knowledge base content, and connector sources (Drive, Box, Confluence, -Slack, Jira, Gmail, ...). When in doubt, the answer is in PipesHub. - -## Default tool: \`pipeshub_chat\` - -**Use \`pipeshub_chat\` for any question that could plausibly be answered -by the user's PipesHub-indexed data.** That includes: - -- Anything about a specific document, file, report, ticket, message, or - page (e.g. "what's in the Q4 sales report?", "summarize the langchain - doc", "what did Aashil say about onboarding?"). -- Anything about company / org policies, processes, decisions, or - history (e.g. "what's our vacation policy?", "who owns the auth - service?"). -- Anything explicitly mentioning PipesHub itself, or its sources - (Drive / Box / Confluence / Slack / Gmail / Jira / etc.) when the - user has those connected. -- Open-ended "what do we know about X" questions where the answer - likely lives in the org's documents. - -Do NOT answer those from your own knowledge — \`pipeshub_chat\` grounds -the answer in the user's actual indexed content and returns citations -the user can verify. - -## When to use the other tools - -- \`pipeshub_search\` — only when the user asks specifically to **find / - locate** a document by name or topic (so you can hand them a list, or - resolve a filename to a \`recordId\` for download). For "what does - the doc say?" use \`pipeshub_chat\` instead — it does the retrieval - internally. -- \`pipeshub_download_record\` — when the user wants the actual file - bytes (download, attach, open). Get the \`recordId\` either from - citations on a prior \`pipeshub_chat\` response or from - \`pipeshub_search\`. -- \`pipeshub_directory\` — people, groups, teams, and \`whoami\` lookups. - Not for documents. -- \`pipeshub_sources\` — call once at the start of a session to discover - which connectors / KB / models are available, then cache the result. - -## Conversation lifecycle - -\`pipeshub_chat\` is a single tool that handles both starting and -continuing conversations. On the first turn omit \`conversationId\`; on -every subsequent turn pass back the \`conversationId\` returned by the -previous call. Server-side context is preserved — do NOT replay prior -messages. Only start a fresh conversation when the user explicitly -asks to clear context. -`; - -import { PipeshubCore } from "../core.js"; +import { SDKCore } from "../core.js"; import { SDKOptions } from "../lib/config.js"; import type { ConsoleLogger } from "./console-logger.js"; import { createRegisterPrompt } from "./prompts.js"; @@ -70,35 +13,83 @@ import { } from "./resources.js"; import { MCPScope } from "./scopes.js"; import { createRegisterTool, registerDynamicTools } from "./tools.js"; -import { tool$pipeshubChat } from "./tools/pipeshubChat.js"; -import { tool$pipeshubSearch } from "./tools/pipeshubSearch.js"; -import { tool$pipeshubDownloadRecord } from "./tools/pipeshubDownloadRecord.js"; -import { tool$pipeshubDirectory } from "./tools/pipeshubDirectory.js"; -import { tool$pipeshubSources } from "./tools/pipeshubSources.js"; +import { tool$agentsArchiveAgentConversation } from "./tools/agentsArchiveAgentConversation.js"; +import { tool$agentsCreateAgent } from "./tools/agentsCreateAgent.js"; +import { tool$agentsDeleteAgent } from "./tools/agentsDeleteAgent.js"; +import { tool$agentsDeleteAgentConversationById } from "./tools/agentsDeleteAgentConversationById.js"; +import { tool$agentsDeleteAgentConversationChatAttachment } from "./tools/agentsDeleteAgentConversationChatAttachment.js"; +import { tool$agentsGetAgent } from "./tools/agentsGetAgent.js"; +import { tool$agentsGetAgentConversationById } from "./tools/agentsGetAgentConversationById.js"; +import { tool$agentsListAgentArchivedConversationsGrouped } from "./tools/agentsListAgentArchivedConversationsGrouped.js"; +import { tool$agentsListAgentConversationArchives } from "./tools/agentsListAgentConversationArchives.js"; +import { tool$agentsListAgentConversations } from "./tools/agentsListAgentConversations.js"; +import { tool$agentsListAgents } from "./tools/agentsListAgents.js"; +import { tool$agentsUnarchiveAgentConversation } from "./tools/agentsUnarchiveAgentConversation.js"; +import { tool$agentsUpdateAgent } from "./tools/agentsUpdateAgent.js"; +import { tool$agentsUpdateAgentConversationMessageFeedback } from "./tools/agentsUpdateAgentConversationMessageFeedback.js"; +import { tool$agentsUpdateAgentConversationTitle } from "./tools/agentsUpdateAgentConversationTitle.js"; +import { tool$agentsUploadAgentConversationChatAttachments } from "./tools/agentsUploadAgentConversationChatAttachments.js"; +import { tool$aiModelsProvidersGetAvailableModelsByType } from "./tools/aiModelsProvidersGetAvailableModelsByType.js"; +import { tool$conversationsArchiveConversation } from "./tools/conversationsArchiveConversation.js"; +import { tool$conversationsDeleteConversationById } from "./tools/conversationsDeleteConversationById.js"; +import { tool$conversationsGetAllConversations } from "./tools/conversationsGetAllConversations.js"; +import { tool$conversationsGetArchivedConversations } from "./tools/conversationsGetArchivedConversations.js"; +import { tool$conversationsGetConversationById } from "./tools/conversationsGetConversationById.js"; +import { tool$conversationsSearchArchivedConversations } from "./tools/conversationsSearchArchivedConversations.js"; +import { tool$conversationsUnarchiveConversation } from "./tools/conversationsUnarchiveConversation.js"; +import { tool$conversationsUpdateConversationTitle } from "./tools/conversationsUpdateConversationTitle.js"; +import { tool$conversationsUpdateMessageFeedback } from "./tools/conversationsUpdateMessageFeedback.js"; +import { tool$knowledgeHubGetKnowledgeHubChildNodes } from "./tools/knowledgeHubGetKnowledgeHubChildNodes.js"; +import { tool$knowledgeHubGetKnowledgeHubRootNodes } from "./tools/knowledgeHubGetKnowledgeHubRootNodes.js"; +import { tool$oAuthAppsActivateOAuthApp } from "./tools/oAuthAppsActivateOAuthApp.js"; +import { tool$oAuthAppsCreateOAuthApp } from "./tools/oAuthAppsCreateOAuthApp.js"; +import { tool$oAuthAppsDeleteOAuthApp } from "./tools/oAuthAppsDeleteOAuthApp.js"; +import { tool$oAuthAppsGetOAuthApp } from "./tools/oAuthAppsGetOAuthApp.js"; +import { tool$oAuthAppsListOAuthApps } from "./tools/oAuthAppsListOAuthApps.js"; +import { tool$oAuthAppsListOAuthAppTokens } from "./tools/oAuthAppsListOAuthAppTokens.js"; +import { tool$oAuthAppsListOAuthScopes } from "./tools/oAuthAppsListOAuthScopes.js"; +import { tool$oAuthAppsRegenerateOAuthAppSecret } from "./tools/oAuthAppsRegenerateOAuthAppSecret.js"; +import { tool$oAuthAppsRevokeAllOAuthAppTokens } from "./tools/oAuthAppsRevokeAllOAuthAppTokens.js"; +import { tool$oAuthAppsSuspendOAuthApp } from "./tools/oAuthAppsSuspendOAuthApp.js"; +import { tool$oAuthAppsUpdateOAuthApp } from "./tools/oAuthAppsUpdateOAuthApp.js"; +import { tool$oAuthProviderOauthIntrospect } from "./tools/oAuthProviderOauthIntrospect.js"; +import { tool$oAuthProviderOauthRevoke } from "./tools/oAuthProviderOauthRevoke.js"; +import { tool$oAuthProviderOauthToken } from "./tools/oAuthProviderOauthToken.js"; +import { tool$openIDConnectOauthUserInfo } from "./tools/openIDConnectOauthUserInfo.js"; +import { tool$organizationAuthConfigGetAuthMethods } from "./tools/organizationAuthConfigGetAuthMethods.js"; +import { tool$organizationAuthConfigSetUpAuthConfig } from "./tools/organizationAuthConfigSetUpAuthConfig.js"; +import { tool$organizationAuthConfigUpdateAuthMethod } from "./tools/organizationAuthConfigUpdateAuthMethod.js"; +import { tool$organizationsGetCurrentOrganization } from "./tools/organizationsGetCurrentOrganization.js"; +import { tool$semanticSearchArchiveSearch } from "./tools/semanticSearchArchiveSearch.js"; +import { tool$semanticSearchDeleteSearchById } from "./tools/semanticSearchDeleteSearchById.js"; +import { tool$semanticSearchDeleteSearchHistory } from "./tools/semanticSearchDeleteSearchHistory.js"; +import { tool$semanticSearchGetSearchById } from "./tools/semanticSearchGetSearchById.js"; +import { tool$semanticSearchSearch } from "./tools/semanticSearchSearch.js"; +import { tool$semanticSearchSearchHistory } from "./tools/semanticSearchSearchHistory.js"; +import { tool$semanticSearchUnarchiveSearch } from "./tools/semanticSearchUnarchiveSearch.js"; +import { tool$userAccountAuthenticate } from "./tools/userAccountAuthenticate.js"; +import { tool$userAccountInitAuth } from "./tools/userAccountInitAuth.js"; +import { tool$userAccountResetPassword } from "./tools/userAccountResetPassword.js"; +import { tool$webSearchGetWebSearchProviders } from "./tools/webSearchGetWebSearchProviders.js"; export function createMCPServer(deps: { logger: ConsoleLogger; allowedTools?: string[] | undefined; dynamic?: boolean | undefined; scopes?: MCPScope[] | undefined; - getSDK?: () => PipeshubCore; + getSDK?: () => SDKCore; serverURL?: string | undefined; security?: SDKOptions["security"] | undefined; serverIdx?: SDKOptions["serverIdx"] | undefined; instance_url?: SDKOptions["instance_url"] | undefined; }) { - const server = new McpServer( - { - name: "pipeshub-mcp", - version: "0.0.4", - }, - { - instructions: PIPESHUB_INSTRUCTIONS, - }, - ); + const server = new McpServer({ + name: "SDK", + version: "0.0.1", + }); const getClient = deps.getSDK || (() => - new PipeshubCore({ + new SDKCore({ security: deps.security, serverURL: deps.serverURL, serverIdx: deps.serverIdx, @@ -139,13 +130,64 @@ export function createMCPServer(deps: { const register = { tool, resource, resourceTemplate, prompt }; void register; // suppress unused warnings - // Curated tool set. Five tools instead of ten one-per-op generated tools. - // Order = preferred discovery order shown to the LLM. - tool(tool$pipeshubSources); // 1. discover sources + models - tool(tool$pipeshubChat); // 2. ask questions (start + continue) - tool(tool$pipeshubSearch); // 3. resolve filename → recordId - tool(tool$pipeshubDownloadRecord); // 4. fetch a document by id - tool(tool$pipeshubDirectory); // 5. people / groups / teams / whoami + tool(tool$oAuthProviderOauthToken); + tool(tool$oAuthProviderOauthRevoke); + tool(tool$oAuthProviderOauthIntrospect); + tool(tool$openIDConnectOauthUserInfo); + tool(tool$oAuthAppsListOAuthApps); + tool(tool$oAuthAppsCreateOAuthApp); + tool(tool$oAuthAppsListOAuthScopes); + tool(tool$oAuthAppsGetOAuthApp); + tool(tool$oAuthAppsUpdateOAuthApp); + tool(tool$oAuthAppsDeleteOAuthApp); + tool(tool$oAuthAppsRegenerateOAuthAppSecret); + tool(tool$oAuthAppsSuspendOAuthApp); + tool(tool$oAuthAppsActivateOAuthApp); + tool(tool$oAuthAppsListOAuthAppTokens); + tool(tool$oAuthAppsRevokeAllOAuthAppTokens); + tool(tool$userAccountInitAuth); + tool(tool$userAccountAuthenticate); + tool(tool$userAccountResetPassword); + tool(tool$organizationAuthConfigGetAuthMethods); + tool(tool$organizationAuthConfigUpdateAuthMethod); + tool(tool$organizationAuthConfigSetUpAuthConfig); + tool(tool$organizationsGetCurrentOrganization); + tool(tool$knowledgeHubGetKnowledgeHubRootNodes); + tool(tool$knowledgeHubGetKnowledgeHubChildNodes); + tool(tool$conversationsGetAllConversations); + tool(tool$conversationsGetArchivedConversations); + tool(tool$conversationsSearchArchivedConversations); + tool(tool$conversationsGetConversationById); + tool(tool$conversationsDeleteConversationById); + tool(tool$conversationsUpdateConversationTitle); + tool(tool$conversationsArchiveConversation); + tool(tool$conversationsUnarchiveConversation); + tool(tool$conversationsUpdateMessageFeedback); + tool(tool$semanticSearchSearch); + tool(tool$semanticSearchSearchHistory); + tool(tool$semanticSearchDeleteSearchHistory); + tool(tool$semanticSearchGetSearchById); + tool(tool$semanticSearchDeleteSearchById); + tool(tool$semanticSearchArchiveSearch); + tool(tool$semanticSearchUnarchiveSearch); + tool(tool$agentsListAgents); + tool(tool$agentsCreateAgent); + tool(tool$agentsGetAgent); + tool(tool$agentsUpdateAgent); + tool(tool$agentsDeleteAgent); + tool(tool$agentsListAgentArchivedConversationsGrouped); + tool(tool$agentsListAgentConversationArchives); + tool(tool$agentsUploadAgentConversationChatAttachments); + tool(tool$agentsDeleteAgentConversationChatAttachment); + tool(tool$agentsUpdateAgentConversationMessageFeedback); + tool(tool$agentsArchiveAgentConversation); + tool(tool$agentsUnarchiveAgentConversation); + tool(tool$agentsUpdateAgentConversationTitle); + tool(tool$agentsDeleteAgentConversationById); + tool(tool$agentsGetAgentConversationById); + tool(tool$agentsListAgentConversations); + tool(tool$aiModelsProvidersGetAvailableModelsByType); + tool(tool$webSearchGetWebSearchProviders); if (deps.dynamic) { registerDynamicTools(deps.logger, server, getClient, toolMap, scopes); diff --git a/src/mcp-server/tools.ts b/src/mcp-server/tools.ts index f3501002..bab4c124 100644 --- a/src/mcp-server/tools.ts +++ b/src/mcp-server/tools.ts @@ -14,7 +14,7 @@ import { ServerRequest, } from "@modelcontextprotocol/sdk/types.js"; import * as z from "zod"; -import { PipeshubCore } from "../core.js"; +import { SDKCore } from "../core.js"; import { ConsoleLogger } from "./console-logger.js"; import { MCPServerFlags } from "./flags.js"; import { MCPScope, mcpScopes } from "./scopes.js"; @@ -35,7 +35,7 @@ export type ToolDefinition< readOnlyHint: boolean; }; tool: ( - client: PipeshubCore, + client: SDKCore, args: ShapeOutput, extra: RequestHandlerExtra, ) => CallToolResult | Promise; @@ -53,7 +53,7 @@ export type ToolDefinition< readOnlyHint: boolean; }; tool: ( - client: PipeshubCore, + client: SDKCore, extra: RequestHandlerExtra, ) => CallToolResult | Promise; }; @@ -86,7 +86,7 @@ export async function formatResult( export function createRegisterTool( logger: ConsoleLogger, server: McpServer, - getSDK: () => PipeshubCore, + getSDK: () => SDKCore, allowedScopes: Set, allowedTools?: Set, dynamic?: boolean, @@ -187,7 +187,7 @@ function matchesSearchTerms( export function registerDynamicTools( logger: ConsoleLogger, server: McpServer, - getSDK: () => PipeshubCore, + getSDK: () => SDKCore, toolMap: Map>, allowedScopes: Set, ): void { @@ -429,7 +429,7 @@ export function buildSDK( ), }; - return new PipeshubCore({ + return new SDKCore({ security: { bearerAuth: flags["bearer-auth"] ?? "", oauth2: flags["client-id"] != null && flags["client-secret"] != null diff --git a/src/mcp-server/tools/_helpers.ts b/src/mcp-server/tools/_helpers.ts deleted file mode 100644 index 5d98e75c..00000000 --- a/src/mcp-server/tools/_helpers.ts +++ /dev/null @@ -1,276 +0,0 @@ -// Curated-tool helpers. Hand-written, NOT regenerated by Speakeasy. -// -// Each curated tool fetches a Response from one of the SDK funcs and then -// trims / restructures the body before handing it to the LLM. The helpers -// here keep that work out of the individual tool files. - -import { Security } from "../../models/security.js"; -import { PipeshubCore } from "../../core.js"; -import { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; - -/** - * Parse a fetch Response as JSON, returning a CallToolResult error when the - * body is missing / malformed. - */ -export async function readJson( - response: Response, -): Promise<{ ok: true; value: T } | { ok: false; result: CallToolResult }> { - const text = await response.text(); - if (!text) { - return { - ok: false, - result: { - content: [{ type: "text", text: "Empty response from server" }], - isError: true, - }, - }; - } - try { - return { ok: true, value: JSON.parse(text) as T }; - } catch (e: unknown) { - return { - ok: false, - result: { - content: [{ - type: "text", - text: `Failed to parse response as JSON: ${ - (e as Error).message - }\n\nRaw body:\n${text.slice(0, 500)}`, - }], - isError: true, - }, - }; - } -} - -/** Return a CallToolResult holding a single JSON-stringified text block. */ -export function jsonResult(value: unknown): CallToolResult { - return { - content: [{ type: "text", text: JSON.stringify(value, null, 2) }], - }; -} - -/** Standard error → CallToolResult conversion. */ -export function errorResult(message: string): CallToolResult { - return { - content: [{ type: "text", text: message }], - isError: true, - }; -} - -/** Resolve `client._options.security` (which may be a function) to a value. */ -export async function resolveSecurity( - client: PipeshubCore, -): Promise { - const sec = client._options.security; - if (typeof sec === "function") { - return await sec(); - } - return sec; -} - -/** - * Decode the bearer JWT and return its claim payload, or null if no bearer - * is configured / the token isn't a JWT. - * - * NOTE: this does NOT verify the signature — we trust the token because the - * server already accepted it on the previous request. The decoded payload - * is for surfacing identity (userId, email) back to the LLM, not for - * authorization decisions. - */ -export async function decodeBearer( - client: PipeshubCore, -): Promise | null> { - // Only the static `bearerAuth` JWT is decodable here. The oauth2 - // credentials flow fetches a token dynamically per request, so it - // isn't available at this layer. - const sec = await resolveSecurity(client); - const token = sec?.bearerAuth; - if (!token) return null; - const parts = token.split("."); - const claims = parts[1]; - if (!claims) return null; - try { - const padded = claims + "=".repeat((4 - claims.length % 4) % 4); - const json = Buffer.from( - padded.replace(/-/g, "+").replace(/_/g, "/"), - "base64", - ).toString("utf8"); - return JSON.parse(json) as Record; - } catch { - return null; - } -} - -// ─── Trimmers for chat / search payloads ───────────────────────────────────── - -/** - * The full Conversation blob is ~kilobytes; the LLM almost always only wants - * the latest answer + grounding. Pull just that. - */ -export function trimConversation(conv: any) { - const messages: any[] = Array.isArray(conv?.messages) ? conv.messages : []; - const lastBot = [...messages].reverse().find( - (m) => m?.messageType === "bot_response", - ); - - return { - conversationId: conv?._id, - title: conv?.title, - status: conv?.status, - answer: lastBot?.content ?? null, - confidence: lastBot?.confidence ?? null, - citations: trimCitations(lastBot?.citations), - followUpQuestions: lastBot?.followUpQuestions?.map((q: any) => - typeof q === "string" ? q : q?.question - ).filter(Boolean) ?? [], - messageCount: messages.length, - }; -} - -export function trimCitations(citations: unknown) { - if (!Array.isArray(citations)) return []; - return citations.map((c: any) => { - const md = c?.metadata ?? {}; - return { - recordId: md.recordId ?? c?.recordId, - recordName: md.recordName ?? c?.recordName, - snippet: typeof c?.content === "string" - ? c.content.slice(0, 280) - : md.blockText ?? null, - mimeType: md.mimeType, - webUrl: md.webUrl, - pageNum: md.pageNum, - chunkIndex: c?.chunkIndex ?? md.chunkIndex, - }; - }); -} - -// ─── SSE parsing ───────────────────────────────────────────────────────────── - -/** - * One SSE frame as emitted by `/conversations/stream`. - * - * Wire format per frame: - * event: \n - * data: \n - * \n - * - * `data` is parsed as JSON; on parse failure the raw string is preserved - * under `raw` so the caller can decide how to react. - */ -export type SSEFrame = { - event: string; - data: any; - raw?: string; -}; - -/** - * Async-iterate SSE frames off a `Response` body. Handles multi-line - * `data:` accumulation per spec, ignores comment lines (leading `:`), - * tolerates `\r\n` and `\n` line endings, and parses `data` as JSON when - * possible. Yields one frame per blank-line-terminated event. - * - * The signal passed in is honoured by the underlying fetch / reader; this - * generator does not need to recheck it. - */ -export async function* iterateSSE( - response: Response, -): AsyncGenerator { - if (!response.body) return; - const reader = response.body.getReader(); - const decoder = new TextDecoder("utf-8"); - let buf = ""; - let event = "message"; - let dataLines: string[] = []; - - const flush = (): SSEFrame | null => { - if (dataLines.length === 0) { - event = "message"; - return null; - } - const raw = dataLines.join("\n"); - let data: any = raw; - try { - data = JSON.parse(raw); - } catch { - // leave as raw string - } - const frame: SSEFrame = { event, data, raw }; - event = "message"; - dataLines = []; - return frame; - }; - - try { - while (true) { - const { value, done } = await reader.read(); - if (done) break; - buf += decoder.decode(value, { stream: true }); - - // Process complete lines; keep the trailing partial line in `buf`. - let nl: number; - while ((nl = buf.indexOf("\n")) !== -1) { - let line = buf.slice(0, nl); - buf = buf.slice(nl + 1); - if (line.endsWith("\r")) line = line.slice(0, -1); - - if (line === "") { - const f = flush(); - if (f) yield f; - continue; - } - if (line.startsWith(":")) continue; // comment / heartbeat - const colon = line.indexOf(":"); - const field = colon === -1 ? line : line.slice(0, colon); - let value = colon === -1 ? "" : line.slice(colon + 1); - if (value.startsWith(" ")) value = value.slice(1); - if (field === "event") event = value; - else if (field === "data") dataLines.push(value); - // `id` and `retry` are unused for our purposes. - } - } - // Flush any final buffered frame on EOS. - const tail = decoder.decode(); - if (tail) buf += tail; - if (buf.length > 0) { - // Treat remaining buffer as one last line. - let line = buf; - if (line.endsWith("\r")) line = line.slice(0, -1); - if (line !== "" && !line.startsWith(":")) { - const colon = line.indexOf(":"); - const field = colon === -1 ? line : line.slice(0, colon); - let value = colon === -1 ? "" : line.slice(colon + 1); - if (value.startsWith(" ")) value = value.slice(1); - if (field === "event") event = value; - else if (field === "data") dataLines.push(value); - } - } - const f = flush(); - if (f) yield f; - } finally { - try { - reader.releaseLock(); - } catch { - // ignore - } - } -} - -/** Trim a single search hit to what the LLM actually needs. */ -export function trimSearchHit(hit: any) { - const md = hit?.metadata ?? {}; - return { - recordId: md.recordId, - recordName: md.recordName, - score: hit?.score, - snippet: typeof hit?.content === "string" - ? hit.content.slice(0, 280) - : md.blockText, - mimeType: md.mimeType, - extension: md.extension, - connector: md.connector, - webUrl: md.webUrl, - pageNum: md.pageNum, - }; -} diff --git a/src/mcp-server/tools/agentsArchiveAgentConversation.ts b/src/mcp-server/tools/agentsArchiveAgentConversation.ts new file mode 100644 index 00000000..47a23af1 --- /dev/null +++ b/src/mcp-server/tools/agentsArchiveAgentConversation.ts @@ -0,0 +1,43 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { agentsArchiveAgentConversation } from "../../funcs/agentsArchiveAgentConversation.js"; +import { ArchiveAgentConversationRequest$zodSchema } from "../../models/archiveagentconversationop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: ArchiveAgentConversationRequest$zodSchema, +}; + +export const tool$agentsArchiveAgentConversation: ToolDefinition = + { + name: "agents-archive-agent-conversation", + description: `Archive an agent conversation + +Marks the conversation as archived for the authenticated owner.`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await agentsArchiveAgentConversation( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, + }; diff --git a/src/mcp-server/tools/agentsCreateAgent.ts b/src/mcp-server/tools/agentsCreateAgent.ts new file mode 100644 index 00000000..d89a1ddb --- /dev/null +++ b/src/mcp-server/tools/agentsCreateAgent.ts @@ -0,0 +1,59 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { agentsCreateAgent } from "../../funcs/agentsCreateAgent.js"; +import { AgentCreateRequest$zodSchema } from "../../models/agentcreaterequest.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: AgentCreateRequest$zodSchema, +}; + +export const tool$agentsCreateAgent: ToolDefinition = { + name: "agents-create-agent", + description: `Create agent + +Create a new custom AI agent. + +**Overview:** +Agents are specialized AI assistants configured for specific tasks. +They can have custom system prompts, access to specific tools, and +be limited to certain knowledge bases. + +**Agent Configuration:** +- **System prompt:** Instructions that define agent behavior +- **Tools:** Capabilities like web search, code execution, etc. +- **Knowledge bases:** Data sources the agent can access +- **Model config:** AI model settings (temperature, max tokens) + +**Use Cases:** +- Customer support bot with product knowledge +- Code review assistant with repository access +- HR assistant with policy documents +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await agentsCreateAgent( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/agentsDeleteAgent.ts b/src/mcp-server/tools/agentsDeleteAgent.ts new file mode 100644 index 00000000..7b80de87 --- /dev/null +++ b/src/mcp-server/tools/agentsDeleteAgent.ts @@ -0,0 +1,60 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { agentsDeleteAgent } from "../../funcs/agentsDeleteAgent.js"; +import { DeleteAgentRequest$zodSchema } from "../../models/deleteagentop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: DeleteAgentRequest$zodSchema, +}; + +export const tool$agentsDeleteAgent: ToolDefinition = { + name: "agents-delete-agent", + description: `Delete agent + +Soft-delete an agent (tombstone) in the graph database. + +**Overview:** +The Python query service marks the agent instance deleted inside a transaction. +List and search endpoints exclude tombstoned agents. Toolsets, tools, and +knowledge linked to the agent are not removed by this call. + +**Permissions:** +Only the agent owner may delete (\`can_delete\` on the permission check). + +**Warning:** +All conversations with this agent will become inaccessible. + +**Observed gateway behavior (localhost integration tests):** +Unknown \`agentKey\`, deleting an already-deleted agent, and \`GET /agents/{agentKey}\` +after delete currently return **HTTP 500** with an \`ErrorResponse\` body (message +often mentions the agent or "not found"), not 404. The Python backend raises 404 +for not-found when called directly; the Node proxy may surface 500 instead. +`, + annotations: { + "title": "", + "destructiveHint": true, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await agentsDeleteAgent( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/agentsDeleteAgentConversationById.ts b/src/mcp-server/tools/agentsDeleteAgentConversationById.ts new file mode 100644 index 00000000..28d9310f --- /dev/null +++ b/src/mcp-server/tools/agentsDeleteAgentConversationById.ts @@ -0,0 +1,55 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { agentsDeleteAgentConversationById } from "../../funcs/agentsDeleteAgentConversationById.js"; +import { DeleteAgentConversationByIdRequest$zodSchema } from "../../models/deleteagentconversationbyidop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: DeleteAgentConversationByIdRequest$zodSchema, +}; + +export const tool$agentsDeleteAgentConversationById: ToolDefinition< + typeof args +> = { + name: "agents-delete-agent-conversation-by-id", + description: `Delete an agent conversation + +Soft-deletes an agent conversation owned by the authenticated user. + +The controller scopes the lookup by \`_id\`, \`orgId\`, \`userId\`, and +\`agentKey\`. If no matching writable conversation is found, the route is +intentionally a no-op and still returns HTTP 200 with \`conversation: null\`. + +This makes the operation idempotent: + +- deleting a nonexistent conversation returns success with \`null\` +- deleting through a different \`agentKey\` returns success with \`null\` +- deleting an already deleted conversation returns success with \`null\` +`, + annotations: { + "title": "", + "destructiveHint": true, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await agentsDeleteAgentConversationById( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/agentsDeleteAgentConversationChatAttachment.ts b/src/mcp-server/tools/agentsDeleteAgentConversationChatAttachment.ts new file mode 100644 index 00000000..81c8d2be --- /dev/null +++ b/src/mcp-server/tools/agentsDeleteAgentConversationChatAttachment.ts @@ -0,0 +1,52 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { agentsDeleteAgentConversationChatAttachment } from "../../funcs/agentsDeleteAgentConversationChatAttachment.js"; +import { DeleteAgentConversationChatAttachmentRequest$zodSchema } from "../../models/deleteagentconversationchatattachmentop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: DeleteAgentConversationChatAttachmentRequest$zodSchema, +}; + +export const tool$agentsDeleteAgentConversationChatAttachment: ToolDefinition< + typeof args +> = { + name: "agents-delete-agent-conversation-chat-attachment", + description: `Delete an agent chat attachment + +Deletes a previously uploaded attachment by proxying \`DELETE\` to the query service +(\`/api/v1/chat/attachments/{recordId}\`). The Node handler always ends the response **without +a JSON body** on success (empty body); the **status code** is the upstream status, or **204** +if none is returned. + +On validation failure in the gateway (invalid / blank path params), the response is **400** +with a small JSON error object. Same fire-and-forget semantics as +\`DELETE /conversations/attachments/{recordId}\` on the client. +`, + annotations: { + "title": "", + "destructiveHint": true, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await agentsDeleteAgentConversationChatAttachment( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/agentsGetAgent.ts b/src/mcp-server/tools/agentsGetAgent.ts new file mode 100644 index 00000000..e8ca5b14 --- /dev/null +++ b/src/mcp-server/tools/agentsGetAgent.ts @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { agentsGetAgent } from "../../funcs/agentsGetAgent.js"; +import { GetAgentRequest$zodSchema } from "../../models/getagentop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: GetAgentRequest$zodSchema, +}; + +export const tool$agentsGetAgent: ToolDefinition = { + name: "agents-get-agent", + description: `Get agent + +Retrieve agent details by its unique key. + +**Observed gateway behavior (localhost integration tests):** +Unknown \`agentKey\`, lookup after soft-delete, and other AI-backend failures +currently return **HTTP 500** with an \`ErrorResponse\` body (message often +mentions the agent or "not found"), not 404. The Python query service may +return 404 when called directly; the Node proxy surfaces 500 instead. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await agentsGetAgent( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/agentsGetAgentConversationById.ts b/src/mcp-server/tools/agentsGetAgentConversationById.ts new file mode 100644 index 00000000..f112b70e --- /dev/null +++ b/src/mcp-server/tools/agentsGetAgentConversationById.ts @@ -0,0 +1,53 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { agentsGetAgentConversationById } from "../../funcs/agentsGetAgentConversationById.js"; +import { GetAgentConversationByIdRequest$zodSchema } from "../../models/getagentconversationbyidop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: GetAgentConversationByIdRequest$zodSchema, +}; + +export const tool$agentsGetAgentConversationById: ToolDefinition = + { + name: "agents-get-agent-conversation-by-id", + description: `Get agent conversation by ID + +Returns the conversation with paginated/sorted messages and filter metadata. + +**Message Pagination:** + +Messages are paginated newest-first: \`page=1\` returns the most recent +batch. Increment \`page\` to load older batches (used by the infinite-scroll +"load older messages" feature). + +- \`page\`: Page number (default: 1) +- \`limit\`: Messages per page (default: 20, max: 100) +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await agentsGetAgentConversationById( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, + }; diff --git a/src/mcp-server/tools/agentsListAgentArchivedConversationsGrouped.ts b/src/mcp-server/tools/agentsListAgentArchivedConversationsGrouped.ts new file mode 100644 index 00000000..68dcf7ab --- /dev/null +++ b/src/mcp-server/tools/agentsListAgentArchivedConversationsGrouped.ts @@ -0,0 +1,47 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { agentsListAgentArchivedConversationsGrouped } from "../../funcs/agentsListAgentArchivedConversationsGrouped.js"; +import { ListAgentArchivedConversationsGroupedRequest$zodSchema } from "../../models/listagentarchivedconversationsgroupedop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: ListAgentArchivedConversationsGroupedRequest$zodSchema.optional(), +}; + +export const tool$agentsListAgentArchivedConversationsGrouped: ToolDefinition< + typeof args +> = { + name: "agents-list-agent-archived-conversations-grouped", + description: `List archived agent conversations grouped by agent + +Returns archived agent conversations for the current user, grouped by +\`agentKey\`, with pagination over agent groups. Excludes conversations +whose agent was soft-deleted upstream. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await agentsListAgentArchivedConversationsGrouped( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/agentsListAgentConversationArchives.ts b/src/mcp-server/tools/agentsListAgentConversationArchives.ts new file mode 100644 index 00000000..6633b4d5 --- /dev/null +++ b/src/mcp-server/tools/agentsListAgentConversationArchives.ts @@ -0,0 +1,44 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { agentsListAgentConversationArchives } from "../../funcs/agentsListAgentConversationArchives.js"; +import { ListAgentConversationArchivesRequest$zodSchema } from "../../models/listagentconversationarchivesop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: ListAgentConversationArchivesRequest$zodSchema, +}; + +export const tool$agentsListAgentConversationArchives: ToolDefinition< + typeof args +> = { + name: "agents-list-agent-conversation-archives", + description: `List archived conversations for an agent + +Paginated list of archived conversations for the given agent key.`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await agentsListAgentConversationArchives( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/agentsListAgentConversations.ts b/src/mcp-server/tools/agentsListAgentConversations.ts new file mode 100644 index 00000000..c18abe49 --- /dev/null +++ b/src/mcp-server/tools/agentsListAgentConversations.ts @@ -0,0 +1,44 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { agentsListAgentConversations } from "../../funcs/agentsListAgentConversations.js"; +import { ListAgentConversationsRequest$zodSchema } from "../../models/listagentconversationsop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: ListAgentConversationsRequest$zodSchema, +}; + +export const tool$agentsListAgentConversations: ToolDefinition = { + name: "agents-list-agent-conversations", + description: `List agent conversations + +Paginated list of conversations for the agent (owned and shared-with-me), +excluding archived threads. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await agentsListAgentConversations( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/agentsListAgents.ts b/src/mcp-server/tools/agentsListAgents.ts new file mode 100644 index 00000000..b2645a67 --- /dev/null +++ b/src/mcp-server/tools/agentsListAgents.ts @@ -0,0 +1,58 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { agentsListAgents } from "../../funcs/agentsListAgents.js"; +import { ListAgentsRequest$zodSchema } from "../../models/listagentsop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: ListAgentsRequest$zodSchema.optional(), +}; + +export const tool$agentsListAgents: ToolDefinition = { + name: "agents-list-agents", + description: `List agents + +Retrieve a paginated list of agents available to the authenticated user. + +**Overview** + +Returns agents accessible through direct, team, or org-level permissions. +Search is performed across agent name, description, and tags. Sorting and +pagination are applied by the AI backend and the resulting envelope is +forwarded unchanged by the Node gateway. + +**Gateway contract** + +The Node route supports only these query params: \`page\`, \`limit\`, \`search\`, +\`sort_by\`, and \`sort_order\`. + +The Python backend also understands \`isDeleted\`, but this gateway route +does not forward it, so it is not part of the public API contract here. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await agentsListAgents( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/agentsUnarchiveAgentConversation.ts b/src/mcp-server/tools/agentsUnarchiveAgentConversation.ts new file mode 100644 index 00000000..7f84d199 --- /dev/null +++ b/src/mcp-server/tools/agentsUnarchiveAgentConversation.ts @@ -0,0 +1,44 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { agentsUnarchiveAgentConversation } from "../../funcs/agentsUnarchiveAgentConversation.js"; +import { UnarchiveAgentConversationRequest$zodSchema } from "../../models/unarchiveagentconversationop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: UnarchiveAgentConversationRequest$zodSchema, +}; + +export const tool$agentsUnarchiveAgentConversation: ToolDefinition< + typeof args +> = { + name: "agents-unarchive-agent-conversation", + description: `Unarchive an agent conversation + +Restores an archived agent conversation to the active list.`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await agentsUnarchiveAgentConversation( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/agentsUpdateAgent.ts b/src/mcp-server/tools/agentsUpdateAgent.ts new file mode 100644 index 00000000..e6c4e6a2 --- /dev/null +++ b/src/mcp-server/tools/agentsUpdateAgent.ts @@ -0,0 +1,67 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { agentsUpdateAgent } from "../../funcs/agentsUpdateAgent.js"; +import { UpdateAgentRequest$zodSchema } from "../../models/updateagentop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: UpdateAgentRequest$zodSchema, +}; + +export const tool$agentsUpdateAgent: ToolDefinition = { + name: "agents-update-agent", + description: `Update agent + +Apply a partial update to an existing agent configuration. + +**Gateway contract** + +The Node gateway validates the request body via Zod middleware before +forwarding to the Python agent service. The \`agentKey\` path param and +the request body are both validated. Query parameters are ignored by +the controller. + +**Update semantics** + +Only fields present in the request body are updated. When \`models\` is +included, the gateway Zod middleware requires at least one model entry +and at least one object entry with \`isReasoning: true\`. + +**Permissions** + +The authenticated user must have \`can_edit\` on the agent (typically the +owner). Service-account and \`shareWithOrg\` transitions follow additional +Python business rules. + +**Success response** + +Returns a lightweight success envelope only. Use +\`GET /agents/{agentKey}\` to read the persisted agent after an update. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await agentsUpdateAgent( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/agentsUpdateAgentConversationMessageFeedback.ts b/src/mcp-server/tools/agentsUpdateAgentConversationMessageFeedback.ts new file mode 100644 index 00000000..6fb0f07a --- /dev/null +++ b/src/mcp-server/tools/agentsUpdateAgentConversationMessageFeedback.ts @@ -0,0 +1,48 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { agentsUpdateAgentConversationMessageFeedback } from "../../funcs/agentsUpdateAgentConversationMessageFeedback.js"; +import { UpdateAgentConversationMessageFeedbackRequest$zodSchema } from "../../models/updateagentconversationmessagefeedbackop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: UpdateAgentConversationMessageFeedbackRequest$zodSchema, +}; + +export const tool$agentsUpdateAgentConversationMessageFeedback: ToolDefinition< + typeof args +> = { + name: "agents-update-agent-conversation-message-feedback", + description: `Submit feedback for an agent message + +Append structured feedback to a bot-response message in an agent +conversation. Uses the same request body shape as +\`updateMessageFeedback\` (helpfulness, categories, comments). Feedback +can only be submitted on \`bot_response\` messages. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await agentsUpdateAgentConversationMessageFeedback( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/agentsUpdateAgentConversationTitle.ts b/src/mcp-server/tools/agentsUpdateAgentConversationTitle.ts new file mode 100644 index 00000000..58a0ca88 --- /dev/null +++ b/src/mcp-server/tools/agentsUpdateAgentConversationTitle.ts @@ -0,0 +1,53 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { agentsUpdateAgentConversationTitle } from "../../funcs/agentsUpdateAgentConversationTitle.js"; +import { UpdateAgentConversationTitleRequest$zodSchema } from "../../models/updateagentconversationtitleop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: UpdateAgentConversationTitleRequest$zodSchema, +}; + +export const tool$agentsUpdateAgentConversationTitle: ToolDefinition< + typeof args +> = { + name: "agents-update-agent-conversation-title", + description: `Update agent conversation title + +Updates the display title for an agent conversation owned by the caller. + +The controller looks up the conversation by \`_id\`, \`orgId\`, \`userId\`, +\`agentKey\`, and \`isDeleted: false\`. + +The request body uses the shared title validator (\`1..200\` chars), and +the controller trims the incoming title before saving it. A whitespace-only +title can therefore still return HTTP 400 even if the raw string is +non-empty. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await agentsUpdateAgentConversationTitle( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/agentsUploadAgentConversationChatAttachments.ts b/src/mcp-server/tools/agentsUploadAgentConversationChatAttachments.ts new file mode 100644 index 00000000..cdad2243 --- /dev/null +++ b/src/mcp-server/tools/agentsUploadAgentConversationChatAttachments.ts @@ -0,0 +1,47 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { agentsUploadAgentConversationChatAttachments } from "../../funcs/agentsUploadAgentConversationChatAttachments.js"; +import { UploadAgentConversationChatAttachmentsRequest$zodSchema } from "../../models/uploadagentconversationchatattachmentsop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: UploadAgentConversationChatAttachmentsRequest$zodSchema, +}; + +export const tool$agentsUploadAgentConversationChatAttachments: ToolDefinition< + typeof args +> = { + name: "agents-upload-agent-conversation-chat-attachments", + description: `Upload agent chat attachments + +Multipart upload of PDF, JPEG, or PNG files for agent chat. Same limits as assistant +chat (\`POST /conversations/attachments/upload\`): up to 10 files, 5 MiB each. Proxies to +the AI backend. Optional \`conversationId\` associates uploads with an existing agent thread. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await agentsUploadAgentConversationChatAttachments( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/aiModelsProvidersGetAvailableModelsByType.ts b/src/mcp-server/tools/aiModelsProvidersGetAvailableModelsByType.ts new file mode 100644 index 00000000..17bf0a95 --- /dev/null +++ b/src/mcp-server/tools/aiModelsProvidersGetAvailableModelsByType.ts @@ -0,0 +1,62 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { aiModelsProvidersGetAvailableModelsByType } from "../../funcs/aiModelsProvidersGetAvailableModelsByType.js"; +import { GetAvailableModelsByTypeRequest$zodSchema } from "../../models/getavailablemodelsbytypeop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: GetAvailableModelsByTypeRequest$zodSchema, +}; + +export const tool$aiModelsProvidersGetAvailableModelsByType: ToolDefinition< + typeof args +> = { + name: "AI-models-providers-get-available-models-by-type", + description: `Get available models by type + +Returns a **flattened list** of individual AI models of the requested type, +suitable for use in selection dropdowns and model-picker UIs. + +Each provider configuration entry may specify multiple comma-separated model +names; this endpoint expands those into one object per model name so callers +receive a flat, enumerable collection. + +**Flattening rules:** +- Only the **first** model in a multi-model provider entry is marked + \`isDefault: true\`; all subsequent models from the same entry get \`false\`. +- \`modelFriendlyName\` is included **only** when the provider entry contains + exactly one model name (not a comma-separated list). +- When no providers of the requested type are configured the endpoint still + returns HTTP **200** with an empty \`models\` array — this is **not** an error. + +**Access control:** requires a valid bearer token. For OAuth tokens the +\`config:read\` scope must be present; regular JWT bearer tokens pass through +without scope enforcement. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await aiModelsProvidersGetAvailableModelsByType( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/conversationsArchiveConversation.ts b/src/mcp-server/tools/conversationsArchiveConversation.ts new file mode 100644 index 00000000..4a39aec9 --- /dev/null +++ b/src/mcp-server/tools/conversationsArchiveConversation.ts @@ -0,0 +1,60 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { conversationsArchiveConversation } from "../../funcs/conversationsArchiveConversation.js"; +import { ArchiveConversationRequest$zodSchema } from "../../models/archiveconversationop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: ArchiveConversationRequest$zodSchema, +}; + +export const tool$conversationsArchiveConversation: ToolDefinition< + typeof args +> = { + name: "conversations-archive-conversation", + description: `Archive conversation + +Archive a conversation to hide it from the main list. + +**Overview:** + +Archived conversations are preserved but hidden from the default conversation list. +Use archiving to clean up your workspace without permanently deleting conversations. + +**Access:** + +The caller must be the conversation's initiator, or be listed in \`sharedWith\` +with \`accessLevel: write\`. Already-archived conversations return \`400\`. + +**Retrieval:** + +View archived conversations using \`GET /conversations/show/archives\`. +Restore one with \`PATCH /conversations/{conversationId}/unarchive\`. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await conversationsArchiveConversation( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/conversationsDeleteConversationById.ts b/src/mcp-server/tools/conversationsDeleteConversationById.ts new file mode 100644 index 00000000..f8c730dd --- /dev/null +++ b/src/mcp-server/tools/conversationsDeleteConversationById.ts @@ -0,0 +1,57 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { conversationsDeleteConversationById } from "../../funcs/conversationsDeleteConversationById.js"; +import { DeleteConversationByIdRequest$zodSchema } from "../../models/deleteconversationbyidop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: DeleteConversationByIdRequest$zodSchema, +}; + +export const tool$conversationsDeleteConversationById: ToolDefinition< + typeof args +> = { + name: "conversations-delete-conversation-by-id", + description: `Delete conversation + +Delete a conversation by its ID. + +**Overview:** + +Performs a soft delete by setting \`isDeleted: true\`. The conversation is +removed from listings but preserved in the database. All citations +referenced by messages in the conversation are also soft-deleted. + +**Permissions:** + +The conversation initiator can always delete. Users the conversation has +been shared with may delete it only when their \`sharedWith.accessLevel\` +is \`write\`. +`, + annotations: { + "title": "", + "destructiveHint": true, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await conversationsDeleteConversationById( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/conversationsGetAllConversations.ts b/src/mcp-server/tools/conversationsGetAllConversations.ts new file mode 100644 index 00000000..f7999ac7 --- /dev/null +++ b/src/mcp-server/tools/conversationsGetAllConversations.ts @@ -0,0 +1,62 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { conversationsGetAllConversations } from "../../funcs/conversationsGetAllConversations.js"; +import { GetAllConversationsRequest$zodSchema } from "../../models/getallconversationsop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: GetAllConversationsRequest$zodSchema.optional(), +}; + +export const tool$conversationsGetAllConversations: ToolDefinition< + typeof args +> = { + name: "conversations-get-all-conversations", + description: `List all conversations + +Retrieve paginated conversations for the authenticated user. + +**Overview:** + +Use the optional \`source\` query parameter to choose which list to return: +\`owned\` — only conversations you own (\`userId\` matches the current user). +\`shared\` — conversations where you have recipient access +(\`isShared\` and your user appears in \`sharedWith\`), without the owner-only branch. +Defaults to \`owned\` when omitted. Each call returns one list; call twice if you need both. + +**Filtering:** + +- Only non-archived conversations are returned by default +- Use \`/conversations/show/archives\` for archived conversations + +**Sorting:** + +Conversations are sorted by last activity timestamp (most recent first) by default. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await conversationsGetAllConversations( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/conversationsGetArchivedConversations.ts b/src/mcp-server/tools/conversationsGetArchivedConversations.ts new file mode 100644 index 00000000..b9bfa649 --- /dev/null +++ b/src/mcp-server/tools/conversationsGetArchivedConversations.ts @@ -0,0 +1,62 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { conversationsGetArchivedConversations } from "../../funcs/conversationsGetArchivedConversations.js"; +import { GetArchivedConversationsRequest$zodSchema } from "../../models/getarchivedconversationsop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: GetArchivedConversationsRequest$zodSchema.optional(), +}; + +export const tool$conversationsGetArchivedConversations: ToolDefinition< + typeof args +> = { + name: "conversations-get-archived-conversations", + description: `List archived conversations + +Retrieve all archived conversations for the authenticated user. + +**Overview:** + +Archived conversations are hidden from the main list but preserved for reference. +This endpoint returns only conversations where \`isArchived: true\` and \`archivedBy\` +is set. Results include conversations the caller owns and those shared with them. + +**Filtering and sorting:** + +Results can be narrowed using \`search\`, \`shared\`, \`startDate\`, \`endDate\`, and +\`conversationId\`. Sorting is controlled by \`sortBy\` and \`sortOrder\`. Pagination +is controlled by \`page\` and \`limit\`. + +**Unarchiving:** + +Use \`PATCH /conversations/{conversationId}/unarchive\` to restore a conversation +to the active list. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await conversationsGetArchivedConversations( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/conversationsGetConversationById.ts b/src/mcp-server/tools/conversationsGetConversationById.ts new file mode 100644 index 00000000..64437525 --- /dev/null +++ b/src/mcp-server/tools/conversationsGetConversationById.ts @@ -0,0 +1,63 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { conversationsGetConversationById } from "../../funcs/conversationsGetConversationById.js"; +import { GetConversationByIdRequest$zodSchema } from "../../models/getconversationbyidop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: GetConversationByIdRequest$zodSchema, +}; + +export const tool$conversationsGetConversationById: ToolDefinition< + typeof args +> = { + name: "conversations-get-conversation-by-id", + description: `Get conversation by ID + +Retrieve a specific conversation with its full message history. + +**Overview:** + +Returns the complete conversation including all messages, citations, +feedback, and metadata. Messages can be paginated for long conversations. + +**Message Pagination:** + +For conversations with many messages, use pagination parameters: + +- \`page\`: Page number (default: 1) +- \`limit\`: Messages per page (default: 10) +- \`sortBy\`: Sort field (default: createdAt) +- \`sortOrder\`: 'asc' or 'desc' (default: desc) + +**Access Control:** + +Users can access conversations they own or that have been shared with them. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await conversationsGetConversationById( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/conversationsSearchArchivedConversations.ts b/src/mcp-server/tools/conversationsSearchArchivedConversations.ts new file mode 100644 index 00000000..8ee5d683 --- /dev/null +++ b/src/mcp-server/tools/conversationsSearchArchivedConversations.ts @@ -0,0 +1,67 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { conversationsSearchArchivedConversations } from "../../funcs/conversationsSearchArchivedConversations.js"; +import { SearchArchivedConversationsRequest$zodSchema } from "../../models/searcharchivedconversationsop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: SearchArchivedConversationsRequest$zodSchema, +}; + +export const tool$conversationsSearchArchivedConversations: ToolDefinition< + typeof args +> = { + name: "conversations-search-archived-conversations", + description: `Search archived conversations + +Search across all archived conversations (assistant and agent) for the authenticated user. + +**Overview:** + +Performs a case-insensitive substring match against conversation titles and message content +across both assistant (\`Conversation\`) and agent (\`AgentConversation\`) archived collections. +Results are merged server-side and sorted by \`lastActivityAt\` descending. + +**Search parameter:** + +The \`search\` query parameter is required, must be a non-empty string, and is capped at +1000 characters. Requests that omit it or exceed the cap return \`400\`. + +**Pagination:** + +Results are paginated using \`page\` and \`limit\`. The response includes a \`pagination\` +block with total counts and a \`summary\` block that breaks matches down by source. + +**Item shape:** + +Each item is a conversation list entry (no \`messages\` payload — that field is omitted +for performance) tagged with \`source\`, plus computed \`isOwner\`, \`accessLevel\`, +\`archivedAt\`, and \`archivedBy\`. \`agentKey\` is present only when \`source\` is \`agent\`. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await conversationsSearchArchivedConversations( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/conversationsUnarchiveConversation.ts b/src/mcp-server/tools/conversationsUnarchiveConversation.ts new file mode 100644 index 00000000..f97bfda3 --- /dev/null +++ b/src/mcp-server/tools/conversationsUnarchiveConversation.ts @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { conversationsUnarchiveConversation } from "../../funcs/conversationsUnarchiveConversation.js"; +import { UnarchiveConversationRequest$zodSchema } from "../../models/unarchiveconversationop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: UnarchiveConversationRequest$zodSchema, +}; + +export const tool$conversationsUnarchiveConversation: ToolDefinition< + typeof args +> = { + name: "conversations-unarchive-conversation", + description: `Unarchive conversation + +Restore an archived conversation. + +- Path params: \`conversationId\` +- Query params: none +- Body: none +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await conversationsUnarchiveConversation( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/conversationsUpdateConversationTitle.ts b/src/mcp-server/tools/conversationsUpdateConversationTitle.ts new file mode 100644 index 00000000..651be953 --- /dev/null +++ b/src/mcp-server/tools/conversationsUpdateConversationTitle.ts @@ -0,0 +1,60 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { conversationsUpdateConversationTitle } from "../../funcs/conversationsUpdateConversationTitle.js"; +import { UpdateConversationTitleRequest$zodSchema } from "../../models/updateconversationtitleop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: UpdateConversationTitleRequest$zodSchema, +}; + +export const tool$conversationsUpdateConversationTitle: ToolDefinition< + typeof args +> = { + name: "conversations-update-conversation-title", + description: `Update conversation title + +Update the title of a conversation. + +**Overview:** + +Conversation titles are auto-generated from the first query by default. +Use this endpoint to set a custom, more descriptive title. + +**Title limits:** + +- Minimum: 1 character +- Maximum: 200 characters + +**Permissions:** + +The conversation must exist, belong to the calling user's organization, +be owned by the caller (matched on \`userId\`), and not be soft-deleted. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await conversationsUpdateConversationTitle( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/conversationsUpdateMessageFeedback.ts b/src/mcp-server/tools/conversationsUpdateMessageFeedback.ts new file mode 100644 index 00000000..49e56e28 --- /dev/null +++ b/src/mcp-server/tools/conversationsUpdateMessageFeedback.ts @@ -0,0 +1,63 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { conversationsUpdateMessageFeedback } from "../../funcs/conversationsUpdateMessageFeedback.js"; +import { UpdateMessageFeedbackRequest$zodSchema } from "../../models/updatemessagefeedbackop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: UpdateMessageFeedbackRequest$zodSchema, +}; + +export const tool$conversationsUpdateMessageFeedback: ToolDefinition< + typeof args +> = { + name: "conversations-update-message-feedback", + description: `Submit feedback on AI response + +Append a feedback entry to a bot-response message. + +**Overview** + +Feedback helps improve AI response quality over time. You can record an +overall helpfulness signal, issue categories, and free-text comments. +Each call appends a new entry to the message; previous entries are +preserved. + +**Feedback options** + +- \`isHelpful\` — overall thumbs up/down. +- \`categories\` — issue or positive categories from a fixed list. +- \`comments\` — free-text \`positive\` and \`negative\`. + +**Restrictions** + +Feedback can only be submitted on \`bot_response\` messages — user +queries and system messages are rejected with \`400\`. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await conversationsUpdateMessageFeedback( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/knowledgeHubGetKnowledgeHubChildNodes.ts b/src/mcp-server/tools/knowledgeHubGetKnowledgeHubChildNodes.ts new file mode 100644 index 00000000..06e4713a --- /dev/null +++ b/src/mcp-server/tools/knowledgeHubGetKnowledgeHubChildNodes.ts @@ -0,0 +1,80 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { knowledgeHubGetKnowledgeHubChildNodes } from "../../funcs/knowledgeHubGetKnowledgeHubChildNodes.js"; +import { GetKnowledgeHubChildNodesRequest$zodSchema } from "../../models/getknowledgehubchildnodesop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: GetKnowledgeHubChildNodesRequest$zodSchema, +}; + +export const tool$knowledgeHubGetKnowledgeHubChildNodes: ToolDefinition< + typeof args +> = { + name: "knowledge-hub-get-knowledge-hub-child-nodes", + description: `Get knowledge hub child nodes + +Returns the children of a specific node in the knowledge hub tree. +Use this endpoint to drill down into Collections, connector app +hierarchies, folders, and record groups. + +**Navigation hierarchy** + +The typical drill-down path is: +1. Root apps (\`GET /knowledgeBase/knowledge-hub/nodes\`) +2. Record groups / folders within an app (\`parentType=app\`) +3. Records within a record group (\`parentType=recordGroup\`) +4. Sub-records or attachments within a record (\`parentType=record\`) + +**Parent identification** + +- \`parentType\` must be one of: \`app\`, \`recordGroup\`, \`folder\`, \`record\` +- \`parentId\` is either a standard UUID or the Collection app sentinel + \`knowledgeBase_\` (e.g. \`knowledgeBase_org123\`) + +**Filtering and searching** + +All query-param filters from the root endpoint are available here and +operate within the scope of the parent node's subtree. When \`q\` is +provided, the search spans all descendants of the parent node. + +**Response extras** + +When \`include=breadcrumbs\` is set, the response contains a +\`breadcrumbs\` array tracing the path from the root to the current +node. The \`currentNode\` and \`parentNode\` objects are always populated +for non-root requests. + +**Access control** + +Requires a valid bearer token. For OAuth tokens the \`kb:read\` scope +must be present; regular JWT bearer tokens pass through without scope +enforcement. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await knowledgeHubGetKnowledgeHubChildNodes( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/knowledgeHubGetKnowledgeHubRootNodes.ts b/src/mcp-server/tools/knowledgeHubGetKnowledgeHubRootNodes.ts new file mode 100644 index 00000000..fa2cfe5a --- /dev/null +++ b/src/mcp-server/tools/knowledgeHubGetKnowledgeHubRootNodes.ts @@ -0,0 +1,85 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { knowledgeHubGetKnowledgeHubRootNodes } from "../../funcs/knowledgeHubGetKnowledgeHubRootNodes.js"; +import { GetKnowledgeHubRootNodesRequest$zodSchema } from "../../models/getknowledgehubrootnodesop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: GetKnowledgeHubRootNodesRequest$zodSchema.optional(), +}; + +export const tool$knowledgeHubGetKnowledgeHubRootNodes: ToolDefinition< + typeof args +> = { + name: "knowledge-hub-get-knowledge-hub-root-nodes", + description: `Get knowledge hub root nodes + +Returns root-level nodes (connector apps and Collection apps) or, when +filters or search are applied, a flat list of matching nodes across the +entire knowledge hub tree. + +**Overview** + +The Knowledge Hub provides a unified view across all knowledge sources: +- **Collection** — locally uploaded knowledge bases (\`origin: COLLECTION\`) +- **Connector app** — external connector instances such as Google Drive, + Slack, Confluence, Jira (\`origin: CONNECTOR\`) + +Use this endpoint to build file-browser UIs and sidebar navigation trees. + +**Browsing vs. searching** + +When no filters or search query are provided, only top-level app nodes +are returned. Adding \`nodeTypes\`, \`q\`, or other filter params triggers a +search across the full tree, returning matching nodes regardless of depth. + +For children of a specific node, use +\`GET /knowledgeBase/knowledge-hub/nodes/{parentType}/{parentId}\`. + +**Pagination and sorting** + +Results are always paginated. Default sort is \`updatedAt\` descending. +The \`pagination\` object in the response contains \`hasNext\` / \`hasPrev\` +flags suitable for infinite-scroll or page-based navigation. + +**Expanding the response** + +Use the \`include\` parameter to request additional sections: +- \`availableFilters\` — adds \`filters.available\` with all filter options +- \`counts\` — adds a \`counts\` summary broken down by node type +- \`breadcrumbs\` — adds the breadcrumb trail (empty at root level) +- \`permissions\` — adds the caller's permission flags + +**Access control** + +Requires a valid bearer token. For OAuth tokens the \`kb:read\` scope +must be present; regular JWT bearer tokens pass through without scope +enforcement. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await knowledgeHubGetKnowledgeHubRootNodes( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/oAuthAppsActivateOAuthApp.ts b/src/mcp-server/tools/oAuthAppsActivateOAuthApp.ts new file mode 100644 index 00000000..dff8e822 --- /dev/null +++ b/src/mcp-server/tools/oAuthAppsActivateOAuthApp.ts @@ -0,0 +1,47 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { oAuthAppsActivateOAuthApp } from "../../funcs/oAuthAppsActivateOAuthApp.js"; +import { ActivateOAuthAppRequest$zodSchema } from "../../models/activateoauthappop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: ActivateOAuthAppRequest$zodSchema, +}; + +export const tool$oAuthAppsActivateOAuthApp: ToolDefinition = { + name: "O-auth-apps-activate-O-auth-app", + description: `Activate suspended OAuth app + +Moves a suspended OAuth app back to \`status: "active"\`, restoring its ability to authenticate and obtain new tokens via \`POST /oauth2/token\`. + +A revoked app cannot be reactivated (returns \`400\`); the only path back is to register a new app. Activating an app that is already active also returns \`400\`. + +Creator-only. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await oAuthAppsActivateOAuthApp( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/oAuthAppsCreateOAuthApp.ts b/src/mcp-server/tools/oAuthAppsCreateOAuthApp.ts new file mode 100644 index 00000000..579d01ea --- /dev/null +++ b/src/mcp-server/tools/oAuthAppsCreateOAuthApp.ts @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { oAuthAppsCreateOAuthApp } from "../../funcs/oAuthAppsCreateOAuthApp.js"; +import { CreateOAuthAppRequest$zodSchema } from "../../models/createoauthapprequest.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: CreateOAuthAppRequest$zodSchema, +}; + +export const tool$oAuthAppsCreateOAuthApp: ToolDefinition = { + name: "O-auth-apps-create-O-auth-app", + description: `Create OAuth app + +Register a new OAuth app for the organization. Any authenticated org member may create apps; the creator is recorded as the app's owner and is the only user who can subsequently read, update, suspend, activate, regenerate the secret of, or delete it. + +The \`clientSecret\` is returned in this response **only** — it is stored hashed server-side and cannot be retrieved later. Persist it before exiting the create flow; if it is ever lost, rotate via \`POST /oauth-clients/{appId}/regenerate-secret\`. + +\`allowedScopes\` is validated against the caller's role-aware scope set (see \`GET /oauth-clients/scopes\`). Org admins may include admin-only scopes; non-admins requesting a restricted scope receive \`400\`. + +All \`/oauth-clients/*\` routes share a per-user rate limiter (default 1000 req/min, configurable via the \`MAX_OAUTH_CLIENT_REQUESTS_PER_MINUTE\` env var). +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await oAuthAppsCreateOAuthApp( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/oAuthAppsDeleteOAuthApp.ts b/src/mcp-server/tools/oAuthAppsDeleteOAuthApp.ts new file mode 100644 index 00000000..5dfce3ec --- /dev/null +++ b/src/mcp-server/tools/oAuthAppsDeleteOAuthApp.ts @@ -0,0 +1,45 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { oAuthAppsDeleteOAuthApp } from "../../funcs/oAuthAppsDeleteOAuthApp.js"; +import { DeleteOAuthAppRequest$zodSchema } from "../../models/deleteoauthappop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: DeleteOAuthAppRequest$zodSchema, +}; + +export const tool$oAuthAppsDeleteOAuthApp: ToolDefinition = { + name: "O-auth-apps-delete-O-auth-app", + description: `Delete OAuth app + +Soft-deletes an OAuth app. The app is flagged \`isDeleted=true\` on the \`OAuthApp\` document, removed from list/get responses for every caller, and all of its access and refresh tokens are revoked in the same operation. There is no restore endpoint — deletion is final. + +Creator-only: even org admins cannot delete apps owned by other users. +`, + annotations: { + "title": "", + "destructiveHint": true, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await oAuthAppsDeleteOAuthApp( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/oAuthAppsGetOAuthApp.ts b/src/mcp-server/tools/oAuthAppsGetOAuthApp.ts new file mode 100644 index 00000000..062652ad --- /dev/null +++ b/src/mcp-server/tools/oAuthAppsGetOAuthApp.ts @@ -0,0 +1,45 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { oAuthAppsGetOAuthApp } from "../../funcs/oAuthAppsGetOAuthApp.js"; +import { GetOAuthAppRequest$zodSchema } from "../../models/getoauthappop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: GetOAuthAppRequest$zodSchema, +}; + +export const tool$oAuthAppsGetOAuthApp: ToolDefinition = { + name: "O-auth-apps-get-O-auth-app", + description: `Get OAuth app details + +Returns the full configuration of an OAuth app you registered. The \`clientSecret\` is never echoed back here; if you need a new one, call \`POST /oauth-clients/{appId}/regenerate-secret\`. + +Access is creator-scoped: even org admins receive \`404\` for apps owned by other users. This avoids leaking app metadata across org members and keeps the read surface symmetric with \`listOAuthApps\`. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await oAuthAppsGetOAuthApp( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/oAuthAppsListOAuthAppTokens.ts b/src/mcp-server/tools/oAuthAppsListOAuthAppTokens.ts new file mode 100644 index 00000000..655dfddf --- /dev/null +++ b/src/mcp-server/tools/oAuthAppsListOAuthAppTokens.ts @@ -0,0 +1,47 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { oAuthAppsListOAuthAppTokens } from "../../funcs/oAuthAppsListOAuthAppTokens.js"; +import { ListOAuthAppTokensRequest$zodSchema } from "../../models/listoauthapptokensop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: ListOAuthAppTokensRequest$zodSchema, +}; + +export const tool$oAuthAppsListOAuthAppTokens: ToolDefinition = { + name: "O-auth-apps-list-O-auth-app-tokens", + description: `List app tokens + +Lists active access and refresh tokens currently issued to an OAuth app, sorted newest first. Useful for auditing app usage and picking specific tokens to investigate before a targeted revocation. + +Each entry includes the token type (\`access\` or \`refresh\`), the user the token was issued for (omitted for client-credentials access tokens), the granted scopes, the issuance and expiry timestamps, and the revocation flag. Each type is capped at 100 most-recent rows server-side (\`listTokensForApp\` in \`oauth_token.service.ts\`); revoked and expired tokens are excluded. + +Creator-only. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await oAuthAppsListOAuthAppTokens( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/oAuthAppsListOAuthApps.ts b/src/mcp-server/tools/oAuthAppsListOAuthApps.ts new file mode 100644 index 00000000..5e7bcf8b --- /dev/null +++ b/src/mcp-server/tools/oAuthAppsListOAuthApps.ts @@ -0,0 +1,47 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { oAuthAppsListOAuthApps } from "../../funcs/oAuthAppsListOAuthApps.js"; +import { ListOAuthAppsRequest$zodSchema } from "../../models/listoauthappsop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: ListOAuthAppsRequest$zodSchema.optional(), +}; + +export const tool$oAuthAppsListOAuthApps: ToolDefinition = { + name: "O-auth-apps-list-O-auth-apps", + description: `List OAuth apps + +Returns a paginated list of OAuth apps registered by the signed-in user. Access is creator-scoped — even org admins only see apps they created themselves, so this endpoint is safe to use for per-user developer dashboards without leaking org-wide app metadata. + +Each entry carries the full app configuration except the client secret, which is only ever returned at creation time and immediately after a regeneration. + +Use the \`status\` query parameter to filter by lifecycle state (\`active\`, \`suspended\`, \`revoked\`) and \`search\` for a case-insensitive substring match against \`name\` or \`description\`. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await oAuthAppsListOAuthApps( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/oAuthAppsListOAuthScopes.ts b/src/mcp-server/tools/oAuthAppsListOAuthScopes.ts new file mode 100644 index 00000000..e6a35b30 --- /dev/null +++ b/src/mcp-server/tools/oAuthAppsListOAuthScopes.ts @@ -0,0 +1,42 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { oAuthAppsListOAuthScopes } from "../../funcs/oAuthAppsListOAuthScopes.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +export const tool$oAuthAppsListOAuthScopes: ToolDefinition = { + name: "O-auth-apps-list-O-auth-scopes", + description: `List available scopes + +Returns the OAuth scopes the signed-in user is permitted to register on new or updated apps, grouped by category. Use this to populate scope-picker UIs and to validate \`allowedScopes\` client-side before submitting to \`createOAuthApp\` / \`updateOAuthApp\`. + +The result is role-aware. Org admins (members of an admin user group) receive every registered scope; everyone else is filtered to exclude admin-only scopes: \`org:write\`, \`org:admin\`, \`user:invite\`, \`user:delete\`, \`usergroup:write\`, \`team:write\`, \`config:write\`, \`crawl:write\`, \`crawl:delete\`. + +Each key in the \`scopes\` map matches the \`category\` field on the \`OAuthScopeInfo\` entries it contains. A category may appear with an empty array when every scope it contains is restricted for the caller — treat empty buckets as "no permitted scopes in this group", not as a missing category. + +Shares the per-user rate limiter applied to every \`/oauth-clients/*\` route (default 1000 req/min, \`MAX_OAUTH_CLIENT_REQUESTS_PER_MINUTE\`). +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + tool: async (client, ctx) => { + const [result] = await oAuthAppsListOAuthScopes( + client, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/oAuthAppsRegenerateOAuthAppSecret.ts b/src/mcp-server/tools/oAuthAppsRegenerateOAuthAppSecret.ts new file mode 100644 index 00000000..4b553fbb --- /dev/null +++ b/src/mcp-server/tools/oAuthAppsRegenerateOAuthAppSecret.ts @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { oAuthAppsRegenerateOAuthAppSecret } from "../../funcs/oAuthAppsRegenerateOAuthAppSecret.js"; +import { RegenerateOAuthAppSecretRequest$zodSchema } from "../../models/regenerateoauthappsecretop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: RegenerateOAuthAppSecretRequest$zodSchema, +}; + +export const tool$oAuthAppsRegenerateOAuthAppSecret: ToolDefinition< + typeof args +> = { + name: "O-auth-apps-regenerate-O-auth-app-secret", + description: `Regenerate client secret + +Generates a fresh client secret for an OAuth app. The previous secret is invalidated immediately — any client still presenting it will fail token exchange at \`POST /oauth2/token\` until updated. + +The new secret is returned in this response **only** and cannot be retrieved later. Pair this call with credential propagation to every integration that uses the app. If the rotation was triggered by a suspected leak, also call \`POST /oauth-clients/{appId}/revoke-all-tokens\` to invalidate already-issued access and refresh tokens instead of waiting for their natural expiry. + +Creator-only: even org admins cannot rotate secrets for other users' apps. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await oAuthAppsRegenerateOAuthAppSecret( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/oAuthAppsRevokeAllOAuthAppTokens.ts b/src/mcp-server/tools/oAuthAppsRevokeAllOAuthAppTokens.ts new file mode 100644 index 00000000..4f9ee722 --- /dev/null +++ b/src/mcp-server/tools/oAuthAppsRevokeAllOAuthAppTokens.ts @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { oAuthAppsRevokeAllOAuthAppTokens } from "../../funcs/oAuthAppsRevokeAllOAuthAppTokens.js"; +import { RevokeAllOAuthAppTokensRequest$zodSchema } from "../../models/revokealloauthapptokensop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: RevokeAllOAuthAppTokensRequest$zodSchema, +}; + +export const tool$oAuthAppsRevokeAllOAuthAppTokens: ToolDefinition< + typeof args +> = { + name: "O-auth-apps-revoke-all-O-auth-app-tokens", + description: `Revoke all app tokens + +Revokes every access and refresh token currently issued to an OAuth app, in a single operation. Use this for emergency credential rotation, suspected secret leaks, or as a follow-up to \`POST /oauth-clients/{appId}/regenerate-secret\` when you want existing sessions invalidated immediately rather than letting them expire naturally. + +The response \`count\` is the total number of tokens revoked across both types. Clients of this app must then obtain new tokens via the standard OAuth flow. + +Creator-only. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await oAuthAppsRevokeAllOAuthAppTokens( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/oAuthAppsSuspendOAuthApp.ts b/src/mcp-server/tools/oAuthAppsSuspendOAuthApp.ts new file mode 100644 index 00000000..b5e21755 --- /dev/null +++ b/src/mcp-server/tools/oAuthAppsSuspendOAuthApp.ts @@ -0,0 +1,47 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { oAuthAppsSuspendOAuthApp } from "../../funcs/oAuthAppsSuspendOAuthApp.js"; +import { SuspendOAuthAppRequest$zodSchema } from "../../models/suspendoauthappop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: SuspendOAuthAppRequest$zodSchema, +}; + +export const tool$oAuthAppsSuspendOAuthApp: ToolDefinition = { + name: "O-auth-apps-suspend-O-auth-app", + description: `Suspend OAuth app + +Moves an OAuth app to \`status: "suspended"\`, blocking new token issuance at \`POST /oauth2/token\` and the authorization-code consent flow. Tokens that have already been issued remain valid until their natural expiry — call \`POST /oauth-clients/{appId}/revoke-all-tokens\` immediately afterwards if you need an immediate lockout. + +Use this for temporary suspensions where you intend to reactivate later. For permanent removal, use \`DELETE /oauth-clients/{appId}\`. Suspending an app that is already suspended returns \`400\`. + +Creator-only. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await oAuthAppsSuspendOAuthApp( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/oAuthAppsUpdateOAuthApp.ts b/src/mcp-server/tools/oAuthAppsUpdateOAuthApp.ts new file mode 100644 index 00000000..2d44c5cb --- /dev/null +++ b/src/mcp-server/tools/oAuthAppsUpdateOAuthApp.ts @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { oAuthAppsUpdateOAuthApp } from "../../funcs/oAuthAppsUpdateOAuthApp.js"; +import { UpdateOAuthAppRequestRequest$zodSchema } from "../../models/updateoauthappop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: UpdateOAuthAppRequestRequest$zodSchema, +}; + +export const tool$oAuthAppsUpdateOAuthApp: ToolDefinition = { + name: "O-auth-apps-update-O-auth-app", + description: `Update OAuth app + +Update an OAuth app's configuration. All body fields are optional — supply only what should change. URL fields (\`homepageUrl\`, \`privacyPolicyUrl\`, \`termsOfServiceUrl\`) accept \`null\` to clear them. + +Creator-only: even org admins cannot edit apps owned by other users. + +When modifying \`allowedScopes\`, the new set must remain a subset of the caller's role-aware scope list (same rule as \`GET /oauth-clients/scopes\`). When adding \`authorization_code\` to \`allowedGrantTypes\`, \`redirectUris\` becomes required and must contain at least one URI; otherwise the request is rejected with \`400\` by the Zod refine on \`updateAppSchema\`. + +This endpoint never rotates the client secret — use \`POST /oauth-clients/{appId}/regenerate-secret\` for that. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await oAuthAppsUpdateOAuthApp( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/oAuthProviderOauthIntrospect.ts b/src/mcp-server/tools/oAuthProviderOauthIntrospect.ts new file mode 100644 index 00000000..dbd12b53 --- /dev/null +++ b/src/mcp-server/tools/oAuthProviderOauthIntrospect.ts @@ -0,0 +1,54 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { oAuthProviderOauthIntrospect } from "../../funcs/oAuthProviderOauthIntrospect.js"; +import { OAuthIntrospectRequest$zodSchema } from "../../models/oauthintrospectrequest.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: OAuthIntrospectRequest$zodSchema, +}; + +export const tool$oAuthProviderOauthIntrospect: ToolDefinition = { + name: "O-auth-provider-oauth-introspect", + description: `Introspect a token + +OAuth 2.0 Token Introspection Endpoint (RFC 7662). + +Check if a token is active and retrieve its metadata. + +**Use Cases:** +- Resource servers validating tokens +- Debugging token issues +- Checking token scopes before processing requests + +**Response:** +- Active token: Returns \`active: true\` with token metadata +- Invalid/expired/revoked token: Returns only \`active: false\` +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await oAuthProviderOauthIntrospect( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/oAuthProviderOauthRevoke.ts b/src/mcp-server/tools/oAuthProviderOauthRevoke.ts new file mode 100644 index 00000000..e8b16fdf --- /dev/null +++ b/src/mcp-server/tools/oAuthProviderOauthRevoke.ts @@ -0,0 +1,54 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { oAuthProviderOauthRevoke } from "../../funcs/oAuthProviderOauthRevoke.js"; +import { OAuthRevokeRequest$zodSchema } from "../../models/oauthrevokerequest.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: OAuthRevokeRequest$zodSchema, +}; + +export const tool$oAuthProviderOauthRevoke: ToolDefinition = { + name: "O-auth-provider-oauth-revoke", + description: `Revoke an access or refresh token + +OAuth 2.0 Token Revocation Endpoint (RFC 7009). + +Revokes an access token or refresh token, preventing further use. +Revoking a refresh token also invalidates associated access tokens. + +**Use Cases:** +- User logs out of third-party app +- User revokes app access from account settings +- Security incident response + +**Note:** Returns 200 OK even if token was already revoked or invalid +(per RFC 7009, to prevent token enumeration). +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await oAuthProviderOauthRevoke( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/oAuthProviderOauthToken.ts b/src/mcp-server/tools/oAuthProviderOauthToken.ts new file mode 100644 index 00000000..e6bb932c --- /dev/null +++ b/src/mcp-server/tools/oAuthProviderOauthToken.ts @@ -0,0 +1,61 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { oAuthProviderOauthToken } from "../../funcs/oAuthProviderOauthToken.js"; +import { OAuthTokenRequest$zodSchema } from "../../models/oauthtokenrequest.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: OAuthTokenRequest$zodSchema, +}; + +export const tool$oAuthProviderOauthToken: ToolDefinition = { + name: "O-auth-provider-oauth-token", + description: `Exchange authorization code for tokens + +OAuth 2.0 Token Endpoint (RFC 6749 Section 4.1.3). + +Exchanges an authorization code, client credentials, or refresh token for access tokens. + +**Grant Types:** +- \`authorization_code\`: Exchange auth code for tokens (user-based) +- \`client_credentials\`: Get tokens for machine-to-machine auth +- \`refresh_token\`: Get new access token using refresh token + +For **\`client_credentials\`**, access tokens represent the **OAuth app creator** (the user who registered the client). The JWT may encode **\`userId === client_id\`**; the **Node API gateway** resolves the creator (**\`createdBy\`** claim or OAuth app lookup) and must not trust client-supplied **\`x-oauth-user-id\`** (stripped on ingress). Downstream Python services accept **\`x-oauth-user-id\`** only when set by the gateway — see **OAuth Provider** tag. + +**Client Authentication:** +Can be provided via: +- HTTP Basic auth: \`Authorization: Basic base64(client_id:client_secret)\` +- Request body: \`client_id\` and \`client_secret\` parameters + +**PKCE Verification:** +If authorization used PKCE, the \`code_verifier\` must be provided and will be +verified against the stored code challenge. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await oAuthProviderOauthToken( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/openIDConnectOauthUserInfo.ts b/src/mcp-server/tools/openIDConnectOauthUserInfo.ts new file mode 100644 index 00000000..785b94b0 --- /dev/null +++ b/src/mcp-server/tools/openIDConnectOauthUserInfo.ts @@ -0,0 +1,47 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { openIDConnectOauthUserInfo } from "../../funcs/openIDConnectOauthUserInfo.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +export const tool$openIDConnectOauthUserInfo: ToolDefinition = { + name: "open-ID-connect-oauth-user-info", + description: `Get authenticated user information + +OpenID Connect UserInfo Endpoint. + +Returns claims about the authenticated user. Requires a valid access token +with the \`openid\` scope. + +**Available Claims:** +- \`user_id\` - User identifier +- \`name\`, \`given_name\`, \`family_name\` - Name claims (with \`profile\` scope) +- \`email\`, \`email_verified\` - Email claims (with \`email\` scope) + +**Authentication:** +Pass the access token as a Bearer token: \`Authorization: Bearer {access_token}\` +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + tool: async (client, ctx) => { + const [result] = await openIDConnectOauthUserInfo( + client, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/organizationAuthConfigGetAuthMethods.ts b/src/mcp-server/tools/organizationAuthConfigGetAuthMethods.ts new file mode 100644 index 00000000..f93975d6 --- /dev/null +++ b/src/mcp-server/tools/organizationAuthConfigGetAuthMethods.ts @@ -0,0 +1,55 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { organizationAuthConfigGetAuthMethods } from "../../funcs/organizationAuthConfigGetAuthMethods.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +export const tool$organizationAuthConfigGetAuthMethods: ToolDefinition = { + name: "organization-auth-config-get-auth-methods", + description: `Get organization authentication methods + +Retrieve the configured authentication methods for the organization. + +**Response Structure:** + +Returns an array of authentication steps, each containing: +- \`order\`: Step number (1-3) +- \`allowedMethods\`: Array of methods allowed for that step + +**Example Response:** + +\`\`\`json +{ + "authMethods": [ + { "order": 1, "allowedMethods": [{ "type": "password" }, { "type": "google" }] }, + { "order": 2, "allowedMethods": [{ "type": "otp" }] } + ] +} +\`\`\` + +**Admin Access Required:** Only organization admins can view auth configuration. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + tool: async (client, ctx) => { + const [result] = await organizationAuthConfigGetAuthMethods( + client, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/organizationAuthConfigSetUpAuthConfig.ts b/src/mcp-server/tools/organizationAuthConfigSetUpAuthConfig.ts new file mode 100644 index 00000000..337eb554 --- /dev/null +++ b/src/mcp-server/tools/organizationAuthConfigSetUpAuthConfig.ts @@ -0,0 +1,45 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { organizationAuthConfigSetUpAuthConfig } from "../../funcs/organizationAuthConfigSetUpAuthConfig.js"; +import { OrgAuthConfigCreateRequest$zodSchema } from "../../models/orgauthconfigcreaterequest.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: OrgAuthConfigCreateRequest$zodSchema, +}; + +export const tool$organizationAuthConfigSetUpAuthConfig: ToolDefinition< + typeof args +> = { + name: "organization-auth-config-set-up-auth-config", + description: `Set up auth configuration + +Set up or initialize the organization's authentication configuration. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await organizationAuthConfigSetUpAuthConfig( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/organizationAuthConfigUpdateAuthMethod.ts b/src/mcp-server/tools/organizationAuthConfigUpdateAuthMethod.ts new file mode 100644 index 00000000..1aad32fe --- /dev/null +++ b/src/mcp-server/tools/organizationAuthConfigUpdateAuthMethod.ts @@ -0,0 +1,85 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { organizationAuthConfigUpdateAuthMethod } from "../../funcs/organizationAuthConfigUpdateAuthMethod.js"; +import { UpdateAuthMethodRequest$zodSchema } from "../../models/updateauthmethodop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: UpdateAuthMethodRequest$zodSchema, +}; + +export const tool$organizationAuthConfigUpdateAuthMethod: ToolDefinition< + typeof args +> = { + name: "organization-auth-config-update-auth-method", + description: `Update organization authentication methods + +Update the authentication methods configuration for an organization. +This allows admins to configure single or multi-factor authentication. + +**Validation Rules:** +- Minimum 1 step, maximum 3 steps +- Each step must have a unique order (1, 2, or 3) +- No duplicate methods within the same step +- No method can appear in multiple steps +- Each step must have at least one allowed method + +**Available Methods:** +- \`password\`: Email/password authentication +- \`otp\`: One-time password via email +- \`google\`: Google OAuth 2.0 +- \`microsoft\`: Microsoft OAuth 2.0 +- \`azureAd\`: Azure Active Directory +- \`samlSso\`: SAML 2.0 Single Sign-On +- \`oauth\`: Generic OAuth 2.0 provider + +**Example - Single Factor (Password or Google):** + +\`\`\`json +{ + "authMethod": [ + { "order": 1, "allowedMethods": [{ "type": "password" }, { "type": "google" }] } + ] +} +\`\`\` + +**Example - Two Factor (Password + OTP):** + +\`\`\`json +{ + "authMethod": [ + { "order": 1, "allowedMethods": [{ "type": "password" }] }, + { "order": 2, "allowedMethods": [{ "type": "otp" }] } + ] +} +\`\`\` + +**Admin Access Required:** Only organization admins can update auth configuration. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await organizationAuthConfigUpdateAuthMethod( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/organizationsGetCurrentOrganization.ts b/src/mcp-server/tools/organizationsGetCurrentOrganization.ts new file mode 100644 index 00000000..65dddd5c --- /dev/null +++ b/src/mcp-server/tools/organizationsGetCurrentOrganization.ts @@ -0,0 +1,53 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { organizationsGetCurrentOrganization } from "../../funcs/organizationsGetCurrentOrganization.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +export const tool$organizationsGetCurrentOrganization: ToolDefinition = { + name: "organizations-get-current-organization", + description: `Get current organization + +Retrieve details about the authenticated user's organization. + +**Overview:** + +This endpoint returns the organization document for the current user's org, including profile data and configuration. + +**Response Includes:** + +- Organization profile (registeredName, shortName, contactEmail, domain) +- Account type +- Onboarding status +- Permanent address +- Creation and modification timestamps + +**Use Cases:** + +- Organization profile pages +- Settings and configuration screens +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + tool: async (client, ctx) => { + const [result] = await organizationsGetCurrentOrganization( + client, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/pipeshubChat.ts b/src/mcp-server/tools/pipeshubChat.ts deleted file mode 100644 index 17eb1f69..00000000 --- a/src/mcp-server/tools/pipeshubChat.ts +++ /dev/null @@ -1,236 +0,0 @@ -// Curated PipesHub chat tool. Hand-written; replaces the two generated -// tools `pipeshub-chat` (create) and `pipeshub-chat-continue` (follow-up) -// with a single tool that branches on whether `conversationId` was given. -// -// Wire transport: SSE. The non-streaming `/conversations/create` endpoint -// is broken in production today, so we drive -// `POST /conversations/stream` (and -// `POST /conversations/{conversationId}/messages/stream` for follow-ups), -// accumulate the frames server-side, and hand the LLM a single trimmed -// `CallToolResult` once the stream emits its terminal `complete` (or -// `error`) frame. -// -// Frame types we know about (from live wire traces): -// - connected — handshake; ignored -// - status — { status: "started" | "searching" | "processing" -// | "checking_tools" | ... }; ignored (UI-only) -// - answer_chunk — { content, accumulated, ... }; we keep the latest -// `accumulated` as a fallback in case the stream -// ends without a `complete` frame -// - tool_call — model invoked an internal tool; we collect these -// as observability breadcrumbs but the LLM doesn't -// need them to answer -// - tool_success — paired with tool_call; same treatment -// - complete — terminal; payload is `{ conversation, meta }`, -// matching the non-stream response shape, so we -// feed it through `trimConversation` like before -// - error — terminal; surface to the LLM as a tool error - -import * as z from "zod"; -import { conversationsStreamConversation } from "../../funcs/conversationsStreamConversation.js"; -import { conversationsStreamMessage } from "../../funcs/conversationsStreamMessage.js"; -import { ToolDefinition } from "../tools.js"; -import { - errorResult, - iterateSSE, - jsonResult, - trimConversation, -} from "./_helpers.js"; - -const FiltersShape = z.object({ - apps: z.array(z.string()).optional().describe( - "Source-scoping ids. Mix connector instance UUIDs with the synthetic " - + "`knowledgeBase_` id (use pipeshub_sources to discover them). " - + "Empty / omitted means no app-side restriction.", - ), - kb: z.array(z.string()).optional().describe( - "Legacy / unused. Leave empty.", - ), -}).optional(); - -const args = { - query: z.string().min(1).describe( - "The user's question or message for this turn.", - ), - conversationId: z.string().optional().describe( - "Existing conversation id to continue. Omit on the FIRST turn; on every " - + "subsequent turn pass the `conversationId` returned by the previous " - + "call. Server-side message history is preserved — do NOT replay " - + "prior messages.", - ), - filters: FiltersShape.describe( - "Source scoping for retrieval. Pass `apps` ids from `pipeshub_sources`. " - + "Only meaningful on the FIRST turn (when starting a new conversation).", - ), - modelKey: z.string().optional().describe( - "Model id to use (from `pipeshub_sources` `models[*].modelKey`). " - + "Defaults to the org's default LLM.", - ), - modelName: z.string().optional(), - modelFriendlyName: z.string().optional(), - chatMode: z.enum(["web_search", "internal_search"]).optional().describe( - "Controls retrieval source. " - + "`internal_search` (default) — searches the org's indexed knowledge " - + "bases (Drive, Confluence, Slack, Gmail, Jira, Box, etc.) and returns " - + "citations. Use this for questions about internal docs, policies, or " - + "company data. " - + "`web_search` — searches the public web instead of internal sources. " - + "Use only when the user explicitly asks about current events, public " - + "information, or anything not expected to be in the org's KB. " - + "Omit this field (or pass `internal_search`) for all normal queries.", - ), -}; - -export const tool$pipeshubChat: ToolDefinition = { - name: "pipeshub_chat", - description: - `**Primary chat tool — handles both internal knowledge queries and web search.** - -**Internal search** (default, \`chatMode: "internal_search"\`): Use whenever -the user asks about their documents, files, knowledge base, company policies, -or anything that could plausibly be answered by content in their PipesHub-indexed -sources (Drive, Box, Confluence, Slack, Gmail, Jira, the org's KB, ...). -Grounds the answer in the user's actual data and returns citations. - -**Web search** (\`chatMode: "web_search"\`): Use when the user asks about -current events, public information, or anything unlikely to be in the org's -internal knowledge base. Pass \`chatMode: "web_search"\` and this tool will -search the public web instead. - -**When to pick this over other tools:** -- "What does say about X?" → \`pipeshub_chat\` (internal_search) -- "Summarize ." → \`pipeshub_chat\` (internal_search) -- "What's our policy on Y?" → \`pipeshub_chat\` (internal_search) -- "What's in the news about Z?" → \`pipeshub_chat\` (web_search) -- "What is the latest version of ?" → \`pipeshub_chat\` (web_search) -- "Find / locate the file named X" → \`pipeshub_search\` (then - \`pipeshub_download_record\` if the user wants the bytes). - -**Conversation lifecycle** — one tool, both start and continue: - -- **First turn**: omit \`conversationId\`. The server creates a new - conversation; capture \`conversationId\` from the response. -- **Follow-up turn**: pass the \`conversationId\` from the previous - response. Server-side context is preserved — do NOT replay earlier - messages, and \`filters\` is ignored on follow-ups (set once at - creation). - -Only re-omit \`conversationId\` (start a fresh conversation) when the -user explicitly asks to start over / clear context. - -The response contains the AI's \`answer\` plus \`citations\`. To download a -cited document, take \`citations[*].recordId\` and call -\`pipeshub_download_record\`.`, - scopes: ["read"], - annotations: { - title: "Chat with PipesHub", - destructiveHint: false, - idempotentHint: false, - openWorldHint: true, - readOnlyHint: false, - }, - args, - tool: async (client, args, ctx) => { - const fetchOptions = { signal: ctx.signal }; - let response: Response; - - if (args.conversationId) { - // Continue an existing conversation. - const [result] = await conversationsStreamMessage(client, { - conversationId: args.conversationId, - body: { - query: args.query, - modelKey: args.modelKey, - modelName: args.modelName, - modelFriendlyName: args.modelFriendlyName, - chatMode: args.chatMode, - }, - }, { fetchOptions }).$inspect(); - if (!result.ok) return errorResult(result.error.message); - response = result.value; - } else { - // Start a new conversation. - const [result] = await conversationsStreamConversation(client, { - query: args.query, - filters: args.filters, - modelKey: args.modelKey, - modelName: args.modelName, - modelFriendlyName: args.modelFriendlyName, - chatMode: args.chatMode, - }, { fetchOptions }).$inspect(); - if (!result.ok) return errorResult(result.error.message); - response = result.value; - } - - // Drain the SSE stream. We only need the terminal `complete` (or - // `error`) frame; everything else is observability and ignored. - let finalConversation: any = null; - let recordsUsed: number | undefined; - let lastAccumulated: string | null = null; - let errorMessage: string | null = null; - - try { - for await (const frame of iterateSSE(response)) { - switch (frame.event) { - case "complete": { - const d = frame.data ?? {}; - finalConversation = d.conversation ?? null; - recordsUsed = d.recordsUsed ?? d.meta?.recordsUsed; - break; - } - case "error": { - const d = frame.data ?? {}; - errorMessage = typeof d === "string" - ? d - : (d.error ?? d.message ?? frame.raw ?? "Stream error"); - break; - } - case "answer_chunk": { - const d = frame.data ?? {}; - if (typeof d.accumulated === "string") { - lastAccumulated = d.accumulated; - } else if (typeof d.content === "string") { - lastAccumulated = (lastAccumulated ?? "") + d.content; - } - break; - } - // status / tool_call / tool_success / connected — ignored. - default: - break; - } - if (finalConversation || errorMessage) break; - } - } catch (e: unknown) { - return errorResult(`SSE stream failed: ${(e as Error).message}`); - } - - if (errorMessage) return errorResult(errorMessage); - - if (finalConversation) { - return jsonResult({ - ...trimConversation(finalConversation), - recordsUsed, - }); - } - - // Stream ended without a terminal frame — unusual, but salvage what - // we accumulated so the LLM has something to work with. - if (lastAccumulated) { - return jsonResult({ - conversationId: null, - title: null, - status: "Inprogress", - answer: lastAccumulated, - confidence: null, - citations: [], - followUpQuestions: [], - messageCount: 0, - recordsUsed, - warning: "Stream ended without a `complete` frame; answer is " - + "the last accumulated chunk and citations are unavailable.", - }); - } - - return errorResult("Stream ended without any usable frames."); - }, -}; diff --git a/src/mcp-server/tools/pipeshubDirectory.ts b/src/mcp-server/tools/pipeshubDirectory.ts deleted file mode 100644 index 066d0bea..00000000 --- a/src/mcp-server/tools/pipeshubDirectory.ts +++ /dev/null @@ -1,154 +0,0 @@ -// Curated directory tool. Hand-written; merges four generated tools -// (`pipeshub-list-users`, `pipeshub-get-user`, `pipeshub-list-user-groups`, -// `pipeshub-list-my-teams`) plus a `whoami` action that decodes the bearer -// JWT into a single tool. - -import * as z from "zod"; -import { usersGetAllUsers } from "../../funcs/usersGetAllUsers.js"; -import { usersGetUserById } from "../../funcs/usersGetUserById.js"; -import { userGroupsGetAllUserGroups } from "../../funcs/userGroupsGetAllUserGroups.js"; -import { teamsGetUserTeams } from "../../funcs/teamsGetUserTeams.js"; -import { ToolDefinition } from "../tools.js"; -import { - decodeBearer, - errorResult, - jsonResult, - readJson, -} from "./_helpers.js"; - -const args = { - action: z.enum([ - "whoami", - "list_users", - "get_user", - "list_groups", - "list_my_teams", - ]).describe( - "What to do:\n" - + "- `whoami` — return the authenticated user's identity (decoded from " - + "the bearer JWT). No other args needed.\n" - + "- `list_users` — paginated list of org users. Optional `page`, " - + "`limit`, `search` (substring match against name or email).\n" - + "- `get_user` — full profile for one user. Required `userId`. " - + "Use `whoami` to find your own id first if needed.\n" - + "- `list_groups` — paginated list of user groups (with `userCount`).\n" - + "- `list_my_teams` — teams the authenticated user belongs to, with " - + "capability flags.", - ), - userId: z.string().optional().describe( - "Required when `action` is `get_user`. 24-character ObjectId.", - ), - page: z.number().int().min(1).optional().describe( - "Pagination — 1-based page number. Used by list_* actions.", - ), - limit: z.number().int().min(1).max(100).optional().describe( - "Pagination — items per page. Used by list_* actions.", - ), - search: z.string().optional().describe( - "Substring match against name / email. Used by list_users.", - ), -}; - -export const tool$pipeshubDirectory: ToolDefinition = { - name: "pipeshub_directory", - description: - `Look up people, groups, and teams in PipesHub. One tool with five -actions — pick the right \`action\`: - -- \`whoami\` — who is the caller? Use this whenever you need the - authenticated user's own id, email, or full name (e.g. before - \`get_user\` on themselves). -- \`list_users\` — search / page through org users. -- \`get_user\` — full \`User\` document for one user (requires \`userId\`). -- \`list_groups\` — list user groups with \`userCount\`. -- \`list_my_teams\` — teams the caller belongs to, with capability flags - (\`canEdit\` / \`canDelete\` / \`canManageMembers\`). - -Output shape varies by action; see each action's docs above.`, - scopes: ["read"], - annotations: { - title: "PipesHub directory (users / groups / teams / whoami)", - destructiveHint: false, - idempotentHint: true, - openWorldHint: false, - readOnlyHint: true, - }, - args, - tool: async (client, args, ctx) => { - const fetchOptions = { signal: ctx.signal }; - - switch (args.action) { - case "whoami": { - const claims = await decodeBearer(client); - if (!claims) { - return errorResult( - "No bearer token configured on the SDK client, so `whoami` " - + "cannot resolve the caller's identity. Ask the user for " - + "their email and use `list_users` with `search`.", - ); - } - return jsonResult({ - userId: claims["userId"], - orgId: claims["orgId"], - email: claims["email"], - fullName: claims["fullName"], - mobile: claims["mobile"], - userSlug: claims["userSlug"], - }); - } - - case "list_users": { - const [result] = await usersGetAllUsers(client, { - page: args.page, - limit: args.limit, - search: args.search, - }, { fetchOptions }).$inspect(); - if (!result.ok) return errorResult(result.error.message); - const parsed = await readJson(result.value); - if (!parsed.ok) return parsed.result; - return jsonResult(parsed.value); - } - - case "get_user": { - if (!args.userId) { - return errorResult( - "`userId` is required when `action` is `get_user`. " - + "Use `whoami` to find your own id, or `list_users` " - + "to look up by name / email.", - ); - } - const [result] = await usersGetUserById(client, { - id: args.userId, - }, { fetchOptions }).$inspect(); - if (!result.ok) return errorResult(result.error.message); - const parsed = await readJson(result.value); - if (!parsed.ok) return parsed.result; - return jsonResult(parsed.value); - } - - case "list_groups": { - const [result] = await userGroupsGetAllUserGroups(client, { - page: args.page, - limit: args.limit, - search: args.search, - }, { fetchOptions }).$inspect(); - if (!result.ok) return errorResult(result.error.message); - const parsed = await readJson(result.value); - if (!parsed.ok) return parsed.result; - return jsonResult(parsed.value); - } - - case "list_my_teams": { - const [result] = await teamsGetUserTeams(client, { - page: args.page, - limit: args.limit, - search: args.search, - }, { fetchOptions }).$inspect(); - if (!result.ok) return errorResult(result.error.message); - const parsed = await readJson(result.value); - if (!parsed.ok) return parsed.result; - return jsonResult(parsed.value); - } - } - }, -}; diff --git a/src/mcp-server/tools/pipeshubDownloadRecord.ts b/src/mcp-server/tools/pipeshubDownloadRecord.ts deleted file mode 100644 index 8ce738e8..00000000 --- a/src/mcp-server/tools/pipeshubDownloadRecord.ts +++ /dev/null @@ -1,55 +0,0 @@ -// Curated download tool. Hand-written; replaces the generated -// `pipeshub-download-record`. Pipes raw bytes back through formatResult -// so binary downloads (PDFs, images) are returned correctly. - -import * as z from "zod"; -import { recordsStreamRecordBuffer } from "../../funcs/recordsStreamRecordBuffer.js"; -import { formatResult, ToolDefinition } from "../tools.js"; -import { errorResult } from "./_helpers.js"; - -const args = { - recordId: z.string().min(1).describe( - "Record identifier — usually a UUID for connector-sourced records or " - + "a 24-character ObjectId for uploaded records. Get it from a chat " - + "citation (`citations[*].recordId`) or from a `pipeshub_search` hit.", - ), - convertTo: z.string().optional().describe( - "Optional server-side format conversion target (e.g. `pdf`). When " - + "omitted, the original file bytes are returned.", - ), -}; - -export const tool$pipeshubDownloadRecord: ToolDefinition = { - name: "pipeshub_download_record", - description: - `Stream the binary content of a single record from PipesHub. - -Typical sources for the \`recordId\`: -- A chat citation: - \`pipeshub_chat\` response → \`citations[*].recordId\`. -- A search result: - \`pipeshub_search\` response → \`hits[*].recordId\` / - \`uniqueRecords[*].recordId\`. - -Response \`Content-Type\` is forwarded from the upstream service — -\`application/pdf\`, \`application/octet-stream\`, etc. Binary content is -returned base64-encoded; text content is returned inline.`, - scopes: ["read"], - annotations: { - title: "Download a document by record id", - destructiveHint: false, - idempotentHint: true, - openWorldHint: false, - readOnlyHint: true, - }, - args, - tool: async (client, args, ctx) => { - const [result] = await recordsStreamRecordBuffer(client, { - recordId: args.recordId, - convertTo: args.convertTo, - }, { fetchOptions: { signal: ctx.signal } }).$inspect(); - if (!result.ok) return errorResult(result.error.message); - - return formatResult(result.value); - }, -}; diff --git a/src/mcp-server/tools/pipeshubSearch.ts b/src/mcp-server/tools/pipeshubSearch.ts deleted file mode 100644 index 4f9cb908..00000000 --- a/src/mcp-server/tools/pipeshubSearch.ts +++ /dev/null @@ -1,85 +0,0 @@ -// Curated semantic-search tool. Hand-written; replaces the generated -// `pipeshub-search` tool. Trims the response to the fields the LLM -// actually needs (recordId, recordName, score, snippet, webUrl). - -import * as z from "zod"; -import { semanticSearchSearch } from "../../funcs/semanticSearchSearch.js"; -import { ToolDefinition } from "../tools.js"; -import { errorResult, jsonResult, readJson, trimSearchHit } from "./_helpers.js"; - -const args = { - query: z.string().min(1).describe( - "Natural language query. Vector search across the org's indexed records.", - ), - limit: z.number().int().min(1).max(100).optional().describe( - "Max number of result chunks. Default 10. Use a small value (5–10) " - + "when the goal is to resolve a filename / topic into a recordId.", - ), - apps: z.array(z.string()).optional().describe( - "Source-scoping ids — connector instance UUIDs and / or " - + "`knowledgeBase_`. Get them from `pipeshub_sources`.", - ), -}; - -export const tool$pipeshubSearch: ToolDefinition = { - name: "pipeshub_search", - description: - `Vector / semantic search across the org's indexed documents. - -**Use this only when the user wants to LOCATE a document** — by name, -topic, or a phrase to grep for. For "what does the document say about -X?" or any open-ended question, use \`pipeshub_chat\` instead, which -does the retrieval internally and grounds the answer in citations. - -Typical uses: -- Resolve a filename / phrase into a \`recordId\` for - \`pipeshub_download_record\`. -- Show the user a ranked list of matching files when they ask "find / - search for X". - -The response is trimmed to one row per hit: -\`{ recordId, recordName, score, snippet, mimeType, webUrl, ... }\`. -Highest \`score\` first; multiple hits may share the same \`recordId\` -(different chunks of the same record).`, - scopes: ["read"], - annotations: { - title: "Semantic search", - destructiveHint: false, - idempotentHint: true, - openWorldHint: true, - readOnlyHint: false, - }, - args, - tool: async (client, args, ctx) => { - const [result] = await semanticSearchSearch(client, { - query: args.query, - limit: args.limit, - filters: args.apps ? { apps: args.apps, kb: [] } : undefined, - }, { fetchOptions: { signal: ctx.signal } }).$inspect(); - if (!result.ok) return errorResult(result.error.message); - - const parsed = await readJson<{ - searchId: string; - searchResponse: { - searchResults: any[]; - records?: any[]; - status?: string; - message?: string; - }; - }>(result.value); - if (!parsed.ok) return parsed.result; - - const sr = parsed.value.searchResponse ?? {}; - return jsonResult({ - searchId: parsed.value.searchId, - hits: (sr.searchResults ?? []).map(trimSearchHit), - uniqueRecords: (sr.records ?? []).map((r: any) => ({ - recordId: r._key, - recordName: r.recordName, - connector: r.connectorName, - mimeType: r.mimeType, - webUrl: r.webUrl, - })), - }); - }, -}; diff --git a/src/mcp-server/tools/pipeshubSources.ts b/src/mcp-server/tools/pipeshubSources.ts deleted file mode 100644 index 742204e6..00000000 --- a/src/mcp-server/tools/pipeshubSources.ts +++ /dev/null @@ -1,101 +0,0 @@ -// Curated discovery tool. Hand-written; merges two generated tools -// (`pipeshub-list-sources` for connectors+KB and `pipeshub-list-models` -// for available LLMs / embedding models) into one tool, since the LLM -// almost always wants both before the first chat turn. - -import * as z from "zod"; -import { knowledgeHubGetKnowledgeHubRootNodes } from "../../funcs/knowledgeHubGetKnowledgeHubRootNodes.js"; -import { aiModelsProvidersGetAvailableModelsByType } from "../../funcs/aiModelsProvidersGetAvailableModelsByType.js"; -import { ToolDefinition } from "../tools.js"; -import { errorResult, jsonResult, readJson } from "./_helpers.js"; - -const args = { - include: z.array(z.enum(["sources", "llmModels", "embeddingModels"])) - .optional() - .describe( - "Which sections to fetch. Default: `[\"sources\", \"llmModels\"]`. " - + "Add `embeddingModels` if the user is configuring re-embedding.", - ), -}; - -export const tool$pipeshubSources: ToolDefinition = { - name: "pipeshub_sources", - description: - `Discover available chat sources and AI models in one call. - -Returns up to three sections: - -- \`sources\` — every connector instance the org has wired up plus the - synthetic \`knowledgeBase_\` entry for the org's KB. Each - item's \`id\` is exactly the value to put in \`pipeshub_chat\`'s or - \`pipeshub_search\`'s \`apps\` filter. -- \`llmModels\` — chat / generation models. Each item's \`modelKey\` - is the value to pass on \`pipeshub_chat\` / \`pipeshub_search\` as - \`modelKey\`. Pick \`isDefault: true\` unless the user asks for a - specific model. -- \`embeddingModels\` — vector embedding models (only fetched when - explicitly requested via \`include\`). - -Call this once at the start of a session and cache the result — -sources and models change infrequently. \`sources\` and \`llmModels\` -are returned by default; pass \`include\` to override.`, - scopes: ["read"], - annotations: { - title: "List PipesHub sources and AI models", - destructiveHint: false, - idempotentHint: true, - openWorldHint: false, - readOnlyHint: true, - }, - args, - tool: async (client, args, ctx) => { - const fetchOptions = { signal: ctx.signal }; - const include = args.include - ?? (["sources", "llmModels"] as const); - const want = (s: string) => (include as readonly string[]).includes(s); - - const result: Record = {}; - - if (want("sources")) { - const [r] = await knowledgeHubGetKnowledgeHubRootNodes(client, { - page: 1, - limit: 200, - }, { fetchOptions }).$inspect(); - if (!r.ok) return errorResult(`sources: ${r.error.message}`); - const parsed = await readJson<{ items?: any[] }>(r.value); - if (!parsed.ok) return parsed.result; - result["sources"] = (parsed.value.items ?? []).map((n: any) => ({ - id: n.id, - name: n.name, - kind: n.connector === "KB" ? "knowledgeBase" : "connector", - connector: n.connector, - hasChildren: n.hasChildren, - })); - } - - for ( - const [key, modelType] of [ - ["llmModels", "llm"] as const, - ["embeddingModels", "embedding"] as const, - ] - ) { - if (!want(key)) continue; - const [r] = await aiModelsProvidersGetAvailableModelsByType(client, { - modelType, - }, { fetchOptions }).$inspect(); - if (!r.ok) return errorResult(`${key}: ${r.error.message}`); - const parsed = await readJson<{ models?: any[] }>(r.value); - if (!parsed.ok) return parsed.result; - result[key] = (parsed.value.models ?? []).map((m: any) => ({ - modelKey: m.modelKey, - modelName: m.modelName, - provider: m.provider, - isDefault: m.isDefault, - isMultimodal: m.isMultimodal, - isReasoning: m.isReasoning, - })); - } - - return jsonResult(result); - }, -}; diff --git a/src/mcp-server/tools/semanticSearchArchiveSearch.ts b/src/mcp-server/tools/semanticSearchArchiveSearch.ts new file mode 100644 index 00000000..ecbf79a0 --- /dev/null +++ b/src/mcp-server/tools/semanticSearchArchiveSearch.ts @@ -0,0 +1,45 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { semanticSearchArchiveSearch } from "../../funcs/semanticSearchArchiveSearch.js"; +import { ArchiveSearchRequest$zodSchema } from "../../models/archivesearchop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: ArchiveSearchRequest$zodSchema, +}; + +export const tool$semanticSearchArchiveSearch: ToolDefinition = { + name: "semantic-search-archive-search", + description: `Archive a search + +Archive a specific search result. Archived searches are hidden +from the default search history view but remain retrievable via +the archive-aware listing endpoints. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await semanticSearchArchiveSearch( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/semanticSearchDeleteSearchById.ts b/src/mcp-server/tools/semanticSearchDeleteSearchById.ts new file mode 100644 index 00000000..c4edcd8d --- /dev/null +++ b/src/mcp-server/tools/semanticSearchDeleteSearchById.ts @@ -0,0 +1,50 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { semanticSearchDeleteSearchById } from "../../funcs/semanticSearchDeleteSearchById.js"; +import { DeleteSearchByIdRequest$zodSchema } from "../../models/deletesearchbyidop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: DeleteSearchByIdRequest$zodSchema, +}; + +export const tool$semanticSearchDeleteSearchById: ToolDefinition = + { + name: "semantic-search-delete-search-by-id", + description: `Delete search by ID + +Permanently delete a single persisted search row, plus every +citation row referenced by its \`citationIds\`. The caller must +either own the row or have it shared with them. + +Scoped to the caller's org and limited to rows where +\`isDeleted: false\` and \`isArchived: false\`; archived or +already-deleted rows surface as \`404\`. +`, + annotations: { + "title": "", + "destructiveHint": true, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await semanticSearchDeleteSearchById( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, + }; diff --git a/src/mcp-server/tools/semanticSearchDeleteSearchHistory.ts b/src/mcp-server/tools/semanticSearchDeleteSearchHistory.ts new file mode 100644 index 00000000..338dd6b9 --- /dev/null +++ b/src/mcp-server/tools/semanticSearchDeleteSearchHistory.ts @@ -0,0 +1,52 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { semanticSearchDeleteSearchHistory } from "../../funcs/semanticSearchDeleteSearchHistory.js"; +import { DeleteSearchHistoryRequest$zodSchema } from "../../models/deletesearchhistoryop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: DeleteSearchHistoryRequest$zodSchema.optional(), +}; + +export const tool$semanticSearchDeleteSearchHistory: ToolDefinition< + typeof args +> = { + name: "semantic-search-delete-search-history", + description: `Clear all search history + +Permanently delete every persisted search row owned by, or shared +with, the authenticated user, along with the citation rows those +searches reference. The action cannot be undone. + +Scoped to the caller's org and limited to rows where +\`isDeleted: false\` and \`isArchived: false\`. If nothing matches +(including the case where every row is already archived), the +endpoint returns \`404\` rather than a successful no-op. +`, + annotations: { + "title": "", + "destructiveHint": true, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await semanticSearchDeleteSearchHistory( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/semanticSearchGetSearchById.ts b/src/mcp-server/tools/semanticSearchGetSearchById.ts new file mode 100644 index 00000000..28785de1 --- /dev/null +++ b/src/mcp-server/tools/semanticSearchGetSearchById.ts @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { semanticSearchGetSearchById } from "../../funcs/semanticSearchGetSearchById.js"; +import { GetSearchByIdRequest$zodSchema } from "../../models/getsearchbyidop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: GetSearchByIdRequest$zodSchema, +}; + +export const tool$semanticSearchGetSearchById: ToolDefinition = { + name: "semantic-search-get-search-by-id", + description: `Get search by ID + +Retrieve a previously persisted search by its id, scoped to the +caller's org. + +The response body is always an **array** containing zero or one +persisted search document. An unknown id returns an empty array +with a \`200\` status — callers should check array length rather +than relying on a \`404\`. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await semanticSearchGetSearchById( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/semanticSearchSearch.ts b/src/mcp-server/tools/semanticSearchSearch.ts new file mode 100644 index 00000000..5cb65600 --- /dev/null +++ b/src/mcp-server/tools/semanticSearchSearch.ts @@ -0,0 +1,56 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { semanticSearchSearch } from "../../funcs/semanticSearchSearch.js"; +import { SemanticSearchRequest$zodSchema } from "../../models/semanticsearchrequest.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: SemanticSearchRequest$zodSchema, +}; + +export const tool$semanticSearchSearch: ToolDefinition = { + name: "semantic-search-search", + description: `Perform semantic search + +Run a semantic search across your organization's knowledge base. +Matching is meaning-based, so relevant results surface even when +the wording differs from the query. + +Use optional \`filters\` to narrow the scope: + +- \`filters.apps\` — restrict to specific connector apps (for + example Google Drive or Confluence). +- \`filters.kb\` — restrict to specific knowledge bases. + +The response returns a \`searchId\` for the persisted search along +with ranked matches, each carrying a relevance score and the +source document's metadata. Past searches can be retrieved via +\`GET /search\`. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await semanticSearchSearch( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/semanticSearchSearchHistory.ts b/src/mcp-server/tools/semanticSearchSearchHistory.ts new file mode 100644 index 00000000..91f7b769 --- /dev/null +++ b/src/mcp-server/tools/semanticSearchSearchHistory.ts @@ -0,0 +1,52 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { semanticSearchSearchHistory } from "../../funcs/semanticSearchSearchHistory.js"; +import { SearchHistoryRequest$zodSchema } from "../../models/searchhistoryop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: SearchHistoryRequest$zodSchema.optional(), +}; + +export const tool$semanticSearchSearchHistory: ToolDefinition = { + name: "semantic-search-search-history", + description: `Get search history + +Retrieve the authenticated user's persisted search history. + +Returns searches the user owns along with searches shared with them, +scoped to the caller's organization. Archived and deleted entries are +excluded. Citation references on this endpoint are returned as raw +identifier strings; use \`GET /search/{searchId}\` to fetch a single +search with its citations fully expanded. + +Pagination defaults to \`page=1, limit=20\` (maximum \`limit\` is 100). +Results are sorted by most recent activity by default. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await semanticSearchSearchHistory( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/semanticSearchUnarchiveSearch.ts b/src/mcp-server/tools/semanticSearchUnarchiveSearch.ts new file mode 100644 index 00000000..f72fcf60 --- /dev/null +++ b/src/mcp-server/tools/semanticSearchUnarchiveSearch.ts @@ -0,0 +1,43 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { semanticSearchUnarchiveSearch } from "../../funcs/semanticSearchUnarchiveSearch.js"; +import { UnarchiveSearchRequest$zodSchema } from "../../models/unarchivesearchop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: UnarchiveSearchRequest$zodSchema, +}; + +export const tool$semanticSearchUnarchiveSearch: ToolDefinition = { + name: "semantic-search-unarchive-search", + description: `Unarchive a search + +Restore a previously archived search result back to the active search history. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await semanticSearchUnarchiveSearch( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/userAccountAuthenticate.ts b/src/mcp-server/tools/userAccountAuthenticate.ts new file mode 100644 index 00000000..c30c747a --- /dev/null +++ b/src/mcp-server/tools/userAccountAuthenticate.ts @@ -0,0 +1,69 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { userAccountAuthenticate } from "../../funcs/userAccountAuthenticate.js"; +import { AuthenticateRequestRequest$zodSchema } from "../../models/authenticateop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: AuthenticateRequestRequest$zodSchema, +}; + +export const tool$userAccountAuthenticate: ToolDefinition = { + name: "user-account-authenticate", + description: `Authenticate user with credentials + +Authenticate a user using the specified method and credentials. +Requires a valid session token from \`/initAuth\`. + +**Credential Formats by Method:** + +- \`password\`: \`{ "credentials": { "password": "your-password" } }\` +- \`otp\`: \`{ "credentials": { "otp": "123456" } }\` (6-digit code, valid for 10 minutes) +- \`google\`: \`{ "credentials": "google-id-token-string" }\` +- \`microsoft\`: \`{ "credentials": { "accessToken": "...", "idToken": "..." } }\` +- \`azureAd\`: \`{ "credentials": { "accessToken": "...", "idToken": "..." } }\` +- \`oauth\`: \`{ "credentials": { "accessToken": "...", "idToken": "..." } }\` +- \`samlSso\`: Handled via redirect flow (use \`/saml/signIn\` instead) + +**Multi-Step Response:** + +If organization uses MFA, successful authentication returns: +- \`status: "success"\` with \`nextStep\` and \`allowedMethods\` for next step + +**Fully Authenticated Response:** + +After completing all steps: +- \`message: "Fully authenticated"\` with \`accessToken\` (1hr) and \`refreshToken\` (7d) + +**Security:** + +- Account locks after 5 consecutive failed attempts +- CAPTCHA may be required if enabled (pass \`cf-turnstile-response\`) +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await userAccountAuthenticate( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/userAccountInitAuth.ts b/src/mcp-server/tools/userAccountInitAuth.ts new file mode 100644 index 00000000..4c6895a7 --- /dev/null +++ b/src/mcp-server/tools/userAccountInitAuth.ts @@ -0,0 +1,69 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { userAccountInitAuth } from "../../funcs/userAccountInitAuth.js"; +import { InitAuthRequest$zodSchema } from "../../models/initauthrequest.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: InitAuthRequest$zodSchema.optional(), +}; + +export const tool$userAccountInitAuth: ToolDefinition = { + name: "user-account-init-auth", + description: `Initialize authentication session + +Start a server-side authentication session and discover which sign-in methods are +configured for the organization. This is the first step in the multi-step login flow. + +**Request body (optional)** + +- You may omit the body, send an empty JSON object \`{}\`, or send \`{ "email": "..." }\`. +- \`email\` in the body is optional and kept for legacy reasons; omitting it does not prevent + initialization. The web client typically calls this endpoint without a body and sends + \`email\` on \`/authenticate\` instead. +- When provided, \`email\` is stored on the session for correlation with subsequent steps. + +**Flow:** + +1. Call this endpoint (optional JSON body as above). +2. Receive a session token in the \`x-session-token\` response header. +3. Send that token on subsequent \`/authenticate\` requests (\`x-session-token\` header). +4. Use \`allowedMethods\` and \`authProviders\` from the response to render the login UI. + +**Session token** + +- Returned as header \`x-session-token\`. +- Required for \`/authenticate\` (and related steps) until it expires. + +**Multi-factor authentication** + +If the organization has MFA, complete multiple authentication steps; each step may +return the next step's allowed methods. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await userAccountInitAuth( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/userAccountResetPassword.ts b/src/mcp-server/tools/userAccountResetPassword.ts new file mode 100644 index 00000000..d123b175 --- /dev/null +++ b/src/mcp-server/tools/userAccountResetPassword.ts @@ -0,0 +1,47 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { userAccountResetPassword } from "../../funcs/userAccountResetPassword.js"; +import { ResetPasswordRequest$zodSchema } from "../../models/resetpasswordop.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +const args = { + request: ResetPasswordRequest$zodSchema, +}; + +export const tool$userAccountResetPassword: ToolDefinition = { + name: "user-account-reset-password", + description: `Reset password + +Reset the password for the currently authenticated user. + +**Overview:** + +Allows a logged-in user to change their password by providing the current password and a new password. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": false, + }, + args, + tool: async (client, args, ctx) => { + const [result] = await userAccountResetPassword( + client, + args.request, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/mcp-server/tools/webSearchGetWebSearchProviders.ts b/src/mcp-server/tools/webSearchGetWebSearchProviders.ts new file mode 100644 index 00000000..9ace1c13 --- /dev/null +++ b/src/mcp-server/tools/webSearchGetWebSearchProviders.ts @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { webSearchGetWebSearchProviders } from "../../funcs/webSearchGetWebSearchProviders.js"; +import { formatResult, ToolDefinition } from "../tools.js"; + +export const tool$webSearchGetWebSearchProviders: ToolDefinition = { + name: "web-search-get-web-search-providers", + description: `Get all web search providers + +Retrieve all configured web search providers and current web search settings. + +**Authentication:** Session JWT or OAuth 2.0 access token via \`Authorization: Bearer\`. +OAuth tokens must include the \`config:read\` scope. Admin role is not required. +`, + annotations: { + "title": "", + "destructiveHint": false, + "idempotentHint": false, + "openWorldHint": false, + "readOnlyHint": true, + }, + tool: async (client, ctx) => { + const [result] = await webSearchGetWebSearchProviders( + client, + { fetchOptions: { signal: ctx.signal } }, + ).$inspect(); + + if (!result.ok) { + return { + content: [{ type: "text", text: result.error.message }], + isError: true, + }; + } + + return formatResult(result.value); + }, +}; diff --git a/src/models/activateoauthappop.ts b/src/models/activateoauthappop.ts new file mode 100644 index 00000000..e78dfaa9 --- /dev/null +++ b/src/models/activateoauthappop.ts @@ -0,0 +1,38 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + ActivateOAuthAppResponse, + ActivateOAuthAppResponse$zodSchema, +} from "./activateoauthappresponse.js"; +import { + ApplicationJsonErrorResponse, + ApplicationJsonErrorResponse$zodSchema, +} from "./applicationjsonerrorresponse.js"; +import { + OAuthClientManagementRateLimitError, + OAuthClientManagementRateLimitError$zodSchema, +} from "./oauthclientmanagementratelimiterror.js"; + +export type ActivateOAuthAppRequest = { appId: string }; + +export const ActivateOAuthAppRequest$zodSchema: z.ZodType< + ActivateOAuthAppRequest +> = z.object({ + appId: z.string().describe("OAuth app ID"), +}); + +export type ActivateOAuthAppResponseResponse = + | ActivateOAuthAppResponse + | ApplicationJsonErrorResponse + | OAuthClientManagementRateLimitError; + +export const ActivateOAuthAppResponseResponse$zodSchema: z.ZodType< + ActivateOAuthAppResponseResponse +> = z.union([ + ActivateOAuthAppResponse$zodSchema, + ApplicationJsonErrorResponse$zodSchema, + OAuthClientManagementRateLimitError$zodSchema, +]); diff --git a/src/models/activateoauthappresponse.ts b/src/models/activateoauthappresponse.ts new file mode 100644 index 00000000..804894bd --- /dev/null +++ b/src/models/activateoauthappresponse.ts @@ -0,0 +1,30 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + OAuthAppResponse, + OAuthAppResponse$zodSchema, +} from "./oauthappresponse.js"; + +/** + * Response body for `POST /oauth-clients/{appId}/activate` + * + * @remarks + * (`oauth.app.controller.ts` `activateApp`). Re-activated app (never includes + * `clientSecret`) is nested under `app`. + */ +export type ActivateOAuthAppResponse = { + message: string; + app: OAuthAppResponse; +}; + +export const ActivateOAuthAppResponse$zodSchema: z.ZodType< + ActivateOAuthAppResponse +> = z.object({ + app: OAuthAppResponse$zodSchema, + message: z.string(), +}).describe( + "Response body for `POST /oauth-clients/{appId}/activate`\n(`oauth.app.controller.ts` `activateApp`). Re-activated app (never includes\n`clientSecret`) is nested under `app`.\n", +); diff --git a/src/models/addmessageop.ts b/src/models/addmessageop.ts deleted file mode 100644 index 050d74b1..00000000 --- a/src/models/addmessageop.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { - AddMessageRequest, - AddMessageRequest$zodSchema, -} from "./addmessagerequest.js"; - -export type AddMessageRequestRequest = { - conversationId: string; - body: AddMessageRequest; -}; - -export const AddMessageRequestRequest$zodSchema: z.ZodType< - AddMessageRequestRequest -> = z.object({ - body: AddMessageRequest$zodSchema, - conversationId: z.string().describe( - "Unique conversation identifier. Get this from a prior\n`POST /conversations/create` response\n(`conversation._id`) or from `GET /conversations`.\n", - ), -}); diff --git a/src/models/addmessagerequest.ts b/src/models/addmessagerequest.ts deleted file mode 100644 index 682631cd..00000000 --- a/src/models/addmessagerequest.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { Filters, Filters$zodSchema } from "./filters.js"; - -/** - * Request body for adding a message to an existing conversation - */ -export type AddMessageRequest = { - query: string; - filters?: Filters | undefined; - modelKey?: string | undefined; - modelName?: string | undefined; - modelFriendlyName?: string | undefined; - chatMode?: string | undefined; - timezone?: string | undefined; - currentTime?: string | undefined; -}; - -export const AddMessageRequest$zodSchema: z.ZodType = z - .object({ - chatMode: z.string().optional(), - currentTime: z.iso.datetime({ offset: true }).optional(), - filters: Filters$zodSchema.optional(), - modelFriendlyName: z.string().optional(), - modelKey: z.string().optional(), - modelName: z.string().optional(), - query: z.string(), - timezone: z.string().optional(), - }).describe("Request body for adding a message to an existing conversation"); diff --git a/src/models/addmessageresponse.ts b/src/models/addmessageresponse.ts deleted file mode 100644 index 2f502ed4..00000000 --- a/src/models/addmessageresponse.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { Conversation, Conversation$zodSchema } from "./conversation.js"; - -export type AddMessageResponseMeta = { - requestId: string; - timestamp: string; - duration: number; -}; - -export const AddMessageResponseMeta$zodSchema: z.ZodType< - AddMessageResponseMeta -> = z.object({ - duration: z.int(), - requestId: z.string(), - timestamp: z.iso.datetime({ offset: true }), -}); - -/** - * Response from `POST /conversations/{conversationId}/messages`. Same - * - * @remarks - * `{ conversation, meta }` envelope as `SSECompleteData` plus a - * `recordsUsed` count for the new turn. - */ -export type AddMessageResponse = { - conversation: Conversation; - recordsUsed?: number | undefined; - meta: AddMessageResponseMeta; -}; - -export const AddMessageResponse$zodSchema: z.ZodType = z - .object({ - conversation: Conversation$zodSchema, - meta: z.lazy(() => AddMessageResponseMeta$zodSchema), - recordsUsed: z.int().optional(), - }).describe( - "Response from `POST /conversations/{conversationId}/messages`. Same\n`{ conversation, meta }` envelope as `SSECompleteData` plus a\n`recordsUsed` count for the new turn.\n", - ); diff --git a/src/models/address.ts b/src/models/address.ts index 84b0f617..cbeaacb8 100644 --- a/src/models/address.ts +++ b/src/models/address.ts @@ -5,6 +5,7 @@ import * as z from "zod"; export type Address = { + _id?: string | undefined; addressLine1?: string | undefined; city?: string | undefined; state?: string | undefined; @@ -13,6 +14,7 @@ export type Address = { }; export const Address$zodSchema: z.ZodType
= z.object({ + _id: z.string().optional(), addressLine1: z.string().optional(), city: z.string().optional(), country: z.string().optional(), diff --git a/src/models/agent.ts b/src/models/agent.ts new file mode 100644 index 00000000..058c33b7 --- /dev/null +++ b/src/models/agent.ts @@ -0,0 +1,224 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AgentCreateToolsetName, + AgentCreateToolsetName$zodSchema, +} from "./agentcreatetoolsetname.js"; +import { + AgentKnowledgeFiltersParsed, + AgentKnowledgeFiltersParsed$zodSchema, +} from "./agentknowledgefiltersparsed.js"; + +export type Model1 = { + modelKey?: string | undefined; + modelName?: string | undefined; + provider?: string | undefined; + isReasoning?: boolean | undefined; + isMultimodal?: boolean | undefined; + isDefault?: boolean | undefined; + modelType?: string | undefined; + modelFriendlyName?: string | undefined; +}; + +export const Model1$zodSchema: z.ZodType = z.object({ + isDefault: z.boolean().optional(), + isMultimodal: z.boolean().optional(), + isReasoning: z.boolean().optional(), + modelFriendlyName: z.string().optional(), + modelKey: z.string().optional(), + modelName: z.string().optional(), + modelType: z.string().optional(), + provider: z.string().optional(), +}); + +export type Model2 = string | Model1; + +export const Model2$zodSchema: z.ZodType = z.union([ + z.string(), + z.lazy(() => Model1$zodSchema), +]); + +export type Tool = { + name?: string | undefined; + fullName?: string | undefined; + description?: string | undefined; + deprecated?: boolean | undefined; +}; + +export const Tool$zodSchema: z.ZodType = z.object({ + deprecated: z.boolean().optional(), + description: z.string().optional(), + fullName: z.string().optional(), + name: z.string().optional(), +}); + +export type Toolset = { + name?: AgentCreateToolsetName | undefined; + displayName?: string | undefined; + type?: string | undefined; + instanceId?: string | undefined; + instanceName?: string | undefined; + iconPath?: string | undefined; + tools?: Array | undefined; +}; + +export const Toolset$zodSchema: z.ZodType = z.object({ + displayName: z.string().optional(), + iconPath: z.string().optional(), + instanceId: z.string().optional(), + instanceName: z.string().optional(), + name: AgentCreateToolsetName$zodSchema.optional(), + tools: z.array(z.lazy(() => Tool$zodSchema)).optional(), + type: z.string().optional(), +}); + +/** + * Knowledge scope filter as stored on the graph edge. The Node `getAgent` + * + * @remarks + * handler proxies this field unchanged from the AI service (only `agent.id` + * is stripped). May be a JSON string (typical graph storage) or an object. + * Prefer `filtersParsed` on GET for a guaranteed parsed object with the + * same keys as the object branch below. + */ +export type AgentFilters = AgentKnowledgeFiltersParsed | string; + +export const AgentFilters$zodSchema: z.ZodType = z.union([ + AgentKnowledgeFiltersParsed$zodSchema, + z.string(), +]).describe( + "Knowledge scope filter as stored on the graph edge. The Node `getAgent`\nhandler proxies this field unchanged from the AI service (only `agent.id`\nis stripped). May be a JSON string (typical graph storage) or an object.\nPrefer `filtersParsed` on GET for a guaranteed parsed object with the\nsame keys as the object branch below.\n", +); + +/** + * Server-derived read-only object parsed from the stored + * + * @remarks + * `filters` JSON by the graph provider on GET (Neo4j / Arango). + * Empty object when `filters` is missing or invalid JSON. + */ +export type FiltersParsed = { + recordGroups?: Array | undefined; + records?: Array | undefined; +}; + +export const FiltersParsed$zodSchema: z.ZodType = z.object({ + recordGroups: z.array(z.string()).optional(), + records: z.array(z.string()).optional(), +}).describe( + "Server-derived read-only object parsed from the stored\n`filters` JSON by the graph provider on GET (Neo4j / Arango).\nEmpty object when `filters` is missing or invalid JSON.\n", +); + +export type Knowledge = { + _key?: string | undefined; + connectorId?: string | undefined; + name?: string | undefined; + type?: string | undefined; + displayName?: string | undefined; + filters?: AgentKnowledgeFiltersParsed | string | undefined; + filtersParsed?: FiltersParsed | undefined; +}; + +export const Knowledge$zodSchema: z.ZodType = z.object({ + _key: z.string().optional(), + connectorId: z.string().optional(), + displayName: z.string().optional(), + filters: z.union([ + AgentKnowledgeFiltersParsed$zodSchema, + z.string(), + ]).optional(), + filtersParsed: z.lazy(() => FiltersParsed$zodSchema).optional(), + name: z.string().optional(), + type: z.string().optional(), +}); + +/** + * Web search provider attached to this agent. Null when none is configured. + */ +export type AgentWebSearch = { + provider: string; + providerKey?: string | undefined; + providerLabel?: string | undefined; +}; + +export const AgentWebSearch$zodSchema: z.ZodType = z.object({ + provider: z.string(), + providerKey: z.string().optional(), + providerLabel: z.string().optional(), +}).describe( + "Web search provider attached to this agent. Null when none is configured.", +); + +/** + * Detailed agent projection returned by agent detail-style endpoints such + * + * @remarks + * as `GET /agents/{agentKey}`. + */ +export type Agent = { + _id: string; + _key: string; + _rev?: string | undefined; + name: string; + description?: string | undefined; + systemPrompt?: string | undefined; + createdBy: string; + startMessage?: string | undefined; + instructions?: string | null | undefined; + models: Array; + toolsets: Array; + knowledge: Array; + shareWithOrg: boolean; + webSearch?: AgentWebSearch | null | undefined; + tags: Array; + createdAtTimestamp: number; + updatedAtTimestamp: number; + updatedBy?: string | null | undefined; + isActive: boolean; + isDeleted: boolean; + isServiceAccount: boolean; + access_type: string; + user_role: string; + can_view: boolean; + can_share: boolean; + can_edit: boolean; + can_delete: boolean; +}; + +export const Agent$zodSchema: z.ZodType = z.object({ + _id: z.string(), + _key: z.string(), + _rev: z.string().optional(), + access_type: z.string(), + can_delete: z.boolean(), + can_edit: z.boolean(), + can_share: z.boolean(), + can_view: z.boolean(), + createdAtTimestamp: z.int(), + createdBy: z.string(), + description: z.string().optional(), + instructions: z.string().nullable().optional(), + isActive: z.boolean(), + isDeleted: z.boolean(), + isServiceAccount: z.boolean(), + knowledge: z.array(z.lazy(() => Knowledge$zodSchema)), + models: z.array(z.union([ + z.string(), + z.lazy(() => Model1$zodSchema), + ])), + name: z.string(), + shareWithOrg: z.boolean(), + startMessage: z.string().optional(), + systemPrompt: z.string().optional(), + tags: z.array(z.string()), + toolsets: z.array(z.lazy(() => Toolset$zodSchema)), + updatedAtTimestamp: z.int(), + updatedBy: z.string().nullable().optional(), + user_role: z.string(), + webSearch: z.lazy(() => AgentWebSearch$zodSchema).nullable().optional(), +}).describe( + "Detailed agent projection returned by agent detail-style endpoints such\nas `GET /agents/{agentKey}`.\n", +); diff --git a/src/models/agentarchivedconversationgroup.ts b/src/models/agentarchivedconversationgroup.ts new file mode 100644 index 00000000..a6a2106c --- /dev/null +++ b/src/models/agentarchivedconversationgroup.ts @@ -0,0 +1,35 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AgentConversationListItem, + AgentConversationListItem$zodSchema, +} from "./agentconversationlistitem.js"; +import { + SemanticSearchHistoryPagination, + SemanticSearchHistoryPagination$zodSchema, +} from "./semanticsearchhistorypagination.js"; + +/** + * Archived conversations for a single agent, sliced to the first page + * + * @remarks + * of the per-agent archive query (limit 5, sorted newest first). + */ +export type AgentArchivedConversationGroup = { + agentKey: string; + conversations: Array; + pagination: SemanticSearchHistoryPagination; +}; + +export const AgentArchivedConversationGroup$zodSchema: z.ZodType< + AgentArchivedConversationGroup +> = z.object({ + agentKey: z.string(), + conversations: z.array(AgentConversationListItem$zodSchema), + pagination: SemanticSearchHistoryPagination$zodSchema, +}).describe( + "Archived conversations for a single agent, sliced to the first page\nof the per-agent archive query (limit 5, sorted newest first).\n", +); diff --git a/src/models/agentarchivedconversationlistresponse.ts b/src/models/agentarchivedconversationlistresponse.ts new file mode 100644 index 00000000..7109f0ee --- /dev/null +++ b/src/models/agentarchivedconversationlistresponse.ts @@ -0,0 +1,50 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AgentArchivedConversationSummary, + AgentArchivedConversationSummary$zodSchema, +} from "./agentarchivedconversationsummary.js"; +import { + AgentConversationListItem, + AgentConversationListItem$zodSchema, +} from "./agentconversationlistitem.js"; +import { + SemanticSearchHistoryFilters, + SemanticSearchHistoryFilters$zodSchema, +} from "./semanticsearchhistoryfilters.js"; +import { + SemanticSearchHistoryMeta, + SemanticSearchHistoryMeta$zodSchema, +} from "./semanticsearchhistorymeta.js"; +import { + SemanticSearchHistoryPagination, + SemanticSearchHistoryPagination$zodSchema, +} from "./semanticsearchhistorypagination.js"; + +/** + * Envelope returned by `GET /agents/{agentKey}/conversations/show/archives`. + * + * @remarks + */ +export type AgentArchivedConversationListResponse = { + conversations: Array; + pagination: SemanticSearchHistoryPagination; + filters: SemanticSearchHistoryFilters; + summary: AgentArchivedConversationSummary; + meta: SemanticSearchHistoryMeta; +}; + +export const AgentArchivedConversationListResponse$zodSchema: z.ZodType< + AgentArchivedConversationListResponse +> = z.object({ + conversations: z.array(AgentConversationListItem$zodSchema), + filters: SemanticSearchHistoryFilters$zodSchema, + meta: SemanticSearchHistoryMeta$zodSchema, + pagination: SemanticSearchHistoryPagination$zodSchema, + summary: AgentArchivedConversationSummary$zodSchema, +}).describe( + "Envelope returned by `GET /agents/{agentKey}/conversations/show/archives`.\n", +); diff --git a/src/models/agentarchivedconversationsummary.ts b/src/models/agentarchivedconversationsummary.ts new file mode 100644 index 00000000..b9880736 --- /dev/null +++ b/src/models/agentarchivedconversationsummary.ts @@ -0,0 +1,27 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Archive counts and bounds for the current result page returned by + * + * @remarks + * `GET /agents/{agentKey}/conversations/show/archives`. + */ +export type AgentArchivedConversationSummary = { + totalArchived?: number | undefined; + oldestArchive?: string | undefined; + newestArchive?: string | undefined; +}; + +export const AgentArchivedConversationSummary$zodSchema: z.ZodType< + AgentArchivedConversationSummary +> = z.object({ + newestArchive: z.iso.datetime({ offset: true }).optional(), + oldestArchive: z.iso.datetime({ offset: true }).optional(), + totalArchived: z.int().optional(), +}).describe( + "Archive counts and bounds for the current result page returned by\n`GET /agents/{agentKey}/conversations/show/archives`.\n", +); diff --git a/src/models/agentarchivedgroupsresponse.ts b/src/models/agentarchivedgroupsresponse.ts new file mode 100644 index 00000000..fea0ca22 --- /dev/null +++ b/src/models/agentarchivedgroupsresponse.ts @@ -0,0 +1,37 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AgentArchivedConversationGroup, + AgentArchivedConversationGroup$zodSchema, +} from "./agentarchivedconversationgroup.js"; +import { RequestMeta, RequestMeta$zodSchema } from "./requestmeta.js"; +import { + SemanticSearchHistoryPagination, + SemanticSearchHistoryPagination$zodSchema, +} from "./semanticsearchhistorypagination.js"; + +/** + * Response from `GET /agents/conversations/show/archives` — archived agent + * + * @remarks + * conversations grouped by `agentKey`, with agent-level pagination over + * the groups and a fixed slice of conversations under each agent. + */ +export type AgentArchivedGroupsResponse = { + groups: Array; + agentPagination: SemanticSearchHistoryPagination; + meta: RequestMeta; +}; + +export const AgentArchivedGroupsResponse$zodSchema: z.ZodType< + AgentArchivedGroupsResponse +> = z.object({ + agentPagination: SemanticSearchHistoryPagination$zodSchema, + groups: z.array(AgentArchivedConversationGroup$zodSchema), + meta: RequestMeta$zodSchema, +}).describe( + "Response from `GET /agents/conversations/show/archives` — archived agent\nconversations grouped by `agentKey`, with agent-level pagination over\nthe groups and a fixed slice of conversations under each agent.\n", +); diff --git a/src/models/agentconversationarchivemeta.ts b/src/models/agentconversationarchivemeta.ts new file mode 100644 index 00000000..4ed68fb3 --- /dev/null +++ b/src/models/agentconversationarchivemeta.ts @@ -0,0 +1,27 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Request-scoped metadata returned by the archive route. `requestId` is + * + * @remarks + * omitted when upstream middleware did not attach one. + */ +export type AgentConversationArchiveMeta = { + requestId?: string | undefined; + timestamp: string; + duration: number; +}; + +export const AgentConversationArchiveMeta$zodSchema: z.ZodType< + AgentConversationArchiveMeta +> = z.object({ + duration: z.int(), + requestId: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }), +}).describe( + "Request-scoped metadata returned by the archive route. `requestId` is\nomitted when upstream middleware did not attach one.\n", +); diff --git a/src/models/agentconversationarchiveresponse.ts b/src/models/agentconversationarchiveresponse.ts new file mode 100644 index 00000000..16f619e8 --- /dev/null +++ b/src/models/agentconversationarchiveresponse.ts @@ -0,0 +1,46 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + AgentConversationArchiveMeta, + AgentConversationArchiveMeta$zodSchema, +} from "./agentconversationarchivemeta.js"; + +export const AgentConversationArchiveResponseStatus = { + Archived: "archived", +} as const; +export type AgentConversationArchiveResponseStatus = ClosedEnum< + typeof AgentConversationArchiveResponseStatus +>; + +export const AgentConversationArchiveResponseStatus$zodSchema = z.enum([ + "archived", +]); + +/** + * Envelope returned by `POST /agents/{agentKey}/conversations/{conversationId}/archive`. + * + * @remarks + */ +export type AgentConversationArchiveResponse = { + id: string; + status: AgentConversationArchiveResponseStatus; + archivedBy: string; + archivedAt: string; + meta: AgentConversationArchiveMeta; +}; + +export const AgentConversationArchiveResponse$zodSchema: z.ZodType< + AgentConversationArchiveResponse +> = z.object({ + archivedAt: z.iso.datetime({ offset: true }), + archivedBy: z.string(), + id: z.string(), + meta: AgentConversationArchiveMeta$zodSchema, + status: AgentConversationArchiveResponseStatus$zodSchema, +}).describe( + "Envelope returned by `POST /agents/{agentKey}/conversations/{conversationId}/archive`.\n", +); diff --git a/src/models/agentconversationdeleteresponse.ts b/src/models/agentconversationdeleteresponse.ts new file mode 100644 index 00000000..fc989792 --- /dev/null +++ b/src/models/agentconversationdeleteresponse.ts @@ -0,0 +1,41 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + StoredAgentConversation, + StoredAgentConversation$zodSchema, +} from "./storedagentconversation.js"; + +export const MessageEnum = { + ConversationDeletedSuccessfully: "Conversation deleted successfully", +} as const; +export type MessageEnum = ClosedEnum; + +export const MessageEnum$zodSchema = z.enum([ + "Conversation deleted successfully", +]); + +/** + * Envelope returned by `DELETE /agents/{agentKey}/conversations/{conversationId}`. + * + * @remarks + * When the conversation does not exist, belongs to a different agent, or + * was already deleted, the API still returns HTTP 200 with + * `conversation: null`. + */ +export type AgentConversationDeleteResponse = { + message: MessageEnum; + conversation: StoredAgentConversation; +}; + +export const AgentConversationDeleteResponse$zodSchema: z.ZodType< + AgentConversationDeleteResponse +> = z.object({ + conversation: StoredAgentConversation$zodSchema, + message: MessageEnum$zodSchema, +}).describe( + "Envelope returned by `DELETE /agents/{agentKey}/conversations/{conversationId}`.\nWhen the conversation does not exist, belongs to a different agent, or\nwas already deleted, the API still returns HTTP 200 with\n`conversation: null`.\n", +); diff --git a/src/models/agentconversationdetail.ts b/src/models/agentconversationdetail.ts new file mode 100644 index 00000000..79cf6dc9 --- /dev/null +++ b/src/models/agentconversationdetail.ts @@ -0,0 +1,108 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + AgentConversationDetailAccess, + AgentConversationDetailAccess$zodSchema, +} from "./agentconversationdetailaccess.js"; +import { + AgentConversationDetailMessage, + AgentConversationDetailMessage$zodSchema, +} from "./agentconversationdetailmessage.js"; +import { + AgentConversationDetailPagination, + AgentConversationDetailPagination$zodSchema, +} from "./agentconversationdetailpagination.js"; +import { + ConversationModelInfo, + ConversationModelInfo$zodSchema, +} from "./conversationmodelinfo.js"; + +export const AgentConversationDetailAccessLevel = { + Read: "read", + Write: "write", +} as const; +export type AgentConversationDetailAccessLevel = ClosedEnum< + typeof AgentConversationDetailAccessLevel +>; + +export const AgentConversationDetailAccessLevel$zodSchema = z.enum([ + "read", + "write", +]); + +export type AgentConversationDetailSharedWith = { + userId?: string | undefined; + accessLevel?: AgentConversationDetailAccessLevel | undefined; +}; + +export const AgentConversationDetailSharedWith$zodSchema: z.ZodType< + AgentConversationDetailSharedWith +> = z.object({ + accessLevel: AgentConversationDetailAccessLevel$zodSchema.optional(), + userId: z.string().optional(), +}); + +export const AgentConversationDetailStatus = { + None: "None", + Inprogress: "Inprogress", + Complete: "Complete", + Failed: "Failed", +} as const; +export type AgentConversationDetailStatus = ClosedEnum< + typeof AgentConversationDetailStatus +>; + +export const AgentConversationDetailStatus$zodSchema = z.enum([ + "None", + "Inprogress", + "Complete", + "Failed", +]); + +/** + * Reduced conversation view returned by the by-id GET route. This is + * + * @remarks + * not the raw `AgentConversation` document shape: fields like `agentKey`, + * `userId`, `orgId`, `conversationSource`, and root-level `messages` + * metadata outside the selected slice are omitted. + */ +export type AgentConversationDetail = { + id: string; + title?: string | undefined; + initiator?: string | undefined; + createdAt: string; + isShared: boolean; + sharedWith: Array; + status?: AgentConversationDetailStatus | undefined; + failReason?: string | undefined; + messages: Array; + modelInfo?: ConversationModelInfo | undefined; + pagination: AgentConversationDetailPagination; + access: AgentConversationDetailAccess; +}; + +export const AgentConversationDetail$zodSchema: z.ZodType< + AgentConversationDetail +> = z.object({ + access: AgentConversationDetailAccess$zodSchema, + createdAt: z.iso.datetime({ offset: true }), + failReason: z.string().optional(), + id: z.string(), + initiator: z.string().optional(), + isShared: z.boolean(), + messages: z.array(AgentConversationDetailMessage$zodSchema), + modelInfo: ConversationModelInfo$zodSchema.optional(), + pagination: AgentConversationDetailPagination$zodSchema, + sharedWith: z.array( + z.lazy(() => AgentConversationDetailSharedWith$zodSchema), + ), + status: AgentConversationDetailStatus$zodSchema.optional(), + title: z.string().optional(), +}).describe( + "Reduced conversation view returned by the by-id GET route. This is\nnot the raw `AgentConversation` document shape: fields like `agentKey`,\n`userId`, `orgId`, `conversationSource`, and root-level `messages`\nmetadata outside the selected slice are omitted.\n", +); diff --git a/src/models/agentconversationdetailaccess.ts b/src/models/agentconversationdetailaccess.ts new file mode 100644 index 00000000..16e4e229 --- /dev/null +++ b/src/models/agentconversationdetailaccess.ts @@ -0,0 +1,31 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +export const AgentConversationDetailAccessAccessLevel = { + Read: "read", + Write: "write", +} as const; +export type AgentConversationDetailAccessAccessLevel = ClosedEnum< + typeof AgentConversationDetailAccessAccessLevel +>; + +export const AgentConversationDetailAccessAccessLevel$zodSchema = z.enum([ + "read", + "write", +]); + +export type AgentConversationDetailAccess = { + isOwner?: boolean | undefined; + accessLevel?: AgentConversationDetailAccessAccessLevel | undefined; +}; + +export const AgentConversationDetailAccess$zodSchema: z.ZodType< + AgentConversationDetailAccess +> = z.object({ + accessLevel: AgentConversationDetailAccessAccessLevel$zodSchema.optional(), + isOwner: z.boolean().optional(), +}); diff --git a/src/models/agentconversationdetailmessage.ts b/src/models/agentconversationdetailmessage.ts new file mode 100644 index 00000000..1688afdb --- /dev/null +++ b/src/models/agentconversationdetailmessage.ts @@ -0,0 +1,166 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + AgentConversationDetailMessageCitation, + AgentConversationDetailMessageCitation$zodSchema, +} from "./agentconversationdetailmessagecitation.js"; +import { AppliedFilters, AppliedFilters$zodSchema } from "./appliedfilters.js"; +import { + ChatAttachmentRef, + ChatAttachmentRef$zodSchema, +} from "./chatattachmentref.js"; +import { + ConversationModelInfo, + ConversationModelInfo$zodSchema, +} from "./conversationmodelinfo.js"; +import { + FollowUpQuestion, + FollowUpQuestion$zodSchema, +} from "./followupquestion.js"; +import { + MessageFeedback, + MessageFeedback$zodSchema, +} from "./messagefeedback.js"; + +export const AgentConversationDetailMessageMessageType = { + UserQuery: "user_query", + BotResponse: "bot_response", + Error: "error", + Feedback: "feedback", + System: "system", +} as const; +export type AgentConversationDetailMessageMessageType = ClosedEnum< + typeof AgentConversationDetailMessageMessageType +>; + +export const AgentConversationDetailMessageMessageType$zodSchema = z.enum([ + "user_query", + "bot_response", + "error", + "feedback", + "system", +]); + +export const AgentConversationDetailMessageContentFormat = { + Markdown: "MARKDOWN", + Json: "JSON", + Html: "HTML", +} as const; +export type AgentConversationDetailMessageContentFormat = ClosedEnum< + typeof AgentConversationDetailMessageContentFormat +>; + +export const AgentConversationDetailMessageContentFormat$zodSchema = z.enum([ + "MARKDOWN", + "JSON", + "HTML", +]); + +export const Confidence = { + VeryHigh: "Very High", + High: "High", + Medium: "Medium", + Low: "Low", + Unknown: "Unknown", +} as const; +export type Confidence = ClosedEnum; + +export const Confidence$zodSchema = z.enum([ + "Very High", + "High", + "Medium", + "Low", + "Unknown", +]); + +export type AgentConversationDetailMessageReferenceDatum = { + name?: string | undefined; + id?: string | undefined; + type?: string | undefined; + app?: string | undefined; + webUrl?: string | undefined; + metadata?: { [k: string]: string } | undefined; +}; + +export const AgentConversationDetailMessageReferenceDatum$zodSchema: z.ZodType< + AgentConversationDetailMessageReferenceDatum +> = z.object({ + app: z.string().optional(), + id: z.string().optional(), + metadata: z.record(z.string(), z.string()).optional(), + name: z.string().optional(), + type: z.string().optional(), + webUrl: z.string().optional(), +}); + +export type AgentConversationDetailMessageMetadata = { + processingTimeMs?: number | undefined; + modelVersion?: string | undefined; + aiTransactionId?: string | undefined; +}; + +export const AgentConversationDetailMessageMetadata$zodSchema: z.ZodType< + AgentConversationDetailMessageMetadata +> = z.object({ + aiTransactionId: z.string().optional(), + modelVersion: z.string().optional(), + processingTimeMs: z.number().optional(), +}); + +/** + * Message shape returned by `GET /agents/{agentKey}/conversations/{conversationId}`. + * + * @remarks + * The response spreads the stored message document and replaces + * `citations` with populated citation objects. + */ +export type AgentConversationDetailMessage = { + _id?: string | undefined; + messageType?: AgentConversationDetailMessageMessageType | undefined; + content?: string | undefined; + contentFormat?: AgentConversationDetailMessageContentFormat | undefined; + citations?: Array | undefined; + confidence?: Confidence | undefined; + followUpQuestions?: Array | undefined; + feedback?: Array | undefined; + referenceData?: + | Array + | undefined; + attachments?: Array | undefined; + modelInfo?: ConversationModelInfo | undefined; + appliedFilters?: AppliedFilters | undefined; + metadata?: AgentConversationDetailMessageMetadata | undefined; + createdAt?: string | undefined; + updatedAt?: string | undefined; +}; + +export const AgentConversationDetailMessage$zodSchema: z.ZodType< + AgentConversationDetailMessage +> = z.object({ + _id: z.string().optional(), + appliedFilters: AppliedFilters$zodSchema.optional(), + attachments: z.array(ChatAttachmentRef$zodSchema).optional(), + citations: z.array(AgentConversationDetailMessageCitation$zodSchema) + .optional(), + confidence: Confidence$zodSchema.optional(), + content: z.string().optional(), + contentFormat: AgentConversationDetailMessageContentFormat$zodSchema + .optional(), + createdAt: z.iso.datetime({ offset: true }).optional(), + feedback: z.array(MessageFeedback$zodSchema).optional(), + followUpQuestions: z.array(FollowUpQuestion$zodSchema).optional(), + messageType: AgentConversationDetailMessageMessageType$zodSchema.optional(), + metadata: z.lazy(() => AgentConversationDetailMessageMetadata$zodSchema) + .optional(), + modelInfo: ConversationModelInfo$zodSchema.optional(), + referenceData: z.array( + z.lazy(() => AgentConversationDetailMessageReferenceDatum$zodSchema), + ).optional(), + updatedAt: z.iso.datetime({ offset: true }).optional(), +}).describe( + "Message shape returned by `GET /agents/{agentKey}/conversations/{conversationId}`.\nThe response spreads the stored message document and replaces\n`citations` with populated citation objects.\n", +); diff --git a/src/models/agentconversationdetailmessagecitation.ts b/src/models/agentconversationdetailmessagecitation.ts new file mode 100644 index 00000000..502a3810 --- /dev/null +++ b/src/models/agentconversationdetailmessagecitation.ts @@ -0,0 +1,27 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { Citation, Citation$zodSchema } from "./citation.js"; + +/** + * Citation entry returned inside a conversation message after the + * + * @remarks + * handler populates `messages.citations.citationId` and rewrites each + * item to `{ citationId, citationData }`. + */ +export type AgentConversationDetailMessageCitation = { + citationId?: string | undefined; + citationData?: Citation | undefined; +}; + +export const AgentConversationDetailMessageCitation$zodSchema: z.ZodType< + AgentConversationDetailMessageCitation +> = z.object({ + citationData: Citation$zodSchema.optional(), + citationId: z.string().optional(), +}).describe( + "Citation entry returned inside a conversation message after the\nhandler populates `messages.citations.citationId` and rewrites each\nitem to `{ citationId, citationData }`.\n", +); diff --git a/src/models/agentconversationdetailmeta.ts b/src/models/agentconversationdetailmeta.ts new file mode 100644 index 00000000..7459911f --- /dev/null +++ b/src/models/agentconversationdetailmeta.ts @@ -0,0 +1,31 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Request-scoped metadata returned by the by-id GET route. `requestId` + * + * @remarks + * is omitted when upstream middleware did not attach one. + */ +export type AgentConversationDetailMeta = { + requestId?: string | undefined; + timestamp: string; + duration: number; + conversationId: string; + messageCount: number; +}; + +export const AgentConversationDetailMeta$zodSchema: z.ZodType< + AgentConversationDetailMeta +> = z.object({ + conversationId: z.string(), + duration: z.int(), + messageCount: z.int(), + requestId: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }), +}).describe( + "Request-scoped metadata returned by the by-id GET route. `requestId`\nis omitted when upstream middleware did not attach one.\n", +); diff --git a/src/models/agentconversationdetailpagination.ts b/src/models/agentconversationdetailpagination.ts new file mode 100644 index 00000000..e135a972 --- /dev/null +++ b/src/models/agentconversationdetailpagination.ts @@ -0,0 +1,43 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export type MessageRange = { start: number; end: number }; + +export const MessageRange$zodSchema: z.ZodType = z.object({ + end: z.int(), + start: z.int(), +}); + +/** + * Message pagination returned inside the `conversation` object. The + * + * @remarks + * handler paginates backwards from the end of the stored message array, + * then sorts the selected page in memory before serialization. + */ +export type AgentConversationDetailPagination = { + page: number; + limit: number; + totalCount: number; + totalPages: number; + hasNextPage: boolean; + hasPrevPage: boolean; + messageRange: MessageRange; +}; + +export const AgentConversationDetailPagination$zodSchema: z.ZodType< + AgentConversationDetailPagination +> = z.object({ + hasNextPage: z.boolean(), + hasPrevPage: z.boolean(), + limit: z.int(), + messageRange: z.lazy(() => MessageRange$zodSchema), + page: z.int(), + totalCount: z.int(), + totalPages: z.int(), +}).describe( + "Message pagination returned inside the `conversation` object. The\nhandler paginates backwards from the end of the stored message array,\nthen sorts the selected page in memory before serialization.\n", +); diff --git a/src/models/agentconversationdetailresponse.ts b/src/models/agentconversationdetailresponse.ts new file mode 100644 index 00000000..32e24b69 --- /dev/null +++ b/src/models/agentconversationdetailresponse.ts @@ -0,0 +1,38 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AgentConversationDetail, + AgentConversationDetail$zodSchema, +} from "./agentconversationdetail.js"; +import { + AgentConversationDetailMeta, + AgentConversationDetailMeta$zodSchema, +} from "./agentconversationdetailmeta.js"; +import { + SemanticSearchHistoryFilters, + SemanticSearchHistoryFilters$zodSchema, +} from "./semanticsearchhistoryfilters.js"; + +/** + * Envelope returned by `GET /agents/{agentKey}/conversations/{conversationId}`. + * + * @remarks + */ +export type AgentConversationDetailResponse = { + conversation: AgentConversationDetail; + filters: SemanticSearchHistoryFilters; + meta: AgentConversationDetailMeta; +}; + +export const AgentConversationDetailResponse$zodSchema: z.ZodType< + AgentConversationDetailResponse +> = z.object({ + conversation: AgentConversationDetail$zodSchema, + filters: SemanticSearchHistoryFilters$zodSchema, + meta: AgentConversationDetailMeta$zodSchema, +}).describe( + "Envelope returned by `GET /agents/{agentKey}/conversations/{conversationId}`.\n", +); diff --git a/src/models/agentconversationlistitem.ts b/src/models/agentconversationlistitem.ts new file mode 100644 index 00000000..bf2b2ae1 --- /dev/null +++ b/src/models/agentconversationlistitem.ts @@ -0,0 +1,184 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + ConversationModelInfo, + ConversationModelInfo$zodSchema, +} from "./conversationmodelinfo.js"; + +export const AgentConversationListItemStatus = { + None: "None", + Inprogress: "Inprogress", + Complete: "Complete", + Failed: "Failed", +} as const; +export type AgentConversationListItemStatus = ClosedEnum< + typeof AgentConversationListItemStatus +>; + +export const AgentConversationListItemStatus$zodSchema = z.enum([ + "None", + "Inprogress", + "Complete", + "Failed", +]); + +export const AgentConversationListItemSharedWithAccessLevel = { + Read: "read", + Write: "write", +} as const; +export type AgentConversationListItemSharedWithAccessLevel = ClosedEnum< + typeof AgentConversationListItemSharedWithAccessLevel +>; + +export const AgentConversationListItemSharedWithAccessLevel$zodSchema = z.enum([ + "read", + "write", +]); + +export type AgentConversationListItemSharedWith = { + userId?: string | undefined; + accessLevel?: AgentConversationListItemSharedWithAccessLevel | undefined; +}; + +export const AgentConversationListItemSharedWith$zodSchema: z.ZodType< + AgentConversationListItemSharedWith +> = z.object({ + accessLevel: AgentConversationListItemSharedWithAccessLevel$zodSchema + .optional(), + userId: z.string().optional(), +}); + +export type AgentConversationListItemConversationError = { + message?: string | undefined; + errorType?: string | undefined; + timestamp?: string | undefined; + messageId?: string | undefined; + stack?: string | undefined; + metadata?: { [k: string]: any } | undefined; +}; + +export const AgentConversationListItemConversationError$zodSchema: z.ZodType< + AgentConversationListItemConversationError +> = z.object({ + errorType: z.string().optional(), + message: z.string().optional(), + messageId: z.string().optional(), + metadata: z.record(z.string(), z.any()).optional(), + stack: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }).optional(), +}); + +export const AgentConversationListItemConversationSource = { + AgentChat: "agent_chat", +} as const; +export type AgentConversationListItemConversationSource = ClosedEnum< + typeof AgentConversationListItemConversationSource +>; + +export const AgentConversationListItemConversationSource$zodSchema = z.enum([ + "agent_chat", +]); + +/** + * Computed per request from `sharedWith`; defaults to `read` when no + * + * @remarks + * explicit share grant is attached to the serialized row. + */ +export const AgentConversationListItemAccessLevel = { + Read: "read", + Write: "write", +} as const; +/** + * Computed per request from `sharedWith`; defaults to `read` when no + * + * @remarks + * explicit share grant is attached to the serialized row. + */ +export type AgentConversationListItemAccessLevel = ClosedEnum< + typeof AgentConversationListItemAccessLevel +>; + +export const AgentConversationListItemAccessLevel$zodSchema = z.enum([ + "read", + "write", +]).describe( + "Computed per request from `sharedWith`; defaults to `read` when no\nexplicit share grant is attached to the serialized row.\n", +); + +/** + * Conversation summary returned by `GET /agents/{agentKey}/conversations`. + * + * @remarks + * The handler excludes `messages` and `__v` from both result sets. Rows + * in `sharedWithMeConversations` also omit `sharedWith` because the + * secondary query explicitly deselects that field before serialization. + */ +export type AgentConversationListItem = { + _id?: string | undefined; + agentKey?: string | undefined; + userId?: string | undefined; + orgId?: string | undefined; + title?: string | undefined; + initiator?: string | undefined; + status?: AgentConversationListItemStatus | undefined; + failReason?: string | undefined; + modelInfo?: ConversationModelInfo | undefined; + isShared?: boolean | undefined; + shareLink?: string | undefined; + sharedWith?: Array | undefined; + isArchived?: boolean | undefined; + archivedBy?: string | null | undefined; + archivedAt?: string | undefined; + isDeleted?: boolean | undefined; + deletedBy?: string | null | undefined; + conversationErrors?: + | Array + | undefined; + conversationSource?: AgentConversationListItemConversationSource | undefined; + lastActivityAt?: number | undefined; + createdAt?: string | undefined; + updatedAt?: string | undefined; + isOwner?: boolean | undefined; + accessLevel?: AgentConversationListItemAccessLevel | undefined; +}; + +export const AgentConversationListItem$zodSchema: z.ZodType< + AgentConversationListItem +> = z.object({ + _id: z.string().optional(), + accessLevel: AgentConversationListItemAccessLevel$zodSchema.optional(), + agentKey: z.string().optional(), + archivedAt: z.iso.datetime({ offset: true }).optional(), + archivedBy: z.string().nullable().optional(), + conversationErrors: z.array( + z.lazy(() => AgentConversationListItemConversationError$zodSchema), + ).optional(), + conversationSource: AgentConversationListItemConversationSource$zodSchema + .optional(), + createdAt: z.iso.datetime({ offset: true }).optional(), + deletedBy: z.string().nullable().optional(), + failReason: z.string().optional(), + initiator: z.string().optional(), + isArchived: z.boolean().optional(), + isDeleted: z.boolean().optional(), + isOwner: z.boolean().optional(), + isShared: z.boolean().optional(), + lastActivityAt: z.int().optional(), + modelInfo: ConversationModelInfo$zodSchema.optional(), + orgId: z.string().optional(), + shareLink: z.string().optional(), + sharedWith: z.array( + z.lazy(() => AgentConversationListItemSharedWith$zodSchema), + ).optional(), + status: AgentConversationListItemStatus$zodSchema.optional(), + title: z.string().optional(), + updatedAt: z.iso.datetime({ offset: true }).optional(), + userId: z.string().optional(), +}).describe( + "Conversation summary returned by `GET /agents/{agentKey}/conversations`.\nThe handler excludes `messages` and `__v` from both result sets. Rows\nin `sharedWithMeConversations` also omit `sharedWith` because the\nsecondary query explicitly deselects that field before serialization.\n", +); diff --git a/src/models/agentconversationlistresponse.ts b/src/models/agentconversationlistresponse.ts new file mode 100644 index 00000000..62c9cc07 --- /dev/null +++ b/src/models/agentconversationlistresponse.ts @@ -0,0 +1,51 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AgentConversationListItem, + AgentConversationListItem$zodSchema, +} from "./agentconversationlistitem.js"; +import { + SemanticSearchHistoryFilters, + SemanticSearchHistoryFilters$zodSchema, +} from "./semanticsearchhistoryfilters.js"; +import { + SemanticSearchHistoryMeta, + SemanticSearchHistoryMeta$zodSchema, +} from "./semanticsearchhistorymeta.js"; +import { + SemanticSearchHistoryPagination, + SemanticSearchHistoryPagination$zodSchema, +} from "./semanticsearchhistorypagination.js"; + +/** + * Envelope returned by `GET /agents/{agentKey}/conversations`. + * + * @remarks + * `conversations` contains rows owned by the caller for the agent; + * `sharedWithMeConversations` contains rows shared with the caller for + * the same agent. Both arrays use the same pagination and sort inputs, + * but `pagination.totalCount` and `totalPages` are computed only from + * `conversations` because the handler counts the owned-query filter only. + */ +export type AgentConversationListResponse = { + conversations: Array; + sharedWithMeConversations: Array; + pagination: SemanticSearchHistoryPagination; + filters: SemanticSearchHistoryFilters; + meta: SemanticSearchHistoryMeta; +}; + +export const AgentConversationListResponse$zodSchema: z.ZodType< + AgentConversationListResponse +> = z.object({ + conversations: z.array(AgentConversationListItem$zodSchema), + filters: SemanticSearchHistoryFilters$zodSchema, + meta: SemanticSearchHistoryMeta$zodSchema, + pagination: SemanticSearchHistoryPagination$zodSchema, + sharedWithMeConversations: z.array(AgentConversationListItem$zodSchema), +}).describe( + "Envelope returned by `GET /agents/{agentKey}/conversations`.\n`conversations` contains rows owned by the caller for the agent;\n`sharedWithMeConversations` contains rows shared with the caller for\nthe same agent. Both arrays use the same pagination and sort inputs,\nbut `pagination.totalCount` and `totalPages` are computed only from\n`conversations` because the handler counts the owned-query filter only.\n", +); diff --git a/src/models/agentconversationtitleupdateresponse.ts b/src/models/agentconversationtitleupdateresponse.ts new file mode 100644 index 00000000..b1821cac --- /dev/null +++ b/src/models/agentconversationtitleupdateresponse.ts @@ -0,0 +1,22 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { RequestMeta, RequestMeta$zodSchema } from "./requestmeta.js"; +import { + StoredAgentConversation, + StoredAgentConversation$zodSchema, +} from "./storedagentconversation.js"; + +export type AgentConversationTitleUpdateResponse = { + conversation: StoredAgentConversation; + meta: RequestMeta; +}; + +export const AgentConversationTitleUpdateResponse$zodSchema: z.ZodType< + AgentConversationTitleUpdateResponse +> = z.object({ + conversation: StoredAgentConversation$zodSchema, + meta: RequestMeta$zodSchema, +}); diff --git a/src/models/agentconversationunarchivemeta.ts b/src/models/agentconversationunarchivemeta.ts new file mode 100644 index 00000000..3cbc6ace --- /dev/null +++ b/src/models/agentconversationunarchivemeta.ts @@ -0,0 +1,27 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Request-scoped metadata returned by the unarchive route. `requestId` is + * + * @remarks + * omitted when upstream middleware did not attach one. + */ +export type AgentConversationUnarchiveMeta = { + requestId?: string | undefined; + timestamp: string; + duration: number; +}; + +export const AgentConversationUnarchiveMeta$zodSchema: z.ZodType< + AgentConversationUnarchiveMeta +> = z.object({ + duration: z.int(), + requestId: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }), +}).describe( + "Request-scoped metadata returned by the unarchive route. `requestId` is\nomitted when upstream middleware did not attach one.\n", +); diff --git a/src/models/agentconversationunarchiveresponse.ts b/src/models/agentconversationunarchiveresponse.ts new file mode 100644 index 00000000..45be71d3 --- /dev/null +++ b/src/models/agentconversationunarchiveresponse.ts @@ -0,0 +1,46 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + AgentConversationUnarchiveMeta, + AgentConversationUnarchiveMeta$zodSchema, +} from "./agentconversationunarchivemeta.js"; + +export const AgentConversationUnarchiveResponseStatus = { + Unarchived: "unarchived", +} as const; +export type AgentConversationUnarchiveResponseStatus = ClosedEnum< + typeof AgentConversationUnarchiveResponseStatus +>; + +export const AgentConversationUnarchiveResponseStatus$zodSchema = z.enum([ + "unarchived", +]); + +/** + * Envelope returned by `POST /agents/{agentKey}/conversations/{conversationId}/unarchive`. + * + * @remarks + */ +export type AgentConversationUnarchiveResponse = { + id: string; + status: AgentConversationUnarchiveResponseStatus; + unarchivedBy: string; + unarchivedAt: string; + meta: AgentConversationUnarchiveMeta; +}; + +export const AgentConversationUnarchiveResponse$zodSchema: z.ZodType< + AgentConversationUnarchiveResponse +> = z.object({ + id: z.string(), + meta: AgentConversationUnarchiveMeta$zodSchema, + status: AgentConversationUnarchiveResponseStatus$zodSchema, + unarchivedAt: z.iso.datetime({ offset: true }), + unarchivedBy: z.string(), +}).describe( + "Envelope returned by `POST /agents/{agentKey}/conversations/{conversationId}/unarchive`.\n", +); diff --git a/src/models/agentcreateknowledge.ts b/src/models/agentcreateknowledge.ts new file mode 100644 index 00000000..353478bd --- /dev/null +++ b/src/models/agentcreateknowledge.ts @@ -0,0 +1,37 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AgentKnowledgeFiltersParsed, + AgentKnowledgeFiltersParsed$zodSchema, +} from "./agentknowledgefiltersparsed.js"; + +export type AgentCreateKnowledgeFilters = + | AgentKnowledgeFiltersParsed + | string + | Array; + +export const AgentCreateKnowledgeFilters$zodSchema: z.ZodType< + AgentCreateKnowledgeFilters +> = z.union([ + AgentKnowledgeFiltersParsed$zodSchema, + z.string(), + z.array(z.any()), +]); + +export type AgentCreateKnowledge = { + connectorId: string; + filters?: AgentKnowledgeFiltersParsed | string | Array | undefined; +}; + +export const AgentCreateKnowledge$zodSchema: z.ZodType = z + .object({ + connectorId: z.string(), + filters: z.union([ + AgentKnowledgeFiltersParsed$zodSchema, + z.string(), + z.array(z.any()), + ]).optional(), + }); diff --git a/src/models/agentcreatemodelentryunion.ts b/src/models/agentcreatemodelentryunion.ts new file mode 100644 index 00000000..2497da72 --- /dev/null +++ b/src/models/agentcreatemodelentryunion.ts @@ -0,0 +1,41 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export type AgentCreateModelEntry = { + modelKey: string; + modelName?: string | undefined; + provider?: string | undefined; + isReasoning?: boolean | undefined; +}; + +export const AgentCreateModelEntry$zodSchema: z.ZodType = + z.object({ + isReasoning: z.boolean().optional(), + modelKey: z.string(), + modelName: z.string().optional(), + provider: z.string().optional(), + }); + +/** + * Accepted model entry for `POST /agents/create`. + * + * @remarks + * The gateway accepts either a non-empty string model entry or an object entry + * with a required `modelKey`. + * + * The `models` array must include at least one object entry with `isReasoning: true`. + * String-only entries are schema-valid but are rejected at the gateway with HTTP 400. + */ +export type AgentCreateModelEntryUnion = AgentCreateModelEntry | string; + +export const AgentCreateModelEntryUnion$zodSchema: z.ZodType< + AgentCreateModelEntryUnion +> = z.union([ + z.lazy(() => AgentCreateModelEntry$zodSchema), + z.string(), +]).describe( + "Accepted model entry for `POST /agents/create`.\nThe gateway accepts either a non-empty string model entry or an object entry\nwith a required `modelKey`.\n\nThe `models` array must include at least one object entry with `isReasoning: true`.\nString-only entries are schema-valid but are rejected at the gateway with HTTP 400.\n", +); diff --git a/src/models/agentcreaterequest.ts b/src/models/agentcreaterequest.ts new file mode 100644 index 00000000..d9aa4340 --- /dev/null +++ b/src/models/agentcreaterequest.ts @@ -0,0 +1,52 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AgentCreateKnowledge, + AgentCreateKnowledge$zodSchema, +} from "./agentcreateknowledge.js"; +import { + AgentCreateModelEntryUnion, + AgentCreateModelEntryUnion$zodSchema, +} from "./agentcreatemodelentryunion.js"; +import { + AgentCreateToolset, + AgentCreateToolset$zodSchema, +} from "./agentcreatetoolset.js"; +import { + AgentCreateWebSearchUnion, + AgentCreateWebSearchUnion$zodSchema, +} from "./agentcreatewebsearchunion.js"; + +export type AgentCreateRequest = { + name: string; + description?: string | undefined; + startMessage?: string | undefined; + systemPrompt?: string | undefined; + instructions?: string | undefined; + models: Array; + tags?: Array | undefined; + shareWithOrg?: boolean | undefined; + isServiceAccount?: boolean | undefined; + toolsets?: Array | undefined; + knowledge?: Array | undefined; + webSearch?: AgentCreateWebSearchUnion | null | undefined; +}; + +export const AgentCreateRequest$zodSchema: z.ZodType = z + .object({ + description: z.string().optional(), + instructions: z.string().optional(), + isServiceAccount: z.boolean().default(false), + knowledge: z.array(AgentCreateKnowledge$zodSchema).optional(), + models: z.array(AgentCreateModelEntryUnion$zodSchema), + name: z.string(), + shareWithOrg: z.boolean().default(false), + startMessage: z.string().optional(), + systemPrompt: z.string().optional(), + tags: z.array(z.string()).optional(), + toolsets: z.array(AgentCreateToolset$zodSchema).optional(), + webSearch: AgentCreateWebSearchUnion$zodSchema.nullable().optional(), + }); diff --git a/src/models/agentcreateresponse.ts b/src/models/agentcreateresponse.ts new file mode 100644 index 00000000..abb608f7 --- /dev/null +++ b/src/models/agentcreateresponse.ts @@ -0,0 +1,42 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + AgentCreateResponseAgent, + AgentCreateResponseAgent$zodSchema, +} from "./agentcreateresponseagent.js"; +import { + AgentCreateWarning, + AgentCreateWarning$zodSchema, +} from "./agentcreatewarning.js"; + +export const AgentCreateResponseStatus = { + Success: "success", + PartialSuccess: "partial_success", +} as const; +export type AgentCreateResponseStatus = ClosedEnum< + typeof AgentCreateResponseStatus +>; + +export const AgentCreateResponseStatus$zodSchema = z.enum([ + "success", + "partial_success", +]); + +export type AgentCreateResponse = { + status: AgentCreateResponseStatus; + message: string; + agent: AgentCreateResponseAgent; + warnings?: Array | null | undefined; +}; + +export const AgentCreateResponse$zodSchema: z.ZodType = z + .object({ + agent: AgentCreateResponseAgent$zodSchema, + message: z.string(), + status: AgentCreateResponseStatus$zodSchema, + warnings: z.array(AgentCreateWarning$zodSchema).nullable().optional(), + }); diff --git a/src/models/agentcreateresponseagent.ts b/src/models/agentcreateresponseagent.ts new file mode 100644 index 00000000..c11680bc --- /dev/null +++ b/src/models/agentcreateresponseagent.ts @@ -0,0 +1,72 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AgentCreateResponseKnowledge, + AgentCreateResponseKnowledge$zodSchema, +} from "./agentcreateresponseknowledge.js"; +import { + AgentCreateResponseToolset, + AgentCreateResponseToolset$zodSchema, +} from "./agentcreateresponsetoolset.js"; + +export type AgentCreateResponseAgentWebSearch = { + provider?: string | undefined; + providerKey?: string | undefined; + providerLabel?: string | undefined; +}; + +export const AgentCreateResponseAgentWebSearch$zodSchema: z.ZodType< + AgentCreateResponseAgentWebSearch +> = z.object({ + provider: z.string().optional(), + providerKey: z.string().optional(), + providerLabel: z.string().optional(), +}); + +export type AgentCreateResponseAgent = { + _key: string; + name: string; + description: string; + startMessage: string; + systemPrompt: string; + instructions: string | null; + models: Array; + tags: Array; + webSearch: AgentCreateResponseAgentWebSearch | null; + isActive: boolean; + isServiceAccount: boolean; + createdBy: string; + updatedBy: string | null; + createdAtTimestamp: number; + updatedAtTimestamp: number; + isDeleted: boolean; + toolsets: Array; + knowledge: Array; +}; + +export const AgentCreateResponseAgent$zodSchema: z.ZodType< + AgentCreateResponseAgent +> = z.object({ + _key: z.string(), + createdAtTimestamp: z.int(), + createdBy: z.string(), + description: z.string(), + instructions: z.string().nullable(), + isActive: z.boolean(), + isDeleted: z.boolean(), + isServiceAccount: z.boolean(), + knowledge: z.array(AgentCreateResponseKnowledge$zodSchema), + models: z.array(z.string()), + name: z.string(), + startMessage: z.string(), + systemPrompt: z.string(), + tags: z.array(z.string()), + toolsets: z.array(AgentCreateResponseToolset$zodSchema), + updatedAtTimestamp: z.int(), + updatedBy: z.string().nullable(), + webSearch: z.lazy(() => AgentCreateResponseAgentWebSearch$zodSchema) + .nullable(), +}); diff --git a/src/models/agentcreateresponseknowledge.ts b/src/models/agentcreateresponseknowledge.ts new file mode 100644 index 00000000..c924729c --- /dev/null +++ b/src/models/agentcreateresponseknowledge.ts @@ -0,0 +1,36 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export type AgentCreateResponseKnowledgeFilters = + | { [k: string]: any } + | string + | Array; + +export const AgentCreateResponseKnowledgeFilters$zodSchema: z.ZodType< + AgentCreateResponseKnowledgeFilters +> = z.union([ + z.record(z.string(), z.any()), + z.string(), + z.array(z.any()), +]); + +export type AgentCreateResponseKnowledge = { + connectorId: string; + key: string; + filters: { [k: string]: any } | string | Array; +}; + +export const AgentCreateResponseKnowledge$zodSchema: z.ZodType< + AgentCreateResponseKnowledge +> = z.object({ + connectorId: z.string(), + filters: z.union([ + z.record(z.string(), z.any()), + z.string(), + z.array(z.any()), + ]), + key: z.string(), +}); diff --git a/src/models/agentcreateresponsetool.ts b/src/models/agentcreateresponsetool.ts new file mode 100644 index 00000000..7b90ff67 --- /dev/null +++ b/src/models/agentcreateresponsetool.ts @@ -0,0 +1,19 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export type AgentCreateResponseTool = { + name: string; + fullName: string; + key: string; +}; + +export const AgentCreateResponseTool$zodSchema: z.ZodType< + AgentCreateResponseTool +> = z.object({ + fullName: z.string(), + key: z.string(), + name: z.string(), +}); diff --git a/src/models/agentcreateresponsetoolset.ts b/src/models/agentcreateresponsetoolset.ts new file mode 100644 index 00000000..c82427ab --- /dev/null +++ b/src/models/agentcreateresponsetoolset.ts @@ -0,0 +1,29 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AgentCreateResponseTool, + AgentCreateResponseTool$zodSchema, +} from "./agentcreateresponsetool.js"; +import { + AgentCreateToolsetName, + AgentCreateToolsetName$zodSchema, +} from "./agentcreatetoolsetname.js"; + +export type AgentCreateResponseToolset = { + name: AgentCreateToolsetName; + displayName: string; + key: string; + tools: Array; +}; + +export const AgentCreateResponseToolset$zodSchema: z.ZodType< + AgentCreateResponseToolset +> = z.object({ + displayName: z.string(), + key: z.string(), + name: AgentCreateToolsetName$zodSchema, + tools: z.array(AgentCreateResponseTool$zodSchema), +}); diff --git a/src/models/agentcreatetoolref.ts b/src/models/agentcreatetoolref.ts new file mode 100644 index 00000000..6224e1a6 --- /dev/null +++ b/src/models/agentcreatetoolref.ts @@ -0,0 +1,18 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export type AgentCreateToolRef = { + name: string; + fullName?: string | undefined; + description?: string | undefined; +}; + +export const AgentCreateToolRef$zodSchema: z.ZodType = z + .object({ + description: z.string().optional(), + fullName: z.string().optional(), + name: z.string(), + }); diff --git a/src/models/agentcreatetoolset.ts b/src/models/agentcreatetoolset.ts new file mode 100644 index 00000000..75f47159 --- /dev/null +++ b/src/models/agentcreatetoolset.ts @@ -0,0 +1,32 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AgentCreateToolRef, + AgentCreateToolRef$zodSchema, +} from "./agentcreatetoolref.js"; +import { + AgentCreateToolsetName, + AgentCreateToolsetName$zodSchema, +} from "./agentcreatetoolsetname.js"; + +export type AgentCreateToolset = { + name: AgentCreateToolsetName; + displayName?: string | undefined; + type?: string | undefined; + instanceId?: string | undefined; + instanceName?: string | undefined; + tools?: Array | undefined; +}; + +export const AgentCreateToolset$zodSchema: z.ZodType = z + .object({ + displayName: z.string().optional(), + instanceId: z.string().optional(), + instanceName: z.string().optional(), + name: AgentCreateToolsetName$zodSchema, + tools: z.array(AgentCreateToolRef$zodSchema).optional(), + type: z.string().optional(), + }); diff --git a/src/models/agentcreatetoolsetname.ts b/src/models/agentcreatetoolsetname.ts new file mode 100644 index 00000000..1810b665 --- /dev/null +++ b/src/models/agentcreatetoolsetname.ts @@ -0,0 +1,55 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +/** + * Registered toolset name (lowercase) accepted by the create-agent gateway. + */ +export const AgentCreateToolsetName = { + Calendar: "calendar", + Clickup: "clickup", + Confluence: "confluence", + Drive: "drive", + Github: "github", + Gmail: "gmail", + Jira: "jira", + Lumos: "lumos", + Mariadb: "mariadb", + Onedrive: "onedrive", + Outlook: "outlook", + Redshift: "redshift", + Salesforce: "salesforce", + Sharepoint: "sharepoint", + Slack: "slack", + Teams: "teams", + Zoom: "zoom", +} as const; +/** + * Registered toolset name (lowercase) accepted by the create-agent gateway. + */ +export type AgentCreateToolsetName = ClosedEnum; + +export const AgentCreateToolsetName$zodSchema = z.enum([ + "calendar", + "clickup", + "confluence", + "drive", + "github", + "gmail", + "jira", + "lumos", + "mariadb", + "onedrive", + "outlook", + "redshift", + "salesforce", + "sharepoint", + "slack", + "teams", + "zoom", +]).describe( + "Registered toolset name (lowercase) accepted by the create-agent gateway.", +); diff --git a/src/models/agentcreatewarning.ts b/src/models/agentcreatewarning.ts new file mode 100644 index 00000000..d670c453 --- /dev/null +++ b/src/models/agentcreatewarning.ts @@ -0,0 +1,16 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export type AgentCreateWarning = { + name?: string | undefined; + error?: string | undefined; +}; + +export const AgentCreateWarning$zodSchema: z.ZodType = z + .object({ + error: z.string().optional(), + name: z.string().optional(), + }); diff --git a/src/models/agentcreatewebsearchunion.ts b/src/models/agentcreatewebsearchunion.ts new file mode 100644 index 00000000..5d740c93 --- /dev/null +++ b/src/models/agentcreatewebsearchunion.ts @@ -0,0 +1,38 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export type AgentCreateWebSearch = { + provider: string; + providerKey?: string | undefined; + providerLabel?: string | undefined; + iconPath?: string | undefined; +}; + +export const AgentCreateWebSearch$zodSchema: z.ZodType = z + .object({ + iconPath: z.string().optional(), + provider: z.string(), + providerKey: z.string().optional(), + providerLabel: z.string().optional(), + }); + +/** + * Accepted web-search attachment for `POST /agents/create`. + * + * @remarks + * The gateway accepts either a provider string or an object with at least + * a `provider` field. + */ +export type AgentCreateWebSearchUnion = AgentCreateWebSearch | string; + +export const AgentCreateWebSearchUnion$zodSchema: z.ZodType< + AgentCreateWebSearchUnion +> = z.union([ + z.lazy(() => AgentCreateWebSearch$zodSchema), + z.string(), +]).describe( + "Accepted web-search attachment for `POST /agents/create`.\nThe gateway accepts either a provider string or an object with at least\na `provider` field.\n", +); diff --git a/src/models/agentdeleteresponse.ts b/src/models/agentdeleteresponse.ts new file mode 100644 index 00000000..355113a6 --- /dev/null +++ b/src/models/agentdeleteresponse.ts @@ -0,0 +1,46 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +export const AgentDeleteResponseStatus = { + Success: "success", +} as const; +export type AgentDeleteResponseStatus = ClosedEnum< + typeof AgentDeleteResponseStatus +>; + +export const AgentDeleteResponseStatus$zodSchema = z.enum([ + "success", +]); + +export type Deleted = { + agents: number; + toolsets: number; + tools: number; + knowledge: number; + edges: number; +}; + +export const Deleted$zodSchema: z.ZodType = z.object({ + agents: z.int(), + edges: z.int(), + knowledge: z.int(), + tools: z.int(), + toolsets: z.int(), +}); + +export type AgentDeleteResponse = { + status: AgentDeleteResponseStatus; + message: string; + deleted: Deleted; +}; + +export const AgentDeleteResponse$zodSchema: z.ZodType = z + .object({ + deleted: z.lazy(() => Deleted$zodSchema), + message: z.string(), + status: AgentDeleteResponseStatus$zodSchema, + }); diff --git a/src/models/agentknowledgefiltersparsed.ts b/src/models/agentknowledgefiltersparsed.ts new file mode 100644 index 00000000..f6b121b0 --- /dev/null +++ b/src/models/agentknowledgefiltersparsed.ts @@ -0,0 +1,27 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Indexed scope for a knowledge connector: record-group ids (collections / + * + * @remarks + * KB roots) and individual record ids. First-party create/update flows set + * `recordGroups` and `records`. On GET, `filtersParsed` is this shape + * parsed from the stored `filters` JSON string. + */ +export type AgentKnowledgeFiltersParsed = { + recordGroups?: Array | undefined; + records?: Array | undefined; +}; + +export const AgentKnowledgeFiltersParsed$zodSchema: z.ZodType< + AgentKnowledgeFiltersParsed +> = z.object({ + recordGroups: z.array(z.string()).optional(), + records: z.array(z.string()).optional(), +}).describe( + "Indexed scope for a knowledge connector: record-group ids (collections /\nKB roots) and individual record ids. First-party create/update flows set\n`recordGroups` and `records`. On GET, `filtersParsed` is this shape\nparsed from the stored `filters` JSON string.\n", +); diff --git a/src/models/agentlistitem.ts b/src/models/agentlistitem.ts new file mode 100644 index 00000000..b953f7f4 --- /dev/null +++ b/src/models/agentlistitem.ts @@ -0,0 +1,99 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Web-search provider attachment for this agent, or `null` when none is attached. + * + * @remarks + * + * For `GET /agents`, the response formatter always emits `provider`. + * It may also emit `providerKey` and `providerLabel` when those values + * were present on the stored attachment. It does not emit `iconPath` + * on this response path. + */ +export type AgentListItemWebSearch = { + provider?: string | undefined; + providerKey?: string | undefined; + providerLabel?: string | undefined; +}; + +export const AgentListItemWebSearch$zodSchema: z.ZodType< + AgentListItemWebSearch +> = z.object({ + provider: z.string().optional(), + providerKey: z.string().optional(), + providerLabel: z.string().optional(), +}).describe( + "Web-search provider attachment for this agent, or `null` when none is attached.\n\nFor `GET /agents`, the response formatter always emits `provider`.\nIt may also emit `providerKey` and `providerLabel` when those values\nwere present on the stored attachment. It does not emit `iconPath`\non this response path.\n", +); + +/** + * Agent projection returned by `GET /agents`. + * + * @remarks + * + * This is the list-view envelope item emitted by the Python backend and + * forwarded by the Node gateway. It is not the full detail projection + * used by `GET /agents/{agentKey}`. + */ +export type AgentListItem = { + _id: string; + _key: string; + _rev?: string | undefined; + createdAtTimestamp: number; + createdBy: string; + description?: string | null | undefined; + instructions?: string | null | undefined; + isActive: boolean; + isDeleted: boolean; + isServiceAccount: boolean; + models: Array; + name: string; + startMessage?: string | null | undefined; + systemPrompt?: string | null | undefined; + tags: Array; + updatedAtTimestamp: number; + updatedBy?: string | null | undefined; + webSearch?: AgentListItemWebSearch | null | undefined; + shareWithOrg: boolean; + can_view: boolean; + can_share: boolean; + can_edit: boolean; + can_delete: boolean; + user_role: string; + access_type: string; +}; + +export const AgentListItem$zodSchema: z.ZodType = z.object({ + _id: z.string(), + _key: z.string(), + _rev: z.string().optional(), + access_type: z.string(), + can_delete: z.boolean(), + can_edit: z.boolean(), + can_share: z.boolean(), + can_view: z.boolean(), + createdAtTimestamp: z.int(), + createdBy: z.string(), + description: z.string().nullable().optional(), + instructions: z.string().nullable().optional(), + isActive: z.boolean(), + isDeleted: z.boolean(), + isServiceAccount: z.boolean(), + models: z.array(z.string()), + name: z.string(), + shareWithOrg: z.boolean(), + startMessage: z.string().nullable().optional(), + systemPrompt: z.string().nullable().optional(), + tags: z.array(z.string()), + updatedAtTimestamp: z.int(), + updatedBy: z.string().nullable().optional(), + user_role: z.string(), + webSearch: z.lazy(() => AgentListItemWebSearch$zodSchema).nullable() + .optional(), +}).describe( + "Agent projection returned by `GET /agents`.\n\nThis is the list-view envelope item emitted by the Python backend and\nforwarded by the Node gateway. It is not the full detail projection\nused by `GET /agents/{agentKey}`.\n", +); diff --git a/src/models/agentlistpagination.ts b/src/models/agentlistpagination.ts new file mode 100644 index 00000000..b4b9e5fe --- /dev/null +++ b/src/models/agentlistpagination.ts @@ -0,0 +1,27 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Pagination block returned by `GET /agents`. + */ +export type AgentListPagination = { + currentPage: number; + limit: number; + totalItems: number; + totalPages: number; + hasNext: boolean; + hasPrev: boolean; +}; + +export const AgentListPagination$zodSchema: z.ZodType = z + .object({ + currentPage: z.int(), + hasNext: z.boolean(), + hasPrev: z.boolean(), + limit: z.int(), + totalItems: z.int(), + totalPages: z.int(), + }).describe("Pagination block returned by `GET /agents`."); diff --git a/src/models/agentlistresponse.ts b/src/models/agentlistresponse.ts new file mode 100644 index 00000000..2b3a9689 --- /dev/null +++ b/src/models/agentlistresponse.ts @@ -0,0 +1,35 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { AgentListItem, AgentListItem$zodSchema } from "./agentlistitem.js"; +import { + AgentListPagination, + AgentListPagination$zodSchema, +} from "./agentlistpagination.js"; + +/** + * Paginated response returned by `GET /agents`. + * + * @remarks + * + * The Node gateway forwards the Python backend response on success. If + * the backend returns a non-200 response, the gateway still returns HTTP + * 200 with `success: true`, an empty `agents` array, and a zeroed + * pagination block derived from the requested `page` / `limit`. + */ +export type AgentListResponse = { + success: boolean; + agents: Array; + pagination: AgentListPagination; +}; + +export const AgentListResponse$zodSchema: z.ZodType = z + .object({ + agents: z.array(AgentListItem$zodSchema), + pagination: AgentListPagination$zodSchema, + success: z.boolean(), + }).describe( + "Paginated response returned by `GET /agents`.\n\nThe Node gateway forwards the Python backend response on success. If\nthe backend returns a non-200 response, the gateway still returns HTTP\n200 with `success: true`, an empty `agents` array, and a zeroed\npagination block derived from the requested `page` / `limit`.\n", + ); diff --git a/src/models/agentupdaterequest.ts b/src/models/agentupdaterequest.ts new file mode 100644 index 00000000..8f1eea12 --- /dev/null +++ b/src/models/agentupdaterequest.ts @@ -0,0 +1,64 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AgentCreateKnowledge, + AgentCreateKnowledge$zodSchema, +} from "./agentcreateknowledge.js"; +import { + AgentCreateModelEntryUnion, + AgentCreateModelEntryUnion$zodSchema, +} from "./agentcreatemodelentryunion.js"; +import { + AgentCreateToolset, + AgentCreateToolset$zodSchema, +} from "./agentcreatetoolset.js"; +import { + AgentCreateWebSearchUnion, + AgentCreateWebSearchUnion$zodSchema, +} from "./agentcreatewebsearchunion.js"; + +/** + * Partial update payload for `PUT /agents/{agentKey}`. + * + * @remarks + * + * Every field is optional — only the fields present in the request body + * are updated. When `models` is included, the gateway Zod middleware + * (mirroring the Python backend) requires at least one model entry and + * at least one object entry with `isReasoning: true`. + */ +export type AgentUpdateRequest = { + name?: string | undefined; + description?: string | undefined; + startMessage?: string | undefined; + systemPrompt?: string | undefined; + instructions?: string | undefined; + models?: Array | undefined; + tags?: Array | undefined; + shareWithOrg?: boolean | undefined; + isServiceAccount?: boolean | undefined; + toolsets?: Array | undefined; + knowledge?: Array | undefined; + webSearch?: AgentCreateWebSearchUnion | null | undefined; +}; + +export const AgentUpdateRequest$zodSchema: z.ZodType = z + .object({ + description: z.string().optional(), + instructions: z.string().optional(), + isServiceAccount: z.boolean().default(false), + knowledge: z.array(AgentCreateKnowledge$zodSchema).optional(), + models: z.array(AgentCreateModelEntryUnion$zodSchema).optional(), + name: z.string().optional(), + shareWithOrg: z.boolean().default(false), + startMessage: z.string().optional(), + systemPrompt: z.string().optional(), + tags: z.array(z.string()).optional(), + toolsets: z.array(AgentCreateToolset$zodSchema).optional(), + webSearch: AgentCreateWebSearchUnion$zodSchema.nullable().optional(), + }).describe( + "Partial update payload for `PUT /agents/{agentKey}`.\n\nEvery field is optional — only the fields present in the request body\nare updated. When `models` is included, the gateway Zod middleware\n(mirroring the Python backend) requires at least one model entry and\nat least one object entry with `isReasoning: true`.\n", + ); diff --git a/src/models/agentupdateresponse.ts b/src/models/agentupdateresponse.ts new file mode 100644 index 00000000..040b7597 --- /dev/null +++ b/src/models/agentupdateresponse.ts @@ -0,0 +1,28 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +export const AgentUpdateResponseStatus = { + Success: "success", +} as const; +export type AgentUpdateResponseStatus = ClosedEnum< + typeof AgentUpdateResponseStatus +>; + +export const AgentUpdateResponseStatus$zodSchema = z.enum([ + "success", +]); + +export type AgentUpdateResponse = { + status: AgentUpdateResponseStatus; + message: string; +}; + +export const AgentUpdateResponse$zodSchema: z.ZodType = z + .object({ + message: z.string(), + status: AgentUpdateResponseStatus$zodSchema, + }); diff --git a/src/models/applicationjsonerrorresponse.ts b/src/models/applicationjsonerrorresponse.ts new file mode 100644 index 00000000..b20d9e0f --- /dev/null +++ b/src/models/applicationjsonerrorresponse.ts @@ -0,0 +1,37 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export type ApplicationJsonErrorResponseError = { + code: string; + message: string; + metadata?: { [k: string]: any } | undefined; +}; + +export const ApplicationJsonErrorResponseError$zodSchema: z.ZodType< + ApplicationJsonErrorResponseError +> = z.object({ + code: z.string(), + message: z.string(), + metadata: z.record(z.string(), z.any()).optional(), +}); + +/** + * Standard JSON error envelope from `ErrorMiddleware` for `BaseError` subclasses (`error.middleware.ts`). + * + * @remarks + * Returned for most API 4xx errors (unauthorized, forbidden, not found, validation failures, etc.). + */ +export type ApplicationJsonErrorResponse = { + error: ApplicationJsonErrorResponseError; +}; + +export const ApplicationJsonErrorResponse$zodSchema: z.ZodType< + ApplicationJsonErrorResponse +> = z.object({ + error: z.lazy(() => ApplicationJsonErrorResponseError$zodSchema), +}).describe( + "Standard JSON error envelope from `ErrorMiddleware` for `BaseError` subclasses (`error.middleware.ts`).\nReturned for most API 4xx errors (unauthorized, forbidden, not found, validation failures, etc.).\n", +); diff --git a/src/models/appliedfilternode.ts b/src/models/appliedfilternode.ts new file mode 100644 index 00000000..a36f6732 --- /dev/null +++ b/src/models/appliedfilternode.ts @@ -0,0 +1,25 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * A single filter node selected by the user (used for display/persistence of active filters) + */ +export type AppliedFilterNode = { + id?: string | undefined; + name?: string | undefined; + nodeType?: string | undefined; + connector?: string | undefined; +}; + +export const AppliedFilterNode$zodSchema: z.ZodType = z + .object({ + connector: z.string().optional(), + id: z.string().optional(), + name: z.string().optional(), + nodeType: z.string().optional(), + }).describe( + "A single filter node selected by the user (used for display/persistence of active filters)", + ); diff --git a/src/models/appliedfilters.ts b/src/models/appliedfilters.ts new file mode 100644 index 00000000..dc16dc9c --- /dev/null +++ b/src/models/appliedfilters.ts @@ -0,0 +1,28 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AppliedFilterNode, + AppliedFilterNode$zodSchema, +} from "./appliedfilternode.js"; + +/** + * Rich filter state selected by the user, used for display and persistence only. + * + * @remarks + * This mirrors the active selection shown in the UI and is distinct from the + * machine-readable `filters` field used for retrieval scoping. + */ +export type AppliedFilters = { + apps?: Array | undefined; + kb?: Array | undefined; +}; + +export const AppliedFilters$zodSchema: z.ZodType = z.object({ + apps: z.array(AppliedFilterNode$zodSchema).optional(), + kb: z.array(AppliedFilterNode$zodSchema).optional(), +}).describe( + "Rich filter state selected by the user, used for display and persistence only.\nThis mirrors the active selection shown in the UI and is distinct from the\nmachine-readable `filters` field used for retrieval scoping.\n", +); diff --git a/src/models/archiveagentconversationop.ts b/src/models/archiveagentconversationop.ts new file mode 100644 index 00000000..922cc70d --- /dev/null +++ b/src/models/archiveagentconversationop.ts @@ -0,0 +1,33 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AgentConversationArchiveResponse, + AgentConversationArchiveResponse$zodSchema, +} from "./agentconversationarchiveresponse.js"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; + +export type ArchiveAgentConversationRequest = { + agentKey: string; + conversationId: string; +}; + +export const ArchiveAgentConversationRequest$zodSchema: z.ZodType< + ArchiveAgentConversationRequest +> = z.object({ + agentKey: z.string(), + conversationId: z.string(), +}); + +export type ArchiveAgentConversationResponse = + | AgentConversationArchiveResponse + | ErrorResponse; + +export const ArchiveAgentConversationResponse$zodSchema: z.ZodType< + ArchiveAgentConversationResponse +> = z.union([ + AgentConversationArchiveResponse$zodSchema, + ErrorResponse$zodSchema, +]); diff --git a/src/models/archiveconversationop.ts b/src/models/archiveconversationop.ts new file mode 100644 index 00000000..c7a1b2f0 --- /dev/null +++ b/src/models/archiveconversationop.ts @@ -0,0 +1,66 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +export type ArchiveConversationRequest = { conversationId: string }; + +export const ArchiveConversationRequest$zodSchema: z.ZodType< + ArchiveConversationRequest +> = z.object({ + conversationId: z.string().describe("Conversation identifier"), +}); + +/** + * New archive status of the conversation + */ +export const ArchiveConversationStatus = { + Archived: "archived", +} as const; +/** + * New archive status of the conversation + */ +export type ArchiveConversationStatus = ClosedEnum< + typeof ArchiveConversationStatus +>; + +export const ArchiveConversationStatus$zodSchema = z.enum([ + "archived", +]).describe("New archive status of the conversation"); + +export type ArchiveConversationMeta = { + requestId?: string | undefined; + timestamp?: string | undefined; + duration?: number | undefined; +}; + +export const ArchiveConversationMeta$zodSchema: z.ZodType< + ArchiveConversationMeta +> = z.object({ + duration: z.int().optional(), + requestId: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }).optional(), +}); + +/** + * Conversation archived successfully + */ +export type ArchiveConversationResponse = { + id?: string | undefined; + status?: ArchiveConversationStatus | undefined; + archivedBy?: string | undefined; + archivedAt?: string | undefined; + meta?: ArchiveConversationMeta | undefined; +}; + +export const ArchiveConversationResponse$zodSchema: z.ZodType< + ArchiveConversationResponse +> = z.object({ + archivedAt: z.iso.datetime({ offset: true }).optional(), + archivedBy: z.string().optional(), + id: z.string().optional(), + meta: z.lazy(() => ArchiveConversationMeta$zodSchema).optional(), + status: ArchiveConversationStatus$zodSchema.optional(), +}).describe("Conversation archived successfully"); diff --git a/src/models/archivesearchop.ts b/src/models/archivesearchop.ts new file mode 100644 index 00000000..9003e302 --- /dev/null +++ b/src/models/archivesearchop.ts @@ -0,0 +1,61 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +export type ArchiveSearchRequest = { searchId: string }; + +export const ArchiveSearchRequest$zodSchema: z.ZodType = z + .object({ + searchId: z.string().describe("Unique search identifier"), + }); + +/** + * Resulting status of the search after the operation. + */ +export const ArchiveSearchStatus = { + Archived: "archived", +} as const; +/** + * Resulting status of the search after the operation. + */ +export type ArchiveSearchStatus = ClosedEnum; + +export const ArchiveSearchStatus$zodSchema = z.enum([ + "archived", +]).describe("Resulting status of the search after the operation."); + +export type ArchiveSearchMeta = { + requestId?: string | undefined; + timestamp: string; + duration: number; +}; + +export const ArchiveSearchMeta$zodSchema: z.ZodType = z + .object({ + duration: z.int(), + requestId: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }), + }); + +/** + * Search archived successfully + */ +export type ArchiveSearchResponse = { + id: string; + status: ArchiveSearchStatus; + archivedBy: string; + archivedAt: string; + meta: ArchiveSearchMeta; +}; + +export const ArchiveSearchResponse$zodSchema: z.ZodType = + z.object({ + archivedAt: z.iso.datetime({ offset: true }), + archivedBy: z.string(), + id: z.string(), + meta: z.lazy(() => ArchiveSearchMeta$zodSchema), + status: ArchiveSearchStatus$zodSchema, + }).describe("Search archived successfully"); diff --git a/src/models/authconfig.ts b/src/models/authconfig.ts new file mode 100644 index 00000000..4b54b8ff --- /dev/null +++ b/src/models/authconfig.ts @@ -0,0 +1,24 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { AuthStep, AuthStep$zodSchema } from "./authstep.js"; + +/** + * Organization authentication configuration. Supports 1-3 authentication steps for multi-factor authentication. + * + * @remarks + * **Validation Rules:** + * - Minimum 1 step, maximum 3 steps + * - Each step must have unique order + * - No duplicate methods within the same step + * - No method can appear in multiple steps + */ +export type AuthConfig = { authMethods: Array }; + +export const AuthConfig$zodSchema: z.ZodType = z.object({ + authMethods: z.array(AuthStep$zodSchema), +}).describe( + "Organization authentication configuration. Supports 1-3 authentication steps for multi-factor authentication.\n**Validation Rules:**\n- Minimum 1 step, maximum 3 steps\n- Each step must have unique order\n- No duplicate methods within the same step\n- No method can appear in multiple steps\n", +); diff --git a/src/models/authenticatedpasswordresetresponse.ts b/src/models/authenticatedpasswordresetresponse.ts new file mode 100644 index 00000000..9d55aecf --- /dev/null +++ b/src/models/authenticatedpasswordresetresponse.ts @@ -0,0 +1,22 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Response after authenticated user changes password (new access token issued) + */ +export type AuthenticatedPasswordResetResponse = { + data: string; + accessToken: string; +}; + +export const AuthenticatedPasswordResetResponse$zodSchema: z.ZodType< + AuthenticatedPasswordResetResponse +> = z.object({ + accessToken: z.string(), + data: z.string(), +}).describe( + "Response after authenticated user changes password (new access token issued)", +); diff --git a/src/models/authenticatefinalresponse.ts b/src/models/authenticatefinalresponse.ts new file mode 100644 index 00000000..abaf5fac --- /dev/null +++ b/src/models/authenticatefinalresponse.ts @@ -0,0 +1,22 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * All authentication steps complete; JWT tokens returned + */ +export type AuthenticateFinalResponse = { + message: string; + accessToken: string; + refreshToken: string; +}; + +export const AuthenticateFinalResponse$zodSchema: z.ZodType< + AuthenticateFinalResponse +> = z.object({ + accessToken: z.string(), + message: z.string(), + refreshToken: z.string(), +}).describe("All authentication steps complete; JWT tokens returned"); diff --git a/src/models/authenticatemultistepresponse.ts b/src/models/authenticatemultistepresponse.ts new file mode 100644 index 00000000..1f3d8595 --- /dev/null +++ b/src/models/authenticatemultistepresponse.ts @@ -0,0 +1,45 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { AuthProviders, AuthProviders$zodSchema } from "./authproviders.js"; + +/** + * Step completion status + */ +export const AuthenticateMultiStepResponseStatus = { + Success: "success", +} as const; +/** + * Step completion status + */ +export type AuthenticateMultiStepResponseStatus = ClosedEnum< + typeof AuthenticateMultiStepResponseStatus +>; + +export const AuthenticateMultiStepResponseStatus$zodSchema = z.enum([ + "success", +]).describe("Step completion status"); + +/** + * Current authentication step succeeded; additional MFA steps remain + */ +export type AuthenticateMultiStepResponse = { + status: AuthenticateMultiStepResponseStatus; + nextStep: number; + allowedMethods: Array; + authProviders: AuthProviders; +}; + +export const AuthenticateMultiStepResponse$zodSchema: z.ZodType< + AuthenticateMultiStepResponse +> = z.object({ + allowedMethods: z.array(z.string()), + authProviders: AuthProviders$zodSchema, + nextStep: z.int(), + status: AuthenticateMultiStepResponseStatus$zodSchema, +}).describe( + "Current authentication step succeeded; additional MFA steps remain", +); diff --git a/src/models/authenticateop.ts b/src/models/authenticateop.ts new file mode 100644 index 00000000..6e7f85e5 --- /dev/null +++ b/src/models/authenticateop.ts @@ -0,0 +1,37 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AuthenticateRequest, + AuthenticateRequest$zodSchema, +} from "./authenticaterequest.js"; +import { + AuthenticateResponse, + AuthenticateResponse$zodSchema, +} from "./authenticateresponse.js"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; + +export type AuthenticateRequestRequest = { + xSessionToken: string; + body: AuthenticateRequest; +}; + +export const AuthenticateRequestRequest$zodSchema: z.ZodType< + AuthenticateRequestRequest +> = z.object({ + body: AuthenticateRequest$zodSchema, + xSessionToken: z.string().describe( + "Session token received from `/initAuth` endpoint", + ), +}); + +export type AuthenticateResponseResponse = ErrorResponse | AuthenticateResponse; + +export const AuthenticateResponseResponse$zodSchema: z.ZodType< + AuthenticateResponseResponse +> = z.union([ + ErrorResponse$zodSchema, + AuthenticateResponse$zodSchema, +]); diff --git a/src/models/authenticaterequest.ts b/src/models/authenticaterequest.ts new file mode 100644 index 00000000..3ecf58a9 --- /dev/null +++ b/src/models/authenticaterequest.ts @@ -0,0 +1,93 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + OAuthCredentials, + OAuthCredentials$zodSchema, +} from "./oauthcredentials.js"; +import { OtpCredentials, OtpCredentials$zodSchema } from "./otpcredentials.js"; +import { + PasswordCredentials, + PasswordCredentials$zodSchema, +} from "./passwordcredentials.js"; + +/** + * Authentication method to use + */ +export const Method = { + SamlSso: "samlSso", + Otp: "otp", + Password: "password", + Google: "google", + Microsoft: "microsoft", + AzureAd: "azureAd", + Oauth: "oauth", +} as const; +/** + * Authentication method to use + */ +export type Method = ClosedEnum; + +export const Method$zodSchema = z.enum([ + "samlSso", + "otp", + "password", + "google", + "microsoft", + "azureAd", + "oauth", +]).describe("Authentication method to use"); + +/** + * Credentials based on the authentication method + */ +export type Credentials = + | PasswordCredentials + | OtpCredentials + | OAuthCredentials + | string; + +export const Credentials$zodSchema: z.ZodType = z.union([ + PasswordCredentials$zodSchema, + OtpCredentials$zodSchema, + OAuthCredentials$zodSchema, + z.string(), +]).describe("Credentials based on the authentication method"); + +/** + * Request to authenticate using specified method. + * + * @remarks + * **Credential format varies by method:** + * - `password`: `{ password: "string" }` + * - `otp`: `{ otp: "123456" }` (6-digit code) + * - `google`: `"google-id-token-string"` + * - `microsoft`: `{ accessToken: "...", idToken: "..." }` + * - `azureAd`: `{ accessToken: "...", idToken: "..." }` + * - `oauth`: `{ accessToken: "...", idToken: "..." }` + * - `samlSso`: handled via redirect flow + */ +export type AuthenticateRequest = { + method: Method; + credentials: PasswordCredentials | OtpCredentials | OAuthCredentials | string; + email?: string | undefined; + cfTurnstileResponse?: string | undefined; +}; + +export const AuthenticateRequest$zodSchema: z.ZodType = z + .object({ + cfTurnstileResponse: z.string().optional(), + credentials: z.union([ + PasswordCredentials$zodSchema, + OtpCredentials$zodSchema, + OAuthCredentials$zodSchema, + z.string(), + ]), + email: z.string().optional(), + method: Method$zodSchema, + }).describe( + "Request to authenticate using specified method.\n**Credential format varies by method:**\n- `password`: `{ password: \"string\" }`\n- `otp`: `{ otp: \"123456\" }` (6-digit code)\n- `google`: `\"google-id-token-string\"`\n- `microsoft`: `{ accessToken: \"...\", idToken: \"...\" }`\n- `azureAd`: `{ accessToken: \"...\", idToken: \"...\" }`\n- `oauth`: `{ accessToken: \"...\", idToken: \"...\" }`\n- `samlSso`: handled via redirect flow\n", + ); diff --git a/src/models/authenticateresponse.ts b/src/models/authenticateresponse.ts new file mode 100644 index 00000000..ec9e1ca3 --- /dev/null +++ b/src/models/authenticateresponse.ts @@ -0,0 +1,31 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AuthenticateFinalResponse, + AuthenticateFinalResponse$zodSchema, +} from "./authenticatefinalresponse.js"; +import { + AuthenticateMultiStepResponse, + AuthenticateMultiStepResponse$zodSchema, +} from "./authenticatemultistepresponse.js"; + +/** + * Either the next step in a multi-factor flow (`status`, `nextStep`, `allowedMethods`, `authProviders`) + * + * @remarks + * or final tokens (`message`, `accessToken`, `refreshToken`). + */ +export type AuthenticateResponse = + | AuthenticateMultiStepResponse + | AuthenticateFinalResponse; + +export const AuthenticateResponse$zodSchema: z.ZodType = z + .union([ + AuthenticateMultiStepResponse$zodSchema, + AuthenticateFinalResponse$zodSchema, + ]).describe( + "Either the next step in a multi-factor flow (`status`, `nextStep`, `allowedMethods`, `authProviders`)\nor final tokens (`message`, `accessToken`, `refreshToken`).\n", + ); diff --git a/src/models/authmethod.ts b/src/models/authmethod.ts new file mode 100644 index 00000000..2b35c807 --- /dev/null +++ b/src/models/authmethod.ts @@ -0,0 +1,62 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +/** + * Type of authentication method: + * + * @remarks + * - `password`: Email/password authentication + * - `otp`: One-time password via email (6-digit, expires in 10 minutes) + * - `google`: Google OAuth 2.0 + * - `microsoft`: Microsoft OAuth 2.0 + * - `azureAd`: Azure Active Directory + * - `samlSso`: SAML 2.0 Single Sign-On + * - `oauth`: Generic OAuth 2.0 provider + */ +export const Type = { + SamlSso: "samlSso", + Otp: "otp", + Password: "password", + Google: "google", + Microsoft: "microsoft", + AzureAd: "azureAd", + Oauth: "oauth", +} as const; +/** + * Type of authentication method: + * + * @remarks + * - `password`: Email/password authentication + * - `otp`: One-time password via email (6-digit, expires in 10 minutes) + * - `google`: Google OAuth 2.0 + * - `microsoft`: Microsoft OAuth 2.0 + * - `azureAd`: Azure Active Directory + * - `samlSso`: SAML 2.0 Single Sign-On + * - `oauth`: Generic OAuth 2.0 provider + */ +export type Type = ClosedEnum; + +export const Type$zodSchema = z.enum([ + "samlSso", + "otp", + "password", + "google", + "microsoft", + "azureAd", + "oauth", +]).describe( + "Type of authentication method:\n- `password`: Email/password authentication\n- `otp`: One-time password via email (6-digit, expires in 10 minutes)\n- `google`: Google OAuth 2.0\n- `microsoft`: Microsoft OAuth 2.0\n- `azureAd`: Azure Active Directory\n- `samlSso`: SAML 2.0 Single Sign-On\n- `oauth`: Generic OAuth 2.0 provider\n", +); + +/** + * Authentication method configuration + */ +export type AuthMethod = { type: Type }; + +export const AuthMethod$zodSchema: z.ZodType = z.object({ + type: Type$zodSchema, +}).describe("Authentication method configuration"); diff --git a/src/models/authproviderazureadpublicconfig.ts b/src/models/authproviderazureadpublicconfig.ts new file mode 100644 index 00000000..704e938f --- /dev/null +++ b/src/models/authproviderazureadpublicconfig.ts @@ -0,0 +1,22 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Public Azure AD OAuth settings returned to clients + */ +export type AuthProviderAzureAdPublicConfig = { + tenantId?: string | undefined; + clientId?: string | undefined; + enableJit?: boolean | undefined; +}; + +export const AuthProviderAzureAdPublicConfig$zodSchema: z.ZodType< + AuthProviderAzureAdPublicConfig +> = z.object({ + clientId: z.string().optional(), + enableJit: z.boolean().optional(), + tenantId: z.string().optional(), +}).describe("Public Azure AD OAuth settings returned to clients"); diff --git a/src/models/authprovidergooglepublicconfig.ts b/src/models/authprovidergooglepublicconfig.ts new file mode 100644 index 00000000..a187652f --- /dev/null +++ b/src/models/authprovidergooglepublicconfig.ts @@ -0,0 +1,20 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Public Google OAuth settings returned to clients + */ +export type AuthProviderGooglePublicConfig = { + clientId?: string | undefined; + enableJit?: boolean | undefined; +}; + +export const AuthProviderGooglePublicConfig$zodSchema: z.ZodType< + AuthProviderGooglePublicConfig +> = z.object({ + clientId: z.string().optional(), + enableJit: z.boolean().optional(), +}).describe("Public Google OAuth settings returned to clients"); diff --git a/src/models/authprovidermicrosoftpublicconfig.ts b/src/models/authprovidermicrosoftpublicconfig.ts new file mode 100644 index 00000000..dd7e35b8 --- /dev/null +++ b/src/models/authprovidermicrosoftpublicconfig.ts @@ -0,0 +1,22 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Public Microsoft OAuth settings returned to clients + */ +export type AuthProviderMicrosoftPublicConfig = { + tenantId?: string | undefined; + clientId?: string | undefined; + enableJit?: boolean | undefined; +}; + +export const AuthProviderMicrosoftPublicConfig$zodSchema: z.ZodType< + AuthProviderMicrosoftPublicConfig +> = z.object({ + clientId: z.string().optional(), + enableJit: z.boolean().optional(), + tenantId: z.string().optional(), +}).describe("Public Microsoft OAuth settings returned to clients"); diff --git a/src/models/authprovideroauthpublicconfig.ts b/src/models/authprovideroauthpublicconfig.ts new file mode 100644 index 00000000..761a9c2f --- /dev/null +++ b/src/models/authprovideroauthpublicconfig.ts @@ -0,0 +1,32 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Public generic OAuth provider settings returned to clients + */ +export type AuthProviderOAuthPublicConfig = { + providerName: string; + clientId: string; + tokenEndpoint: string; + authorizationUrl: string; + clientSecret?: string | undefined; + userInfoEndpoint?: string | undefined; + scope?: string | undefined; + enableJit?: boolean | undefined; +}; + +export const AuthProviderOAuthPublicConfig$zodSchema: z.ZodType< + AuthProviderOAuthPublicConfig +> = z.object({ + authorizationUrl: z.string(), + clientId: z.string(), + clientSecret: z.string().optional(), + enableJit: z.boolean().optional(), + providerName: z.string(), + scope: z.string().optional(), + tokenEndpoint: z.string(), + userInfoEndpoint: z.string().optional(), +}).describe("Public generic OAuth provider settings returned to clients"); diff --git a/src/models/authproviders.ts b/src/models/authproviders.ts new file mode 100644 index 00000000..462dc86f --- /dev/null +++ b/src/models/authproviders.ts @@ -0,0 +1,42 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AuthProviderAzureAdPublicConfig, + AuthProviderAzureAdPublicConfig$zodSchema, +} from "./authproviderazureadpublicconfig.js"; +import { + AuthProviderGooglePublicConfig, + AuthProviderGooglePublicConfig$zodSchema, +} from "./authprovidergooglepublicconfig.js"; +import { + AuthProviderMicrosoftPublicConfig, + AuthProviderMicrosoftPublicConfig$zodSchema, +} from "./authprovidermicrosoftpublicconfig.js"; +import { + AuthProviderOAuthPublicConfig, + AuthProviderOAuthPublicConfig$zodSchema, +} from "./authprovideroauthpublicconfig.js"; + +/** + * Configuration for external authentication providers (returned when those methods are allowed) + */ +export type AuthProviders = { + google?: AuthProviderGooglePublicConfig | undefined; + microsoft?: AuthProviderMicrosoftPublicConfig | undefined; + azuread?: AuthProviderAzureAdPublicConfig | undefined; + oauth?: AuthProviderOAuthPublicConfig | undefined; + saml?: { [k: string]: any } | undefined; +}; + +export const AuthProviders$zodSchema: z.ZodType = z.object({ + azuread: AuthProviderAzureAdPublicConfig$zodSchema.optional(), + google: AuthProviderGooglePublicConfig$zodSchema.optional(), + microsoft: AuthProviderMicrosoftPublicConfig$zodSchema.optional(), + oauth: AuthProviderOAuthPublicConfig$zodSchema.optional(), + saml: z.record(z.string(), z.any()).optional(), +}).describe( + "Configuration for external authentication providers (returned when those methods are allowed)", +); diff --git a/src/models/authstep.ts b/src/models/authstep.ts new file mode 100644 index 00000000..abebed00 --- /dev/null +++ b/src/models/authstep.ts @@ -0,0 +1,16 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { AuthMethod, AuthMethod$zodSchema } from "./authmethod.js"; + +/** + * A single step in multi-factor authentication flow + */ +export type AuthStep = { order: number; allowedMethods: Array }; + +export const AuthStep$zodSchema: z.ZodType = z.object({ + allowedMethods: z.array(AuthMethod$zodSchema), + order: z.int(), +}).describe("A single step in multi-factor authentication flow"); diff --git a/src/models/availablemodel.ts b/src/models/availablemodel.ts deleted file mode 100644 index 46a69c16..00000000 --- a/src/models/availablemodel.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ModelType, ModelType$zodSchema } from "./modeltype.js"; - -/** - * A configured AI model the org can use. Returned by - * - * @remarks - * `GET /configurationManager/ai-models/available/{modelType}`. - * Pass `modelKey` (and optionally `modelName` / `modelFriendlyName`) - * on chat requests to select this model for the turn. - */ -export type AvailableModel = { - modelType: ModelType; - provider: string; - modelName: string; - modelKey: string; - isMultimodal?: boolean | undefined; - isReasoning?: boolean | undefined; - isDefault?: boolean | undefined; -}; - -export const AvailableModel$zodSchema: z.ZodType = z.object({ - isDefault: z.boolean().optional(), - isMultimodal: z.boolean().optional(), - isReasoning: z.boolean().optional(), - modelKey: z.string(), - modelName: z.string(), - modelType: ModelType$zodSchema, - provider: z.string(), -}).describe( - "A configured AI model the org can use. Returned by\n`GET /configurationManager/ai-models/available/{modelType}`.\nPass `modelKey` (and optionally `modelName` / `modelFriendlyName`)\non chat requests to select this model for the turn.\n", -); diff --git a/src/models/availablemodelsresponse.ts b/src/models/availablemodelsresponse.ts deleted file mode 100644 index e472457c..00000000 --- a/src/models/availablemodelsresponse.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ClosedEnum } from "../types/enums.js"; -import { AvailableModel, AvailableModel$zodSchema } from "./availablemodel.js"; - -export const AvailableModelsResponseStatus = { - Success: "success", - Error: "error", -} as const; -export type AvailableModelsResponseStatus = ClosedEnum< - typeof AvailableModelsResponseStatus ->; - -export const AvailableModelsResponseStatus$zodSchema = z.enum([ - "success", - "error", -]); - -/** - * Response from `GET /configurationManager/ai-models/available/{modelType}`. - */ -export type AvailableModelsResponse = { - status: AvailableModelsResponseStatus; - message?: string | undefined; - models: Array; -}; - -export const AvailableModelsResponse$zodSchema: z.ZodType< - AvailableModelsResponse -> = z.object({ - message: z.string().optional(), - models: z.array(AvailableModel$zodSchema), - status: AvailableModelsResponseStatus$zodSchema, -}).describe( - "Response from `GET /configurationManager/ai-models/available/{modelType}`.", -); diff --git a/src/models/chatattachmentref.ts b/src/models/chatattachmentref.ts new file mode 100644 index 00000000..d1667010 --- /dev/null +++ b/src/models/chatattachmentref.ts @@ -0,0 +1,31 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Reference to an attachment produced by `POST /conversations/attachments/upload` + * + * @remarks + * (or the equivalent agent route). Include in create/stream/message bodies + * so the turn is sent with uploaded files. + */ +export type ChatAttachmentRef = { + recordId: string; + recordName?: string | undefined; + mimeType?: string | undefined; + extension?: string | undefined; + virtualRecordId?: string | undefined; +}; + +export const ChatAttachmentRef$zodSchema: z.ZodType = z + .object({ + extension: z.string().optional(), + mimeType: z.string().optional(), + recordId: z.string(), + recordName: z.string().optional(), + virtualRecordId: z.string().optional(), + }).describe( + "Reference to an attachment produced by `POST /conversations/attachments/upload`\n(or the equivalent agent route). Include in create/stream/message bodies\nso the turn is sent with uploaded files.\n", + ); diff --git a/src/models/chatattachmentuploadref.ts b/src/models/chatattachmentuploadref.ts new file mode 100644 index 00000000..bc43bde5 --- /dev/null +++ b/src/models/chatattachmentuploadref.ts @@ -0,0 +1,33 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Concrete attachment metadata returned by `POST /conversations/attachments/upload` + * + * @remarks + * (or the equivalent agent route). + */ +export type ChatAttachmentUploadRef = { + recordId: string; + recordName: string; + mimeType: string; + extension: string; + virtualRecordId: string; + ocrMode?: string | undefined; +}; + +export const ChatAttachmentUploadRef$zodSchema: z.ZodType< + ChatAttachmentUploadRef +> = z.object({ + extension: z.string(), + mimeType: z.string(), + ocrMode: z.string().optional(), + recordId: z.string(), + recordName: z.string(), + virtualRecordId: z.string(), +}).describe( + "Concrete attachment metadata returned by `POST /conversations/attachments/upload`\n(or the equivalent agent route).\n", +); diff --git a/src/models/chatattachmentuploadresponse.ts b/src/models/chatattachmentuploadresponse.ts new file mode 100644 index 00000000..b92e3b7c --- /dev/null +++ b/src/models/chatattachmentuploadresponse.ts @@ -0,0 +1,29 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + ChatAttachmentUploadRef, + ChatAttachmentUploadRef$zodSchema, +} from "./chatattachmentuploadref.js"; + +/** + * Success envelope returned by `POST /conversations/attachments/upload` + * + * @remarks + * and `POST /agents/{agentKey}/conversations/attachments/upload`. + */ +export type ChatAttachmentUploadResponse = { + conversationId: string | null; + attachments: Array; +}; + +export const ChatAttachmentUploadResponse$zodSchema: z.ZodType< + ChatAttachmentUploadResponse +> = z.object({ + attachments: z.array(ChatAttachmentUploadRef$zodSchema), + conversationId: z.string().nullable(), +}).describe( + "Success envelope returned by `POST /conversations/attachments/upload`\nand `POST /agents/{agentKey}/conversations/attachments/upload`.\n", +); diff --git a/src/models/citation.ts b/src/models/citation.ts new file mode 100644 index 00000000..6c02d8fe --- /dev/null +++ b/src/models/citation.ts @@ -0,0 +1,38 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + PersistedSemanticSearchCitationMetadata, + PersistedSemanticSearchCitationMetadata$zodSchema, +} from "./persistedsemanticsearchcitationmetadata.js"; + +/** + * A populated citation document. Represents a single chunk of source + * + * @remarks + * content (e.g. a passage from a document or record) referenced by an + * AI response, together with its provenance metadata. + */ +export type Citation = { + _id: string; + content: string; + chunkIndex: number; + citationType: string; + metadata: PersistedSemanticSearchCitationMetadata; + createdAt: string; + updatedAt: string; +}; + +export const Citation$zodSchema: z.ZodType = z.object({ + _id: z.string(), + chunkIndex: z.int(), + citationType: z.string(), + content: z.string(), + createdAt: z.iso.datetime({ offset: true }), + metadata: PersistedSemanticSearchCitationMetadata$zodSchema, + updatedAt: z.iso.datetime({ offset: true }), +}).describe( + "A populated citation document. Represents a single chunk of source\ncontent (e.g. a passage from a document or record) referenced by an\nAI response, together with its provenance metadata.\n", +); diff --git a/src/models/citationmetadata.ts b/src/models/citationmetadata.ts deleted file mode 100644 index 414c4e40..00000000 --- a/src/models/citationmetadata.ts +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ClosedEnum } from "../types/enums.js"; - -/** - * Where the record came from — direct upload or a connector sync. - */ -export const CitationMetadataOrigin = { - Upload: "UPLOAD", - Connector: "CONNECTOR", -} as const; -/** - * Where the record came from — direct upload or a connector sync. - */ -export type CitationMetadataOrigin = ClosedEnum; - -export const CitationMetadataOrigin$zodSchema = z.enum([ - "UPLOAD", - "CONNECTOR", -]).describe("Where the record came from — direct upload or a connector sync."); - -export type CitationMetadataBoundingBox = { - x?: number | undefined; - y?: number | undefined; -}; - -export const CitationMetadataBoundingBox$zodSchema: z.ZodType< - CitationMetadataBoundingBox -> = z.object({ - x: z.number().optional(), - y: z.number().optional(), -}); - -/** - * Record-level identity and locator for a citation. recordId - * - * @remarks - * is the field a caller passes to - * GET /knowledgeBase/stream/record/{recordId} to download - * the underlying file. - */ -export type CitationMetadata = { - recordId: string; - recordName: string; - recordType?: string | undefined; - recordVersion?: number | undefined; - mimeType: string; - extension: string; - origin: CitationMetadataOrigin; - connector?: string | undefined; - orgId: string; - chunkIndex?: number | undefined; - blockNum?: Array | undefined; - blockType?: string | undefined; - blockText?: string | undefined; - pageNum?: Array | undefined; - sheetName?: string | undefined; - sheetNum?: number | undefined; - bounding_box?: Array | undefined; - categories?: string | undefined; - subcategoryLevel1?: string | undefined; - subcategoryLevel2?: string | undefined; - subcategoryLevel3?: string | undefined; - departments?: Array | undefined; - topics?: Array | undefined; - languages?: Array | undefined; - score?: number | undefined; - _collection_name?: string | undefined; -}; - -export const CitationMetadata$zodSchema: z.ZodType = z.object( - { - _collection_name: z.string().optional(), - blockNum: z.array(z.int()).optional(), - blockText: z.string().optional(), - blockType: z.string().optional(), - bounding_box: z.array(z.lazy(() => CitationMetadataBoundingBox$zodSchema)) - .optional(), - categories: z.string().optional(), - chunkIndex: z.int().optional(), - connector: z.string().optional(), - departments: z.array(z.string()).optional(), - extension: z.string(), - languages: z.array(z.string()).optional(), - mimeType: z.string(), - orgId: z.string(), - origin: CitationMetadataOrigin$zodSchema, - pageNum: z.array(z.int()).optional(), - recordId: z.string(), - recordName: z.string(), - recordType: z.string().optional(), - recordVersion: z.int().default(0), - score: z.number().optional(), - sheetName: z.string().optional(), - sheetNum: z.int().optional(), - subcategoryLevel1: z.string().optional(), - subcategoryLevel2: z.string().optional(), - subcategoryLevel3: z.string().optional(), - topics: z.array(z.string()).optional(), - }, -).describe( - "Record-level identity and locator for a citation. recordId\nis the field a caller passes to\nGET /knowledgeBase/stream/record/{recordId} to download\nthe underlying file.\n", -); diff --git a/src/models/citationreference.ts b/src/models/citationreference.ts index cbe34308..bdf47c05 100644 --- a/src/models/citationreference.ts +++ b/src/models/citationreference.ts @@ -3,47 +3,21 @@ */ import * as z from "zod"; -import { - CitationMetadata, - CitationMetadata$zodSchema, -} from "./citationmetadata.js"; /** - * A single citation attached to a `bot_response` message. Each citation - * - * @remarks - * points back to a chunk of a source record that the AI used while - * answering.

- * Shape on the wire: the API returns a populated Citation document - * with `_id`, `content` (the chunk text), `chunkIndex`, `citationType`, - * timestamps, and a `metadata` object that carries the record-level - * identity (most importantly metadata.recordId and - * metadata.recordName).

- * Discovering a recordId for download: when a programmatic / MCP - * caller wants to download a file mentioned in the chat, read - * citations[*].metadata.recordId from the - * complete SSE frame and pass it to - * GET /knowledgeBase/stream/record/{recordId}. + * Reference to a source document cited in a response */ export type CitationReference = { - _id?: string | undefined; - content?: string | undefined; - chunkIndex?: number | undefined; - citationType?: string | undefined; - metadata?: CitationMetadata | undefined; - createdAt?: string | undefined; - updatedAt?: string | undefined; + citationId?: string | undefined; + relevanceScore?: number | undefined; + excerpt?: string | undefined; + context?: string | undefined; }; export const CitationReference$zodSchema: z.ZodType = z .object({ - _id: z.string().optional(), - chunkIndex: z.int().optional(), - citationType: z.string().optional(), - content: z.string().optional(), - createdAt: z.iso.datetime({ offset: true }).optional(), - metadata: CitationMetadata$zodSchema.optional(), - updatedAt: z.iso.datetime({ offset: true }).optional(), - }).describe( - "A single citation attached to a `bot_response` message. Each citation\npoints back to a chunk of a source record that the AI used while\nanswering.

\nShape on the wire: the API returns a populated Citation document\nwith `_id`, `content` (the chunk text), `chunkIndex`, `citationType`,\ntimestamps, and a `metadata` object that carries the record-level\nidentity (most importantly metadata.recordId and\nmetadata.recordName).

\nDiscovering a recordId for download: when a programmatic / MCP\ncaller wants to download a file mentioned in the chat, read\ncitations[*].metadata.recordId from the\ncomplete SSE frame and pass it to\nGET /knowledgeBase/stream/record/{recordId}.\n", - ); + citationId: z.string().optional(), + context: z.string().optional(), + excerpt: z.string().optional(), + relevanceScore: z.number().optional(), + }).describe("Reference to a source document cited in a response"); diff --git a/src/models/compactpaginationinfo.ts b/src/models/compactpaginationinfo.ts deleted file mode 100644 index 9e936279..00000000 --- a/src/models/compactpaginationinfo.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; - -/** - * Alternative pagination block used by a handful of older endpoints - * - * @remarks - * (e.g. `GET /teams/user/teams`). Same semantics as `PaginationInfo` - * but with shorter field names: `total`, `pages`, `hasNext`, - * `hasPrev`. New endpoints should prefer `PaginationInfo`. - */ -export type CompactPaginationInfo = { - page?: number | undefined; - limit?: number | undefined; - total?: number | undefined; - pages?: number | undefined; - hasNext?: boolean | undefined; - hasPrev?: boolean | undefined; -}; - -export const CompactPaginationInfo$zodSchema: z.ZodType = - z.object({ - hasNext: z.boolean().optional(), - hasPrev: z.boolean().optional(), - limit: z.int().optional(), - page: z.int().optional(), - pages: z.int().optional(), - total: z.int().optional(), - }).describe( - "Alternative pagination block used by a handful of older endpoints\n(e.g. `GET /teams/user/teams`). Same semantics as `PaginationInfo`\nbut with shorter field names: `total`, `pages`, `hasNext`,\n`hasPrev`. New endpoints should prefer `PaginationInfo`.\n", - ); diff --git a/src/models/conversation.ts b/src/models/conversation.ts deleted file mode 100644 index 4dca4577..00000000 --- a/src/models/conversation.ts +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ClosedEnum } from "../types/enums.js"; -import { Message, Message$zodSchema } from "./message.js"; - -/** - * Current status of the conversation (mixed-case values, source of - * - * @remarks - * truth is `CONVERSATION_STATUS` in - * `enterprise_search/constants/constants.ts`): - *
    - *
  • Inprogress — request received, AI is generating a response
  • - *
  • Complete — response ready
  • - *
  • Failed — AI backend or downstream error; see failReason
  • - *
  • None — placeholder used for empty/legacy conversations
  • - *
- */ -export const ConversationStatus = { - Complete: "Complete", - Failed: "Failed", - Inprogress: "Inprogress", - None: "None", -} as const; -/** - * Current status of the conversation (mixed-case values, source of - * - * @remarks - * truth is `CONVERSATION_STATUS` in - * `enterprise_search/constants/constants.ts`): - *
    - *
  • Inprogress — request received, AI is generating a response
  • - *
  • Complete — response ready
  • - *
  • Failed — AI backend or downstream error; see failReason
  • - *
  • None — placeholder used for empty/legacy conversations
  • - *
- */ -export type ConversationStatus = ClosedEnum; - -export const ConversationStatus$zodSchema = z.enum([ - "Complete", - "Failed", - "Inprogress", - "None", -]).describe( - "Current status of the conversation (mixed-case values, source of\ntruth is `CONVERSATION_STATUS` in\n`enterprise_search/constants/constants.ts`):\n
    \n
  • Inprogress — request received, AI is generating a response
  • \n
  • Complete — response ready
  • \n
  • Failed — AI backend or downstream error; see failReason
  • \n
  • None — placeholder used for empty/legacy conversations
  • \n
\n", -); - -/** - * AI model configuration used - */ -export type ModelInfo = { - modelKey?: string | undefined; - modelName?: string | undefined; - modelFriendlyName?: string | undefined; - modelProvider?: string | undefined; - chatMode?: string | undefined; -}; - -export const ModelInfo$zodSchema: z.ZodType = z.object({ - chatMode: z.string().optional(), - modelFriendlyName: z.string().optional(), - modelKey: z.string().optional(), - modelName: z.string().optional(), - modelProvider: z.string().optional(), -}).describe("AI model configuration used"); - -export const AccessLevel = { - Read: "read", - Write: "write", -} as const; -export type AccessLevel = ClosedEnum; - -export const AccessLevel$zodSchema = z.enum([ - "read", - "write", -]); - -export type SharedWith = { - userId?: string | undefined; - accessLevel?: AccessLevel | undefined; -}; - -export const SharedWith$zodSchema: z.ZodType = z.object({ - accessLevel: AccessLevel$zodSchema.optional(), - userId: z.string().optional(), -}); - -/** - * A conversation represents a chat session between a user and the AI. - * - * @remarks - * Conversations maintain context across multiple messages and can be - * shared, archived, and organized. - */ -export type Conversation = { - _id?: string | undefined; - userId?: string | undefined; - orgId?: string | undefined; - title?: string | undefined; - initiator?: string | undefined; - messages?: Array | undefined; - status?: ConversationStatus | undefined; - failReason?: string | undefined; - modelInfo?: ModelInfo | undefined; - isShared?: boolean | undefined; - shareLink?: string | undefined; - sharedWith?: Array | undefined; - isArchived?: boolean | undefined; - archivedBy?: string | undefined; - lastActivityAt?: number | undefined; - createdAt?: string | undefined; - updatedAt?: string | undefined; -}; - -export const Conversation$zodSchema: z.ZodType = z.object({ - _id: z.string().optional(), - archivedBy: z.string().optional(), - createdAt: z.iso.datetime({ offset: true }).optional(), - failReason: z.string().optional(), - initiator: z.string().optional(), - isArchived: z.boolean().default(false), - isShared: z.boolean().default(false), - lastActivityAt: z.int().optional(), - messages: z.array(Message$zodSchema).optional(), - modelInfo: z.lazy(() => ModelInfo$zodSchema).optional(), - orgId: z.string().optional(), - shareLink: z.string().optional(), - sharedWith: z.array(z.lazy(() => SharedWith$zodSchema)).optional(), - status: ConversationStatus$zodSchema.optional(), - title: z.string().optional(), - updatedAt: z.iso.datetime({ offset: true }).optional(), - userId: z.string().optional(), -}).describe( - "A conversation represents a chat session between a user and the AI.\nConversations maintain context across multiple messages and can be\nshared, archived, and organized.\n", -); diff --git a/src/models/conversationlistitem.ts b/src/models/conversationlistitem.ts new file mode 100644 index 00000000..36c6b5f0 --- /dev/null +++ b/src/models/conversationlistitem.ts @@ -0,0 +1,160 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +export const ConversationListItemStatus = { + None: "None", + Inprogress: "Inprogress", + Complete: "Complete", + Failed: "Failed", +} as const; +export type ConversationListItemStatus = ClosedEnum< + typeof ConversationListItemStatus +>; + +export const ConversationListItemStatus$zodSchema = z.enum([ + "None", + "Inprogress", + "Complete", + "Failed", +]); + +export type ModelInfo = { + modelKey?: string | undefined; + modelName?: string | undefined; + modelFriendlyName?: string | undefined; + modelProvider?: string | undefined; + chatMode?: string | undefined; +}; + +export const ModelInfo$zodSchema: z.ZodType = z.object({ + chatMode: z.string().optional(), + modelFriendlyName: z.string().optional(), + modelKey: z.string().optional(), + modelName: z.string().optional(), + modelProvider: z.string().optional(), +}); + +export const ConversationListItemSharedWithAccessLevel = { + Read: "read", + Write: "write", +} as const; +export type ConversationListItemSharedWithAccessLevel = ClosedEnum< + typeof ConversationListItemSharedWithAccessLevel +>; + +export const ConversationListItemSharedWithAccessLevel$zodSchema = z.enum([ + "read", + "write", +]); + +export type ConversationListItemSharedWith = { + userId?: string | undefined; + accessLevel?: ConversationListItemSharedWithAccessLevel | undefined; +}; + +export const ConversationListItemSharedWith$zodSchema: z.ZodType< + ConversationListItemSharedWith +> = z.object({ + accessLevel: ConversationListItemSharedWithAccessLevel$zodSchema.optional(), + userId: z.string().optional(), +}); + +export type ConversationListItemConversationError = { + message?: string | undefined; + errorType?: string | undefined; + timestamp?: string | undefined; + messageId?: string | undefined; + stack?: string | undefined; + metadata?: { [k: string]: any } | undefined; +}; + +export const ConversationListItemConversationError$zodSchema: z.ZodType< + ConversationListItemConversationError +> = z.object({ + errorType: z.string().optional(), + message: z.string().optional(), + messageId: z.string().optional(), + metadata: z.record(z.string(), z.any()).optional(), + stack: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }).optional(), +}); + +export const ConversationListItemAccessLevel = { + Read: "read", + Write: "write", +} as const; +export type ConversationListItemAccessLevel = ClosedEnum< + typeof ConversationListItemAccessLevel +>; + +export const ConversationListItemAccessLevel$zodSchema = z.enum([ + "read", + "write", +]); + +/** + * Conversation summary returned by list endpoints. Identical to + * + * @remarks + * `Conversation` but omits `messages` to keep list payloads small. + * Fetch a single conversation to retrieve its messages. + */ +export type ConversationListItem = { + _id?: string | undefined; + userId?: string | undefined; + orgId?: string | undefined; + title?: string | undefined; + initiator?: string | undefined; + status?: ConversationListItemStatus | undefined; + failReason?: string | undefined; + modelInfo?: ModelInfo | undefined; + isShared?: boolean | undefined; + shareLink?: string | undefined; + sharedWith?: Array | undefined; + isArchived?: boolean | undefined; + archivedBy?: string | null | undefined; + isDeleted?: boolean | undefined; + deletedBy?: string | undefined; + conversationErrors?: Array | undefined; + metadata?: { [k: string]: any } | undefined; + lastActivityAt?: number | undefined; + createdAt?: string | undefined; + updatedAt?: string | undefined; + isOwner?: boolean | undefined; + accessLevel?: ConversationListItemAccessLevel | undefined; +}; + +export const ConversationListItem$zodSchema: z.ZodType = z + .object({ + _id: z.string().optional(), + accessLevel: ConversationListItemAccessLevel$zodSchema.optional(), + archivedBy: z.string().nullable().optional(), + conversationErrors: z.array( + z.lazy(() => ConversationListItemConversationError$zodSchema), + ).optional(), + createdAt: z.iso.datetime({ offset: true }).optional(), + deletedBy: z.string().optional(), + failReason: z.string().optional(), + initiator: z.string().optional(), + isArchived: z.boolean().optional(), + isDeleted: z.boolean().optional(), + isOwner: z.boolean().optional(), + isShared: z.boolean().optional(), + lastActivityAt: z.int().optional(), + metadata: z.record(z.string(), z.any()).optional(), + modelInfo: z.lazy(() => ModelInfo$zodSchema).optional(), + orgId: z.string().optional(), + shareLink: z.string().optional(), + sharedWith: z.array(z.lazy(() => ConversationListItemSharedWith$zodSchema)) + .optional(), + status: ConversationListItemStatus$zodSchema.optional(), + title: z.string().optional(), + updatedAt: z.iso.datetime({ offset: true }).optional(), + userId: z.string().optional(), + }).describe( + "Conversation summary returned by list endpoints. Identical to\n`Conversation` but omits `messages` to keep list payloads small.\nFetch a single conversation to retrieve its messages.\n", + ); diff --git a/src/models/conversationmodelinfo.ts b/src/models/conversationmodelinfo.ts new file mode 100644 index 00000000..ef6e32b0 --- /dev/null +++ b/src/models/conversationmodelinfo.ts @@ -0,0 +1,27 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * AI model configuration recorded against a conversation or message. + */ +export type ConversationModelInfo = { + modelKey?: string | undefined; + modelName?: string | undefined; + modelProvider?: string | undefined; + modelFriendlyName?: string | undefined; + chatMode?: string | undefined; +}; + +export const ConversationModelInfo$zodSchema: z.ZodType = + z.object({ + chatMode: z.string().optional(), + modelFriendlyName: z.string().optional(), + modelKey: z.string().optional(), + modelName: z.string().optional(), + modelProvider: z.string().optional(), + }).describe( + "AI model configuration recorded against a conversation or message.", + ); diff --git a/src/models/conversationtitleupdaterequest.ts b/src/models/conversationtitleupdaterequest.ts new file mode 100644 index 00000000..20644511 --- /dev/null +++ b/src/models/conversationtitleupdaterequest.ts @@ -0,0 +1,13 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export type ConversationTitleUpdateRequest = { title: string }; + +export const ConversationTitleUpdateRequest$zodSchema: z.ZodType< + ConversationTitleUpdateRequest +> = z.object({ + title: z.string(), +}); diff --git a/src/models/createconversationrequest.ts b/src/models/createconversationrequest.ts deleted file mode 100644 index b4d29b71..00000000 --- a/src/models/createconversationrequest.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { Filters, Filters$zodSchema } from "./filters.js"; - -/** - * Request body for creating a new AI conversation.

- * - * @remarks - * Query Processing:
- * The query is processed through PipesHub's AI pipeline which: - *
    - *
  • Performs semantic search across indexed knowledge bases
  • - *
  • Retrieves relevant context from matching documents
  • - *
  • Generates a response with citations to source materials
  • - *
  • Suggests follow-up questions based on the conversation
  • - *
- */ -export type CreateConversationRequest = { - query: string; - recordIds?: Array | undefined; - previousConversations?: Array<{ [k: string]: any }> | undefined; - departments?: Array | undefined; - filters?: Filters | undefined; - modelKey?: string | undefined; - modelName?: string | undefined; - modelFriendlyName?: string | undefined; - modelProvider?: string | undefined; - chatMode?: string | undefined; - conversationId?: string | undefined; - timezone?: string | undefined; - currentTime?: string | undefined; -}; - -export const CreateConversationRequest$zodSchema: z.ZodType< - CreateConversationRequest -> = z.object({ - chatMode: z.string().optional(), - conversationId: z.string().optional(), - currentTime: z.iso.datetime({ offset: true }).optional(), - departments: z.array(z.string()).optional(), - filters: Filters$zodSchema.optional(), - modelFriendlyName: z.string().optional(), - modelKey: z.string().optional(), - modelName: z.string().optional(), - modelProvider: z.string().optional(), - previousConversations: z.array(z.record(z.string(), z.any())).optional(), - query: z.string(), - recordIds: z.array(z.string()).optional(), - timezone: z.string().optional(), -}).describe( - "Request body for creating a new AI conversation.

\nQuery Processing:
\nThe query is processed through PipesHub's AI pipeline which:\n
    \n
  • Performs semantic search across indexed knowledge bases
  • \n
  • Retrieves relevant context from matching documents
  • \n
  • Generates a response with citations to source materials
  • \n
  • Suggests follow-up questions based on the conversation
  • \n
\n", -); diff --git a/src/models/createoauthappop.ts b/src/models/createoauthappop.ts new file mode 100644 index 00000000..0e4c3456 --- /dev/null +++ b/src/models/createoauthappop.ts @@ -0,0 +1,30 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + ApplicationJsonErrorResponse, + ApplicationJsonErrorResponse$zodSchema, +} from "./applicationjsonerrorresponse.js"; +import { + CreateOAuthAppResponse, + CreateOAuthAppResponse$zodSchema, +} from "./createoauthappresponse.js"; +import { + OAuthClientManagementRateLimitError, + OAuthClientManagementRateLimitError$zodSchema, +} from "./oauthclientmanagementratelimiterror.js"; + +export type CreateOAuthAppResponseResponse = + | CreateOAuthAppResponse + | ApplicationJsonErrorResponse + | OAuthClientManagementRateLimitError; + +export const CreateOAuthAppResponseResponse$zodSchema: z.ZodType< + CreateOAuthAppResponseResponse +> = z.union([ + CreateOAuthAppResponse$zodSchema, + ApplicationJsonErrorResponse$zodSchema, + OAuthClientManagementRateLimitError$zodSchema, +]); diff --git a/src/models/createoauthapprequest.ts b/src/models/createoauthapprequest.ts new file mode 100644 index 00000000..e95312f0 --- /dev/null +++ b/src/models/createoauthapprequest.ts @@ -0,0 +1,65 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +export const CreateOAuthAppRequestAllowedGrantType = { + AuthorizationCode: "authorization_code", + ClientCredentials: "client_credentials", + RefreshToken: "refresh_token", +} as const; +export type CreateOAuthAppRequestAllowedGrantType = ClosedEnum< + typeof CreateOAuthAppRequestAllowedGrantType +>; + +export const CreateOAuthAppRequestAllowedGrantType$zodSchema = z.enum([ + "authorization_code", + "client_credentials", + "refresh_token", +]); + +/** + * Request to create a new OAuth app (`createAppSchema` in `oauth.validators.ts`). + * + * @remarks + * + * **Required:** `name`, `allowedScopes`. **Optional:** `description`, `redirectUris`, `allowedGrantTypes`, + * `homepageUrl`, `privacyPolicyUrl`, `termsOfServiceUrl`, `isConfidential`, `accessTokenLifetime`, `refreshTokenLifetime`. + * + * **Redirect rule (Zod refine):** If the effective grant list includes `authorization_code` + * (including when `allowedGrantTypes` is omitted — defaults to `authorization_code` + `refresh_token`), + * at least one redirect URI is required. If grants exclude `authorization_code`, `redirectUris` may be omitted. + */ +export type CreateOAuthAppRequest = { + name: string; + description?: string | undefined; + redirectUris?: Array | undefined; + allowedGrantTypes?: Array | undefined; + allowedScopes: Array; + homepageUrl?: string | undefined; + privacyPolicyUrl?: string | undefined; + termsOfServiceUrl?: string | undefined; + isConfidential?: boolean | undefined; + accessTokenLifetime?: number | undefined; + refreshTokenLifetime?: number | undefined; +}; + +export const CreateOAuthAppRequest$zodSchema: z.ZodType = + z.object({ + accessTokenLifetime: z.int().default(3600), + allowedGrantTypes: z.array(CreateOAuthAppRequestAllowedGrantType$zodSchema) + .optional(), + allowedScopes: z.array(z.string()), + description: z.string().optional(), + homepageUrl: z.string().optional(), + isConfidential: z.boolean().default(true), + name: z.string(), + privacyPolicyUrl: z.string().optional(), + redirectUris: z.array(z.string()).optional(), + refreshTokenLifetime: z.int().default(2592000), + termsOfServiceUrl: z.string().optional(), + }).describe( + "Request to create a new OAuth app (`createAppSchema` in `oauth.validators.ts`).\n\n**Required:** `name`, `allowedScopes`. **Optional:** `description`, `redirectUris`, `allowedGrantTypes`,\n`homepageUrl`, `privacyPolicyUrl`, `termsOfServiceUrl`, `isConfidential`, `accessTokenLifetime`, `refreshTokenLifetime`.\n\n**Redirect rule (Zod refine):** If the effective grant list includes `authorization_code`\n(including when `allowedGrantTypes` is omitted — defaults to `authorization_code` + `refresh_token`),\nat least one redirect URI is required. If grants exclude `authorization_code`, `redirectUris` may be omitted.\n", + ); diff --git a/src/models/createoauthappresponse.ts b/src/models/createoauthappresponse.ts new file mode 100644 index 00000000..bb86ef41 --- /dev/null +++ b/src/models/createoauthappresponse.ts @@ -0,0 +1,29 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + OAuthAppWithSecret, + OAuthAppWithSecret$zodSchema, +} from "./oauthappwithsecret.js"; + +/** + * Response body for `POST /oauth-clients` (`oauth.app.controller.ts` `createApp`). + * + * @remarks + * The new app (including one-time `clientSecret`) is nested under `app`. + */ +export type CreateOAuthAppResponse = { + message: string; + app: OAuthAppWithSecret; +}; + +export const CreateOAuthAppResponse$zodSchema: z.ZodType< + CreateOAuthAppResponse +> = z.object({ + app: OAuthAppWithSecret$zodSchema, + message: z.string(), +}).describe( + "Response body for `POST /oauth-clients` (`oauth.app.controller.ts` `createApp`).\nThe new app (including one-time `clientSecret`) is nested under `app`.\n", +); diff --git a/src/models/deleteagentconversationbyidop.ts b/src/models/deleteagentconversationbyidop.ts new file mode 100644 index 00000000..ad6cffa0 --- /dev/null +++ b/src/models/deleteagentconversationbyidop.ts @@ -0,0 +1,33 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AgentConversationDeleteResponse, + AgentConversationDeleteResponse$zodSchema, +} from "./agentconversationdeleteresponse.js"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; + +export type DeleteAgentConversationByIdRequest = { + agentKey: string; + conversationId: string; +}; + +export const DeleteAgentConversationByIdRequest$zodSchema: z.ZodType< + DeleteAgentConversationByIdRequest +> = z.object({ + agentKey: z.string(), + conversationId: z.string(), +}); + +export type DeleteAgentConversationByIdResponse = + | AgentConversationDeleteResponse + | ErrorResponse; + +export const DeleteAgentConversationByIdResponse$zodSchema: z.ZodType< + DeleteAgentConversationByIdResponse +> = z.union([ + AgentConversationDeleteResponse$zodSchema, + ErrorResponse$zodSchema, +]); diff --git a/src/models/deleteagentconversationchatattachmentop.ts b/src/models/deleteagentconversationchatattachmentop.ts new file mode 100644 index 00000000..61e51e9c --- /dev/null +++ b/src/models/deleteagentconversationchatattachmentop.ts @@ -0,0 +1,30 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export type DeleteAgentConversationChatAttachmentRequest = { + agentKey: string; + recordId: string; +}; + +export const DeleteAgentConversationChatAttachmentRequest$zodSchema: z.ZodType< + DeleteAgentConversationChatAttachmentRequest +> = z.object({ + agentKey: z.string().describe("Agent key path parameter. Must be non-empty."), + recordId: z.string().describe( + "Attachment record id (from the upload response). Must be non-blank after trim.", + ), +}); + +/** + * Invalid or blank path params (`agentKey` or `recordId`). + */ +export type DeleteAgentConversationChatAttachmentResponse = { error: string }; + +export const DeleteAgentConversationChatAttachmentResponse$zodSchema: z.ZodType< + DeleteAgentConversationChatAttachmentResponse +> = z.object({ + error: z.string(), +}).describe("Invalid or blank path params (`agentKey` or `recordId`)."); diff --git a/src/models/deleteagentop.ts b/src/models/deleteagentop.ts new file mode 100644 index 00000000..dbef96c9 --- /dev/null +++ b/src/models/deleteagentop.ts @@ -0,0 +1,27 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AgentDeleteResponse, + AgentDeleteResponse$zodSchema, +} from "./agentdeleteresponse.js"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; + +export type DeleteAgentRequest = { agentKey: string }; + +export const DeleteAgentRequest$zodSchema: z.ZodType = z + .object({ + agentKey: z.string().describe( + "Unique agent identifier (gateway Zod requires non-empty string).", + ), + }); + +export type DeleteAgentResponse = AgentDeleteResponse | ErrorResponse; + +export const DeleteAgentResponse$zodSchema: z.ZodType = z + .union([ + AgentDeleteResponse$zodSchema, + ErrorResponse$zodSchema, + ]); diff --git a/src/models/deleteconversationbyidop.ts b/src/models/deleteconversationbyidop.ts new file mode 100644 index 00000000..34066ff6 --- /dev/null +++ b/src/models/deleteconversationbyidop.ts @@ -0,0 +1,68 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +export type DeleteConversationByIdRequest = { conversationId: string }; + +export const DeleteConversationByIdRequest$zodSchema: z.ZodType< + DeleteConversationByIdRequest +> = z.object({ + conversationId: z.string().describe("Unique conversation identifier"), +}); + +/** + * Outcome of the operation + */ +export const DeleteConversationByIdStatus = { + Deleted: "deleted", +} as const; +/** + * Outcome of the operation + */ +export type DeleteConversationByIdStatus = ClosedEnum< + typeof DeleteConversationByIdStatus +>; + +export const DeleteConversationByIdStatus$zodSchema = z.enum([ + "deleted", +]).describe("Outcome of the operation"); + +export type DeleteConversationByIdMeta = { + requestId?: string | undefined; + timestamp?: string | undefined; + duration?: number | undefined; +}; + +export const DeleteConversationByIdMeta$zodSchema: z.ZodType< + DeleteConversationByIdMeta +> = z.object({ + duration: z.int().optional(), + requestId: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }).optional(), +}); + +/** + * Conversation deleted successfully + */ +export type DeleteConversationByIdResponse = { + id?: string | undefined; + status?: DeleteConversationByIdStatus | undefined; + deletedAt?: string | undefined; + deletedBy?: string | undefined; + citationsDeleted?: number | undefined; + meta?: DeleteConversationByIdMeta | undefined; +}; + +export const DeleteConversationByIdResponse$zodSchema: z.ZodType< + DeleteConversationByIdResponse +> = z.object({ + citationsDeleted: z.int().optional(), + deletedAt: z.iso.datetime({ offset: true }).optional(), + deletedBy: z.string().optional(), + id: z.string().optional(), + meta: z.lazy(() => DeleteConversationByIdMeta$zodSchema).optional(), + status: DeleteConversationByIdStatus$zodSchema.optional(), +}).describe("Conversation deleted successfully"); diff --git a/src/models/deleteoauthappop.ts b/src/models/deleteoauthappop.ts new file mode 100644 index 00000000..4b6b08c8 --- /dev/null +++ b/src/models/deleteoauthappop.ts @@ -0,0 +1,44 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + ApplicationJsonErrorResponse, + ApplicationJsonErrorResponse$zodSchema, +} from "./applicationjsonerrorresponse.js"; +import { + OAuthClientManagementRateLimitError, + OAuthClientManagementRateLimitError$zodSchema, +} from "./oauthclientmanagementratelimiterror.js"; + +export type DeleteOAuthAppRequest = { appId: string }; + +export const DeleteOAuthAppRequest$zodSchema: z.ZodType = + z.object({ + appId: z.string().describe("OAuth app ID"), + }); + +/** + * OAuth app deleted + */ +export type DeleteOAuthAppResponseBody = { message?: string | undefined }; + +export const DeleteOAuthAppResponseBody$zodSchema: z.ZodType< + DeleteOAuthAppResponseBody +> = z.object({ + message: z.string().optional(), +}).describe("OAuth app deleted"); + +export type DeleteOAuthAppResponse = + | ApplicationJsonErrorResponse + | OAuthClientManagementRateLimitError + | DeleteOAuthAppResponseBody; + +export const DeleteOAuthAppResponse$zodSchema: z.ZodType< + DeleteOAuthAppResponse +> = z.union([ + ApplicationJsonErrorResponse$zodSchema, + OAuthClientManagementRateLimitError$zodSchema, + z.lazy(() => DeleteOAuthAppResponseBody$zodSchema), +]); diff --git a/src/models/deletesearchbyidop.ts b/src/models/deletesearchbyidop.ts new file mode 100644 index 00000000..98972b76 --- /dev/null +++ b/src/models/deletesearchbyidop.ts @@ -0,0 +1,68 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +/** + * Additional `isShared` filter (`'true'` / `'false'`). The row is + * + * @remarks + * only deleted if it also matches this value. + */ +export const DeleteSearchByIdShared = { + True: "true", + False: "false", +} as const; +/** + * Additional `isShared` filter (`'true'` / `'false'`). The row is + * + * @remarks + * only deleted if it also matches this value. + */ +export type DeleteSearchByIdShared = ClosedEnum; + +export const DeleteSearchByIdShared$zodSchema = z.enum([ + "true", + "false", +]).describe( + "Additional `isShared` filter (`'true'` / `'false'`). The row is\nonly deleted if it also matches this value.\n", +); + +export type DeleteSearchByIdRequest = { + searchId: string; + search?: string | undefined; + shared?: DeleteSearchByIdShared | undefined; + startDate?: string | undefined; + endDate?: string | undefined; +}; + +export const DeleteSearchByIdRequest$zodSchema: z.ZodType< + DeleteSearchByIdRequest +> = z.object({ + endDate: z.iso.datetime({ offset: true }).describe( + "ISO 8601 upper bound for `createdAt`. The row is only deleted\nif its `createdAt` is on or before this value.\n", + ).optional(), + search: z.string().describe( + "Additional substring filter against `title` / `messages.content`.\nThe row is only deleted if the `searchId` row also matches this\nfilter; otherwise `404`. Special regex characters are escaped;\nvalues over 1000 chars or tripping the XSS guard yield `400`.\n", + ).optional(), + searchId: z.string().describe( + "ObjectId of the persisted search row to delete.", + ), + shared: DeleteSearchByIdShared$zodSchema.optional(), + startDate: z.iso.datetime({ offset: true }).describe( + "ISO 8601 lower bound for `createdAt`. The row is only deleted\nif its `createdAt` is on or after this value.\n", + ).optional(), +}); + +/** + * Search deleted successfully. + */ +export type DeleteSearchByIdResponse = { message: string }; + +export const DeleteSearchByIdResponse$zodSchema: z.ZodType< + DeleteSearchByIdResponse +> = z.object({ + message: z.string(), +}).describe("Search deleted successfully."); diff --git a/src/models/deletesearchhistoryop.ts b/src/models/deletesearchhistoryop.ts new file mode 100644 index 00000000..d4a101a6 --- /dev/null +++ b/src/models/deletesearchhistoryop.ts @@ -0,0 +1,66 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +/** + * Restrict the deletion to rows with this `isShared` value + * + * @remarks + * (`'true'` / `'false'`). + */ +export const DeleteSearchHistoryShared = { + True: "true", + False: "false", +} as const; +/** + * Restrict the deletion to rows with this `isShared` value + * + * @remarks + * (`'true'` / `'false'`). + */ +export type DeleteSearchHistoryShared = ClosedEnum< + typeof DeleteSearchHistoryShared +>; + +export const DeleteSearchHistoryShared$zodSchema = z.enum([ + "true", + "false", +]).describe( + "Restrict the deletion to rows with this `isShared` value\n(`'true'` / `'false'`).\n", +); + +export type DeleteSearchHistoryRequest = { + search?: string | undefined; + shared?: DeleteSearchHistoryShared | undefined; + startDate?: string | undefined; + endDate?: string | undefined; +}; + +export const DeleteSearchHistoryRequest$zodSchema: z.ZodType< + DeleteSearchHistoryRequest +> = z.object({ + endDate: z.iso.datetime({ offset: true }).describe( + "ISO 8601 upper bound for `createdAt`.", + ).optional(), + search: z.string().describe( + "Restrict the deletion to rows whose `title` or `messages.content`\nmatches this case-insensitive substring. Special regex characters\nare escaped before the lookup; values over 1000 chars are\nrejected with `400`.\n", + ).optional(), + shared: DeleteSearchHistoryShared$zodSchema.optional(), + startDate: z.iso.datetime({ offset: true }).describe( + "ISO 8601 lower bound for `createdAt`. Combined with `endDate`\nto scope which rows are deleted.\n", + ).optional(), +}); + +/** + * Search history deleted successfully. + */ +export type DeleteSearchHistoryResponse = { message: string }; + +export const DeleteSearchHistoryResponse$zodSchema: z.ZodType< + DeleteSearchHistoryResponse +> = z.object({ + message: z.string(), +}).describe("Search history deleted successfully."); diff --git a/src/models/errorresponse.ts b/src/models/errorresponse.ts new file mode 100644 index 00000000..0ac3456b --- /dev/null +++ b/src/models/errorresponse.ts @@ -0,0 +1,34 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export type ErrorResponseError = { + code: string; + message: string; + metadata?: { [k: string]: any } | undefined; +}; + +export const ErrorResponseError$zodSchema: z.ZodType = z + .object({ + code: z.string(), + message: z.string(), + metadata: z.record(z.string(), z.any()).optional(), + }); + +/** + * Standard error envelope returned by all errors routed through `ErrorMiddleware`. + * + * @remarks + * Applies to all `BaseError` subclasses including `HttpError`, `ValidationError`, and others. + * The `code` field is a machine-readable string identifying the error type (e.g. + * `HTTP_UNAUTHORIZED`, `HTTP_NOT_FOUND`, `VALIDATION_ERROR`, `INTERNAL_ERROR`). + */ +export type ErrorResponse = { error: ErrorResponseError }; + +export const ErrorResponse$zodSchema: z.ZodType = z.object({ + error: z.lazy(() => ErrorResponseError$zodSchema), +}).describe( + "Standard error envelope returned by all errors routed through `ErrorMiddleware`.\nApplies to all `BaseError` subclasses including `HttpError`, `ValidationError`, and others.\nThe `code` field is a machine-readable string identifying the error type (e.g.\n`HTTP_UNAUTHORIZED`, `HTTP_NOT_FOUND`, `VALIDATION_ERROR`, `INTERNAL_ERROR`).\n", +); diff --git a/src/models/filteroption.ts b/src/models/filteroption.ts index aed5b941..a71d2013 100644 --- a/src/models/filteroption.ts +++ b/src/models/filteroption.ts @@ -5,18 +5,18 @@ import * as z from "zod"; /** - * A single filter option for knowledge hub filters + * A single filter option for knowledge hub filters. */ export type FilterOption = { - id?: string | undefined; - label?: string | undefined; + id: string; + label: string; type?: string | null | undefined; connectorType?: string | null | undefined; }; export const FilterOption$zodSchema: z.ZodType = z.object({ connectorType: z.string().nullable().optional(), - id: z.string().optional(), - label: z.string().optional(), + id: z.string(), + label: z.string(), type: z.string().nullable().optional(), -}).describe("A single filter option for knowledge hub filters"); +}).describe("A single filter option for knowledge hub filters."); diff --git a/src/models/filters.ts b/src/models/filters.ts index 9b73ed91..cb0b9753 100644 --- a/src/models/filters.ts +++ b/src/models/filters.ts @@ -5,24 +5,14 @@ import * as z from "zod"; /** - * Source-scoping for a chat turn. **All scoping ids go in `apps`** — + * App connector instance ids and knowledge-base / record-group ids that narrow retrieval * * @remarks - * both connector instance UUIDs (e.g. a specific Box / Drive / Confluence - * connection) and the synthetic knowledge-base id - * `knowledgeBase_` (used to include the org's knowledge base - * as a source). The separate `kb` field is preserved for - * backwards-compat but the server-side flow funnels everything - * through `apps`; leave `kb` as `[]`.

- * **NOT connector type names** — do NOT pass `"drive"`, `"gmail"`, - * etc. Get connector instance UUIDs from - * `GET /connectors/active` (field `_id`).

- * For **org assistant** chats, send explicit `apps` lists. For - * **agent** chats, send explicit id lists, or **omit** `filters` - * (and `tools`) to let the service use the agent's stored knowledge - * and tool configuration. Sending `{ "apps": [], "kb": [] }` on an - * agent chat means **no** knowledge sources for that turn (it is - * not "full org default"). + * for a turn. For **org assistant** chat streams, send explicit `apps` / `kb` lists. + * For **agent** chat streams, send explicit id lists, or **omit** `filters` (and `tools`) + * to let the service use the agent’s stored knowledge and tool configuration. Sending + * `{ "apps": [], "kb": [] }` on an agent stream means **no** knowledge sources for that + * turn (it is not “full org default”). */ export type Filters = { apps?: Array | undefined; @@ -33,5 +23,5 @@ export const Filters$zodSchema: z.ZodType = z.object({ apps: z.array(z.string()).optional(), kb: z.array(z.string()).optional(), }).describe( - "Source-scoping for a chat turn. **All scoping ids go in `apps`** —\nboth connector instance UUIDs (e.g. a specific Box / Drive / Confluence\nconnection) and the synthetic knowledge-base id\n`knowledgeBase_` (used to include the org's knowledge base\nas a source). The separate `kb` field is preserved for\nbackwards-compat but the server-side flow funnels everything\nthrough `apps`; leave `kb` as `[]`.

\n**NOT connector type names** — do NOT pass `\"drive\"`, `\"gmail\"`,\netc. Get connector instance UUIDs from\n`GET /connectors/active` (field `_id`).

\nFor **org assistant** chats, send explicit `apps` lists. For\n**agent** chats, send explicit id lists, or **omit** `filters`\n(and `tools`) to let the service use the agent's stored knowledge\nand tool configuration. Sending `{ \"apps\": [], \"kb\": [] }` on an\nagent chat means **no** knowledge sources for that turn (it is\nnot \"full org default\").\n", + "App connector instance ids and knowledge-base / record-group ids that narrow retrieval\nfor a turn. For **org assistant** chat streams, send explicit `apps` / `kb` lists.\nFor **agent** chat streams, send explicit id lists, or **omit** `filters` (and `tools`)\nto let the service use the agent’s stored knowledge and tool configuration. Sending\n`{ \"apps\": [], \"kb\": [] }` on an agent stream means **no** knowledge sources for that\nturn (it is not “full org default”).\n", ); diff --git a/src/models/getagentconversationbyidop.ts b/src/models/getagentconversationbyidop.ts new file mode 100644 index 00000000..aa93abf4 --- /dev/null +++ b/src/models/getagentconversationbyidop.ts @@ -0,0 +1,103 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +/** + * Field to sort messages by + */ +export const GetAgentConversationByIdSortBy = { + CreatedAt: "createdAt", + MessageType: "messageType", + Content: "content", +} as const; +/** + * Field to sort messages by + */ +export type GetAgentConversationByIdSortBy = ClosedEnum< + typeof GetAgentConversationByIdSortBy +>; + +export const GetAgentConversationByIdSortBy$zodSchema = z.enum([ + "createdAt", + "messageType", + "content", +]).describe("Field to sort messages by"); + +/** + * Sort direction + */ +export const GetAgentConversationByIdSortOrder = { + Asc: "asc", + Desc: "desc", +} as const; +/** + * Sort direction + */ +export type GetAgentConversationByIdSortOrder = ClosedEnum< + typeof GetAgentConversationByIdSortOrder +>; + +export const GetAgentConversationByIdSortOrder$zodSchema = z.enum([ + "asc", + "desc", +]).describe("Sort direction"); + +/** + * Filter messages by type + */ +export const GetAgentConversationByIdMessageType = { + UserQuery: "user_query", + BotResponse: "bot_response", + Error: "error", + Feedback: "feedback", + System: "system", +} as const; +/** + * Filter messages by type + */ +export type GetAgentConversationByIdMessageType = ClosedEnum< + typeof GetAgentConversationByIdMessageType +>; + +export const GetAgentConversationByIdMessageType$zodSchema = z.enum([ + "user_query", + "bot_response", + "error", + "feedback", + "system", +]).describe("Filter messages by type"); + +export type GetAgentConversationByIdRequest = { + agentKey: string; + conversationId: string; + page?: number | undefined; + limit?: number | undefined; + sortBy?: GetAgentConversationByIdSortBy | undefined; + sortOrder?: GetAgentConversationByIdSortOrder | undefined; + startDate?: string | undefined; + endDate?: string | undefined; + messageType?: GetAgentConversationByIdMessageType | undefined; +}; + +export const GetAgentConversationByIdRequest$zodSchema: z.ZodType< + GetAgentConversationByIdRequest +> = z.object({ + agentKey: z.string(), + conversationId: z.string(), + endDate: z.iso.datetime({ offset: true }).describe( + "Filter messages created on or before this date", + ).optional(), + limit: z.int().default(20).describe("Number of messages per page"), + messageType: GetAgentConversationByIdMessageType$zodSchema.optional(), + page: z.int().default(1).describe( + "Page number for message pagination (1 = most recent batch)", + ), + sortBy: GetAgentConversationByIdSortBy$zodSchema.default("createdAt"), + sortOrder: GetAgentConversationByIdSortOrder$zodSchema.default("desc"), + startDate: z.iso.datetime({ offset: true }).describe( + "Filter messages created on or after this date", + ).optional(), +}); diff --git a/src/models/getagentop.ts b/src/models/getagentop.ts new file mode 100644 index 00000000..13ae19cc --- /dev/null +++ b/src/models/getagentop.ts @@ -0,0 +1,25 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; +import { + GetAgentResponse, + GetAgentResponse$zodSchema, +} from "./getagentresponse.js"; + +export type GetAgentRequest = { agentKey: string }; + +export const GetAgentRequest$zodSchema: z.ZodType = z.object({ + agentKey: z.string().describe("Unique agent identifier"), +}); + +export type GetAgentResponseResponse = GetAgentResponse | ErrorResponse; + +export const GetAgentResponseResponse$zodSchema: z.ZodType< + GetAgentResponseResponse +> = z.union([ + GetAgentResponse$zodSchema, + ErrorResponse$zodSchema, +]); diff --git a/src/models/getagentresponse.ts b/src/models/getagentresponse.ts new file mode 100644 index 00000000..7249f405 --- /dev/null +++ b/src/models/getagentresponse.ts @@ -0,0 +1,31 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { Agent, Agent$zodSchema } from "./agent.js"; + +/** + * Success envelope returned by `GET /agents/{agentKey}`. + * + * @remarks + * + * The Node gateway forwards the backend response as an envelope with a + * top-level status/message and the detailed agent projection nested under + * `agent`. + */ +export type GetAgentResponse = { + status: string; + message: string; + agent: Agent; +}; + +export const GetAgentResponse$zodSchema: z.ZodType = z.object( + { + agent: Agent$zodSchema, + message: z.string(), + status: z.string(), + }, +).describe( + "Success envelope returned by `GET /agents/{agentKey}`.\n\nThe Node gateway forwards the backend response as an envelope with a\ntop-level status/message and the detailed agent projection nested under\n`agent`.\n", +); diff --git a/src/models/getallconversationsop.ts b/src/models/getallconversationsop.ts new file mode 100644 index 00000000..fe06091d --- /dev/null +++ b/src/models/getallconversationsop.ts @@ -0,0 +1,585 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + ConversationListItem, + ConversationListItem$zodSchema, +} from "./conversationlistitem.js"; + +/** + * `owned` — owner list (`userId` filter only). + * + * @remarks + * `shared` — explicit share grant list (`isShared` + `sharedWith`). + * Defaults to `owned` when omitted. + */ +export const QueryParamSource = { + Owned: "owned", + Shared: "shared", +} as const; +/** + * `owned` — owner list (`userId` filter only). + * + * @remarks + * `shared` — explicit share grant list (`isShared` + `sharedWith`). + * Defaults to `owned` when omitted. + */ +export type QueryParamSource = ClosedEnum; + +export const QueryParamSource$zodSchema = z.enum([ + "owned", + "shared", +]).describe( + "`owned` — owner list (`userId` filter only).\n`shared` — explicit share grant list (`isShared` + `sharedWith`).\nDefaults to `owned` when omitted.\n", +); + +/** + * Sort field. Invalid values fall back to `lastActivityAt`. + */ +export const GetAllConversationsSortByEnum = { + CreatedAt: "createdAt", + LastActivityAt: "lastActivityAt", + Title: "title", +} as const; +/** + * Sort field. Invalid values fall back to `lastActivityAt`. + */ +export type GetAllConversationsSortByEnum = ClosedEnum< + typeof GetAllConversationsSortByEnum +>; + +export const GetAllConversationsSortByEnum$zodSchema = z.enum([ + "createdAt", + "lastActivityAt", + "title", +]).describe("Sort field. Invalid values fall back to `lastActivityAt`."); + +/** + * Sort direction. Defaults to `desc` unless set to `asc`. + */ +export const GetAllConversationsSortOrderEnum = { + Asc: "asc", + Desc: "desc", +} as const; +/** + * Sort direction. Defaults to `desc` unless set to `asc`. + */ +export type GetAllConversationsSortOrderEnum = ClosedEnum< + typeof GetAllConversationsSortOrderEnum +>; + +export const GetAllConversationsSortOrderEnum$zodSchema = z.enum([ + "asc", + "desc", +]).describe("Sort direction. Defaults to `desc` unless set to `asc`."); + +export type GetAllConversationsRequest = { + source?: QueryParamSource | undefined; + page?: number | undefined; + limit?: number | undefined; + sortBy?: GetAllConversationsSortByEnum | undefined; + sortOrder?: GetAllConversationsSortOrderEnum | undefined; + conversationId?: string | undefined; + search?: string | undefined; + startDate?: string | undefined; + endDate?: string | undefined; + shared?: string | undefined; +}; + +export const GetAllConversationsRequest$zodSchema: z.ZodType< + GetAllConversationsRequest +> = z.object({ + conversationId: z.string().describe( + "When set, restricts results to that conversation ID (if visible under the chosen `source`).", + ).optional(), + endDate: z.iso.datetime({ offset: true }).describe( + "Filter by `createdAt` ≤ this ISO date.", + ).optional(), + limit: z.int().describe( + "Page size. Defaults to 20; capped by the server (max 100).", + ).optional(), + page: z.int().describe("Page number (1-based). Defaults to 1.").optional(), + search: z.string().describe( + "Case-insensitive match on title and message content (max 1000 characters).", + ).optional(), + shared: z.string().describe( + "When set, filters by `isShared`. Accepts case-insensitive\n`true`/`false`, or `1`/`0`.\n", + ).optional(), + sortBy: GetAllConversationsSortByEnum$zodSchema.optional(), + sortOrder: GetAllConversationsSortOrderEnum$zodSchema.optional(), + source: QueryParamSource$zodSchema.default("owned"), + startDate: z.iso.datetime({ offset: true }).describe( + "Filter by `createdAt` ≥ this ISO date.", + ).optional(), +}); + +/** + * Echoes the requested `source` query value. + */ +export const GetAllConversationsSourceResponse = { + Owned: "owned", + Shared: "shared", +} as const; +/** + * Echoes the requested `source` query value. + */ +export type GetAllConversationsSourceResponse = ClosedEnum< + typeof GetAllConversationsSourceResponse +>; + +export const GetAllConversationsSourceResponse$zodSchema = z.enum([ + "owned", + "shared", +]).describe("Echoes the requested `source` query value."); + +export type GetAllConversationsPagination = { + page?: number | undefined; + limit?: number | undefined; + totalCount?: number | undefined; + totalPages?: number | undefined; + hasNextPage?: boolean | undefined; + hasPrevPage?: boolean | undefined; +}; + +export const GetAllConversationsPagination$zodSchema: z.ZodType< + GetAllConversationsPagination +> = z.object({ + hasNextPage: z.boolean().optional(), + hasPrevPage: z.boolean().optional(), + limit: z.int().optional(), + page: z.int().optional(), + totalCount: z.int().optional(), + totalPages: z.int().optional(), +}); + +export type ValuesDateRange = { + start?: string | null | undefined; + end?: string | null | undefined; +}; + +export const ValuesDateRange$zodSchema: z.ZodType = z.object({ + end: z.string().nullable().optional(), + start: z.string().nullable().optional(), +}); + +/** + * Current value for each applied filter. Only keys + * + * @remarks + * present in `filters` are populated; others are + * omitted. + */ +export type GetAllConversationsValues = { + search?: string | undefined; + shared?: string | undefined; + tags?: string | undefined; + minMessages?: string | undefined; + sortBy?: string | undefined; + sortOrder?: string | undefined; + startDate?: string | undefined; + endDate?: string | undefined; + messageType?: string | undefined; + page?: number | undefined; + limit?: number | undefined; + dateRange?: ValuesDateRange | undefined; +}; + +export const GetAllConversationsValues$zodSchema: z.ZodType< + GetAllConversationsValues +> = z.object({ + dateRange: z.lazy(() => ValuesDateRange$zodSchema).optional(), + endDate: z.string().optional(), + limit: z.int().optional(), + messageType: z.string().optional(), + minMessages: z.string().optional(), + page: z.int().optional(), + search: z.string().optional(), + shared: z.string().optional(), + sortBy: z.string().optional(), + sortOrder: z.string().optional(), + startDate: z.string().optional(), + tags: z.string().optional(), +}).describe( + "Current value for each applied filter. Only keys\npresent in `filters` are populated; others are\nomitted.\n", +); + +export type GetAllConversationsApplied = { + filters: Array; + values: GetAllConversationsValues; +}; + +export const GetAllConversationsApplied$zodSchema: z.ZodType< + GetAllConversationsApplied +> = z.object({ + filters: z.array(z.string()), + values: z.lazy(() => GetAllConversationsValues$zodSchema), +}); + +export type GetAllConversationsShared = { + values?: Array | undefined; + description?: string | undefined; + current?: string | null | undefined; + applied?: boolean | undefined; +}; + +export const GetAllConversationsShared$zodSchema: z.ZodType< + GetAllConversationsShared +> = z.object({ + applied: z.boolean().optional(), + current: z.string().nullable().optional(), + description: z.string().optional(), + values: z.array(z.string()).optional(), +}); + +export type GetAllConversationsTags = { + type?: string | undefined; + description?: string | undefined; + current?: string | null | undefined; + applied?: boolean | undefined; +}; + +export const GetAllConversationsTags$zodSchema: z.ZodType< + GetAllConversationsTags +> = z.object({ + applied: z.boolean().optional(), + current: z.string().nullable().optional(), + description: z.string().optional(), + type: z.string().optional(), +}); + +export type GetAllConversationsMinMessages = { + type?: string | undefined; + description?: string | undefined; + current?: number | null | undefined; + applied?: boolean | undefined; +}; + +export const GetAllConversationsMinMessages$zodSchema: z.ZodType< + GetAllConversationsMinMessages +> = z.object({ + applied: z.boolean().optional(), + current: z.number().nullable().optional(), + description: z.string().optional(), + type: z.string().optional(), +}); + +export type GetAllConversationsSearch = { + type?: string | undefined; + description?: string | undefined; + current?: string | null | undefined; + applied?: boolean | undefined; +}; + +export const GetAllConversationsSearch$zodSchema: z.ZodType< + GetAllConversationsSearch +> = z.object({ + applied: z.boolean().optional(), + current: z.string().nullable().optional(), + description: z.string().optional(), + type: z.string().optional(), +}); + +export type GetAllConversationsPage = { + type?: string | undefined; + current?: number | undefined; + min?: number | undefined; + max?: number | undefined; + default?: number | undefined; + description?: string | undefined; + applied?: boolean | undefined; +}; + +export const GetAllConversationsPage$zodSchema: z.ZodType< + GetAllConversationsPage +> = z.object({ + applied: z.boolean().optional(), + current: z.int().optional(), + default: z.int().optional(), + description: z.string().optional(), + max: z.int().optional(), + min: z.int().optional(), + type: z.string().optional(), +}); + +export type GetAllConversationsLimit = { + type?: string | undefined; + current?: number | undefined; + min?: number | undefined; + max?: number | undefined; + default?: number | undefined; + description?: string | undefined; + applied?: boolean | undefined; +}; + +export const GetAllConversationsLimit$zodSchema: z.ZodType< + GetAllConversationsLimit +> = z.object({ + applied: z.boolean().optional(), + current: z.int().optional(), + default: z.int().optional(), + description: z.string().optional(), + max: z.int().optional(), + min: z.int().optional(), + type: z.string().optional(), +}); + +export type GetAllConversationsAvailablePagination = { + page?: GetAllConversationsPage | undefined; + limit?: GetAllConversationsLimit | undefined; +}; + +export const GetAllConversationsAvailablePagination$zodSchema: z.ZodType< + GetAllConversationsAvailablePagination +> = z.object({ + limit: z.lazy(() => GetAllConversationsLimit$zodSchema).optional(), + page: z.lazy(() => GetAllConversationsPage$zodSchema).optional(), +}); + +export type GetAllConversationsSortingSortBy = { + values?: Array | undefined; + default?: string | undefined; + description?: string | undefined; + current?: string | undefined; + applied?: boolean | undefined; +}; + +export const GetAllConversationsSortingSortBy$zodSchema: z.ZodType< + GetAllConversationsSortingSortBy +> = z.object({ + applied: z.boolean().optional(), + current: z.string().optional(), + default: z.string().optional(), + description: z.string().optional(), + values: z.array(z.string()).optional(), +}); + +export type GetAllConversationsSortingSortOrder = { + values?: Array | undefined; + default?: string | undefined; + description?: string | undefined; + current?: string | undefined; + applied?: boolean | undefined; +}; + +export const GetAllConversationsSortingSortOrder$zodSchema: z.ZodType< + GetAllConversationsSortingSortOrder +> = z.object({ + applied: z.boolean().optional(), + current: z.string().optional(), + default: z.string().optional(), + description: z.string().optional(), + values: z.array(z.string()).optional(), +}); + +export type GetAllConversationsSorting = { + sortBy?: GetAllConversationsSortingSortBy | undefined; + sortOrder?: GetAllConversationsSortingSortOrder | undefined; +}; + +export const GetAllConversationsSorting$zodSchema: z.ZodType< + GetAllConversationsSorting +> = z.object({ + sortBy: z.lazy(() => GetAllConversationsSortingSortBy$zodSchema).optional(), + sortOrder: z.lazy(() => GetAllConversationsSortingSortOrder$zodSchema) + .optional(), +}); + +export type GetAllConversationsCurrent = { + start?: string | null | undefined; + end?: string | null | undefined; +}; + +export const GetAllConversationsCurrent$zodSchema: z.ZodType< + GetAllConversationsCurrent +> = z.object({ + end: z.string().nullable().optional(), + start: z.string().nullable().optional(), +}); + +export type GetAllConversationsDateFiltersDateRange = { + type?: string | undefined; + description?: string | undefined; + format?: string | undefined; + current?: GetAllConversationsCurrent | undefined; + applied?: boolean | undefined; +}; + +export const GetAllConversationsDateFiltersDateRange$zodSchema: z.ZodType< + GetAllConversationsDateFiltersDateRange +> = z.object({ + applied: z.boolean().optional(), + current: z.lazy(() => GetAllConversationsCurrent$zodSchema).optional(), + description: z.string().optional(), + format: z.string().optional(), + type: z.string().optional(), +}); + +export type GetAllConversationsDateFilters = { + dateRange?: GetAllConversationsDateFiltersDateRange | undefined; +}; + +export const GetAllConversationsDateFilters$zodSchema: z.ZodType< + GetAllConversationsDateFilters +> = z.object({ + dateRange: z.lazy(() => GetAllConversationsDateFiltersDateRange$zodSchema) + .optional(), +}); + +export type GetAllConversationsMessageType = { + values?: Array | undefined; + description?: string | undefined; + current?: string | null | undefined; + applied?: boolean | undefined; +}; + +export const GetAllConversationsMessageType$zodSchema: z.ZodType< + GetAllConversationsMessageType +> = z.object({ + applied: z.boolean().optional(), + current: z.string().nullable().optional(), + description: z.string().optional(), + values: z.array(z.string()).optional(), +}); + +export type GetAllConversationsMessageFilters = { + messageType?: GetAllConversationsMessageType | undefined; +}; + +export const GetAllConversationsMessageFilters$zodSchema: z.ZodType< + GetAllConversationsMessageFilters +> = z.object({ + messageType: z.lazy(() => GetAllConversationsMessageType$zodSchema) + .optional(), +}); + +export type GetAllConversationsSortingMessagesSortBy = { + values?: Array | undefined; + default?: string | undefined; + description?: string | undefined; + current?: string | undefined; +}; + +export const GetAllConversationsSortingMessagesSortBy$zodSchema: z.ZodType< + GetAllConversationsSortingMessagesSortBy +> = z.object({ + current: z.string().optional(), + default: z.string().optional(), + description: z.string().optional(), + values: z.array(z.string()).optional(), +}); + +export type GetAllConversationsSortingMessagesSortOrder = { + values?: Array | undefined; + default?: string | undefined; + description?: string | undefined; + current?: string | undefined; +}; + +export const GetAllConversationsSortingMessagesSortOrder$zodSchema: z.ZodType< + GetAllConversationsSortingMessagesSortOrder +> = z.object({ + current: z.string().optional(), + default: z.string().optional(), + description: z.string().optional(), + values: z.array(z.string()).optional(), +}); + +export type GetAllConversationsSortingMessages = { + sortBy?: GetAllConversationsSortingMessagesSortBy | undefined; + sortOrder?: GetAllConversationsSortingMessagesSortOrder | undefined; +}; + +export const GetAllConversationsSortingMessages$zodSchema: z.ZodType< + GetAllConversationsSortingMessages +> = z.object({ + sortBy: z.lazy(() => GetAllConversationsSortingMessagesSortBy$zodSchema) + .optional(), + sortOrder: z.lazy(() => GetAllConversationsSortingMessagesSortOrder$zodSchema) + .optional(), +}); + +export type GetAllConversationsAvailable = { + shared: GetAllConversationsShared; + tags: GetAllConversationsTags; + minMessages: GetAllConversationsMinMessages; + search: GetAllConversationsSearch; + pagination: GetAllConversationsAvailablePagination; + sorting: GetAllConversationsSorting; + dateFilters: GetAllConversationsDateFilters; + messageFilters: GetAllConversationsMessageFilters; + sortingMessages: GetAllConversationsSortingMessages; +}; + +export const GetAllConversationsAvailable$zodSchema: z.ZodType< + GetAllConversationsAvailable +> = z.object({ + dateFilters: z.lazy(() => GetAllConversationsDateFilters$zodSchema), + messageFilters: z.lazy(() => GetAllConversationsMessageFilters$zodSchema), + minMessages: z.lazy(() => GetAllConversationsMinMessages$zodSchema), + pagination: z.lazy(() => GetAllConversationsAvailablePagination$zodSchema), + search: z.lazy(() => GetAllConversationsSearch$zodSchema), + shared: z.lazy(() => GetAllConversationsShared$zodSchema), + sorting: z.lazy(() => GetAllConversationsSorting$zodSchema), + sortingMessages: z.lazy(() => GetAllConversationsSortingMessages$zodSchema), + tags: z.lazy(() => GetAllConversationsTags$zodSchema), +}); + +/** + * Filter introspection block. `applied` summarises the + * + * @remarks + * filters active on this request; `available` catalogues + * every supported filter with its current value and whether + * it is applied. + */ +export type GetAllConversationsFilters = { + applied: GetAllConversationsApplied; + available: GetAllConversationsAvailable; +}; + +export const GetAllConversationsFilters$zodSchema: z.ZodType< + GetAllConversationsFilters +> = z.object({ + applied: z.lazy(() => GetAllConversationsApplied$zodSchema), + available: z.lazy(() => GetAllConversationsAvailable$zodSchema), +}).describe( + "Filter introspection block. `applied` summarises the\nfilters active on this request; `available` catalogues\nevery supported filter with its current value and whether\nit is applied.\n", +); + +export type GetAllConversationsMeta = { + requestId?: string | undefined; + timestamp?: string | undefined; + duration?: number | undefined; +}; + +export const GetAllConversationsMeta$zodSchema: z.ZodType< + GetAllConversationsMeta +> = z.object({ + duration: z.int().optional(), + requestId: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }).optional(), +}); + +/** + * List of conversations for the requested source + */ +export type GetAllConversationsResponse = { + conversations: Array; + source: GetAllConversationsSourceResponse; + pagination: GetAllConversationsPagination; + filters: GetAllConversationsFilters; + meta: GetAllConversationsMeta; +}; + +export const GetAllConversationsResponse$zodSchema: z.ZodType< + GetAllConversationsResponse +> = z.object({ + conversations: z.array(ConversationListItem$zodSchema), + filters: z.lazy(() => GetAllConversationsFilters$zodSchema), + meta: z.lazy(() => GetAllConversationsMeta$zodSchema), + pagination: z.lazy(() => GetAllConversationsPagination$zodSchema), + source: GetAllConversationsSourceResponse$zodSchema, +}).describe("List of conversations for the requested source"); diff --git a/src/models/getallusergroupsop.ts b/src/models/getallusergroupsop.ts deleted file mode 100644 index e6d3da23..00000000 --- a/src/models/getallusergroupsop.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; - -export type GetAllUserGroupsRequest = { - page?: number | undefined; - limit?: number | undefined; - search?: string | undefined; -}; - -export const GetAllUserGroupsRequest$zodSchema: z.ZodType< - GetAllUserGroupsRequest -> = z.object({ - limit: z.int().default(25).describe("Number of groups per page"), - page: z.int().default(1).describe("Page number (1-based)"), - search: z.string().describe("Search groups by name (case-insensitive)") - .optional(), -}); diff --git a/src/models/getallusersop.ts b/src/models/getallusersop.ts deleted file mode 100644 index 89a60a39..00000000 --- a/src/models/getallusersop.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; - -export type GetAllUsersRequest = { - page?: number | undefined; - limit?: number | undefined; - search?: string | undefined; -}; - -export const GetAllUsersRequest$zodSchema: z.ZodType = z - .object({ - limit: z.int().default(50).describe("Number of users per page."), - page: z.int().default(1).describe("Page number for pagination (1-based)."), - search: z.string().describe("Substring match against name or email.") - .optional(), - }); diff --git a/src/models/getarchivedconversationsop.ts b/src/models/getarchivedconversationsop.ts new file mode 100644 index 00000000..c0454dc6 --- /dev/null +++ b/src/models/getarchivedconversationsop.ts @@ -0,0 +1,777 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { Message, Message$zodSchema } from "./message.js"; + +/** + * Field to sort by + */ +export const GetArchivedConversationsSortByEnum = { + CreatedAt: "createdAt", + LastActivityAt: "lastActivityAt", + Title: "title", +} as const; +/** + * Field to sort by + */ +export type GetArchivedConversationsSortByEnum = ClosedEnum< + typeof GetArchivedConversationsSortByEnum +>; + +export const GetArchivedConversationsSortByEnum$zodSchema = z.enum([ + "createdAt", + "lastActivityAt", + "title", +]).describe("Field to sort by"); + +/** + * Sort direction + */ +export const GetArchivedConversationsSortOrderEnum = { + Asc: "asc", + Desc: "desc", +} as const; +/** + * Sort direction + */ +export type GetArchivedConversationsSortOrderEnum = ClosedEnum< + typeof GetArchivedConversationsSortOrderEnum +>; + +export const GetArchivedConversationsSortOrderEnum$zodSchema = z.enum([ + "asc", + "desc", +]).describe("Sort direction"); + +export type GetArchivedConversationsRequest = { + page?: number | undefined; + limit?: number | undefined; + sortBy?: GetArchivedConversationsSortByEnum | undefined; + sortOrder?: GetArchivedConversationsSortOrderEnum | undefined; + search?: string | undefined; + shared?: boolean | undefined; + startDate?: string | undefined; + endDate?: string | undefined; + conversationId?: string | undefined; +}; + +export const GetArchivedConversationsRequest$zodSchema: z.ZodType< + GetArchivedConversationsRequest +> = z.object({ + conversationId: z.string().describe( + "Restrict results to a single conversation by identifier", + ).optional(), + endDate: z.iso.datetime({ offset: true }).describe( + "Include conversations created on or before this timestamp", + ).optional(), + limit: z.int().default(20).describe("Items per page"), + page: z.int().default(1).describe("Page number (1-indexed)"), + search: z.string().describe( + "Case-insensitive substring match against title and message content (max 1000 chars)", + ).optional(), + shared: z.boolean().describe("Filter by shared status").optional(), + sortBy: GetArchivedConversationsSortByEnum$zodSchema.default( + "lastActivityAt", + ), + sortOrder: GetArchivedConversationsSortOrderEnum$zodSchema.default("desc"), + startDate: z.iso.datetime({ offset: true }).describe( + "Include conversations created on or after this timestamp", + ).optional(), +}); + +/** + * Current status of the conversation: + * + * @remarks + * - `None` — no activity yet + * - `Inprogress` — AI is processing + * - `Complete` — response ready + * - `Failed` — error occurred + */ +export const GetArchivedConversationsStatus = { + None: "None", + Inprogress: "Inprogress", + Complete: "Complete", + Failed: "Failed", +} as const; +/** + * Current status of the conversation: + * + * @remarks + * - `None` — no activity yet + * - `Inprogress` — AI is processing + * - `Complete` — response ready + * - `Failed` — error occurred + */ +export type GetArchivedConversationsStatus = ClosedEnum< + typeof GetArchivedConversationsStatus +>; + +export const GetArchivedConversationsStatus$zodSchema = z.enum([ + "None", + "Inprogress", + "Complete", + "Failed", +]).describe( + "Current status of the conversation:\n- `None` — no activity yet\n- `Inprogress` — AI is processing\n- `Complete` — response ready\n- `Failed` — error occurred\n", +); + +/** + * AI model configuration used + */ +export type GetArchivedConversationsModelInfo = { + modelKey?: string | undefined; + modelName?: string | undefined; + modelFriendlyName?: string | undefined; + modelProvider?: string | undefined; + chatMode?: string | undefined; +}; + +export const GetArchivedConversationsModelInfo$zodSchema: z.ZodType< + GetArchivedConversationsModelInfo +> = z.object({ + chatMode: z.string().optional(), + modelFriendlyName: z.string().optional(), + modelKey: z.string().optional(), + modelName: z.string().optional(), + modelProvider: z.string().optional(), +}).describe("AI model configuration used"); + +export const GetArchivedConversationsSharedWithAccessLevel = { + Read: "read", + Write: "write", +} as const; +export type GetArchivedConversationsSharedWithAccessLevel = ClosedEnum< + typeof GetArchivedConversationsSharedWithAccessLevel +>; + +export const GetArchivedConversationsSharedWithAccessLevel$zodSchema = z.enum([ + "read", + "write", +]); + +export type GetArchivedConversationsSharedWith = { + userId?: string | undefined; + accessLevel?: GetArchivedConversationsSharedWithAccessLevel | undefined; +}; + +export const GetArchivedConversationsSharedWith$zodSchema: z.ZodType< + GetArchivedConversationsSharedWith +> = z.object({ + accessLevel: GetArchivedConversationsSharedWithAccessLevel$zodSchema + .optional(), + userId: z.string().optional(), +}); + +export type GetArchivedConversationsConversationError = { + message: string; + errorType?: string | undefined; + timestamp?: string | undefined; + messageId?: string | undefined; + stack?: string | undefined; + metadata?: { [k: string]: any } | undefined; +}; + +export const GetArchivedConversationsConversationError$zodSchema: z.ZodType< + GetArchivedConversationsConversationError +> = z.object({ + errorType: z.string().optional(), + message: z.string(), + messageId: z.string().optional(), + metadata: z.record(z.string(), z.any()).optional(), + stack: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }).optional(), +}); + +/** + * Computed per request. The requester's effective access level: + * + * @remarks + * their entry in `sharedWith`, or `read` by default. + */ +export const GetArchivedConversationsAccessLevel = { + Read: "read", + Write: "write", +} as const; +/** + * Computed per request. The requester's effective access level: + * + * @remarks + * their entry in `sharedWith`, or `read` by default. + */ +export type GetArchivedConversationsAccessLevel = ClosedEnum< + typeof GetArchivedConversationsAccessLevel +>; + +export const GetArchivedConversationsAccessLevel$zodSchema = z.enum([ + "read", + "write", +]).describe( + "Computed per request. The requester's effective access level:\ntheir entry in `sharedWith`, or `read` by default.\n", +); + +/** + * A conversation represents a chat session between a user and the AI. + * + * @remarks + * Conversations maintain context across multiple messages and can be + * shared, archived, and organized. + */ +export type GetArchivedConversationsConversation = { + _id?: string | undefined; + userId?: string | undefined; + orgId?: string | undefined; + title?: string | undefined; + initiator?: string | undefined; + messages?: Array | undefined; + status?: GetArchivedConversationsStatus | undefined; + failReason?: string | undefined; + modelInfo?: GetArchivedConversationsModelInfo | undefined; + isShared?: boolean | undefined; + shareLink?: string | undefined; + sharedWith?: Array | undefined; + isArchived?: boolean | undefined; + archivedBy?: string | null | undefined; + isDeleted?: boolean | undefined; + deletedBy?: string | undefined; + conversationErrors?: + | Array + | undefined; + metadata?: { [k: string]: any } | undefined; + lastActivityAt?: number | undefined; + createdAt?: string | undefined; + updatedAt?: string | undefined; + isOwner?: boolean | undefined; + accessLevel?: GetArchivedConversationsAccessLevel | undefined; + archivedAt?: string | undefined; +}; + +export const GetArchivedConversationsConversation$zodSchema: z.ZodType< + GetArchivedConversationsConversation +> = z.object({ + _id: z.string().optional(), + accessLevel: GetArchivedConversationsAccessLevel$zodSchema.optional(), + archivedAt: z.iso.datetime({ offset: true }).optional(), + archivedBy: z.string().nullable().optional(), + conversationErrors: z.array( + z.lazy(() => GetArchivedConversationsConversationError$zodSchema), + ).optional(), + createdAt: z.iso.datetime({ offset: true }).optional(), + deletedBy: z.string().optional(), + failReason: z.string().optional(), + initiator: z.string().optional(), + isArchived: z.boolean().default(false), + isDeleted: z.boolean().default(false), + isOwner: z.boolean().optional(), + isShared: z.boolean().default(false), + lastActivityAt: z.int().optional(), + messages: z.array(Message$zodSchema).optional(), + metadata: z.record(z.string(), z.any()).optional(), + modelInfo: z.lazy(() => GetArchivedConversationsModelInfo$zodSchema) + .optional(), + orgId: z.string().optional(), + shareLink: z.string().optional(), + sharedWith: z.array( + z.lazy(() => GetArchivedConversationsSharedWith$zodSchema), + ).optional(), + status: GetArchivedConversationsStatus$zodSchema.optional(), + title: z.string().optional(), + updatedAt: z.iso.datetime({ offset: true }).optional(), + userId: z.string().optional(), +}).describe( + "A conversation represents a chat session between a user and the AI.\nConversations maintain context across multiple messages and can be\nshared, archived, and organized.\n", +); + +export type GetArchivedConversationsPagination = { + page?: number | undefined; + limit?: number | undefined; + totalCount?: number | undefined; + totalPages?: number | undefined; + hasNextPage?: boolean | undefined; + hasPrevPage?: boolean | undefined; +}; + +export const GetArchivedConversationsPagination$zodSchema: z.ZodType< + GetArchivedConversationsPagination +> = z.object({ + hasNextPage: z.boolean().optional(), + hasPrevPage: z.boolean().optional(), + limit: z.int().optional(), + page: z.int().optional(), + totalCount: z.int().optional(), + totalPages: z.int().optional(), +}); + +export type GetArchivedConversationsApplied = { + filters?: Array | undefined; + values?: { [k: string]: any } | undefined; +}; + +export const GetArchivedConversationsApplied$zodSchema: z.ZodType< + GetArchivedConversationsApplied +> = z.object({ + filters: z.array(z.string()).optional(), + values: z.record(z.string(), z.any()).optional(), +}); + +export type GetArchivedConversationsShared = { + values?: Array | undefined; + description?: string | undefined; + current?: string | null | undefined; + applied?: boolean | undefined; +}; + +export const GetArchivedConversationsShared$zodSchema: z.ZodType< + GetArchivedConversationsShared +> = z.object({ + applied: z.boolean().optional(), + current: z.string().nullable().optional(), + description: z.string().optional(), + values: z.array(z.string()).optional(), +}); + +export type GetArchivedConversationsTags = { + type?: string | undefined; + description?: string | undefined; + current?: string | null | undefined; + applied?: boolean | undefined; +}; + +export const GetArchivedConversationsTags$zodSchema: z.ZodType< + GetArchivedConversationsTags +> = z.object({ + applied: z.boolean().optional(), + current: z.string().nullable().optional(), + description: z.string().optional(), + type: z.string().optional(), +}); + +export type GetArchivedConversationsMinMessages = { + type?: string | undefined; + description?: string | undefined; + current?: number | null | undefined; + applied?: boolean | undefined; +}; + +export const GetArchivedConversationsMinMessages$zodSchema: z.ZodType< + GetArchivedConversationsMinMessages +> = z.object({ + applied: z.boolean().optional(), + current: z.int().nullable().optional(), + description: z.string().optional(), + type: z.string().optional(), +}); + +export type GetArchivedConversationsSearch = { + type?: string | undefined; + description?: string | undefined; + current?: string | null | undefined; + applied?: boolean | undefined; +}; + +export const GetArchivedConversationsSearch$zodSchema: z.ZodType< + GetArchivedConversationsSearch +> = z.object({ + applied: z.boolean().optional(), + current: z.string().nullable().optional(), + description: z.string().optional(), + type: z.string().optional(), +}); + +export type GetArchivedConversationsPage = { + type?: string | undefined; + current?: number | undefined; + min?: number | undefined; + max?: number | undefined; + default?: number | undefined; + description?: string | undefined; + applied?: boolean | undefined; +}; + +export const GetArchivedConversationsPage$zodSchema: z.ZodType< + GetArchivedConversationsPage +> = z.object({ + applied: z.boolean().optional(), + current: z.int().optional(), + default: z.int().optional(), + description: z.string().optional(), + max: z.int().optional(), + min: z.int().optional(), + type: z.string().optional(), +}); + +export type GetArchivedConversationsLimit = { + type?: string | undefined; + current?: number | undefined; + min?: number | undefined; + max?: number | undefined; + default?: number | undefined; + description?: string | undefined; + applied?: boolean | undefined; +}; + +export const GetArchivedConversationsLimit$zodSchema: z.ZodType< + GetArchivedConversationsLimit +> = z.object({ + applied: z.boolean().optional(), + current: z.int().optional(), + default: z.int().optional(), + description: z.string().optional(), + max: z.int().optional(), + min: z.int().optional(), + type: z.string().optional(), +}); + +export type GetArchivedConversationsAvailablePagination = { + page?: GetArchivedConversationsPage | undefined; + limit?: GetArchivedConversationsLimit | undefined; +}; + +export const GetArchivedConversationsAvailablePagination$zodSchema: z.ZodType< + GetArchivedConversationsAvailablePagination +> = z.object({ + limit: z.lazy(() => GetArchivedConversationsLimit$zodSchema).optional(), + page: z.lazy(() => GetArchivedConversationsPage$zodSchema).optional(), +}); + +export type GetArchivedConversationsSortingSortBy = { + values?: Array | undefined; + default?: string | undefined; + description?: string | undefined; + current?: string | undefined; + applied?: boolean | undefined; +}; + +export const GetArchivedConversationsSortingSortBy$zodSchema: z.ZodType< + GetArchivedConversationsSortingSortBy +> = z.object({ + applied: z.boolean().optional(), + current: z.string().optional(), + default: z.string().optional(), + description: z.string().optional(), + values: z.array(z.string()).optional(), +}); + +export const SortingValue = { + Asc: "asc", + Desc: "desc", +} as const; +export type SortingValue = ClosedEnum; + +export const SortingValue$zodSchema = z.enum([ + "asc", + "desc", +]); + +export const SortingDefault = { + Asc: "asc", + Desc: "desc", +} as const; +export type SortingDefault = ClosedEnum; + +export const SortingDefault$zodSchema = z.enum([ + "asc", + "desc", +]); + +export const SortingCurrent = { + Asc: "asc", + Desc: "desc", +} as const; +export type SortingCurrent = ClosedEnum; + +export const SortingCurrent$zodSchema = z.enum([ + "asc", + "desc", +]); + +export type GetArchivedConversationsSortingSortOrder = { + values?: Array | undefined; + default?: SortingDefault | undefined; + description?: string | undefined; + current?: SortingCurrent | undefined; + applied?: boolean | undefined; +}; + +export const GetArchivedConversationsSortingSortOrder$zodSchema: z.ZodType< + GetArchivedConversationsSortingSortOrder +> = z.object({ + applied: z.boolean().optional(), + current: SortingCurrent$zodSchema.optional(), + default: SortingDefault$zodSchema.optional(), + description: z.string().optional(), + values: z.array(SortingValue$zodSchema).optional(), +}); + +export type GetArchivedConversationsSorting = { + sortBy?: GetArchivedConversationsSortingSortBy | undefined; + sortOrder?: GetArchivedConversationsSortingSortOrder | undefined; +}; + +export const GetArchivedConversationsSorting$zodSchema: z.ZodType< + GetArchivedConversationsSorting +> = z.object({ + sortBy: z.lazy(() => GetArchivedConversationsSortingSortBy$zodSchema) + .optional(), + sortOrder: z.lazy(() => GetArchivedConversationsSortingSortOrder$zodSchema) + .optional(), +}); + +export type GetArchivedConversationsDateRangeCurrent = { + start?: string | null | undefined; + end?: string | null | undefined; +}; + +export const GetArchivedConversationsDateRangeCurrent$zodSchema: z.ZodType< + GetArchivedConversationsDateRangeCurrent +> = z.object({ + end: z.iso.datetime({ offset: true }).nullable().optional(), + start: z.iso.datetime({ offset: true }).nullable().optional(), +}); + +export type GetArchivedConversationsDateRange = { + type?: string | undefined; + description?: string | undefined; + format?: string | undefined; + current?: GetArchivedConversationsDateRangeCurrent | undefined; + applied?: boolean | undefined; +}; + +export const GetArchivedConversationsDateRange$zodSchema: z.ZodType< + GetArchivedConversationsDateRange +> = z.object({ + applied: z.boolean().optional(), + current: z.lazy(() => GetArchivedConversationsDateRangeCurrent$zodSchema) + .optional(), + description: z.string().optional(), + format: z.string().optional(), + type: z.string().optional(), +}); + +export type GetArchivedConversationsDateFilters = { + dateRange?: GetArchivedConversationsDateRange | undefined; +}; + +export const GetArchivedConversationsDateFilters$zodSchema: z.ZodType< + GetArchivedConversationsDateFilters +> = z.object({ + dateRange: z.lazy(() => GetArchivedConversationsDateRange$zodSchema) + .optional(), +}); + +export type GetArchivedConversationsMessageType = { + values?: Array | undefined; + description?: string | undefined; + current?: string | null | undefined; + applied?: boolean | undefined; +}; + +export const GetArchivedConversationsMessageType$zodSchema: z.ZodType< + GetArchivedConversationsMessageType +> = z.object({ + applied: z.boolean().optional(), + current: z.string().nullable().optional(), + description: z.string().optional(), + values: z.array(z.string()).optional(), +}); + +export type GetArchivedConversationsMessageFilters = { + messageType?: GetArchivedConversationsMessageType | undefined; +}; + +export const GetArchivedConversationsMessageFilters$zodSchema: z.ZodType< + GetArchivedConversationsMessageFilters +> = z.object({ + messageType: z.lazy(() => GetArchivedConversationsMessageType$zodSchema) + .optional(), +}); + +export type GetArchivedConversationsSortingMessagesSortBy = { + values?: Array | undefined; + default?: string | undefined; + description?: string | undefined; + current?: string | undefined; +}; + +export const GetArchivedConversationsSortingMessagesSortBy$zodSchema: z.ZodType< + GetArchivedConversationsSortingMessagesSortBy +> = z.object({ + current: z.string().optional(), + default: z.string().optional(), + description: z.string().optional(), + values: z.array(z.string()).optional(), +}); + +export const SortingMessagesValue = { + Asc: "asc", + Desc: "desc", +} as const; +export type SortingMessagesValue = ClosedEnum; + +export const SortingMessagesValue$zodSchema = z.enum([ + "asc", + "desc", +]); + +export const SortingMessagesDefault = { + Asc: "asc", + Desc: "desc", +} as const; +export type SortingMessagesDefault = ClosedEnum; + +export const SortingMessagesDefault$zodSchema = z.enum([ + "asc", + "desc", +]); + +export const SortingMessagesCurrent = { + Asc: "asc", + Desc: "desc", +} as const; +export type SortingMessagesCurrent = ClosedEnum; + +export const SortingMessagesCurrent$zodSchema = z.enum([ + "asc", + "desc", +]); + +export type GetArchivedConversationsSortingMessagesSortOrder = { + values?: Array | undefined; + default?: SortingMessagesDefault | undefined; + description?: string | undefined; + current?: SortingMessagesCurrent | undefined; +}; + +export const GetArchivedConversationsSortingMessagesSortOrder$zodSchema: + z.ZodType = z.object({ + current: SortingMessagesCurrent$zodSchema.optional(), + default: SortingMessagesDefault$zodSchema.optional(), + description: z.string().optional(), + values: z.array(SortingMessagesValue$zodSchema).optional(), + }); + +export type GetArchivedConversationsSortingMessages = { + sortBy?: GetArchivedConversationsSortingMessagesSortBy | undefined; + sortOrder?: GetArchivedConversationsSortingMessagesSortOrder | undefined; +}; + +export const GetArchivedConversationsSortingMessages$zodSchema: z.ZodType< + GetArchivedConversationsSortingMessages +> = z.object({ + sortBy: z.lazy(() => GetArchivedConversationsSortingMessagesSortBy$zodSchema) + .optional(), + sortOrder: z.lazy(() => + GetArchivedConversationsSortingMessagesSortOrder$zodSchema + ).optional(), +}); + +/** + * Describes filters supported by this endpoint and their current values + */ +export type GetArchivedConversationsAvailable = { + shared?: GetArchivedConversationsShared | undefined; + tags?: GetArchivedConversationsTags | undefined; + minMessages?: GetArchivedConversationsMinMessages | undefined; + search?: GetArchivedConversationsSearch | undefined; + pagination?: GetArchivedConversationsAvailablePagination | undefined; + sorting?: GetArchivedConversationsSorting | undefined; + dateFilters?: GetArchivedConversationsDateFilters | undefined; + messageFilters?: GetArchivedConversationsMessageFilters | undefined; + sortingMessages?: GetArchivedConversationsSortingMessages | undefined; +}; + +export const GetArchivedConversationsAvailable$zodSchema: z.ZodType< + GetArchivedConversationsAvailable +> = z.object({ + dateFilters: z.lazy(() => GetArchivedConversationsDateFilters$zodSchema) + .optional(), + messageFilters: z.lazy(() => GetArchivedConversationsMessageFilters$zodSchema) + .optional(), + minMessages: z.lazy(() => GetArchivedConversationsMinMessages$zodSchema) + .optional(), + pagination: z.lazy(() => + GetArchivedConversationsAvailablePagination$zodSchema + ).optional(), + search: z.lazy(() => GetArchivedConversationsSearch$zodSchema).optional(), + shared: z.lazy(() => GetArchivedConversationsShared$zodSchema).optional(), + sorting: z.lazy(() => GetArchivedConversationsSorting$zodSchema).optional(), + sortingMessages: z.lazy(() => + GetArchivedConversationsSortingMessages$zodSchema + ).optional(), + tags: z.lazy(() => GetArchivedConversationsTags$zodSchema).optional(), +}).describe( + "Describes filters supported by this endpoint and their current values", +); + +/** + * Filters applied to this request and filters available for clients to use + */ +export type GetArchivedConversationsFilters = { + applied?: GetArchivedConversationsApplied | undefined; + available?: GetArchivedConversationsAvailable | undefined; +}; + +export const GetArchivedConversationsFilters$zodSchema: z.ZodType< + GetArchivedConversationsFilters +> = z.object({ + applied: z.lazy(() => GetArchivedConversationsApplied$zodSchema).optional(), + available: z.lazy(() => GetArchivedConversationsAvailable$zodSchema) + .optional(), +}).describe( + "Filters applied to this request and filters available for clients to use", +); + +export type GetArchivedConversationsSummary = { + totalArchived?: number | undefined; + oldestArchive?: string | undefined; + newestArchive?: string | undefined; +}; + +export const GetArchivedConversationsSummary$zodSchema: z.ZodType< + GetArchivedConversationsSummary +> = z.object({ + newestArchive: z.iso.datetime({ offset: true }).optional(), + oldestArchive: z.iso.datetime({ offset: true }).optional(), + totalArchived: z.int().optional(), +}); + +export type GetArchivedConversationsMeta = { + requestId?: string | undefined; + timestamp?: string | undefined; + duration?: number | undefined; +}; + +export const GetArchivedConversationsMeta$zodSchema: z.ZodType< + GetArchivedConversationsMeta +> = z.object({ + duration: z.int().optional(), + requestId: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }).optional(), +}); + +/** + * List of archived conversations + */ +export type GetArchivedConversationsResponse = { + conversations?: Array | undefined; + pagination?: GetArchivedConversationsPagination | undefined; + filters?: GetArchivedConversationsFilters | undefined; + summary?: GetArchivedConversationsSummary | undefined; + meta?: GetArchivedConversationsMeta | undefined; +}; + +export const GetArchivedConversationsResponse$zodSchema: z.ZodType< + GetArchivedConversationsResponse +> = z.object({ + conversations: z.array( + z.lazy(() => GetArchivedConversationsConversation$zodSchema), + ).optional(), + filters: z.lazy(() => GetArchivedConversationsFilters$zodSchema).optional(), + meta: z.lazy(() => GetArchivedConversationsMeta$zodSchema).optional(), + pagination: z.lazy(() => GetArchivedConversationsPagination$zodSchema) + .optional(), + summary: z.lazy(() => GetArchivedConversationsSummary$zodSchema).optional(), +}).describe("List of archived conversations"); diff --git a/src/models/getauthmethodsop.ts b/src/models/getauthmethodsop.ts new file mode 100644 index 00000000..0da590b3 --- /dev/null +++ b/src/models/getauthmethodsop.ts @@ -0,0 +1,16 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { AuthConfig, AuthConfig$zodSchema } from "./authconfig.js"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; + +export type GetAuthMethodsResponse = AuthConfig | ErrorResponse; + +export const GetAuthMethodsResponse$zodSchema: z.ZodType< + GetAuthMethodsResponse +> = z.union([ + AuthConfig$zodSchema, + ErrorResponse$zodSchema, +]); diff --git a/src/models/getavailablemodelsbytypeop.ts b/src/models/getavailablemodelsbytypeop.ts index 834f7318..b6d3e0fb 100644 --- a/src/models/getavailablemodelsbytypeop.ts +++ b/src/models/getavailablemodelsbytypeop.ts @@ -3,6 +3,7 @@ */ import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; import { ModelType, ModelType$zodSchema } from "./modeltype.js"; export type GetAvailableModelsByTypeRequest = { modelType: ModelType }; @@ -12,3 +13,309 @@ export const GetAvailableModelsByTypeRequest$zodSchema: z.ZodType< > = z.object({ modelType: ModelType$zodSchema, }); + +export const GetAvailableModelsByTypeCodeHTTPInternalServerError = { + HttpInternalServerError: "HTTP_INTERNAL_SERVER_ERROR", +} as const; +export type GetAvailableModelsByTypeCodeHTTPInternalServerError = ClosedEnum< + typeof GetAvailableModelsByTypeCodeHTTPInternalServerError +>; + +export const GetAvailableModelsByTypeCodeHTTPInternalServerError$zodSchema = z + .enum([ + "HTTP_INTERNAL_SERVER_ERROR", + ]); + +export type GetAvailableModelsByTypeErrorHTTPInternalServerError = { + code: GetAvailableModelsByTypeCodeHTTPInternalServerError; + message: string; +}; + +export const GetAvailableModelsByTypeErrorHTTPInternalServerError$zodSchema: + z.ZodType = z.object({ + code: GetAvailableModelsByTypeCodeHTTPInternalServerError$zodSchema, + message: z.string(), + }); + +/** + * An unexpected error occurred on the server. + */ +export type GetAvailableModelsByTypeInternalServerErrorResponseBody = { + error: GetAvailableModelsByTypeErrorHTTPInternalServerError; +}; + +export const GetAvailableModelsByTypeInternalServerErrorResponseBody$zodSchema: + z.ZodType = z.object( + { + error: z.lazy(() => + GetAvailableModelsByTypeErrorHTTPInternalServerError$zodSchema + ), + }, + ).describe("An unexpected error occurred on the server."); + +export const GetAvailableModelsByTypeForbiddenCode = { + HttpForbidden: "HTTP_FORBIDDEN", +} as const; +export type GetAvailableModelsByTypeForbiddenCode = ClosedEnum< + typeof GetAvailableModelsByTypeForbiddenCode +>; + +export const GetAvailableModelsByTypeForbiddenCode$zodSchema = z.enum([ + "HTTP_FORBIDDEN", +]); + +export type GetAvailableModelsByTypeErrorHTTPForbidden = { + code: GetAvailableModelsByTypeForbiddenCode; + message: string; +}; + +export const GetAvailableModelsByTypeErrorHTTPForbidden$zodSchema: z.ZodType< + GetAvailableModelsByTypeErrorHTTPForbidden +> = z.object({ + code: GetAvailableModelsByTypeForbiddenCode$zodSchema, + message: z.string(), +}); + +/** + * Insufficient OAuth scope. + * + * @remarks + * + * Only applies to OAuth tokens. The token did not carry the `config:read` + * scope required by this endpoint. Regular (non-OAuth) JWT bearer tokens + * are not subject to scope enforcement and will not receive this error. + */ +export type GetAvailableModelsByTypeForbiddenResponseBody = { + error: GetAvailableModelsByTypeErrorHTTPForbidden; +}; + +export const GetAvailableModelsByTypeForbiddenResponseBody$zodSchema: z.ZodType< + GetAvailableModelsByTypeForbiddenResponseBody +> = z.object({ + error: z.lazy(() => GetAvailableModelsByTypeErrorHTTPForbidden$zodSchema), +}).describe( + "Insufficient OAuth scope.\n\nOnly applies to OAuth tokens. The token did not carry the `config:read`\nscope required by this endpoint. Regular (non-OAuth) JWT bearer tokens\nare not subject to scope enforcement and will not receive this error.\n", +); + +export const GetAvailableModelsByTypeUnauthorizedCode = { + HttpUnauthorized: "HTTP_UNAUTHORIZED", +} as const; +export type GetAvailableModelsByTypeUnauthorizedCode = ClosedEnum< + typeof GetAvailableModelsByTypeUnauthorizedCode +>; + +export const GetAvailableModelsByTypeUnauthorizedCode$zodSchema = z.enum([ + "HTTP_UNAUTHORIZED", +]); + +export type GetAvailableModelsByTypeErrorHTTPUnauthorized = { + code: GetAvailableModelsByTypeUnauthorizedCode; + message: string; +}; + +export const GetAvailableModelsByTypeErrorHTTPUnauthorized$zodSchema: z.ZodType< + GetAvailableModelsByTypeErrorHTTPUnauthorized +> = z.object({ + code: GetAvailableModelsByTypeUnauthorizedCode$zodSchema, + message: z.string(), +}); + +/** + * Missing or invalid authentication token. + * + * @remarks + * + * The bearer token was absent, expired, malformed, or could not be + * verified by the auth middleware. + */ +export type GetAvailableModelsByTypeUnauthorizedResponseBody = { + error: GetAvailableModelsByTypeErrorHTTPUnauthorized; +}; + +export const GetAvailableModelsByTypeUnauthorizedResponseBody$zodSchema: + z.ZodType = z.object({ + error: z.lazy(() => + GetAvailableModelsByTypeErrorHTTPUnauthorized$zodSchema + ), + }).describe( + "Missing or invalid authentication token.\n\nThe bearer token was absent, expired, malformed, or could not be\nverified by the auth middleware.\n", + ); + +export const GetAvailableModelsByTypeCodeValidationError = { + ValidationError: "VALIDATION_ERROR", +} as const; +export type GetAvailableModelsByTypeCodeValidationError = ClosedEnum< + typeof GetAvailableModelsByTypeCodeValidationError +>; + +export const GetAvailableModelsByTypeCodeValidationError$zodSchema = z.enum([ + "VALIDATION_ERROR", +]); + +/** + * Machine-readable error code mapped from the Zod issue code. + */ +export const MetadataCode = { + InvalidType: "INVALID_TYPE", + InvalidLiteral: "INVALID_LITERAL", + InvalidEnum: "INVALID_ENUM", + InvalidUnion: "INVALID_UNION", + InvalidDiscriminator: "INVALID_DISCRIMINATOR", + InvalidArguments: "INVALID_ARGUMENTS", + TooSmall: "TOO_SMALL", + TooBig: "TOO_BIG", +} as const; +/** + * Machine-readable error code mapped from the Zod issue code. + */ +export type MetadataCode = ClosedEnum; + +export const MetadataCode$zodSchema = z.enum([ + "INVALID_TYPE", + "INVALID_LITERAL", + "INVALID_ENUM", + "INVALID_UNION", + "INVALID_DISCRIMINATOR", + "INVALID_ARGUMENTS", + "TOO_SMALL", + "TOO_BIG", +]).describe("Machine-readable error code mapped from the Zod issue code."); + +export type MetadataError = { + field: string; + message: string; + code: MetadataCode; + value: string; +}; + +export const MetadataError$zodSchema: z.ZodType = z.object({ + code: MetadataCode$zodSchema, + field: z.string(), + message: z.string(), + value: z.string(), +}); + +/** + * Per-field validation detail from Zod. + */ +export type GetAvailableModelsByTypeMetadata = { errors: Array }; + +export const GetAvailableModelsByTypeMetadata$zodSchema: z.ZodType< + GetAvailableModelsByTypeMetadata +> = z.object({ + errors: z.array(z.lazy(() => MetadataError$zodSchema)), +}).describe("Per-field validation detail from Zod."); + +export type GetAvailableModelsByTypeErrorValidationError = { + code: GetAvailableModelsByTypeCodeValidationError; + message: string; + metadata: GetAvailableModelsByTypeMetadata; +}; + +export const GetAvailableModelsByTypeErrorValidationError$zodSchema: z.ZodType< + GetAvailableModelsByTypeErrorValidationError +> = z.object({ + code: GetAvailableModelsByTypeCodeValidationError$zodSchema, + message: z.string(), + metadata: z.lazy(() => GetAvailableModelsByTypeMetadata$zodSchema), +}); + +/** + * Invalid `modelType` path parameter. + * + * @remarks + * + * The `modelType` value was not one of the supported enum categories. + * This response is produced by the Zod validation middleware **before** + * the handler runs. The `error.metadata.errors` array contains + * per-field detail about exactly which constraint failed. + */ +export type GetAvailableModelsByTypeBadRequestResponseBody = { + error: GetAvailableModelsByTypeErrorValidationError; +}; + +export const GetAvailableModelsByTypeBadRequestResponseBody$zodSchema: + z.ZodType = z.object({ + error: z.lazy(() => GetAvailableModelsByTypeErrorValidationError$zodSchema), + }).describe( + "Invalid `modelType` path parameter.\n\nThe `modelType` value was not one of the supported enum categories.\nThis response is produced by the Zod validation middleware **before**\nthe handler runs. The `error.metadata.errors` array contains\nper-field detail about exactly which constraint failed.\n", + ); + +export const GetAvailableModelsByTypeStatus = { + Success: "success", +} as const; +export type GetAvailableModelsByTypeStatus = ClosedEnum< + typeof GetAvailableModelsByTypeStatus +>; + +export const GetAvailableModelsByTypeStatus$zodSchema = z.enum([ + "success", +]); + +export type GetAvailableModelsByTypeModel = { + modelType: ModelType; + provider: string; + modelName: string; + modelKey: string; + isMultimodal: boolean; + isReasoning: boolean; + isDefault: boolean; + modelFriendlyName?: string | undefined; +}; + +export const GetAvailableModelsByTypeModel$zodSchema: z.ZodType< + GetAvailableModelsByTypeModel +> = z.object({ + isDefault: z.boolean(), + isMultimodal: z.boolean(), + isReasoning: z.boolean(), + modelFriendlyName: z.string().optional(), + modelKey: z.string(), + modelName: z.string(), + modelType: ModelType$zodSchema, + provider: z.string(), +}); + +/** + * Available models retrieved successfully. + * + * @remarks + * + * An empty `models` array (with HTTP 200) is returned when no providers of + * the requested type have been configured — treat this as a valid, empty + * state, not an error. + */ +export type GetAvailableModelsByTypeResponseBodySuccess = { + status: GetAvailableModelsByTypeStatus; + message: string; + models: Array; +}; + +export const GetAvailableModelsByTypeResponseBodySuccess$zodSchema: z.ZodType< + GetAvailableModelsByTypeResponseBodySuccess +> = z.object({ + message: z.string(), + models: z.array(z.lazy(() => GetAvailableModelsByTypeModel$zodSchema)), + status: GetAvailableModelsByTypeStatus$zodSchema, +}).describe( + "Available models retrieved successfully.\n\nAn empty `models` array (with HTTP 200) is returned when no providers of\nthe requested type have been configured — treat this as a valid, empty\nstate, not an error.\n", +); + +export type GetAvailableModelsByTypeResponse = + | GetAvailableModelsByTypeResponseBodySuccess + | GetAvailableModelsByTypeBadRequestResponseBody + | GetAvailableModelsByTypeUnauthorizedResponseBody + | GetAvailableModelsByTypeForbiddenResponseBody + | GetAvailableModelsByTypeInternalServerErrorResponseBody; + +export const GetAvailableModelsByTypeResponse$zodSchema: z.ZodType< + GetAvailableModelsByTypeResponse +> = z.union([ + z.lazy(() => GetAvailableModelsByTypeResponseBodySuccess$zodSchema), + z.lazy(() => GetAvailableModelsByTypeBadRequestResponseBody$zodSchema), + z.lazy(() => GetAvailableModelsByTypeUnauthorizedResponseBody$zodSchema), + z.lazy(() => GetAvailableModelsByTypeForbiddenResponseBody$zodSchema), + z.lazy(() => + GetAvailableModelsByTypeInternalServerErrorResponseBody$zodSchema + ), +]); diff --git a/src/models/getconversationbyidop.ts b/src/models/getconversationbyidop.ts new file mode 100644 index 00000000..718414d7 --- /dev/null +++ b/src/models/getconversationbyidop.ts @@ -0,0 +1,830 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + AppliedFilterNode, + AppliedFilterNode$zodSchema, +} from "./appliedfilternode.js"; +import { + ChatAttachmentRef, + ChatAttachmentRef$zodSchema, +} from "./chatattachmentref.js"; +import { Citation, Citation$zodSchema } from "./citation.js"; +import { + ConversationModelInfo, + ConversationModelInfo$zodSchema, +} from "./conversationmodelinfo.js"; +import { + FollowUpQuestion, + FollowUpQuestion$zodSchema, +} from "./followupquestion.js"; +import { + MessageFeedback, + MessageFeedback$zodSchema, +} from "./messagefeedback.js"; + +/** + * Field to sort messages by + */ +export const GetConversationByIdSortByEnum = { + CreatedAt: "createdAt", + MessageType: "messageType", + Content: "content", +} as const; +/** + * Field to sort messages by + */ +export type GetConversationByIdSortByEnum = ClosedEnum< + typeof GetConversationByIdSortByEnum +>; + +export const GetConversationByIdSortByEnum$zodSchema = z.enum([ + "createdAt", + "messageType", + "content", +]).describe("Field to sort messages by"); + +/** + * Sort direction + */ +export const GetConversationByIdSortOrderEnum = { + Asc: "asc", + Desc: "desc", +} as const; +/** + * Sort direction + */ +export type GetConversationByIdSortOrderEnum = ClosedEnum< + typeof GetConversationByIdSortOrderEnum +>; + +export const GetConversationByIdSortOrderEnum$zodSchema = z.enum([ + "asc", + "desc", +]).describe("Sort direction"); + +/** + * Filter messages by type + */ +export const GetConversationByIdQueryParamMessageType = { + UserQuery: "user_query", + BotResponse: "bot_response", + Error: "error", + Feedback: "feedback", + System: "system", +} as const; +/** + * Filter messages by type + */ +export type GetConversationByIdQueryParamMessageType = ClosedEnum< + typeof GetConversationByIdQueryParamMessageType +>; + +export const GetConversationByIdQueryParamMessageType$zodSchema = z.enum([ + "user_query", + "bot_response", + "error", + "feedback", + "system", +]).describe("Filter messages by type"); + +export type GetConversationByIdRequest = { + conversationId: string; + page?: number | undefined; + limit?: number | undefined; + sortBy?: GetConversationByIdSortByEnum | undefined; + sortOrder?: GetConversationByIdSortOrderEnum | undefined; + search?: string | undefined; + startDate?: string | undefined; + endDate?: string | undefined; + shared?: boolean | undefined; + messageType?: GetConversationByIdQueryParamMessageType | undefined; +}; + +export const GetConversationByIdRequest$zodSchema: z.ZodType< + GetConversationByIdRequest +> = z.object({ + conversationId: z.string().describe("Unique conversation identifier"), + endDate: z.iso.datetime({ offset: true }).describe( + "Filter messages created on or before this date (ISO 8601)", + ).optional(), + limit: z.int().default(20).describe("Number of messages per page"), + messageType: GetConversationByIdQueryParamMessageType$zodSchema.optional(), + page: z.int().default(1).describe("Page number for message pagination"), + search: z.string().describe( + "Case-insensitive search across conversation title and message content", + ).optional(), + shared: z.boolean().describe("Filter by shared status of the conversation") + .optional(), + sortBy: GetConversationByIdSortByEnum$zodSchema.default("createdAt"), + sortOrder: GetConversationByIdSortOrderEnum$zodSchema.default("desc"), + startDate: z.iso.datetime({ offset: true }).describe( + "Filter messages created on or after this date (ISO 8601)", + ).optional(), +}); + +export const GetConversationByIdSharedWithAccessLevel = { + Read: "read", + Write: "write", +} as const; +export type GetConversationByIdSharedWithAccessLevel = ClosedEnum< + typeof GetConversationByIdSharedWithAccessLevel +>; + +export const GetConversationByIdSharedWithAccessLevel$zodSchema = z.enum([ + "read", + "write", +]); + +export type GetConversationByIdSharedWith = { + userId?: string | undefined; + accessLevel?: GetConversationByIdSharedWithAccessLevel | undefined; +}; + +export const GetConversationByIdSharedWith$zodSchema: z.ZodType< + GetConversationByIdSharedWith +> = z.object({ + accessLevel: GetConversationByIdSharedWithAccessLevel$zodSchema.optional(), + userId: z.string().optional(), +}); + +export const GetConversationByIdStatus = { + None: "None", + Inprogress: "Inprogress", + Complete: "Complete", + Failed: "Failed", +} as const; +export type GetConversationByIdStatus = ClosedEnum< + typeof GetConversationByIdStatus +>; + +export const GetConversationByIdStatus$zodSchema = z.enum([ + "None", + "Inprogress", + "Complete", + "Failed", +]); + +export const GetConversationByIdMessageMessageType = { + UserQuery: "user_query", + BotResponse: "bot_response", + Error: "error", + Feedback: "feedback", + System: "system", +} as const; +export type GetConversationByIdMessageMessageType = ClosedEnum< + typeof GetConversationByIdMessageMessageType +>; + +export const GetConversationByIdMessageMessageType$zodSchema = z.enum([ + "user_query", + "bot_response", + "error", + "feedback", + "system", +]); + +export const GetConversationByIdContentFormat = { + Markdown: "MARKDOWN", + Json: "JSON", + Html: "HTML", +} as const; +export type GetConversationByIdContentFormat = ClosedEnum< + typeof GetConversationByIdContentFormat +>; + +export const GetConversationByIdContentFormat$zodSchema = z.enum([ + "MARKDOWN", + "JSON", + "HTML", +]); + +/** + * AI confidence in the answer. Present only on `bot_response` messages, and only when the model emitted a trailing confidence block. + */ +export const GetConversationByIdConfidence = { + VeryHigh: "Very High", + High: "High", + Medium: "Medium", + Low: "Low", + Unknown: "Unknown", +} as const; +/** + * AI confidence in the answer. Present only on `bot_response` messages, and only when the model emitted a trailing confidence block. + */ +export type GetConversationByIdConfidence = ClosedEnum< + typeof GetConversationByIdConfidence +>; + +export const GetConversationByIdConfidence$zodSchema = z.enum([ + "Very High", + "High", + "Medium", + "Low", + "Unknown", +]).describe( + "AI confidence in the answer. Present only on `bot_response` messages, and only when the model emitted a trailing confidence block.", +); + +export type GetConversationByIdCitation = { + citationId?: string | undefined; + citationData?: Citation | undefined; +}; + +export const GetConversationByIdCitation$zodSchema: z.ZodType< + GetConversationByIdCitation +> = z.object({ + citationData: Citation$zodSchema.optional(), + citationId: z.string().optional(), +}); + +export type GetConversationByIdReferenceDatum = { + name?: string | undefined; + id?: string | undefined; + type?: string | undefined; + app?: string | undefined; + webUrl?: string | undefined; + metadata?: { [k: string]: string } | undefined; +}; + +export const GetConversationByIdReferenceDatum$zodSchema: z.ZodType< + GetConversationByIdReferenceDatum +> = z.object({ + app: z.string().optional(), + id: z.string().optional(), + metadata: z.record(z.string(), z.string()).optional(), + name: z.string().optional(), + type: z.string().optional(), + webUrl: z.string().optional(), +}); + +export type GetConversationByIdAppliedFilters = { + apps?: Array | undefined; + kb?: Array | undefined; +}; + +export const GetConversationByIdAppliedFilters$zodSchema: z.ZodType< + GetConversationByIdAppliedFilters +> = z.object({ + apps: z.array(AppliedFilterNode$zodSchema).optional(), + kb: z.array(AppliedFilterNode$zodSchema).optional(), +}); + +export type GetConversationByIdMetadata = { + processingTimeMs?: number | undefined; + modelVersion?: string | undefined; + aiTransactionId?: string | undefined; +}; + +export const GetConversationByIdMetadata$zodSchema: z.ZodType< + GetConversationByIdMetadata +> = z.object({ + aiTransactionId: z.string().optional(), + modelVersion: z.string().optional(), + processingTimeMs: z.number().optional(), +}); + +export type GetConversationByIdMessage = { + _id?: string | undefined; + messageType?: GetConversationByIdMessageMessageType | undefined; + content?: string | undefined; + contentFormat?: GetConversationByIdContentFormat | undefined; + confidence?: GetConversationByIdConfidence | null | undefined; + citations?: Array | undefined; + followUpQuestions?: Array | undefined; + feedback?: Array | undefined; + referenceData?: Array | undefined; + modelInfo?: ConversationModelInfo | undefined; + appliedFilters?: GetConversationByIdAppliedFilters | undefined; + attachments?: Array | undefined; + metadata?: GetConversationByIdMetadata | undefined; + createdAt?: string | undefined; + updatedAt?: string | undefined; +}; + +export const GetConversationByIdMessage$zodSchema: z.ZodType< + GetConversationByIdMessage +> = z.object({ + _id: z.string().optional(), + appliedFilters: z.lazy(() => GetConversationByIdAppliedFilters$zodSchema) + .optional(), + attachments: z.array(ChatAttachmentRef$zodSchema).optional(), + citations: z.array(z.lazy(() => GetConversationByIdCitation$zodSchema)) + .optional(), + confidence: GetConversationByIdConfidence$zodSchema.nullable().optional(), + content: z.string().optional(), + contentFormat: GetConversationByIdContentFormat$zodSchema.optional(), + createdAt: z.iso.datetime({ offset: true }).optional(), + feedback: z.array(MessageFeedback$zodSchema).optional(), + followUpQuestions: z.array(FollowUpQuestion$zodSchema).optional(), + messageType: GetConversationByIdMessageMessageType$zodSchema.optional(), + metadata: z.lazy(() => GetConversationByIdMetadata$zodSchema).optional(), + modelInfo: ConversationModelInfo$zodSchema.optional(), + referenceData: z.array( + z.lazy(() => GetConversationByIdReferenceDatum$zodSchema), + ).optional(), + updatedAt: z.iso.datetime({ offset: true }).optional(), +}); + +export type GetConversationByIdMessageRange = { + start?: number | undefined; + end?: number | undefined; +}; + +export const GetConversationByIdMessageRange$zodSchema: z.ZodType< + GetConversationByIdMessageRange +> = z.object({ + end: z.int().optional(), + start: z.int().optional(), +}); + +/** + * Pagination over the conversation's messages. Messages are paginated backwards + * + * @remarks + * (newest first), so `messageRange.start`/`messageRange.end` refer to 1-based + * positions within the full message list. + */ +export type ConversationPagination = { + page?: number | undefined; + limit?: number | undefined; + totalCount?: number | undefined; + totalPages?: number | undefined; + hasNextPage?: boolean | undefined; + hasPrevPage?: boolean | undefined; + messageRange?: GetConversationByIdMessageRange | undefined; +}; + +export const ConversationPagination$zodSchema: z.ZodType< + ConversationPagination +> = z.object({ + hasNextPage: z.boolean().optional(), + hasPrevPage: z.boolean().optional(), + limit: z.int().optional(), + messageRange: z.lazy(() => GetConversationByIdMessageRange$zodSchema) + .optional(), + page: z.int().optional(), + totalCount: z.int().optional(), + totalPages: z.int().optional(), +}).describe( + "Pagination over the conversation's messages. Messages are paginated backwards\n(newest first), so `messageRange.start`/`messageRange.end` refer to 1-based\npositions within the full message list.\n", +); + +export const AccessAccessLevel = { + Read: "read", + Write: "write", +} as const; +export type AccessAccessLevel = ClosedEnum; + +export const AccessAccessLevel$zodSchema = z.enum([ + "read", + "write", +]); + +export type Access = { + isOwner?: boolean | undefined; + accessLevel?: AccessAccessLevel | undefined; +}; + +export const Access$zodSchema: z.ZodType = z.object({ + accessLevel: AccessAccessLevel$zodSchema.optional(), + isOwner: z.boolean().optional(), +}); + +export type GetConversationByIdConversation = { + id?: string | undefined; + title?: string | undefined; + initiator?: string | undefined; + createdAt?: string | undefined; + isShared?: boolean | undefined; + sharedWith?: Array | undefined; + status?: GetConversationByIdStatus | undefined; + failReason?: string | undefined; + messages?: Array | undefined; + modelInfo?: ConversationModelInfo | undefined; + pagination?: ConversationPagination | undefined; + access?: Access | undefined; +}; + +export const GetConversationByIdConversation$zodSchema: z.ZodType< + GetConversationByIdConversation +> = z.object({ + access: z.lazy(() => Access$zodSchema).optional(), + createdAt: z.iso.datetime({ offset: true }).optional(), + failReason: z.string().optional(), + id: z.string().optional(), + initiator: z.string().optional(), + isShared: z.boolean().optional(), + messages: z.array(z.lazy(() => GetConversationByIdMessage$zodSchema)) + .optional(), + modelInfo: ConversationModelInfo$zodSchema.optional(), + pagination: z.lazy(() => ConversationPagination$zodSchema).optional(), + sharedWith: z.array(z.lazy(() => GetConversationByIdSharedWith$zodSchema)) + .optional(), + status: GetConversationByIdStatus$zodSchema.optional(), + title: z.string().optional(), +}); + +export type GetConversationByIdApplied = { + filters?: Array | undefined; + values?: { [k: string]: any } | undefined; +}; + +export const GetConversationByIdApplied$zodSchema: z.ZodType< + GetConversationByIdApplied +> = z.object({ + filters: z.array(z.string()).optional(), + values: z.record(z.string(), z.any()).optional(), +}); + +export type GetConversationByIdShared = { + values?: Array | undefined; + description?: string | undefined; + current?: string | null | undefined; + applied?: boolean | undefined; +}; + +export const GetConversationByIdShared$zodSchema: z.ZodType< + GetConversationByIdShared +> = z.object({ + applied: z.boolean().optional(), + current: z.string().nullable().optional(), + description: z.string().optional(), + values: z.array(z.string()).optional(), +}); + +/** + * Advertised in the `available` catalog but not currently applied as a filter by the server. + */ +export type GetConversationByIdTags = { + type?: string | undefined; + description?: string | undefined; + current?: string | null | undefined; + applied?: boolean | undefined; +}; + +export const GetConversationByIdTags$zodSchema: z.ZodType< + GetConversationByIdTags +> = z.object({ + applied: z.boolean().optional(), + current: z.string().nullable().optional(), + description: z.string().optional(), + type: z.string().optional(), +}).describe( + "Advertised in the `available` catalog but not currently applied as a filter by the server.", +); + +/** + * Advertised in the `available` catalog but not currently applied as a filter by the server. + */ +export type GetConversationByIdMinMessages = { + type?: string | undefined; + description?: string | undefined; + current?: string | null | undefined; + applied?: boolean | undefined; +}; + +export const GetConversationByIdMinMessages$zodSchema: z.ZodType< + GetConversationByIdMinMessages +> = z.object({ + applied: z.boolean().optional(), + current: z.string().nullable().optional(), + description: z.string().optional(), + type: z.string().optional(), +}).describe( + "Advertised in the `available` catalog but not currently applied as a filter by the server.", +); + +export type GetConversationByIdSearch = { + type?: string | undefined; + description?: string | undefined; + current?: string | null | undefined; + applied?: boolean | undefined; +}; + +export const GetConversationByIdSearch$zodSchema: z.ZodType< + GetConversationByIdSearch +> = z.object({ + applied: z.boolean().optional(), + current: z.string().nullable().optional(), + description: z.string().optional(), + type: z.string().optional(), +}); + +export type GetConversationByIdPage = { + type?: string | undefined; + current?: number | undefined; + min?: number | undefined; + max?: number | undefined; + default?: number | undefined; + description?: string | undefined; + applied?: boolean | undefined; +}; + +export const GetConversationByIdPage$zodSchema: z.ZodType< + GetConversationByIdPage +> = z.object({ + applied: z.boolean().optional(), + current: z.int().optional(), + default: z.int().optional(), + description: z.string().optional(), + max: z.int().optional(), + min: z.int().optional(), + type: z.string().optional(), +}); + +export type GetConversationByIdLimit = { + type?: string | undefined; + current?: number | undefined; + min?: number | undefined; + max?: number | undefined; + default?: number | undefined; + description?: string | undefined; + applied?: boolean | undefined; +}; + +export const GetConversationByIdLimit$zodSchema: z.ZodType< + GetConversationByIdLimit +> = z.object({ + applied: z.boolean().optional(), + current: z.int().optional(), + default: z.int().optional(), + description: z.string().optional(), + max: z.int().optional(), + min: z.int().optional(), + type: z.string().optional(), +}); + +export type GetConversationByIdAvailablePagination = { + page?: GetConversationByIdPage | undefined; + limit?: GetConversationByIdLimit | undefined; +}; + +export const GetConversationByIdAvailablePagination$zodSchema: z.ZodType< + GetConversationByIdAvailablePagination +> = z.object({ + limit: z.lazy(() => GetConversationByIdLimit$zodSchema).optional(), + page: z.lazy(() => GetConversationByIdPage$zodSchema).optional(), +}); + +export type GetConversationByIdSortingSortBy = { + values?: Array | undefined; + default?: string | undefined; + description?: string | undefined; + current?: string | undefined; + applied?: boolean | undefined; +}; + +export const GetConversationByIdSortingSortBy$zodSchema: z.ZodType< + GetConversationByIdSortingSortBy +> = z.object({ + applied: z.boolean().optional(), + current: z.string().optional(), + default: z.string().optional(), + description: z.string().optional(), + values: z.array(z.string()).optional(), +}); + +export type GetConversationByIdSortingSortOrder = { + values?: Array | undefined; + default?: string | undefined; + description?: string | undefined; + current?: string | undefined; + applied?: boolean | undefined; +}; + +export const GetConversationByIdSortingSortOrder$zodSchema: z.ZodType< + GetConversationByIdSortingSortOrder +> = z.object({ + applied: z.boolean().optional(), + current: z.string().optional(), + default: z.string().optional(), + description: z.string().optional(), + values: z.array(z.string()).optional(), +}); + +/** + * Sort applied to the conversation list. Field set echoes back the original list-endpoint sort options even though this endpoint returns a single conversation. + */ +export type GetConversationByIdSorting = { + sortBy?: GetConversationByIdSortingSortBy | undefined; + sortOrder?: GetConversationByIdSortingSortOrder | undefined; +}; + +export const GetConversationByIdSorting$zodSchema: z.ZodType< + GetConversationByIdSorting +> = z.object({ + sortBy: z.lazy(() => GetConversationByIdSortingSortBy$zodSchema).optional(), + sortOrder: z.lazy(() => GetConversationByIdSortingSortOrder$zodSchema) + .optional(), +}).describe( + "Sort applied to the conversation list. Field set echoes back the original list-endpoint sort options even though this endpoint returns a single conversation.", +); + +export type GetConversationByIdCurrent = { + start?: string | null | undefined; + end?: string | null | undefined; +}; + +export const GetConversationByIdCurrent$zodSchema: z.ZodType< + GetConversationByIdCurrent +> = z.object({ + end: z.string().nullable().optional(), + start: z.string().nullable().optional(), +}); + +export type GetConversationByIdDateRange = { + type?: string | undefined; + description?: string | undefined; + format?: string | undefined; + current?: GetConversationByIdCurrent | undefined; + applied?: boolean | undefined; +}; + +export const GetConversationByIdDateRange$zodSchema: z.ZodType< + GetConversationByIdDateRange +> = z.object({ + applied: z.boolean().optional(), + current: z.lazy(() => GetConversationByIdCurrent$zodSchema).optional(), + description: z.string().optional(), + format: z.string().optional(), + type: z.string().optional(), +}); + +export type GetConversationByIdDateFilters = { + dateRange?: GetConversationByIdDateRange | undefined; +}; + +export const GetConversationByIdDateFilters$zodSchema: z.ZodType< + GetConversationByIdDateFilters +> = z.object({ + dateRange: z.lazy(() => GetConversationByIdDateRange$zodSchema).optional(), +}); + +export type GetConversationByIdMessageFiltersMessageType = { + values?: Array | undefined; + description?: string | undefined; + current?: string | null | undefined; + applied?: boolean | undefined; +}; + +export const GetConversationByIdMessageFiltersMessageType$zodSchema: z.ZodType< + GetConversationByIdMessageFiltersMessageType +> = z.object({ + applied: z.boolean().optional(), + current: z.string().nullable().optional(), + description: z.string().optional(), + values: z.array(z.string()).optional(), +}); + +export type GetConversationByIdMessageFilters = { + messageType?: GetConversationByIdMessageFiltersMessageType | undefined; +}; + +export const GetConversationByIdMessageFilters$zodSchema: z.ZodType< + GetConversationByIdMessageFilters +> = z.object({ + messageType: z.lazy(() => + GetConversationByIdMessageFiltersMessageType$zodSchema + ).optional(), +}); + +export type GetConversationByIdSortingMessagesSortBy = { + values?: Array | undefined; + default?: string | undefined; + description?: string | undefined; + current?: string | undefined; +}; + +export const GetConversationByIdSortingMessagesSortBy$zodSchema: z.ZodType< + GetConversationByIdSortingMessagesSortBy +> = z.object({ + current: z.string().optional(), + default: z.string().optional(), + description: z.string().optional(), + values: z.array(z.string()).optional(), +}); + +export type GetConversationByIdSortingMessagesSortOrder = { + values?: Array | undefined; + default?: string | undefined; + description?: string | undefined; + current?: string | undefined; +}; + +export const GetConversationByIdSortingMessagesSortOrder$zodSchema: z.ZodType< + GetConversationByIdSortingMessagesSortOrder +> = z.object({ + current: z.string().optional(), + default: z.string().optional(), + description: z.string().optional(), + values: z.array(z.string()).optional(), +}); + +/** + * Sort applied to messages within the conversation (separate from the conversation-list `sorting` block). + */ +export type GetConversationByIdSortingMessages = { + sortBy?: GetConversationByIdSortingMessagesSortBy | undefined; + sortOrder?: GetConversationByIdSortingMessagesSortOrder | undefined; +}; + +export const GetConversationByIdSortingMessages$zodSchema: z.ZodType< + GetConversationByIdSortingMessages +> = z.object({ + sortBy: z.lazy(() => GetConversationByIdSortingMessagesSortBy$zodSchema) + .optional(), + sortOrder: z.lazy(() => GetConversationByIdSortingMessagesSortOrder$zodSchema) + .optional(), +}).describe( + "Sort applied to messages within the conversation (separate from the conversation-list `sorting` block).", +); + +export type GetConversationByIdAvailable = { + shared?: GetConversationByIdShared | undefined; + tags?: GetConversationByIdTags | undefined; + minMessages?: GetConversationByIdMinMessages | undefined; + search?: GetConversationByIdSearch | undefined; + pagination?: GetConversationByIdAvailablePagination | undefined; + sorting?: GetConversationByIdSorting | undefined; + dateFilters?: GetConversationByIdDateFilters | undefined; + messageFilters?: GetConversationByIdMessageFilters | undefined; + sortingMessages?: GetConversationByIdSortingMessages | undefined; +}; + +export const GetConversationByIdAvailable$zodSchema: z.ZodType< + GetConversationByIdAvailable +> = z.object({ + dateFilters: z.lazy(() => GetConversationByIdDateFilters$zodSchema) + .optional(), + messageFilters: z.lazy(() => GetConversationByIdMessageFilters$zodSchema) + .optional(), + minMessages: z.lazy(() => GetConversationByIdMinMessages$zodSchema) + .optional(), + pagination: z.lazy(() => GetConversationByIdAvailablePagination$zodSchema) + .optional(), + search: z.lazy(() => GetConversationByIdSearch$zodSchema).optional(), + shared: z.lazy(() => GetConversationByIdShared$zodSchema).optional(), + sorting: z.lazy(() => GetConversationByIdSorting$zodSchema).optional(), + sortingMessages: z.lazy(() => GetConversationByIdSortingMessages$zodSchema) + .optional(), + tags: z.lazy(() => GetConversationByIdTags$zodSchema).optional(), +}); + +/** + * Summary of which filter/sort/pagination parameters were applied to this request, plus the catalog of options available on this endpoint. + */ +export type GetConversationByIdFilters = { + applied?: GetConversationByIdApplied | undefined; + available?: GetConversationByIdAvailable | undefined; +}; + +export const GetConversationByIdFilters$zodSchema: z.ZodType< + GetConversationByIdFilters +> = z.object({ + applied: z.lazy(() => GetConversationByIdApplied$zodSchema).optional(), + available: z.lazy(() => GetConversationByIdAvailable$zodSchema).optional(), +}).describe( + "Summary of which filter/sort/pagination parameters were applied to this request, plus the catalog of options available on this endpoint.", +); + +export type GetConversationByIdMeta = { + requestId?: string | undefined; + timestamp?: string | undefined; + duration?: number | undefined; + conversationId?: string | undefined; + messageCount?: number | undefined; +}; + +export const GetConversationByIdMeta$zodSchema: z.ZodType< + GetConversationByIdMeta +> = z.object({ + conversationId: z.string().optional(), + duration: z.int().optional(), + messageCount: z.int().optional(), + requestId: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }).optional(), +}); + +/** + * Conversation with paginated messages, applied filter metadata, and request metadata + */ +export type GetConversationByIdResponse = { + conversation?: GetConversationByIdConversation | undefined; + filters?: GetConversationByIdFilters | undefined; + meta?: GetConversationByIdMeta | undefined; +}; + +export const GetConversationByIdResponse$zodSchema: z.ZodType< + GetConversationByIdResponse +> = z.object({ + conversation: z.lazy(() => GetConversationByIdConversation$zodSchema) + .optional(), + filters: z.lazy(() => GetConversationByIdFilters$zodSchema).optional(), + meta: z.lazy(() => GetConversationByIdMeta$zodSchema).optional(), +}).describe( + "Conversation with paginated messages, applied filter metadata, and request metadata", +); diff --git a/src/models/getcurrentorganizationop.ts b/src/models/getcurrentorganizationop.ts new file mode 100644 index 00000000..38bb55b6 --- /dev/null +++ b/src/models/getcurrentorganizationop.ts @@ -0,0 +1,16 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; +import { Organization, Organization$zodSchema } from "./organization.js"; + +export type GetCurrentOrganizationResponse = Organization | ErrorResponse; + +export const GetCurrentOrganizationResponse$zodSchema: z.ZodType< + GetCurrentOrganizationResponse +> = z.union([ + Organization$zodSchema, + ErrorResponse$zodSchema, +]); diff --git a/src/models/getknowledgehubchildnodesop.ts b/src/models/getknowledgehubchildnodesop.ts new file mode 100644 index 00000000..f97feaaf --- /dev/null +++ b/src/models/getknowledgehubchildnodesop.ts @@ -0,0 +1,403 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + KnowledgeHubNodesResponse, + KnowledgeHubNodesResponse$zodSchema, +} from "./knowledgehubnodesresponse.js"; + +/** + * Type of the parent node whose children to retrieve. + * + * @remarks + * + * Must be one of: `app`, `recordGroup`, `folder`, `record`. + * Any other value returns a 400 error. + */ +export const ParentType = { + App: "app", + RecordGroup: "recordGroup", + Folder: "folder", + Record: "record", +} as const; +/** + * Type of the parent node whose children to retrieve. + * + * @remarks + * + * Must be one of: `app`, `recordGroup`, `folder`, `record`. + * Any other value returns a 400 error. + */ +export type ParentType = ClosedEnum; + +export const ParentType$zodSchema = z.enum([ + "app", + "recordGroup", + "folder", + "record", +]).describe( + "Type of the parent node whose children to retrieve.\n\nMust be one of: `app`, `recordGroup`, `folder`, `record`.\nAny other value returns a 400 error.\n", +); + +/** + * Field to sort results by. Omitted → default `updatedAt`. + * + * @remarks + * Unknown value → silently falls back to `name`. + */ +export const GetKnowledgeHubChildNodesSortBy = { + Name: "name", + CreatedAt: "createdAt", + UpdatedAt: "updatedAt", + Size: "size", + Type: "type", +} as const; +/** + * Field to sort results by. Omitted → default `updatedAt`. + * + * @remarks + * Unknown value → silently falls back to `name`. + */ +export type GetKnowledgeHubChildNodesSortBy = ClosedEnum< + typeof GetKnowledgeHubChildNodesSortBy +>; + +export const GetKnowledgeHubChildNodesSortBy$zodSchema = z.enum([ + "name", + "createdAt", + "updatedAt", + "size", + "type", +]).describe( + "Field to sort results by. Omitted → default `updatedAt`.\nUnknown value → silently falls back to `name`.\n", +); + +/** + * Sort direction. Omitted → default `desc`. + * + * @remarks + * Unknown value → silently falls back to `asc`. + */ +export const GetKnowledgeHubChildNodesSortOrder = { + Asc: "asc", + Desc: "desc", +} as const; +/** + * Sort direction. Omitted → default `desc`. + * + * @remarks + * Unknown value → silently falls back to `asc`. + */ +export type GetKnowledgeHubChildNodesSortOrder = ClosedEnum< + typeof GetKnowledgeHubChildNodesSortOrder +>; + +export const GetKnowledgeHubChildNodesSortOrder$zodSchema = z.enum([ + "asc", + "desc", +]).describe( + "Sort direction. Omitted → default `desc`.\nUnknown value → silently falls back to `asc`.\n", +); + +export type GetKnowledgeHubChildNodesRequest = { + parentType: ParentType; + parentId: string; + onlyContainers?: boolean | undefined; + page?: number | undefined; + limit?: number | undefined; + sortBy?: GetKnowledgeHubChildNodesSortBy | undefined; + sortOrder?: GetKnowledgeHubChildNodesSortOrder | undefined; + q?: string | undefined; + nodeTypes?: string | undefined; + recordTypes?: string | undefined; + origins?: string | undefined; + connectorIds?: string | undefined; + indexingStatus?: string | undefined; + createdAt?: string | undefined; + updatedAt?: string | undefined; + size?: string | undefined; + include?: string | undefined; +}; + +export const GetKnowledgeHubChildNodesRequest$zodSchema: z.ZodType< + GetKnowledgeHubChildNodesRequest +> = z.object({ + connectorIds: z.string().describe( + "Comma-separated list of connector instance IDs (UUIDs) to filter by.\nMaximum 100 items. No enum validation — any string is accepted, but\nnon-existent IDs simply yield zero results.\n", + ).optional(), + createdAt: z.string().describe( + "Created-date range filter. Format: `gte:,lte:`.\nBoth bounds are optional (you may send just `gte:...` or just\n`lte:...`). Timestamps must be in the range 0 to 9999999999999 and\n`gte` must be less than or equal to `lte` when both are present.\n", + ).optional(), + include: z.string().describe( + "Comma-separated list of additional response sections to include.\nInvalid values are silently ignored. Maximum 100 items.\n\nValid values: `breadcrumbs`, `counts`, `availableFilters`, `permissions`\n", + ).optional(), + indexingStatus: z.string().describe( + "Comma-separated list of indexing statuses to include. Invalid values\nare silently ignored. Maximum 100 items.\n\nValid values: `NOT_STARTED`, `PAUSED`, `IN_PROGRESS`, `COMPLETED`,\n`FAILED`, `FILE_TYPE_NOT_SUPPORTED`, `AUTO_INDEX_OFF`, `EMPTY`,\n`ENABLE_MULTIMODAL_MODELS`, `QUEUED`\n", + ).optional(), + limit: z.int().default(50).describe( + "Maximum number of items to return per page.\n", + ), + nodeTypes: z.string().describe( + "Comma-separated list of node types to include. Invalid values are\nsilently ignored. Maximum 100 items.\n\nValid values: `folder`, `app`, `recordGroup`, `record`\n", + ).optional(), + onlyContainers: z.boolean().default(false).describe( + "When `true`, only nodes that have children are returned (useful for\nbuilding sidebar / tree navigation). Leaf nodes are excluded.\n", + ), + origins: z.string().describe( + "Comma-separated list of origin types to include. Invalid values are\nsilently ignored. Maximum 100 items.\n\nValid values: `COLLECTION`, `CONNECTOR`\n", + ).optional(), + page: z.int().default(1).describe( + "Page number (1-indexed). Combined with `limit` to paginate results.\n", + ), + parentId: z.string().describe( + "Identifier of the parent node. Accepts two formats:\n- A standard UUID (e.g. `f3a4b5b6-5b6c-4e85-9097-3202cfe696fc`)\n- The Collection app sentinel `knowledgeBase_`\n (e.g. `knowledgeBase_org123`)\n\nAny value that does not match either format returns a 400 error.\n", + ), + parentType: ParentType$zodSchema, + q: z.string().describe( + "Full-text search query. Must be between 2 and 500 characters\n(inclusive). When provided, the endpoint searches across all\ndescendants of the parent node.\n", + ).optional(), + recordTypes: z.string().describe( + "Comma-separated list of record types to include. Invalid values are\nsilently ignored. Maximum 100 items.\n\nValid values: `FILE`, `DRIVE`, `WEBPAGE`, `DATABASE`, `DATASOURCE`,\n`MESSAGE`, `MAIL`, `GROUP_MAIL`, `TICKET`, `COMMENT`,\n`INLINE_COMMENT`, `CONFLUENCE_PAGE`, `CONFLUENCE_BLOGPOST`,\n`SHAREPOINT_PAGE`, `SHAREPOINT_LIST`, `SHAREPOINT_LIST_ITEM`,\n`SHAREPOINT_DOCUMENT_LIBRARY`, `LINK`, `PROJECT`, `PULL_REQUEST`,\n`MEETING`, `PRODUCT`, `DEAL`, `CASE`, `TASK`, `ARTIFACT`,\n`CODE_FILE`, `SQL_TABLE`, `SQL_VIEW`, `OTHERS`\n", + ).optional(), + size: z.string().describe( + "File-size range filter in bytes. Format: `gte:,lte:`.\nBoth bounds are optional. Values must be non-negative and at most\n1099511627776 (1 TB). `gte` must be less than or equal to `lte`\nwhen both are present.\n", + ).optional(), + sortBy: GetKnowledgeHubChildNodesSortBy$zodSchema.default("updatedAt"), + sortOrder: GetKnowledgeHubChildNodesSortOrder$zodSchema.default("desc"), + updatedAt: z.string().describe( + "Updated-date range filter. Same format and constraints as `createdAt`.\n", + ).optional(), +}); + +export const GetKnowledgeHubChildNodesCodeHTTPInternalServerError = { + HttpInternalServerError: "HTTP_INTERNAL_SERVER_ERROR", +} as const; +export type GetKnowledgeHubChildNodesCodeHTTPInternalServerError = ClosedEnum< + typeof GetKnowledgeHubChildNodesCodeHTTPInternalServerError +>; + +export const GetKnowledgeHubChildNodesCodeHTTPInternalServerError$zodSchema = z + .enum([ + "HTTP_INTERNAL_SERVER_ERROR", + ]); + +export type GetKnowledgeHubChildNodesErrorHTTPInternalServerError = { + code: GetKnowledgeHubChildNodesCodeHTTPInternalServerError; + message: string; +}; + +export const GetKnowledgeHubChildNodesErrorHTTPInternalServerError$zodSchema: + z.ZodType = z.object({ + code: GetKnowledgeHubChildNodesCodeHTTPInternalServerError$zodSchema, + message: z.string(), + }); + +/** + * An unexpected error occurred on the server. + */ +export type GetKnowledgeHubChildNodesInternalServerErrorResponseBody = { + error: GetKnowledgeHubChildNodesErrorHTTPInternalServerError; +}; + +export const GetKnowledgeHubChildNodesInternalServerErrorResponseBody$zodSchema: + z.ZodType = z + .object({ + error: z.lazy(() => + GetKnowledgeHubChildNodesErrorHTTPInternalServerError$zodSchema + ), + }).describe("An unexpected error occurred on the server."); + +export const GetKnowledgeHubChildNodesNotFoundCode = { + HttpNotFound: "HTTP_NOT_FOUND", +} as const; +export type GetKnowledgeHubChildNodesNotFoundCode = ClosedEnum< + typeof GetKnowledgeHubChildNodesNotFoundCode +>; + +export const GetKnowledgeHubChildNodesNotFoundCode$zodSchema = z.enum([ + "HTTP_NOT_FOUND", +]); + +export type GetKnowledgeHubChildNodesNotFoundError = { + code: GetKnowledgeHubChildNodesNotFoundCode; + message: string; +}; + +export const GetKnowledgeHubChildNodesNotFoundError$zodSchema: z.ZodType< + GetKnowledgeHubChildNodesNotFoundError +> = z.object({ + code: GetKnowledgeHubChildNodesNotFoundCode$zodSchema, + message: z.string(), +}); + +/** + * Parent node not found. + * + * @remarks + * + * The `parentId` does not correspond to an existing node of the + * specified `parentType`, or the node has been deleted. + */ +export type GetKnowledgeHubChildNodesNotFoundResponseBody = { + error: GetKnowledgeHubChildNodesNotFoundError; +}; + +export const GetKnowledgeHubChildNodesNotFoundResponseBody$zodSchema: z.ZodType< + GetKnowledgeHubChildNodesNotFoundResponseBody +> = z.object({ + error: z.lazy(() => GetKnowledgeHubChildNodesNotFoundError$zodSchema), +}).describe( + "Parent node not found.\n\nThe `parentId` does not correspond to an existing node of the\nspecified `parentType`, or the node has been deleted.\n", +); + +export const GetKnowledgeHubChildNodesForbiddenCode = { + HttpForbidden: "HTTP_FORBIDDEN", +} as const; +export type GetKnowledgeHubChildNodesForbiddenCode = ClosedEnum< + typeof GetKnowledgeHubChildNodesForbiddenCode +>; + +export const GetKnowledgeHubChildNodesForbiddenCode$zodSchema = z.enum([ + "HTTP_FORBIDDEN", +]); + +export type GetKnowledgeHubChildNodesErrorHTTPForbidden = { + code: GetKnowledgeHubChildNodesForbiddenCode; + message: string; +}; + +export const GetKnowledgeHubChildNodesErrorHTTPForbidden$zodSchema: z.ZodType< + GetKnowledgeHubChildNodesErrorHTTPForbidden +> = z.object({ + code: GetKnowledgeHubChildNodesForbiddenCode$zodSchema, + message: z.string(), +}); + +/** + * Insufficient OAuth scope. + * + * @remarks + * + * Only applies to OAuth tokens. The token did not carry the `kb:read` + * scope required by this endpoint. Regular (non-OAuth) JWT bearer + * tokens are not subject to scope enforcement and will not receive + * this error. + */ +export type GetKnowledgeHubChildNodesForbiddenResponseBody = { + error: GetKnowledgeHubChildNodesErrorHTTPForbidden; +}; + +export const GetKnowledgeHubChildNodesForbiddenResponseBody$zodSchema: + z.ZodType = z.object({ + error: z.lazy(() => GetKnowledgeHubChildNodesErrorHTTPForbidden$zodSchema), + }).describe( + "Insufficient OAuth scope.\n\nOnly applies to OAuth tokens. The token did not carry the `kb:read`\nscope required by this endpoint. Regular (non-OAuth) JWT bearer\ntokens are not subject to scope enforcement and will not receive\nthis error.\n", + ); + +export const GetKnowledgeHubChildNodesUnauthorizedCode = { + HttpUnauthorized: "HTTP_UNAUTHORIZED", +} as const; +export type GetKnowledgeHubChildNodesUnauthorizedCode = ClosedEnum< + typeof GetKnowledgeHubChildNodesUnauthorizedCode +>; + +export const GetKnowledgeHubChildNodesUnauthorizedCode$zodSchema = z.enum([ + "HTTP_UNAUTHORIZED", +]); + +export type GetKnowledgeHubChildNodesErrorHTTPUnauthorized = { + code: GetKnowledgeHubChildNodesUnauthorizedCode; + message: string; +}; + +export const GetKnowledgeHubChildNodesErrorHTTPUnauthorized$zodSchema: + z.ZodType = z.object({ + code: GetKnowledgeHubChildNodesUnauthorizedCode$zodSchema, + message: z.string(), + }); + +/** + * Missing or invalid authentication token. + * + * @remarks + * + * The bearer token was absent, expired, malformed, or could not be + * verified by the auth middleware. + */ +export type GetKnowledgeHubChildNodesUnauthorizedResponseBody = { + error: GetKnowledgeHubChildNodesErrorHTTPUnauthorized; +}; + +export const GetKnowledgeHubChildNodesUnauthorizedResponseBody$zodSchema: + z.ZodType = z.object({ + error: z.lazy(() => + GetKnowledgeHubChildNodesErrorHTTPUnauthorized$zodSchema + ), + }).describe( + "Missing or invalid authentication token.\n\nThe bearer token was absent, expired, malformed, or could not be\nverified by the auth middleware.\n", + ); + +export const GetKnowledgeHubChildNodesCodeHTTPBadRequest = { + HttpBadRequest: "HTTP_BAD_REQUEST", +} as const; +export type GetKnowledgeHubChildNodesCodeHTTPBadRequest = ClosedEnum< + typeof GetKnowledgeHubChildNodesCodeHTTPBadRequest +>; + +export const GetKnowledgeHubChildNodesCodeHTTPBadRequest$zodSchema = z.enum([ + "HTTP_BAD_REQUEST", +]); + +export type GetKnowledgeHubChildNodesErrorHTTPBadRequest = { + code: GetKnowledgeHubChildNodesCodeHTTPBadRequest; + message: string; +}; + +export const GetKnowledgeHubChildNodesErrorHTTPBadRequest$zodSchema: z.ZodType< + GetKnowledgeHubChildNodesErrorHTTPBadRequest +> = z.object({ + code: GetKnowledgeHubChildNodesCodeHTTPBadRequest$zodSchema, + message: z.string(), +}); + +/** + * Invalid request parameters or path values. The backend's validation + * + * @remarks + * message is returned verbatim in `error.message`. See the examples + * below for the common triggers. + */ +export type GetKnowledgeHubChildNodesBadRequestResponseBody = { + error: GetKnowledgeHubChildNodesErrorHTTPBadRequest; +}; + +export const GetKnowledgeHubChildNodesBadRequestResponseBody$zodSchema: + z.ZodType = z.object({ + error: z.lazy(() => GetKnowledgeHubChildNodesErrorHTTPBadRequest$zodSchema), + }).describe( + "Invalid request parameters or path values. The backend's validation\nmessage is returned verbatim in `error.message`. See the examples\nbelow for the common triggers.\n", + ); + +export type GetKnowledgeHubChildNodesResponse = + | KnowledgeHubNodesResponse + | GetKnowledgeHubChildNodesBadRequestResponseBody + | GetKnowledgeHubChildNodesUnauthorizedResponseBody + | GetKnowledgeHubChildNodesForbiddenResponseBody + | GetKnowledgeHubChildNodesNotFoundResponseBody + | GetKnowledgeHubChildNodesInternalServerErrorResponseBody; + +export const GetKnowledgeHubChildNodesResponse$zodSchema: z.ZodType< + GetKnowledgeHubChildNodesResponse +> = z.union([ + KnowledgeHubNodesResponse$zodSchema, + z.lazy(() => GetKnowledgeHubChildNodesBadRequestResponseBody$zodSchema), + z.lazy(() => GetKnowledgeHubChildNodesUnauthorizedResponseBody$zodSchema), + z.lazy(() => GetKnowledgeHubChildNodesForbiddenResponseBody$zodSchema), + z.lazy(() => GetKnowledgeHubChildNodesNotFoundResponseBody$zodSchema), + z.lazy(() => + GetKnowledgeHubChildNodesInternalServerErrorResponseBody$zodSchema + ), +]); diff --git a/src/models/getknowledgehubrootnodesop.ts b/src/models/getknowledgehubrootnodesop.ts index fb2d502c..173edca9 100644 --- a/src/models/getknowledgehubrootnodesop.ts +++ b/src/models/getknowledgehubrootnodesop.ts @@ -4,30 +4,77 @@ import * as z from "zod"; import { ClosedEnum } from "../types/enums.js"; +import { + KnowledgeHubNodesResponse, + KnowledgeHubNodesResponse$zodSchema, +} from "./knowledgehubnodesresponse.js"; /** - * Sort order. + * Field to sort results by. Omitted → default `updatedAt`. + * + * @remarks + * Unknown value → silently falls back to `name`. */ -export const SortOrder = { +export const GetKnowledgeHubRootNodesSortBy = { + Name: "name", + CreatedAt: "createdAt", + UpdatedAt: "updatedAt", + Size: "size", + Type: "type", +} as const; +/** + * Field to sort results by. Omitted → default `updatedAt`. + * + * @remarks + * Unknown value → silently falls back to `name`. + */ +export type GetKnowledgeHubRootNodesSortBy = ClosedEnum< + typeof GetKnowledgeHubRootNodesSortBy +>; + +export const GetKnowledgeHubRootNodesSortBy$zodSchema = z.enum([ + "name", + "createdAt", + "updatedAt", + "size", + "type", +]).describe( + "Field to sort results by. Omitted → default `updatedAt`.\nUnknown value → silently falls back to `name`.\n", +); + +/** + * Sort direction. Omitted → default `desc`. + * + * @remarks + * Unknown value → silently falls back to `asc`. + */ +export const GetKnowledgeHubRootNodesSortOrder = { Asc: "asc", Desc: "desc", } as const; /** - * Sort order. + * Sort direction. Omitted → default `desc`. + * + * @remarks + * Unknown value → silently falls back to `asc`. */ -export type SortOrder = ClosedEnum; +export type GetKnowledgeHubRootNodesSortOrder = ClosedEnum< + typeof GetKnowledgeHubRootNodesSortOrder +>; -export const SortOrder$zodSchema = z.enum([ +export const GetKnowledgeHubRootNodesSortOrder$zodSchema = z.enum([ "asc", "desc", -]).describe("Sort order."); +]).describe( + "Sort direction. Omitted → default `desc`.\nUnknown value → silently falls back to `asc`.\n", +); export type GetKnowledgeHubRootNodesRequest = { - only_containers?: boolean | undefined; + onlyContainers?: boolean | undefined; page?: number | undefined; limit?: number | undefined; - sortBy?: string | undefined; - sortOrder?: SortOrder | undefined; + sortBy?: GetKnowledgeHubRootNodesSortBy | undefined; + sortOrder?: GetKnowledgeHubRootNodesSortOrder | undefined; q?: string | undefined; nodeTypes?: string | undefined; recordTypes?: string | undefined; @@ -37,7 +84,6 @@ export type GetKnowledgeHubRootNodesRequest = { createdAt?: string | undefined; updatedAt?: string | undefined; size?: string | undefined; - flattened?: boolean | undefined; include?: string | undefined; }; @@ -45,38 +91,232 @@ export const GetKnowledgeHubRootNodesRequest$zodSchema: z.ZodType< GetKnowledgeHubRootNodesRequest > = z.object({ connectorIds: z.string().describe( - "Comma-separated connector instance ids to scope to.", + "Comma-separated list of connector instance IDs (UUIDs) to filter by.\nMaximum 100 items. No enum validation — any string is accepted, but\nnon-existent IDs simply yield zero results.\n", + ).optional(), + createdAt: z.string().describe( + "Created-date range filter. Format: `gte:,lte:`.\nBoth bounds are optional (you may send just `gte:...` or just\n`lte:...`). Timestamps must be in the range 0 to 9999999999999 and\n`gte` must be less than or equal to `lte` when both are present.\n", ).optional(), - createdAt: z.string().describe("Created date range as `gte:,lte:`.") - .optional(), - flattened: z.boolean().default(false).describe( - "Return flattened view with all nested children.", - ), include: z.string().describe( - "Comma-separated includes — any of `breadcrumbs`, `counts`,\n`availableFilters`, `permissions`.\n", + "Comma-separated list of additional response sections to include.\nInvalid values are silently ignored. Maximum 100 items.\n\nValid values: `breadcrumbs`, `counts`, `availableFilters`, `permissions`\n", ).optional(), - indexingStatus: z.string().describe("Comma-separated indexing statuses.") - .optional(), - limit: z.int().default(50).describe("Items per page."), + indexingStatus: z.string().describe( + "Comma-separated list of indexing statuses to include. Invalid values\nare silently ignored. Maximum 100 items.\n\nValid values: `NOT_STARTED`, `PAUSED`, `IN_PROGRESS`, `COMPLETED`,\n`FAILED`, `FILE_TYPE_NOT_SUPPORTED`, `AUTO_INDEX_OFF`, `EMPTY`,\n`ENABLE_MULTIMODAL_MODELS`, `QUEUED`\n", + ).optional(), + limit: z.int().default(50).describe( + "Maximum number of items to return per page.\n", + ), nodeTypes: z.string().describe( - "Comma-separated node types (`app`, `recordGroup`, `folder`, `record`).", + "Comma-separated list of node types to include. Invalid values are\nsilently ignored. Maximum 100 items.\n\nValid values: `folder`, `app`, `recordGroup`, `record`\n", ).optional(), - only_containers: z.boolean().default(false).describe( - "Only return nodes with children (for sidebar UIs).", + onlyContainers: z.boolean().default(false).describe( + "When `true`, only nodes that have children are returned (useful for\nbuilding sidebar / tree navigation). Leaf nodes are excluded.\n", ), origins: z.string().describe( - "Comma-separated origins (`COLLECTION`, `CONNECTOR`).", + "Comma-separated list of origin types to include. Invalid values are\nsilently ignored. Maximum 100 items.\n\nValid values: `COLLECTION`, `CONNECTOR`\n", ).optional(), - page: z.int().default(1).describe("Page number (1-indexed)."), - q: z.string().describe("Full-text search query against node names.") - .optional(), - recordTypes: z.string().describe("Comma-separated record types.").optional(), - size: z.string().describe("Size range as `gte:,lte:`.") - .optional(), - sortBy: z.string().default("updatedAt").describe( - "Sort field — one of `name`, `createdAt`, `updatedAt`, `size`, `type`.", + page: z.int().default(1).describe( + "Page number (1-indexed). Combined with `limit` to paginate results.\n", ), - sortOrder: SortOrder$zodSchema.default("desc"), - updatedAt: z.string().describe("Updated date range as `gte:,lte:`.") - .optional(), + q: z.string().describe( + "Full-text search query. Must be between 2 and 500 characters\n(inclusive). When provided, the endpoint searches across the entire\nnode tree regardless of the current browse level.\n", + ).optional(), + recordTypes: z.string().describe( + "Comma-separated list of record types to include. Invalid values are\nsilently ignored. Maximum 100 items.\n\nValid values: `FILE`, `DRIVE`, `WEBPAGE`, `DATABASE`, `DATASOURCE`,\n`MESSAGE`, `MAIL`, `GROUP_MAIL`, `TICKET`, `COMMENT`,\n`INLINE_COMMENT`, `CONFLUENCE_PAGE`, `CONFLUENCE_BLOGPOST`,\n`SHAREPOINT_PAGE`, `SHAREPOINT_LIST`, `SHAREPOINT_LIST_ITEM`,\n`SHAREPOINT_DOCUMENT_LIBRARY`, `LINK`, `PROJECT`, `PULL_REQUEST`,\n`MEETING`, `PRODUCT`, `DEAL`, `CASE`, `TASK`, `ARTIFACT`,\n`CODE_FILE`, `SQL_TABLE`, `SQL_VIEW`, `OTHERS`\n", + ).optional(), + size: z.string().describe( + "File-size range filter in bytes. Format: `gte:,lte:`.\nBoth bounds are optional. Values must be non-negative and at most\n1099511627776 (1 TB). `gte` must be less than or equal to `lte`\nwhen both are present.\n", + ).optional(), + sortBy: GetKnowledgeHubRootNodesSortBy$zodSchema.default("updatedAt"), + sortOrder: GetKnowledgeHubRootNodesSortOrder$zodSchema.default("desc"), + updatedAt: z.string().describe( + "Updated-date range filter. Same format and constraints as `createdAt`.\n", + ).optional(), }); + +export const GetKnowledgeHubRootNodesCodeHTTPInternalServerError = { + HttpInternalServerError: "HTTP_INTERNAL_SERVER_ERROR", +} as const; +export type GetKnowledgeHubRootNodesCodeHTTPInternalServerError = ClosedEnum< + typeof GetKnowledgeHubRootNodesCodeHTTPInternalServerError +>; + +export const GetKnowledgeHubRootNodesCodeHTTPInternalServerError$zodSchema = z + .enum([ + "HTTP_INTERNAL_SERVER_ERROR", + ]); + +export type GetKnowledgeHubRootNodesErrorHTTPInternalServerError = { + code: GetKnowledgeHubRootNodesCodeHTTPInternalServerError; + message: string; +}; + +export const GetKnowledgeHubRootNodesErrorHTTPInternalServerError$zodSchema: + z.ZodType = z.object({ + code: GetKnowledgeHubRootNodesCodeHTTPInternalServerError$zodSchema, + message: z.string(), + }); + +/** + * An unexpected error occurred on the server. + */ +export type GetKnowledgeHubRootNodesInternalServerErrorResponseBody = { + error: GetKnowledgeHubRootNodesErrorHTTPInternalServerError; +}; + +export const GetKnowledgeHubRootNodesInternalServerErrorResponseBody$zodSchema: + z.ZodType = z.object( + { + error: z.lazy(() => + GetKnowledgeHubRootNodesErrorHTTPInternalServerError$zodSchema + ), + }, + ).describe("An unexpected error occurred on the server."); + +export const GetKnowledgeHubRootNodesForbiddenCode = { + HttpForbidden: "HTTP_FORBIDDEN", +} as const; +export type GetKnowledgeHubRootNodesForbiddenCode = ClosedEnum< + typeof GetKnowledgeHubRootNodesForbiddenCode +>; + +export const GetKnowledgeHubRootNodesForbiddenCode$zodSchema = z.enum([ + "HTTP_FORBIDDEN", +]); + +export type GetKnowledgeHubRootNodesErrorHTTPForbidden = { + code: GetKnowledgeHubRootNodesForbiddenCode; + message: string; +}; + +export const GetKnowledgeHubRootNodesErrorHTTPForbidden$zodSchema: z.ZodType< + GetKnowledgeHubRootNodesErrorHTTPForbidden +> = z.object({ + code: GetKnowledgeHubRootNodesForbiddenCode$zodSchema, + message: z.string(), +}); + +/** + * Insufficient OAuth scope. + * + * @remarks + * + * Only applies to OAuth tokens. The token did not carry the `kb:read` + * scope required by this endpoint. Regular (non-OAuth) JWT bearer + * tokens are not subject to scope enforcement and will not receive + * this error. + */ +export type GetKnowledgeHubRootNodesForbiddenResponseBody = { + error: GetKnowledgeHubRootNodesErrorHTTPForbidden; +}; + +export const GetKnowledgeHubRootNodesForbiddenResponseBody$zodSchema: z.ZodType< + GetKnowledgeHubRootNodesForbiddenResponseBody +> = z.object({ + error: z.lazy(() => GetKnowledgeHubRootNodesErrorHTTPForbidden$zodSchema), +}).describe( + "Insufficient OAuth scope.\n\nOnly applies to OAuth tokens. The token did not carry the `kb:read`\nscope required by this endpoint. Regular (non-OAuth) JWT bearer\ntokens are not subject to scope enforcement and will not receive\nthis error.\n", +); + +export const GetKnowledgeHubRootNodesUnauthorizedCode = { + HttpUnauthorized: "HTTP_UNAUTHORIZED", +} as const; +export type GetKnowledgeHubRootNodesUnauthorizedCode = ClosedEnum< + typeof GetKnowledgeHubRootNodesUnauthorizedCode +>; + +export const GetKnowledgeHubRootNodesUnauthorizedCode$zodSchema = z.enum([ + "HTTP_UNAUTHORIZED", +]); + +export type GetKnowledgeHubRootNodesErrorHTTPUnauthorized = { + code: GetKnowledgeHubRootNodesUnauthorizedCode; + message: string; +}; + +export const GetKnowledgeHubRootNodesErrorHTTPUnauthorized$zodSchema: z.ZodType< + GetKnowledgeHubRootNodesErrorHTTPUnauthorized +> = z.object({ + code: GetKnowledgeHubRootNodesUnauthorizedCode$zodSchema, + message: z.string(), +}); + +/** + * Missing or invalid authentication token. + * + * @remarks + * + * The bearer token was absent, expired, malformed, or could not be + * verified by the auth middleware. + */ +export type GetKnowledgeHubRootNodesUnauthorizedResponseBody = { + error: GetKnowledgeHubRootNodesErrorHTTPUnauthorized; +}; + +export const GetKnowledgeHubRootNodesUnauthorizedResponseBody$zodSchema: + z.ZodType = z.object({ + error: z.lazy(() => + GetKnowledgeHubRootNodesErrorHTTPUnauthorized$zodSchema + ), + }).describe( + "Missing or invalid authentication token.\n\nThe bearer token was absent, expired, malformed, or could not be\nverified by the auth middleware.\n", + ); + +export const GetKnowledgeHubRootNodesCodeHTTPBadRequest = { + HttpBadRequest: "HTTP_BAD_REQUEST", +} as const; +export type GetKnowledgeHubRootNodesCodeHTTPBadRequest = ClosedEnum< + typeof GetKnowledgeHubRootNodesCodeHTTPBadRequest +>; + +export const GetKnowledgeHubRootNodesCodeHTTPBadRequest$zodSchema = z.enum([ + "HTTP_BAD_REQUEST", +]); + +export type GetKnowledgeHubRootNodesErrorHTTPBadRequest = { + code: GetKnowledgeHubRootNodesCodeHTTPBadRequest; + message: string; +}; + +export const GetKnowledgeHubRootNodesErrorHTTPBadRequest$zodSchema: z.ZodType< + GetKnowledgeHubRootNodesErrorHTTPBadRequest +> = z.object({ + code: GetKnowledgeHubRootNodesCodeHTTPBadRequest$zodSchema, + message: z.string(), +}); + +/** + * Invalid request parameters. The backend's validation message is + * + * @remarks + * returned verbatim in `error.message`. See the examples below for + * the common triggers. + */ +export type GetKnowledgeHubRootNodesBadRequestResponseBody = { + error: GetKnowledgeHubRootNodesErrorHTTPBadRequest; +}; + +export const GetKnowledgeHubRootNodesBadRequestResponseBody$zodSchema: + z.ZodType = z.object({ + error: z.lazy(() => GetKnowledgeHubRootNodesErrorHTTPBadRequest$zodSchema), + }).describe( + "Invalid request parameters. The backend's validation message is\nreturned verbatim in `error.message`. See the examples below for\nthe common triggers.\n", + ); + +export type GetKnowledgeHubRootNodesResponse = + | KnowledgeHubNodesResponse + | GetKnowledgeHubRootNodesBadRequestResponseBody + | GetKnowledgeHubRootNodesUnauthorizedResponseBody + | GetKnowledgeHubRootNodesForbiddenResponseBody + | GetKnowledgeHubRootNodesInternalServerErrorResponseBody; + +export const GetKnowledgeHubRootNodesResponse$zodSchema: z.ZodType< + GetKnowledgeHubRootNodesResponse +> = z.union([ + KnowledgeHubNodesResponse$zodSchema, + z.lazy(() => GetKnowledgeHubRootNodesBadRequestResponseBody$zodSchema), + z.lazy(() => GetKnowledgeHubRootNodesUnauthorizedResponseBody$zodSchema), + z.lazy(() => GetKnowledgeHubRootNodesForbiddenResponseBody$zodSchema), + z.lazy(() => + GetKnowledgeHubRootNodesInternalServerErrorResponseBody$zodSchema + ), +]); diff --git a/src/models/getoauthappop.ts b/src/models/getoauthappop.ts new file mode 100644 index 00000000..2f38912e --- /dev/null +++ b/src/models/getoauthappop.ts @@ -0,0 +1,36 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + ApplicationJsonErrorResponse, + ApplicationJsonErrorResponse$zodSchema, +} from "./applicationjsonerrorresponse.js"; +import { + OAuthAppResponse, + OAuthAppResponse$zodSchema, +} from "./oauthappresponse.js"; +import { + OAuthClientManagementRateLimitError, + OAuthClientManagementRateLimitError$zodSchema, +} from "./oauthclientmanagementratelimiterror.js"; + +export type GetOAuthAppRequest = { appId: string }; + +export const GetOAuthAppRequest$zodSchema: z.ZodType = z + .object({ + appId: z.string().describe("OAuth app ID (MongoDB ObjectId)"), + }); + +export type GetOAuthAppResponse = + | OAuthAppResponse + | ApplicationJsonErrorResponse + | OAuthClientManagementRateLimitError; + +export const GetOAuthAppResponse$zodSchema: z.ZodType = z + .union([ + OAuthAppResponse$zodSchema, + ApplicationJsonErrorResponse$zodSchema, + OAuthClientManagementRateLimitError$zodSchema, + ]); diff --git a/src/models/getsearchbyidop.ts b/src/models/getsearchbyidop.ts new file mode 100644 index 00000000..9ff53041 --- /dev/null +++ b/src/models/getsearchbyidop.ts @@ -0,0 +1,338 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + PersistedSemanticSearch, + PersistedSemanticSearch$zodSchema, +} from "./persistedsemanticsearch.js"; + +export type GetSearchByIdRequest = { searchId: string }; + +export const GetSearchByIdRequest$zodSchema: z.ZodType = z + .object({ + searchId: z.string().describe("Unique search identifier"), + }); + +/** + * Machine-readable error code. + * + * @remarks + * + * - `HTTP_INTERNAL_SERVER_ERROR` — explicit + * `InternalServerError` raised by the handler. + * - `INTERNAL_ERROR` — unhandled exception + * caught by the global error middleware. + * - `MIDDLEWARE_ERROR` — the error middleware + * itself failed while serializing the + * response. + */ +export const InternalServerErrorErrorCode = { + HttpInternalServerError: "HTTP_INTERNAL_SERVER_ERROR", + InternalError: "INTERNAL_ERROR", + MiddlewareError: "MIDDLEWARE_ERROR", +} as const; +/** + * Machine-readable error code. + * + * @remarks + * + * - `HTTP_INTERNAL_SERVER_ERROR` — explicit + * `InternalServerError` raised by the handler. + * - `INTERNAL_ERROR` — unhandled exception + * caught by the global error middleware. + * - `MIDDLEWARE_ERROR` — the error middleware + * itself failed while serializing the + * response. + */ +export type InternalServerErrorErrorCode = ClosedEnum< + typeof InternalServerErrorErrorCode +>; + +export const InternalServerErrorErrorCode$zodSchema = z.enum([ + "HTTP_INTERNAL_SERVER_ERROR", + "INTERNAL_ERROR", + "MIDDLEWARE_ERROR", +]).describe( + "Machine-readable error code.\n\n- `HTTP_INTERNAL_SERVER_ERROR` — explicit\n `InternalServerError` raised by the handler.\n- `INTERNAL_ERROR` — unhandled exception\n caught by the global error middleware.\n- `MIDDLEWARE_ERROR` — the error middleware\n itself failed while serializing the\n response.\n", +); + +export type GetSearchByIdInternalServerErrorError = { + code: InternalServerErrorErrorCode; + message: string; +}; + +export const GetSearchByIdInternalServerErrorError$zodSchema: z.ZodType< + GetSearchByIdInternalServerErrorError +> = z.object({ + code: InternalServerErrorErrorCode$zodSchema, + message: z.string(), +}); + +/** + * Server error. Possible causes: + * + * @remarks + * + * - Explicit `InternalServerError` + * or any other 500 `BaseError` thrown by the handler. + * - Non-`BaseError` exception caught by the + * global error middleware. + * - Response serializer fallback. + */ +export type GetSearchByIdInternalServerErrorResponseBody = { + error: GetSearchByIdInternalServerErrorError; +}; + +export const GetSearchByIdInternalServerErrorResponseBody$zodSchema: z.ZodType< + GetSearchByIdInternalServerErrorResponseBody +> = z.object({ + error: z.lazy(() => GetSearchByIdInternalServerErrorError$zodSchema), +}).describe( + "Server error. Possible causes:\n\n- Explicit `InternalServerError`\n or any other 500 `BaseError` thrown by the handler.\n- Non-`BaseError` exception caught by the\n global error middleware.\n- Response serializer fallback.\n", +); + +/** + * Machine-readable error code. `HTTP_NOT_FOUND` + * + * @remarks + * is emitted when the addressed resource does + * not exist. + */ +export const GetSearchByIdNotFoundCode = { + HttpNotFound: "HTTP_NOT_FOUND", +} as const; +/** + * Machine-readable error code. `HTTP_NOT_FOUND` + * + * @remarks + * is emitted when the addressed resource does + * not exist. + */ +export type GetSearchByIdNotFoundCode = ClosedEnum< + typeof GetSearchByIdNotFoundCode +>; + +export const GetSearchByIdNotFoundCode$zodSchema = z.enum([ + "HTTP_NOT_FOUND", +]).describe( + "Machine-readable error code. `HTTP_NOT_FOUND`\nis emitted when the addressed resource does\nnot exist.\n", +); + +export type GetSearchByIdNotFoundError = { + code: GetSearchByIdNotFoundCode; + message: string; +}; + +export const GetSearchByIdNotFoundError$zodSchema: z.ZodType< + GetSearchByIdNotFoundError +> = z.object({ + code: GetSearchByIdNotFoundCode$zodSchema, + message: z.string(), +}); + +/** + * Reserved for parity with sibling routes; this endpoint + * + * @remarks + * currently returns `200` with an empty array for an unknown + * id rather than emitting `404`. + */ +export type GetSearchByIdNotFoundResponseBody = { + error: GetSearchByIdNotFoundError; +}; + +export const GetSearchByIdNotFoundResponseBody$zodSchema: z.ZodType< + GetSearchByIdNotFoundResponseBody +> = z.object({ + error: z.lazy(() => GetSearchByIdNotFoundError$zodSchema), +}).describe( + "Reserved for parity with sibling routes; this endpoint\ncurrently returns `200` with an empty array for an unknown\nid rather than emitting `404`.\n", +); + +/** + * Machine-readable error code. `HTTP_FORBIDDEN` + * + * @remarks + * is emitted when the bearer token is valid but + * lacks the required scope. + */ +export const GetSearchByIdForbiddenCode = { + HttpForbidden: "HTTP_FORBIDDEN", +} as const; +/** + * Machine-readable error code. `HTTP_FORBIDDEN` + * + * @remarks + * is emitted when the bearer token is valid but + * lacks the required scope. + */ +export type GetSearchByIdForbiddenCode = ClosedEnum< + typeof GetSearchByIdForbiddenCode +>; + +export const GetSearchByIdForbiddenCode$zodSchema = z.enum([ + "HTTP_FORBIDDEN", +]).describe( + "Machine-readable error code. `HTTP_FORBIDDEN`\nis emitted when the bearer token is valid but\nlacks the required scope.\n", +); + +export type GetSearchByIdErrorHTTPForbidden = { + code: GetSearchByIdForbiddenCode; + message: string; +}; + +export const GetSearchByIdErrorHTTPForbidden$zodSchema: z.ZodType< + GetSearchByIdErrorHTTPForbidden +> = z.object({ + code: GetSearchByIdForbiddenCode$zodSchema, + message: z.string(), +}); + +/** + * Bearer token lacks the `semantic:read` scope. + * + * @remarks + */ +export type GetSearchByIdForbiddenResponseBody = { + error: GetSearchByIdErrorHTTPForbidden; +}; + +export const GetSearchByIdForbiddenResponseBody$zodSchema: z.ZodType< + GetSearchByIdForbiddenResponseBody +> = z.object({ + error: z.lazy(() => GetSearchByIdErrorHTTPForbidden$zodSchema), +}).describe("Bearer token lacks the `semantic:read` scope.\n"); + +/** + * Machine-readable error code. `HTTP_UNAUTHORIZED` + * + * @remarks + * is emitted when the bearer token is missing, + * invalid, or expired. + */ +export const GetSearchByIdUnauthorizedCode = { + HttpUnauthorized: "HTTP_UNAUTHORIZED", +} as const; +/** + * Machine-readable error code. `HTTP_UNAUTHORIZED` + * + * @remarks + * is emitted when the bearer token is missing, + * invalid, or expired. + */ +export type GetSearchByIdUnauthorizedCode = ClosedEnum< + typeof GetSearchByIdUnauthorizedCode +>; + +export const GetSearchByIdUnauthorizedCode$zodSchema = z.enum([ + "HTTP_UNAUTHORIZED", +]).describe( + "Machine-readable error code. `HTTP_UNAUTHORIZED`\nis emitted when the bearer token is missing,\ninvalid, or expired.\n", +); + +export type GetSearchByIdErrorHTTPUnauthorized = { + code: GetSearchByIdUnauthorizedCode; + message: string; +}; + +export const GetSearchByIdErrorHTTPUnauthorized$zodSchema: z.ZodType< + GetSearchByIdErrorHTTPUnauthorized +> = z.object({ + code: GetSearchByIdUnauthorizedCode$zodSchema, + message: z.string(), +}); + +/** + * Missing or invalid bearer token. + * + * @remarks + */ +export type GetSearchByIdUnauthorizedResponseBody = { + error: GetSearchByIdErrorHTTPUnauthorized; +}; + +export const GetSearchByIdUnauthorizedResponseBody$zodSchema: z.ZodType< + GetSearchByIdUnauthorizedResponseBody +> = z.object({ + error: z.lazy(() => GetSearchByIdErrorHTTPUnauthorized$zodSchema), +}).describe("Missing or invalid bearer token.\n"); + +/** + * Machine-readable error code. `VALIDATION_ERROR` + * + * @remarks + * is emitted when the request fails Zod + * validation. + */ +export const GetSearchByIdCodeValidationError = { + ValidationError: "VALIDATION_ERROR", +} as const; +/** + * Machine-readable error code. `VALIDATION_ERROR` + * + * @remarks + * is emitted when the request fails Zod + * validation. + */ +export type GetSearchByIdCodeValidationError = ClosedEnum< + typeof GetSearchByIdCodeValidationError +>; + +export const GetSearchByIdCodeValidationError$zodSchema = z.enum([ + "VALIDATION_ERROR", +]).describe( + "Machine-readable error code. `VALIDATION_ERROR`\nis emitted when the request fails Zod\nvalidation.\n", +); + +export type GetSearchByIdErrorValidationError = { + code: GetSearchByIdCodeValidationError; + message: string; +}; + +export const GetSearchByIdErrorValidationError$zodSchema: z.ZodType< + GetSearchByIdErrorValidationError +> = z.object({ + code: GetSearchByIdCodeValidationError$zodSchema, + message: z.string(), +}); + +/** + * Invalid request — `searchId` + * + * @remarks + * failed Zod validation (not a valid ObjectId). + */ +export type GetSearchByIdBadRequestResponseBody = { + error: GetSearchByIdErrorValidationError; +}; + +export const GetSearchByIdBadRequestResponseBody$zodSchema: z.ZodType< + GetSearchByIdBadRequestResponseBody +> = z.object({ + error: z.lazy(() => GetSearchByIdErrorValidationError$zodSchema), +}).describe( + "Invalid request — `searchId`\nfailed Zod validation (not a valid ObjectId).\n", +); + +export type GetSearchByIdResponse = + | GetSearchByIdBadRequestResponseBody + | GetSearchByIdUnauthorizedResponseBody + | GetSearchByIdForbiddenResponseBody + | GetSearchByIdNotFoundResponseBody + | GetSearchByIdInternalServerErrorResponseBody + | Array; + +export const GetSearchByIdResponse$zodSchema: z.ZodType = + z.union([ + z.lazy(() => GetSearchByIdBadRequestResponseBody$zodSchema), + z.lazy(() => GetSearchByIdUnauthorizedResponseBody$zodSchema), + z.lazy(() => GetSearchByIdForbiddenResponseBody$zodSchema), + z.lazy(() => GetSearchByIdNotFoundResponseBody$zodSchema), + z.lazy(() => GetSearchByIdInternalServerErrorResponseBody$zodSchema), + z.array(PersistedSemanticSearch$zodSchema).describe( + "Array containing zero or one persisted search document.", + ), + ]); diff --git a/src/models/getuserbyidop.ts b/src/models/getuserbyidop.ts deleted file mode 100644 index 31fc0a7a..00000000 --- a/src/models/getuserbyidop.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; - -export type GetUserByIdRequest = { id: string }; - -export const GetUserByIdRequest$zodSchema: z.ZodType = z - .object({ - id: z.string().describe( - "User identifier (24-character MongoDB ObjectId). To look up the\nauthenticated user, decode the JWT and use its `userId` claim,\nor list `/users` and match on email.\n", - ), - }); diff --git a/src/models/getuserteamsop.ts b/src/models/getuserteamsop.ts deleted file mode 100644 index bff61f5b..00000000 --- a/src/models/getuserteamsop.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; - -export type GetUserTeamsRequest = { - page?: number | undefined; - limit?: number | undefined; - search?: string | undefined; - created_by?: string | undefined; - created_after?: number | undefined; - created_before?: number | undefined; -}; - -export const GetUserTeamsRequest$zodSchema: z.ZodType = z - .object({ - created_after: z.int().describe( - "Filter teams created after this timestamp (ms)", - ).optional(), - created_before: z.int().describe( - "Filter teams created before this timestamp (ms)", - ).optional(), - created_by: z.string().describe("Filter by creator user key").optional(), - limit: z.int().default(100).describe("Number of teams per page"), - page: z.int().default(1).describe("Page number for pagination (1-based)"), - search: z.string().describe("Search teams by name").optional(), - }); diff --git a/src/models/getwebsearchprovidersop.ts b/src/models/getwebsearchprovidersop.ts new file mode 100644 index 00000000..7e5b59dd --- /dev/null +++ b/src/models/getwebsearchprovidersop.ts @@ -0,0 +1,21 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; +import { + WebSearchProvidersResponse, + WebSearchProvidersResponse$zodSchema, +} from "./websearchprovidersresponse.js"; + +export type GetWebSearchProvidersResponse = + | WebSearchProvidersResponse + | ErrorResponse; + +export const GetWebSearchProvidersResponse$zodSchema: z.ZodType< + GetWebSearchProvidersResponse +> = z.union([ + WebSearchProvidersResponse$zodSchema, + ErrorResponse$zodSchema, +]); diff --git a/src/models/initauthop.ts b/src/models/initauthop.ts new file mode 100644 index 00000000..a041a23d --- /dev/null +++ b/src/models/initauthop.ts @@ -0,0 +1,34 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; +import { + InitAuthResponse, + InitAuthResponse$zodSchema, +} from "./initauthresponse.js"; + +export type InitAuthResponseResult = InitAuthResponse | ErrorResponse; + +export const InitAuthResponseResult$zodSchema: z.ZodType< + InitAuthResponseResult +> = z.union([ + InitAuthResponse$zodSchema, + ErrorResponse$zodSchema, +]); + +export type InitAuthResponseResponse = { + Headers: { [k: string]: Array }; + Result: InitAuthResponse | ErrorResponse; +}; + +export const InitAuthResponseResponse$zodSchema: z.ZodType< + InitAuthResponseResponse +> = z.object({ + Headers: z.record(z.string(), z.array(z.string())).default({}), + Result: z.union([ + InitAuthResponse$zodSchema, + ErrorResponse$zodSchema, + ]), +}); diff --git a/src/models/initauthrequest.ts b/src/models/initauthrequest.ts new file mode 100644 index 00000000..f53e9065 --- /dev/null +++ b/src/models/initauthrequest.ts @@ -0,0 +1,18 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Optional JSON body for `/userAccount/initAuth`. Valid shapes include: omitting the body entirely, sending `{}` (empty object), or `{ "email": "
" }`. Neither the body nor `email` is required. When `email` is omitted or empty, the session is still created and `allowedMethods` / `authProviders` are returned as usual; clients typically supply `email` later on `/userAccount/authenticate`. The `email` property remains supported mainly for legacy clients and backward compatibility. + * + * @remarks + */ +export type InitAuthRequest = { email?: string | undefined }; + +export const InitAuthRequest$zodSchema: z.ZodType = z.object({ + email: z.string().optional(), +}).describe( + "Optional JSON body for `/userAccount/initAuth`. Valid shapes include: omitting the body entirely, sending `{}` (empty object), or `{ \"email\": \"
\" }`. Neither the body nor `email` is required. When `email` is omitted or empty, the session is still created and `allowedMethods` / `authProviders` are returned as usual; clients typically supply `email` later on `/userAccount/authenticate`. The `email` property remains supported mainly for legacy clients and backward compatibility.\n", +); diff --git a/src/models/initauthresponse.ts b/src/models/initauthresponse.ts new file mode 100644 index 00000000..e2f8b332 --- /dev/null +++ b/src/models/initauthresponse.ts @@ -0,0 +1,51 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { AuthProviders, AuthProviders$zodSchema } from "./authproviders.js"; + +export const AllowedMethod = { + SamlSso: "samlSso", + Otp: "otp", + Password: "password", + Google: "google", + Microsoft: "microsoft", + AzureAd: "azureAd", + Oauth: "oauth", +} as const; +export type AllowedMethod = ClosedEnum; + +export const AllowedMethod$zodSchema = z.enum([ + "samlSso", + "otp", + "password", + "google", + "microsoft", + "azureAd", + "oauth", +]); + +/** + * Response containing available authentication methods and session info + */ +export type InitAuthResponse = { + currentStep: number; + allowedMethods: Array; + message: string; + authProviders: AuthProviders; + jitEnabled: boolean; +}; + +export const InitAuthResponse$zodSchema: z.ZodType = z.object( + { + allowedMethods: z.array(AllowedMethod$zodSchema), + authProviders: AuthProviders$zodSchema, + currentStep: z.int(), + jitEnabled: z.boolean(), + message: z.string(), + }, +).describe( + "Response containing available authentication methods and session info", +); diff --git a/src/models/knowledgehubnode.ts b/src/models/knowledgehubnode.ts index 6d18a620..04ac8044 100644 --- a/src/models/knowledgehubnode.ts +++ b/src/models/knowledgehubnode.ts @@ -6,7 +6,7 @@ import * as z from "zod"; import { ClosedEnum } from "../types/enums.js"; /** - * Type of the node + * Type of the node (app, recordGroup, folder, or record). */ export const NodeType = { App: "app", @@ -15,7 +15,7 @@ export const NodeType = { Record: "record", } as const; /** - * Type of the node + * Type of the node (app, recordGroup, folder, or record). */ export type NodeType = ClosedEnum; @@ -24,86 +24,92 @@ export const NodeType$zodSchema = z.enum([ "recordGroup", "folder", "record", -]).describe("Type of the node"); +]).describe("Type of the node (app, recordGroup, folder, or record)."); /** - * Origin type + * Origin type. */ -export const KnowledgeHubNodeOrigin = { +export const Origin = { Collection: "COLLECTION", Connector: "CONNECTOR", } as const; /** - * Origin type + * Origin type. */ -export type KnowledgeHubNodeOrigin = ClosedEnum; +export type Origin = ClosedEnum; -export const KnowledgeHubNodeOrigin$zodSchema = z.enum([ +export const Origin$zodSchema = z.enum([ "COLLECTION", "CONNECTOR", -]).describe("Origin type"); +]).describe("Origin type."); -export type Permission = { - role?: string | undefined; - canEdit?: boolean | undefined; - canDelete?: boolean | undefined; -}; +/** + * Per-item permission when `include=permissions` is requested; otherwise `null`. + */ +export type Permission = { role: string; canEdit: boolean; canDelete: boolean }; export const Permission$zodSchema: z.ZodType = z.object({ - canDelete: z.boolean().optional(), - canEdit: z.boolean().optional(), - role: z.string().optional(), -}); + canDelete: z.boolean(), + canEdit: z.boolean(), + role: z.string(), +}).describe( + "Per-item permission when `include=permissions` is requested; otherwise `null`.", +); /** - * A node in the knowledge hub tree structure (NodeItem) + * One element of `items`. The live API keeps keys stable and sets + * + * @remarks + * inapplicable values to JSON `null` (not omitted). */ export type KnowledgeHubNode = { - id?: string | undefined; - name?: string | undefined; - nodeType?: NodeType | undefined; - parentId?: string | null | undefined; - origin?: KnowledgeHubNodeOrigin | undefined; - connector?: string | null | undefined; - recordType?: string | null | undefined; - recordGroupType?: string | null | undefined; - indexingStatus?: string | null | undefined; - reason?: string | null | undefined; - isInternal?: boolean | undefined; - createdAt?: number | undefined; - updatedAt?: number | undefined; - sizeInBytes?: number | null | undefined; - mimeType?: string | null | undefined; - extension?: string | null | undefined; - webUrl?: string | null | undefined; - hasChildren?: boolean | undefined; - previewRenderable?: boolean | null | undefined; - permission?: Permission | null | undefined; - sharingStatus?: string | null | undefined; + id: string; + name: string; + nodeType: NodeType; + parentId: string | null; + origin: Origin; + connector: string | null; + recordType: string | null; + recordGroupType: string | null; + indexingStatus: string | null; + reason: string | null; + isInternal: boolean; + createdAt: number; + updatedAt: number; + sizeInBytes: number | null; + mimeType: string | null; + extension: string | null; + webUrl: string | null; + hasChildren: boolean; + previewRenderable: boolean | null; + permission: Permission | null; + sharingStatus: string | null; }; export const KnowledgeHubNode$zodSchema: z.ZodType = z.object( { - connector: z.string().nullable().optional(), - createdAt: z.int().optional(), - extension: z.string().nullable().optional(), - hasChildren: z.boolean().optional(), - id: z.string().optional(), - indexingStatus: z.string().nullable().optional(), - isInternal: z.boolean().optional(), - mimeType: z.string().nullable().optional(), - name: z.string().optional(), - nodeType: NodeType$zodSchema.optional(), - origin: KnowledgeHubNodeOrigin$zodSchema.optional(), - parentId: z.string().nullable().optional(), - permission: z.lazy(() => Permission$zodSchema).nullable().optional(), - previewRenderable: z.boolean().nullable().optional(), - reason: z.string().nullable().optional(), - recordGroupType: z.string().nullable().optional(), - recordType: z.string().nullable().optional(), - sharingStatus: z.string().nullable().optional(), - sizeInBytes: z.int().nullable().optional(), - updatedAt: z.int().optional(), - webUrl: z.string().nullable().optional(), + connector: z.string().nullable(), + createdAt: z.int(), + extension: z.string().nullable(), + hasChildren: z.boolean(), + id: z.string(), + indexingStatus: z.string().nullable(), + isInternal: z.boolean(), + mimeType: z.string().nullable(), + name: z.string(), + nodeType: NodeType$zodSchema, + origin: Origin$zodSchema, + parentId: z.string().nullable(), + permission: z.lazy(() => Permission$zodSchema).nullable(), + previewRenderable: z.boolean().nullable(), + reason: z.string().nullable(), + recordGroupType: z.string().nullable(), + recordType: z.string().nullable(), + sharingStatus: z.string().nullable(), + sizeInBytes: z.int().nullable(), + updatedAt: z.int(), + webUrl: z.string().nullable(), }, -).describe("A node in the knowledge hub tree structure (NodeItem)"); +).describe( + "One element of `items`. The live API keeps keys stable and sets\ninapplicable values to JSON `null` (not omitted).\n", +); diff --git a/src/models/knowledgehubnodesresponse.ts b/src/models/knowledgehubnodesresponse.ts index 4bbd07a7..629ab0cb 100644 --- a/src/models/knowledgehubnodesresponse.ts +++ b/src/models/knowledgehubnodesresponse.ts @@ -9,204 +9,257 @@ import { KnowledgeHubNode$zodSchema, } from "./knowledgehubnode.js"; +/** + * Node being browsed when `parentId` is in the path; `null` at root. + */ export type CurrentNode = { - id?: string | undefined; - name?: string | undefined; - nodeType?: string | undefined; + id: string; + name: string; + nodeType: string; subType?: string | null | undefined; }; export const CurrentNode$zodSchema: z.ZodType = z.object({ - id: z.string().optional(), - name: z.string().optional(), - nodeType: z.string().optional(), + id: z.string(), + name: z.string(), + nodeType: z.string(), subType: z.string().nullable().optional(), -}); +}).describe( + "Node being browsed when `parentId` is in the path; `null` at root.", +); +/** + * Parent of `currentNode` when present; `null` when not applicable. + */ export type ParentNode = { - id?: string | undefined; - name?: string | undefined; - nodeType?: string | undefined; + id: string; + name: string; + nodeType: string; subType?: string | null | undefined; }; export const ParentNode$zodSchema: z.ZodType = z.object({ - id: z.string().optional(), - name: z.string().optional(), - nodeType: z.string().optional(), + id: z.string(), + name: z.string(), + nodeType: z.string(), subType: z.string().nullable().optional(), -}); +}).describe( + "Parent of `currentNode` when present; `null` when not applicable.", +); -export type Pagination = { - page?: number | undefined; - limit?: number | undefined; - totalItems?: number | undefined; - totalPages?: number | undefined; - hasNext?: boolean | undefined; - hasPrev?: boolean | undefined; +export type KnowledgeHubNodesResponsePagination = { + page: number; + limit: number; + totalItems: number; + totalPages: number; + hasNext: boolean; + hasPrev: boolean; }; -export const Pagination$zodSchema: z.ZodType = z.object({ - hasNext: z.boolean().optional(), - hasPrev: z.boolean().optional(), - limit: z.int().optional(), - page: z.int().optional(), - totalItems: z.int().optional(), - totalPages: z.int().optional(), +export const KnowledgeHubNodesResponsePagination$zodSchema: z.ZodType< + KnowledgeHubNodesResponsePagination +> = z.object({ + hasNext: z.boolean(), + hasPrev: z.boolean(), + limit: z.int(), + page: z.int(), + totalItems: z.int(), + totalPages: z.int(), }); -export type CreatedAt = {}; +/** + * Date range filter with optional inclusive bounds (epoch ms). + */ +export type CreatedAt = { + gte?: number | null | undefined; + lte?: number | null | undefined; +}; -export const CreatedAt$zodSchema: z.ZodType = z.object({}); +export const CreatedAt$zodSchema: z.ZodType = z.object({ + gte: z.int().nullable().optional(), + lte: z.int().nullable().optional(), +}).describe("Date range filter with optional inclusive bounds (epoch ms)."); -export type UpdatedAt = {}; +/** + * Date range filter with optional inclusive bounds (epoch ms). + */ +export type UpdatedAt = { + gte?: number | null | undefined; + lte?: number | null | undefined; +}; -export const UpdatedAt$zodSchema: z.ZodType = z.object({}); +export const UpdatedAt$zodSchema: z.ZodType = z.object({ + gte: z.int().nullable().optional(), + lte: z.int().nullable().optional(), +}).describe("Date range filter with optional inclusive bounds (epoch ms)."); -export type Size = {}; +/** + * Size range filter with optional inclusive bounds (bytes). + */ +export type Size = { + gte?: number | null | undefined; + lte?: number | null | undefined; +}; -export const Size$zodSchema: z.ZodType = z.object({}); +export const Size$zodSchema: z.ZodType = z.object({ + gte: z.int().nullable().optional(), + lte: z.int().nullable().optional(), +}).describe("Size range filter with optional inclusive bounds (bytes)."); +/** + * Echo of applied filters; unused slots are JSON `null`. + */ export type Applied = { - q?: string | null | undefined; - nodeTypes?: Array | null | undefined; - recordTypes?: Array | null | undefined; - origins?: Array | null | undefined; - connectorIds?: Array | null | undefined; - indexingStatus?: Array | null | undefined; - createdAt?: CreatedAt | null | undefined; - updatedAt?: UpdatedAt | null | undefined; - size?: Size | null | undefined; - sortBy?: string | undefined; - sortOrder?: string | undefined; + q: string | null; + nodeTypes: Array | null; + recordTypes: Array | null; + origins: Array | null; + connectorIds: Array | null; + indexingStatus: Array | null; + createdAt: CreatedAt | null; + updatedAt: UpdatedAt | null; + size: Size | null; + sortBy: string; + sortOrder: string; }; export const Applied$zodSchema: z.ZodType = z.object({ - connectorIds: z.array(z.string()).nullable().optional(), - createdAt: z.lazy(() => CreatedAt$zodSchema).nullable().optional(), - indexingStatus: z.array(z.string()).nullable().optional(), - nodeTypes: z.array(z.string()).nullable().optional(), - origins: z.array(z.string()).nullable().optional(), - q: z.string().nullable().optional(), - recordTypes: z.array(z.string()).nullable().optional(), - size: z.lazy(() => Size$zodSchema).nullable().optional(), - sortBy: z.string().optional(), - sortOrder: z.string().optional(), - updatedAt: z.lazy(() => UpdatedAt$zodSchema).nullable().optional(), -}); + connectorIds: z.array(z.string()).nullable(), + createdAt: z.lazy(() => CreatedAt$zodSchema).nullable(), + indexingStatus: z.array(z.string()).nullable(), + nodeTypes: z.array(z.string()).nullable(), + origins: z.array(z.string()).nullable(), + q: z.string().nullable(), + recordTypes: z.array(z.string()).nullable(), + size: z.lazy(() => Size$zodSchema).nullable(), + sortBy: z.string(), + sortOrder: z.string(), + updatedAt: z.lazy(() => UpdatedAt$zodSchema).nullable(), +}).describe("Echo of applied filters; unused slots are JSON `null`."); +/** + * Populated when `include=availableFilters`; otherwise `null`. + */ export type Available = { - nodeTypes?: Array | undefined; - recordTypes?: Array | undefined; - origins?: Array | undefined; - connectors?: Array | undefined; - indexingStatus?: Array | undefined; - sortBy?: Array | undefined; - sortOrder?: Array | undefined; + nodeTypes: Array; + recordTypes: Array; + origins: Array; + connectors: Array; + indexingStatus: Array; + sortBy: Array; + sortOrder: Array; }; export const Available$zodSchema: z.ZodType = z.object({ - connectors: z.array(FilterOption$zodSchema).optional(), - indexingStatus: z.array(FilterOption$zodSchema).optional(), - nodeTypes: z.array(FilterOption$zodSchema).optional(), - origins: z.array(FilterOption$zodSchema).optional(), - recordTypes: z.array(FilterOption$zodSchema).optional(), - sortBy: z.array(FilterOption$zodSchema).optional(), - sortOrder: z.array(FilterOption$zodSchema).optional(), -}); + connectors: z.array(FilterOption$zodSchema), + indexingStatus: z.array(FilterOption$zodSchema), + nodeTypes: z.array(FilterOption$zodSchema), + origins: z.array(FilterOption$zodSchema), + recordTypes: z.array(FilterOption$zodSchema), + sortBy: z.array(FilterOption$zodSchema), + sortOrder: z.array(FilterOption$zodSchema), +}).describe("Populated when `include=availableFilters`; otherwise `null`."); export type KnowledgeHubNodesResponseFilters = { - applied?: Applied | undefined; - available?: Available | null | undefined; + applied: Applied; + available: Available | null; }; export const KnowledgeHubNodesResponseFilters$zodSchema: z.ZodType< KnowledgeHubNodesResponseFilters > = z.object({ - applied: z.lazy(() => Applied$zodSchema).optional(), - available: z.lazy(() => Available$zodSchema).nullable().optional(), + applied: z.lazy(() => Applied$zodSchema), + available: z.lazy(() => Available$zodSchema).nullable(), }); export type Breadcrumb = { - id?: string | undefined; - name?: string | undefined; - nodeType?: string | undefined; + id: string; + name: string; + nodeType: string; subType?: string | null | undefined; }; export const Breadcrumb$zodSchema: z.ZodType = z.object({ - id: z.string().optional(), - name: z.string().optional(), - nodeType: z.string().optional(), + id: z.string(), + name: z.string(), + nodeType: z.string(), subType: z.string().nullable().optional(), }); -export type Item = { label?: string | undefined; count?: number | undefined }; +export type Item = { label: string; count: number }; export const Item$zodSchema: z.ZodType = z.object({ - count: z.int().optional(), - label: z.string().optional(), + count: z.int(), + label: z.string(), }); -export type Counts = { - items?: Array | undefined; - total?: number | undefined; -}; +/** + * Present when `include=counts`; otherwise `null`. + */ +export type Counts = { items: Array; total: number }; export const Counts$zodSchema: z.ZodType = z.object({ - items: z.array(z.lazy(() => Item$zodSchema)).optional(), - total: z.int().optional(), -}); + items: z.array(z.lazy(() => Item$zodSchema)), + total: z.int(), +}).describe("Present when `include=counts`; otherwise `null`."); +/** + * Present when `include=permissions`; otherwise `null`. + */ export type Permissions = { - role?: string | undefined; - canUpload?: boolean | undefined; - canCreateFolders?: boolean | undefined; - canEdit?: boolean | undefined; - canDelete?: boolean | undefined; - canManagePermissions?: boolean | undefined; + role: string; + canUpload: boolean; + canCreateFolders: boolean; + canEdit: boolean; + canDelete: boolean; + canManagePermissions: boolean; }; export const Permissions$zodSchema: z.ZodType = z.object({ - canCreateFolders: z.boolean().optional(), - canDelete: z.boolean().optional(), - canEdit: z.boolean().optional(), - canManagePermissions: z.boolean().optional(), - canUpload: z.boolean().optional(), - role: z.string().optional(), -}); + canCreateFolders: z.boolean(), + canDelete: z.boolean(), + canEdit: z.boolean(), + canManagePermissions: z.boolean(), + canUpload: z.boolean(), + role: z.string(), +}).describe("Present when `include=permissions`; otherwise `null`."); /** - * Response for Knowledge Hub nodes API + * Response body for the Knowledge Hub nodes API. The deployed service + * + * @remarks + * serialises optional values as JSON `null` and always includes the keys + * listed in `required` (Swagger / clients will see stable shapes, not + * omitted properties). */ export type KnowledgeHubNodesResponse = { - success?: boolean | undefined; - error?: string | null | undefined; - id?: string | null | undefined; - currentNode?: CurrentNode | null | undefined; - parentNode?: ParentNode | null | undefined; - items?: Array | undefined; - pagination?: Pagination | null | undefined; - filters?: KnowledgeHubNodesResponseFilters | null | undefined; - breadcrumbs?: Array | null | undefined; - counts?: Counts | null | undefined; - permissions?: Permissions | null | undefined; + success: boolean; + error: string | null; + id: string | null; + currentNode: CurrentNode | null; + parentNode: ParentNode | null; + items: Array; + pagination: KnowledgeHubNodesResponsePagination; + filters: KnowledgeHubNodesResponseFilters; + breadcrumbs: Array | null; + counts: Counts | null; + permissions: Permissions | null; }; export const KnowledgeHubNodesResponse$zodSchema: z.ZodType< KnowledgeHubNodesResponse > = z.object({ - breadcrumbs: z.array(z.lazy(() => Breadcrumb$zodSchema)).nullable() - .optional(), - counts: z.lazy(() => Counts$zodSchema).nullable().optional(), - currentNode: z.lazy(() => CurrentNode$zodSchema).nullable().optional(), - error: z.string().nullable().optional(), - filters: z.lazy(() => KnowledgeHubNodesResponseFilters$zodSchema).nullable() - .optional(), - id: z.string().nullable().optional(), - items: z.array(KnowledgeHubNode$zodSchema).optional(), - pagination: z.lazy(() => Pagination$zodSchema).nullable().optional(), - parentNode: z.lazy(() => ParentNode$zodSchema).nullable().optional(), - permissions: z.lazy(() => Permissions$zodSchema).nullable().optional(), - success: z.boolean().optional(), -}).describe("Response for Knowledge Hub nodes API"); + breadcrumbs: z.array(z.lazy(() => Breadcrumb$zodSchema)).nullable(), + counts: z.lazy(() => Counts$zodSchema).nullable(), + currentNode: z.lazy(() => CurrentNode$zodSchema).nullable(), + error: z.string().nullable(), + filters: z.lazy(() => KnowledgeHubNodesResponseFilters$zodSchema), + id: z.string().nullable(), + items: z.array(KnowledgeHubNode$zodSchema), + pagination: z.lazy(() => KnowledgeHubNodesResponsePagination$zodSchema), + parentNode: z.lazy(() => ParentNode$zodSchema).nullable(), + permissions: z.lazy(() => Permissions$zodSchema).nullable(), + success: z.boolean(), +}).describe( + "Response body for the Knowledge Hub nodes API. The deployed service\nserialises optional values as JSON `null` and always includes the keys\nlisted in `required` (Swagger / clients will see stable shapes, not\nomitted properties).\n", +); diff --git a/src/models/listagentarchivedconversationsgroupedop.ts b/src/models/listagentarchivedconversationsgroupedop.ts new file mode 100644 index 00000000..10e9940e --- /dev/null +++ b/src/models/listagentarchivedconversationsgroupedop.ts @@ -0,0 +1,17 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export type ListAgentArchivedConversationsGroupedRequest = { + agentPage?: number | undefined; + agentLimit?: number | undefined; +}; + +export const ListAgentArchivedConversationsGroupedRequest$zodSchema: z.ZodType< + ListAgentArchivedConversationsGroupedRequest +> = z.object({ + agentLimit: z.int().default(5), + agentPage: z.int().default(1), +}); diff --git a/src/models/listagentconversationarchivesop.ts b/src/models/listagentconversationarchivesop.ts new file mode 100644 index 00000000..e4fc2451 --- /dev/null +++ b/src/models/listagentconversationarchivesop.ts @@ -0,0 +1,74 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + AgentArchivedConversationListResponse, + AgentArchivedConversationListResponse$zodSchema, +} from "./agentarchivedconversationlistresponse.js"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; + +export const ListAgentConversationArchivesSortBy = { + CreatedAt: "createdAt", + LastActivityAt: "lastActivityAt", + Title: "title", +} as const; +export type ListAgentConversationArchivesSortBy = ClosedEnum< + typeof ListAgentConversationArchivesSortBy +>; + +export const ListAgentConversationArchivesSortBy$zodSchema = z.enum([ + "createdAt", + "lastActivityAt", + "title", +]); + +export const ListAgentConversationArchivesSortOrder = { + Asc: "asc", + Desc: "desc", +} as const; +export type ListAgentConversationArchivesSortOrder = ClosedEnum< + typeof ListAgentConversationArchivesSortOrder +>; + +export const ListAgentConversationArchivesSortOrder$zodSchema = z.enum([ + "asc", + "desc", +]); + +export type ListAgentConversationArchivesRequest = { + agentKey: string; + page?: number | undefined; + limit?: number | undefined; + sortBy?: ListAgentConversationArchivesSortBy | undefined; + sortOrder?: ListAgentConversationArchivesSortOrder | undefined; + search?: string | undefined; + startDate?: string | undefined; + endDate?: string | undefined; +}; + +export const ListAgentConversationArchivesRequest$zodSchema: z.ZodType< + ListAgentConversationArchivesRequest +> = z.object({ + agentKey: z.string(), + endDate: z.iso.datetime({ offset: true }).optional(), + limit: z.int().default(20), + page: z.int().default(1), + search: z.string().optional(), + sortBy: ListAgentConversationArchivesSortBy$zodSchema.optional(), + sortOrder: ListAgentConversationArchivesSortOrder$zodSchema.optional(), + startDate: z.iso.datetime({ offset: true }).optional(), +}); + +export type ListAgentConversationArchivesResponse = + | AgentArchivedConversationListResponse + | ErrorResponse; + +export const ListAgentConversationArchivesResponse$zodSchema: z.ZodType< + ListAgentConversationArchivesResponse +> = z.union([ + AgentArchivedConversationListResponse$zodSchema, + ErrorResponse$zodSchema, +]); diff --git a/src/models/listagentconversationsop.ts b/src/models/listagentconversationsop.ts new file mode 100644 index 00000000..f4db2ee2 --- /dev/null +++ b/src/models/listagentconversationsop.ts @@ -0,0 +1,93 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + AgentConversationListResponse, + AgentConversationListResponse$zodSchema, +} from "./agentconversationlistresponse.js"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; + +/** + * Optional archived flag applied to the `sharedWithMeConversations` + * + * @remarks + * branch before the route-level non-archived guard is enforced. + * Accepted values are `true` and `false`. + */ +export const IsArchived = { + True: "true", + False: "false", +} as const; +/** + * Optional archived flag applied to the `sharedWithMeConversations` + * + * @remarks + * branch before the route-level non-archived guard is enforced. + * Accepted values are `true` and `false`. + */ +export type IsArchived = ClosedEnum; + +export const IsArchived$zodSchema = z.enum([ + "true", + "false", +]).describe( + "Optional archived flag applied to the `sharedWithMeConversations`\nbranch before the route-level non-archived guard is enforced.\nAccepted values are `true` and `false`.\n", +); + +export type ListAgentConversationsRequest = { + agentKey: string; + page?: number | undefined; + limit?: number | undefined; + sortBy?: string | undefined; + sortOrder?: string | undefined; + search?: string | undefined; + startDate?: string | undefined; + endDate?: string | undefined; + status?: string | undefined; + isArchived?: IsArchived | undefined; +}; + +export const ListAgentConversationsRequest$zodSchema: z.ZodType< + ListAgentConversationsRequest +> = z.object({ + agentKey: z.string().describe( + "Agent identifier used to scope the conversation list.", + ), + endDate: z.string().describe( + "Inclusive upper bound on `createdAt`. The handler accepts any\nJavaScript-parseable date string; invalid values return HTTP 400.\n", + ).optional(), + isArchived: IsArchived$zodSchema.optional(), + limit: z.int().default(20).describe( + "Page size. Defaults to `20`; maximum `100`.", + ), + page: z.int().default(1).describe("1-based page number. Defaults to `1`."), + search: z.string().describe( + "Case-insensitive search term applied to conversation `title` and\n`messages.content`. Maximum length is 1000 characters. HTML/XSS\npayloads and format specifiers are rejected.\n", + ).optional(), + sortBy: z.string().describe( + "Preferred sort field. Supported values are `createdAt`,\n`lastActivityAt`, and `title`.\n\nThe current gateway validator preserves legacy behavior: unsupported\nvalues are accepted but ignored, and the handler falls back to\n`lastActivityAt`.\n", + ).optional(), + sortOrder: z.string().describe( + "Preferred sort direction. Supported values are `asc` and `desc`.\n\nThe current gateway validator preserves legacy behavior: unsupported\nvalues are accepted but ignored, and the handler falls back to\ndescending order.\n", + ).optional(), + startDate: z.string().describe( + "Inclusive lower bound on `createdAt`. The handler accepts any\nJavaScript-parseable date string; invalid values return HTTP 400.\n", + ).optional(), + status: z.string().describe( + "Optional status filter applied to the `sharedWithMeConversations`\nbranch of the response. The main `conversations` list ignores this\nparameter.\n", + ).optional(), +}); + +export type ListAgentConversationsResponse = + | AgentConversationListResponse + | ErrorResponse; + +export const ListAgentConversationsResponse$zodSchema: z.ZodType< + ListAgentConversationsResponse +> = z.union([ + AgentConversationListResponse$zodSchema, + ErrorResponse$zodSchema, +]); diff --git a/src/models/listagentsop.ts b/src/models/listagentsop.ts new file mode 100644 index 00000000..a5af5044 --- /dev/null +++ b/src/models/listagentsop.ts @@ -0,0 +1,59 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + AgentListResponse, + AgentListResponse$zodSchema, +} from "./agentlistresponse.js"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; + +/** + * Sort direction. + */ +export const ListAgentsSortOrder = { + Asc: "asc", + Desc: "desc", +} as const; +/** + * Sort direction. + */ +export type ListAgentsSortOrder = ClosedEnum; + +export const ListAgentsSortOrder$zodSchema = z.enum([ + "asc", + "desc", +]).describe("Sort direction."); + +export type ListAgentsRequest = { + page?: number | undefined; + limit?: number | undefined; + search?: string | undefined; + sort_by?: string | undefined; + sort_order?: ListAgentsSortOrder | undefined; +}; + +export const ListAgentsRequest$zodSchema: z.ZodType = z + .object({ + limit: z.int().default(20).describe( + "Maximum number of agents to return in the current page.", + ), + page: z.int().default(1).describe("1-based page number."), + search: z.string().describe( + "Case-insensitive search across agent name, description, and tags. Leading/trailing whitespace is trimmed; blank-after-trim values are rejected.", + ).optional(), + sort_by: z.string().default("updatedAtTimestamp").describe( + "Backend sort field. Leading/trailing whitespace is trimmed. Common value is `updatedAtTimestamp`.", + ), + sort_order: ListAgentsSortOrder$zodSchema.default("desc"), + }); + +export type ListAgentsResponse = AgentListResponse | ErrorResponse; + +export const ListAgentsResponse$zodSchema: z.ZodType = z + .union([ + AgentListResponse$zodSchema, + ErrorResponse$zodSchema, + ]); diff --git a/src/models/listoauthappsop.ts b/src/models/listoauthappsop.ts new file mode 100644 index 00000000..ce41dbbb --- /dev/null +++ b/src/models/listoauthappsop.ts @@ -0,0 +1,70 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + ApplicationJsonErrorResponse, + ApplicationJsonErrorResponse$zodSchema, +} from "./applicationjsonerrorresponse.js"; +import { + OAuthAppListResponse, + OAuthAppListResponse$zodSchema, +} from "./oauthapplistresponse.js"; +import { + OAuthClientManagementRateLimitError, + OAuthClientManagementRateLimitError$zodSchema, +} from "./oauthclientmanagementratelimiterror.js"; + +/** + * Filter by status + */ +export const ListOAuthAppsStatus = { + Active: "active", + Suspended: "suspended", + Revoked: "revoked", +} as const; +/** + * Filter by status + */ +export type ListOAuthAppsStatus = ClosedEnum; + +export const ListOAuthAppsStatus$zodSchema = z.enum([ + "active", + "suspended", + "revoked", +]).describe("Filter by status"); + +export type ListOAuthAppsRequest = { + page?: number | undefined; + limit?: number | undefined; + status?: ListOAuthAppsStatus | undefined; + search?: string | undefined; +}; + +export const ListOAuthAppsRequest$zodSchema: z.ZodType = z + .object({ + limit: z.int().default(20).describe( + "Items per page (defaults to `20` when omitted or empty; max 100).\n", + ), + page: z.int().default(1).describe( + "Page number (matches `listAppsQuerySchema`: defaults to `1` when omitted or empty).\n", + ), + search: z.string().describe( + "Search by app name or description (case-insensitive)", + ).optional(), + status: ListOAuthAppsStatus$zodSchema.optional(), + }); + +export type ListOAuthAppsResponse = + | OAuthAppListResponse + | ApplicationJsonErrorResponse + | OAuthClientManagementRateLimitError; + +export const ListOAuthAppsResponse$zodSchema: z.ZodType = + z.union([ + OAuthAppListResponse$zodSchema, + ApplicationJsonErrorResponse$zodSchema, + OAuthClientManagementRateLimitError$zodSchema, + ]); diff --git a/src/models/listoauthapptokensop.ts b/src/models/listoauthapptokensop.ts new file mode 100644 index 00000000..3e7d88b2 --- /dev/null +++ b/src/models/listoauthapptokensop.ts @@ -0,0 +1,38 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + ApplicationJsonErrorResponse, + ApplicationJsonErrorResponse$zodSchema, +} from "./applicationjsonerrorresponse.js"; +import { + OAuthAppTokensListResponse, + OAuthAppTokensListResponse$zodSchema, +} from "./oauthapptokenslistresponse.js"; +import { + OAuthClientManagementRateLimitError, + OAuthClientManagementRateLimitError$zodSchema, +} from "./oauthclientmanagementratelimiterror.js"; + +export type ListOAuthAppTokensRequest = { appId: string }; + +export const ListOAuthAppTokensRequest$zodSchema: z.ZodType< + ListOAuthAppTokensRequest +> = z.object({ + appId: z.string().describe("OAuth app ID"), +}); + +export type ListOAuthAppTokensResponse = + | OAuthAppTokensListResponse + | ApplicationJsonErrorResponse + | OAuthClientManagementRateLimitError; + +export const ListOAuthAppTokensResponse$zodSchema: z.ZodType< + ListOAuthAppTokensResponse +> = z.union([ + OAuthAppTokensListResponse$zodSchema, + ApplicationJsonErrorResponse$zodSchema, + OAuthClientManagementRateLimitError$zodSchema, +]); diff --git a/src/models/listoauthscopesop.ts b/src/models/listoauthscopesop.ts new file mode 100644 index 00000000..acb1f5a0 --- /dev/null +++ b/src/models/listoauthscopesop.ts @@ -0,0 +1,30 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + ApplicationJsonErrorResponse, + ApplicationJsonErrorResponse$zodSchema, +} from "./applicationjsonerrorresponse.js"; +import { + OAuthClientManagementRateLimitError, + OAuthClientManagementRateLimitError$zodSchema, +} from "./oauthclientmanagementratelimiterror.js"; +import { + OAuthScopesGroupedResponse, + OAuthScopesGroupedResponse$zodSchema, +} from "./oauthscopesgroupedresponse.js"; + +export type ListOAuthScopesResponse = + | OAuthScopesGroupedResponse + | ApplicationJsonErrorResponse + | OAuthClientManagementRateLimitError; + +export const ListOAuthScopesResponse$zodSchema: z.ZodType< + ListOAuthScopesResponse +> = z.union([ + OAuthScopesGroupedResponse$zodSchema, + ApplicationJsonErrorResponse$zodSchema, + OAuthClientManagementRateLimitError$zodSchema, +]); diff --git a/src/models/message.ts b/src/models/message.ts index a9072ef5..6f847a0d 100644 --- a/src/models/message.ts +++ b/src/models/message.ts @@ -4,10 +4,19 @@ import * as z from "zod"; import { ClosedEnum } from "../types/enums.js"; +import { AppliedFilters, AppliedFilters$zodSchema } from "./appliedfilters.js"; +import { + ChatAttachmentRef, + ChatAttachmentRef$zodSchema, +} from "./chatattachmentref.js"; import { CitationReference, CitationReference$zodSchema, } from "./citationreference.js"; +import { + ConversationModelInfo, + ConversationModelInfo$zodSchema, +} from "./conversationmodelinfo.js"; import { FollowUpQuestion, FollowUpQuestion$zodSchema, @@ -29,7 +38,7 @@ import { *
  • system - System notification or status
  • * */ -export const MessageType = { +export const MessageMessageType = { UserQuery: "user_query", BotResponse: "bot_response", Error: "error", @@ -48,9 +57,9 @@ export const MessageType = { *
  • system - System notification or status
  • * */ -export type MessageType = ClosedEnum; +export type MessageMessageType = ClosedEnum; -export const MessageType$zodSchema = z.enum([ +export const MessageMessageType$zodSchema = z.enum([ "user_query", "bot_response", "error", @@ -63,7 +72,7 @@ export const MessageType$zodSchema = z.enum([ /** * Format of the content for rendering */ -export const ContentFormat = { +export const MessageContentFormat = { Markdown: "MARKDOWN", Json: "JSON", Html: "HTML", @@ -71,61 +80,47 @@ export const ContentFormat = { /** * Format of the content for rendering */ -export type ContentFormat = ClosedEnum; +export type MessageContentFormat = ClosedEnum; -export const ContentFormat$zodSchema = z.enum([ +export const MessageContentFormat$zodSchema = z.enum([ "MARKDOWN", "JSON", "HTML", ]).describe("Format of the content for rendering"); -/** - * AI confidence level in the response. Values come from - * - * @remarks - * `CONFIDENCE_LEVELS` in - * `enterprise_search/constants/constants.ts`. - */ -export const Confidence = { - High: "High", - Medium: "Medium", - Low: "Low", - VeryHigh: "Very High", - Unknown: "Unknown", -} as const; -/** - * AI confidence level in the response. Values come from - * - * @remarks - * `CONFIDENCE_LEVELS` in - * `enterprise_search/constants/constants.ts`. - */ -export type Confidence = ClosedEnum; - -export const Confidence$zodSchema = z.enum([ - "High", - "Medium", - "Low", - "Very High", - "Unknown", -]).describe( - "AI confidence level in the response. Values come from\n`CONFIDENCE_LEVELS` in\n`enterprise_search/constants/constants.ts`.\n", -); - -export type Metadata = { +export type MessageMetadata = { processingTimeMs?: number | undefined; modelVersion?: string | undefined; aiTransactionId?: string | undefined; reason?: string | undefined; }; -export const Metadata$zodSchema: z.ZodType = z.object({ +export const MessageMetadata$zodSchema: z.ZodType = z.object({ aiTransactionId: z.string().optional(), modelVersion: z.string().optional(), processingTimeMs: z.number().optional(), reason: z.string().optional(), }); +export type MessageReferenceDatum = { + name?: string | undefined; + id?: string | undefined; + type?: string | undefined; + app?: string | undefined; + webUrl?: string | undefined; + metadata?: { [k: string]: string } | undefined; +}; + +export const MessageReferenceDatum$zodSchema: z.ZodType = + z.object({ + app: z.string().optional(), + id: z.string().optional(), + metadata: z.record(z.string(), z.string()).optional(), + name: z.string().optional(), + type: z.string().optional(), + webUrl: z.string().optional(), + }); + /** * A single message within a conversation. Messages can be user queries, * @@ -134,29 +129,38 @@ export const Metadata$zodSchema: z.ZodType = z.object({ */ export type Message = { _id?: string | undefined; - messageType?: MessageType | undefined; + messageType?: MessageMessageType | undefined; content?: string | undefined; - contentFormat?: ContentFormat | undefined; + contentFormat?: MessageContentFormat | undefined; citations?: Array | undefined; - confidence?: Confidence | undefined; + confidence?: string | undefined; followUpQuestions?: Array | undefined; feedback?: Array | undefined; - metadata?: Metadata | undefined; + metadata?: MessageMetadata | undefined; + modelInfo?: ConversationModelInfo | undefined; + appliedFilters?: AppliedFilters | undefined; + referenceData?: Array | undefined; + attachments?: Array | undefined; createdAt?: string | undefined; updatedAt?: string | undefined; }; export const Message$zodSchema: z.ZodType = z.object({ _id: z.string().optional(), + appliedFilters: AppliedFilters$zodSchema.optional(), + attachments: z.array(ChatAttachmentRef$zodSchema).optional(), citations: z.array(CitationReference$zodSchema).optional(), - confidence: Confidence$zodSchema.optional(), + confidence: z.string().optional(), content: z.string().optional(), - contentFormat: ContentFormat$zodSchema.default("MARKDOWN"), + contentFormat: MessageContentFormat$zodSchema.default("MARKDOWN"), createdAt: z.iso.datetime({ offset: true }).optional(), feedback: z.array(MessageFeedback$zodSchema).optional(), followUpQuestions: z.array(FollowUpQuestion$zodSchema).optional(), - messageType: MessageType$zodSchema.optional(), - metadata: z.lazy(() => Metadata$zodSchema).optional(), + messageType: MessageMessageType$zodSchema.optional(), + metadata: z.lazy(() => MessageMetadata$zodSchema).optional(), + modelInfo: ConversationModelInfo$zodSchema.optional(), + referenceData: z.array(z.lazy(() => MessageReferenceDatum$zodSchema)) + .optional(), updatedAt: z.iso.datetime({ offset: true }).optional(), }).describe( "A single message within a conversation. Messages can be user queries,\nAI responses, system messages, or error notifications.\n", diff --git a/src/models/messagefeedback.ts b/src/models/messagefeedback.ts index 9f3e3de9..9444766f 100644 --- a/src/models/messagefeedback.ts +++ b/src/models/messagefeedback.ts @@ -19,42 +19,49 @@ export const Ratings$zodSchema: z.ZodType = z.object({ relevance: z.int().optional(), }); -export const Category = { +export const MessageFeedbackCategory = { IncorrectInformation: "incorrect_information", MissingInformation: "missing_information", - OutdatedInformation: "outdated_information", - IrrelevantResponse: "irrelevant_response", - TooVerbose: "too_verbose", - TooBrief: "too_brief", - FormattingIssues: "formatting_issues", - CitationIssues: "citation_issues", + IrrelevantInformation: "irrelevant_information", + UnclearExplanation: "unclear_explanation", + PoorCitations: "poor_citations", + ExcellentAnswer: "excellent_answer", + HelpfulCitations: "helpful_citations", + WellExplained: "well_explained", + Other: "other", } as const; -export type Category = ClosedEnum; +export type MessageFeedbackCategory = ClosedEnum< + typeof MessageFeedbackCategory +>; -export const Category$zodSchema = z.enum([ +export const MessageFeedbackCategory$zodSchema = z.enum([ "incorrect_information", "missing_information", - "outdated_information", - "irrelevant_response", - "too_verbose", - "too_brief", - "formatting_issues", - "citation_issues", + "irrelevant_information", + "unclear_explanation", + "poor_citations", + "excellent_answer", + "helpful_citations", + "well_explained", + "other", ]); -export type Comments = { +export type MessageFeedbackComments = { positive?: string | undefined; negative?: string | undefined; suggestions?: string | undefined; }; -export const Comments$zodSchema: z.ZodType = z.object({ +export const MessageFeedbackComments$zodSchema: z.ZodType< + MessageFeedbackComments +> = z.object({ negative: z.string().optional(), positive: z.string().optional(), suggestions: z.string().optional(), }); export type CitationFeedback = { + _id?: string | undefined; citationId?: string | undefined; isRelevant?: boolean | undefined; relevanceScore?: number | undefined; @@ -63,6 +70,7 @@ export type CitationFeedback = { export const CitationFeedback$zodSchema: z.ZodType = z.object( { + _id: z.string().optional(), citationId: z.string().optional(), comment: z.string().optional(), isRelevant: z.boolean().optional(), @@ -70,6 +78,64 @@ export const CitationFeedback$zodSchema: z.ZodType = z.object( }, ); +/** + * Origin of the feedback. Always present in responses (server applies the default `user`). + */ +export const Source = { + User: "user", + System: "system", + Admin: "admin", + Auto: "auto", +} as const; +/** + * Origin of the feedback. Always present in responses (server applies the default `user`). + */ +export type Source = ClosedEnum; + +export const Source$zodSchema = z.enum([ + "user", + "system", + "admin", + "auto", +]).describe( + "Origin of the feedback. Always present in responses (server applies the default `user`).", +); + +export type Revision = { + _id?: string | undefined; + updatedFields?: Array | undefined; + previousValues?: { [k: string]: any } | undefined; + updatedBy?: string | undefined; + updatedAt?: number | undefined; +}; + +export const Revision$zodSchema: z.ZodType = z.object({ + _id: z.string().optional(), + previousValues: z.record(z.string(), z.any()).optional(), + updatedAt: z.int().optional(), + updatedBy: z.string().optional(), + updatedFields: z.array(z.string()).optional(), +}); + +/** + * Optional telemetry captured alongside the feedback + */ +export type Metrics = { + timeToFeedback?: number | undefined; + userInteractionTime?: number | undefined; + feedbackSessionId?: string | undefined; + userAgent?: string | undefined; + platform?: string | undefined; +}; + +export const Metrics$zodSchema: z.ZodType = z.object({ + feedbackSessionId: z.string().optional(), + platform: z.string().optional(), + timeToFeedback: z.number().optional(), + userAgent: z.string().optional(), + userInteractionTime: z.number().optional(), +}).describe("Optional telemetry captured alongside the feedback"); + /** * Comprehensive feedback on an AI response. Feedback helps improve * @@ -79,20 +145,32 @@ export const CitationFeedback$zodSchema: z.ZodType = z.object( export type MessageFeedback = { isHelpful?: boolean | undefined; ratings?: Ratings | undefined; - categories?: Array | undefined; - comments?: Comments | undefined; + categories?: Array | undefined; + comments?: MessageFeedbackComments | undefined; citationFeedback?: Array | undefined; followUpQuestionsHelpful?: boolean | undefined; + unusedFollowUpQuestions?: Array | undefined; + source?: Source | undefined; + feedbackProvider?: string | undefined; + timestamp?: number | undefined; + revisions?: Array | undefined; + metrics?: Metrics | undefined; }; export const MessageFeedback$zodSchema: z.ZodType = z.object({ - categories: z.array(Category$zodSchema).optional(), + categories: z.array(MessageFeedbackCategory$zodSchema).optional(), citationFeedback: z.array(z.lazy(() => CitationFeedback$zodSchema)) .optional(), - comments: z.lazy(() => Comments$zodSchema).optional(), + comments: z.lazy(() => MessageFeedbackComments$zodSchema).optional(), + feedbackProvider: z.string().optional(), followUpQuestionsHelpful: z.boolean().optional(), isHelpful: z.boolean().optional(), + metrics: z.lazy(() => Metrics$zodSchema).optional(), ratings: z.lazy(() => Ratings$zodSchema).optional(), + revisions: z.array(z.lazy(() => Revision$zodSchema)).optional(), + source: Source$zodSchema.default("user"), + timestamp: z.int().optional(), + unusedFollowUpQuestions: z.array(z.string()).optional(), }).describe( "Comprehensive feedback on an AI response. Feedback helps improve\nthe AI's performance and response quality over time.\n", ); diff --git a/src/models/messagefeedbackappendentry.ts b/src/models/messagefeedbackappendentry.ts new file mode 100644 index 00000000..967d5ab8 --- /dev/null +++ b/src/models/messagefeedbackappendentry.ts @@ -0,0 +1,82 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + MessageFeedbackAppendMetrics, + MessageFeedbackAppendMetrics$zodSchema, +} from "./messagefeedbackappendmetrics.js"; + +export const MessageFeedbackAppendEntryCategory = { + IncorrectInformation: "incorrect_information", + MissingInformation: "missing_information", + IrrelevantInformation: "irrelevant_information", + UnclearExplanation: "unclear_explanation", + PoorCitations: "poor_citations", + ExcellentAnswer: "excellent_answer", + HelpfulCitations: "helpful_citations", + WellExplained: "well_explained", + Other: "other", +} as const; +export type MessageFeedbackAppendEntryCategory = ClosedEnum< + typeof MessageFeedbackAppendEntryCategory +>; + +export const MessageFeedbackAppendEntryCategory$zodSchema = z.enum([ + "incorrect_information", + "missing_information", + "irrelevant_information", + "unclear_explanation", + "poor_citations", + "excellent_answer", + "helpful_citations", + "well_explained", + "other", +]); + +/** + * Echoed free-text comments from the request. + */ +export type MessageFeedbackAppendEntryComments = { + positive?: string | undefined; + negative?: string | undefined; +}; + +export const MessageFeedbackAppendEntryComments$zodSchema: z.ZodType< + MessageFeedbackAppendEntryComments +> = z.object({ + negative: z.string().optional(), + positive: z.string().optional(), +}).describe("Echoed free-text comments from the request."); + +/** + * The feedback entry just appended to the message. Echoes the fields + * + * @remarks + * supplied in the request plus server-stamped `feedbackProvider`, + * `timestamp`, and `metrics`. + */ +export type MessageFeedbackAppendEntry = { + isHelpful?: boolean | undefined; + categories?: Array | undefined; + comments?: MessageFeedbackAppendEntryComments | undefined; + feedbackProvider: string; + timestamp: number; + metrics: MessageFeedbackAppendMetrics; +}; + +export const MessageFeedbackAppendEntry$zodSchema: z.ZodType< + MessageFeedbackAppendEntry +> = z.object({ + categories: z.array(MessageFeedbackAppendEntryCategory$zodSchema).optional(), + comments: z.lazy(() => MessageFeedbackAppendEntryComments$zodSchema) + .optional(), + feedbackProvider: z.string(), + isHelpful: z.boolean().optional(), + metrics: MessageFeedbackAppendMetrics$zodSchema, + timestamp: z.int(), +}).describe( + "The feedback entry just appended to the message. Echoes the fields\nsupplied in the request plus server-stamped `feedbackProvider`,\n`timestamp`, and `metrics`.\n", +); diff --git a/src/models/messagefeedbackappendmetrics.ts b/src/models/messagefeedbackappendmetrics.ts new file mode 100644 index 00000000..d13609dd --- /dev/null +++ b/src/models/messagefeedbackappendmetrics.ts @@ -0,0 +1,25 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Telemetry recorded server-side alongside the feedback. Always present + * + * @remarks + * on append responses. + */ +export type MessageFeedbackAppendMetrics = { + timeToFeedback: number; + userAgent?: string | undefined; +}; + +export const MessageFeedbackAppendMetrics$zodSchema: z.ZodType< + MessageFeedbackAppendMetrics +> = z.object({ + timeToFeedback: z.number(), + userAgent: z.string().optional(), +}).describe( + "Telemetry recorded server-side alongside the feedback. Always present\non append responses.\n", +); diff --git a/src/models/messagefeedbacksubmitrequest.ts b/src/models/messagefeedbacksubmitrequest.ts new file mode 100644 index 00000000..aa24a89e --- /dev/null +++ b/src/models/messagefeedbacksubmitrequest.ts @@ -0,0 +1,73 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +export const MessageFeedbackSubmitRequestCategory = { + IncorrectInformation: "incorrect_information", + MissingInformation: "missing_information", + IrrelevantInformation: "irrelevant_information", + UnclearExplanation: "unclear_explanation", + PoorCitations: "poor_citations", + ExcellentAnswer: "excellent_answer", + HelpfulCitations: "helpful_citations", + WellExplained: "well_explained", + Other: "other", +} as const; +export type MessageFeedbackSubmitRequestCategory = ClosedEnum< + typeof MessageFeedbackSubmitRequestCategory +>; + +export const MessageFeedbackSubmitRequestCategory$zodSchema = z.enum([ + "incorrect_information", + "missing_information", + "irrelevant_information", + "unclear_explanation", + "poor_citations", + "excellent_answer", + "helpful_citations", + "well_explained", + "other", +]); + +/** + * Free-text comments grouped by sentiment. + */ +export type MessageFeedbackSubmitRequestComments = { + positive?: string | undefined; + negative?: string | undefined; +}; + +export const MessageFeedbackSubmitRequestComments$zodSchema: z.ZodType< + MessageFeedbackSubmitRequestComments +> = z.object({ + negative: z.string().optional(), + positive: z.string().optional(), +}).describe("Free-text comments grouped by sentiment."); + +/** + * Gateway request body for submitting message feedback (Zod + * + * @remarks + * `feedbackBodySchema`). All fields are optional; an empty object is + * accepted. Matches the first-party chat UI payload shape. + */ +export type MessageFeedbackSubmitRequest = { + isHelpful?: boolean | undefined; + categories?: Array | undefined; + comments?: MessageFeedbackSubmitRequestComments | undefined; +}; + +export const MessageFeedbackSubmitRequest$zodSchema: z.ZodType< + MessageFeedbackSubmitRequest +> = z.object({ + categories: z.array(MessageFeedbackSubmitRequestCategory$zodSchema) + .optional(), + comments: z.lazy(() => MessageFeedbackSubmitRequestComments$zodSchema) + .optional(), + isHelpful: z.boolean().optional(), +}).describe( + "Gateway request body for submitting message feedback (Zod\n`feedbackBodySchema`). All fields are optional; an empty object is\naccepted. Matches the first-party chat UI payload shape.\n", +); diff --git a/src/models/messagefeedbackupdateresponse.ts b/src/models/messagefeedbackupdateresponse.ts new file mode 100644 index 00000000..97d3f131 --- /dev/null +++ b/src/models/messagefeedbackupdateresponse.ts @@ -0,0 +1,40 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + MessageFeedbackAppendEntry, + MessageFeedbackAppendEntry$zodSchema, +} from "./messagefeedbackappendentry.js"; + +export type Meta = { requestId: string; timestamp: string; duration: number }; + +export const Meta$zodSchema: z.ZodType = z.object({ + duration: z.int(), + requestId: z.string(), + timestamp: z.iso.datetime({ offset: true }), +}); + +/** + * Gateway response after appending feedback to a bot-response message. + * + * @remarks + */ +export type MessageFeedbackUpdateResponse = { + conversationId: string; + messageId: string; + feedback: MessageFeedbackAppendEntry; + meta: Meta; +}; + +export const MessageFeedbackUpdateResponse$zodSchema: z.ZodType< + MessageFeedbackUpdateResponse +> = z.object({ + conversationId: z.string(), + feedback: MessageFeedbackAppendEntry$zodSchema, + messageId: z.string(), + meta: z.lazy(() => Meta$zodSchema), +}).describe( + "Gateway response after appending feedback to a bot-response message.\n", +); diff --git a/src/models/oauthapplistresponse.ts b/src/models/oauthapplistresponse.ts new file mode 100644 index 00000000..412b4697 --- /dev/null +++ b/src/models/oauthapplistresponse.ts @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + OAuthAppResponse, + OAuthAppResponse$zodSchema, +} from "./oauthappresponse.js"; + +export type OAuthAppListResponsePagination = { + page: number; + limit: number; + total: number; + totalPages: number; +}; + +export const OAuthAppListResponsePagination$zodSchema: z.ZodType< + OAuthAppListResponsePagination +> = z.object({ + limit: z.int(), + page: z.int(), + total: z.int(), + totalPages: z.int(), +}); + +/** + * Paginated list of OAuth apps + */ +export type OAuthAppListResponse = { + data: Array; + pagination: OAuthAppListResponsePagination; +}; + +export const OAuthAppListResponse$zodSchema: z.ZodType = z + .object({ + data: z.array(OAuthAppResponse$zodSchema), + pagination: z.lazy(() => OAuthAppListResponsePagination$zodSchema), + }).describe("Paginated list of OAuth apps"); diff --git a/src/models/oauthappresponse.ts b/src/models/oauthappresponse.ts new file mode 100644 index 00000000..ac2951d9 --- /dev/null +++ b/src/models/oauthappresponse.ts @@ -0,0 +1,76 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +/** + * App status + */ +export const OAuthAppResponseStatus = { + Active: "active", + Suspended: "suspended", + Revoked: "revoked", +} as const; +/** + * App status + */ +export type OAuthAppResponseStatus = ClosedEnum; + +export const OAuthAppResponseStatus$zodSchema = z.enum([ + "active", + "suspended", + "revoked", +]).describe("App status"); + +/** + * OAuth app details (without secret). Fields under `required:` always appear + * + * @remarks + * in `toAppResponse` (`oauth.app.service.ts`); optional URL/description fields + * are only present when set by the caller. + */ +export type OAuthAppResponse = { + id: string; + slug: string; + clientId: string; + name: string; + description?: string | undefined; + redirectUris: Array; + allowedGrantTypes: Array; + allowedScopes: Array; + status: OAuthAppResponseStatus; + homepageUrl?: string | undefined; + privacyPolicyUrl?: string | undefined; + termsOfServiceUrl?: string | undefined; + isConfidential: boolean; + accessTokenLifetime: number; + refreshTokenLifetime: number; + createdAt: string; + updatedAt: string; +}; + +export const OAuthAppResponse$zodSchema: z.ZodType = z.object( + { + accessTokenLifetime: z.int(), + allowedGrantTypes: z.array(z.string()), + allowedScopes: z.array(z.string()), + clientId: z.string(), + createdAt: z.iso.datetime({ offset: true }), + description: z.string().optional(), + homepageUrl: z.string().optional(), + id: z.string(), + isConfidential: z.boolean(), + name: z.string(), + privacyPolicyUrl: z.string().optional(), + redirectUris: z.array(z.string()), + refreshTokenLifetime: z.int(), + slug: z.string(), + status: OAuthAppResponseStatus$zodSchema, + termsOfServiceUrl: z.string().optional(), + updatedAt: z.iso.datetime({ offset: true }), + }, +).describe( + "OAuth app details (without secret). Fields under `required:` always appear\nin `toAppResponse` (`oauth.app.service.ts`); optional URL/description fields\nare only present when set by the caller.\n", +); diff --git a/src/models/oauthapptokenslistresponse.ts b/src/models/oauthapptokenslistresponse.ts new file mode 100644 index 00000000..9c511108 --- /dev/null +++ b/src/models/oauthapptokenslistresponse.ts @@ -0,0 +1,24 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + OAuthTokenListItem, + OAuthTokenListItem$zodSchema, +} from "./oauthtokenlistitem.js"; + +/** + * Response body for `GET /oauth-clients/{appId}/tokens` (`listAppTokens`). + * + * @remarks + */ +export type OAuthAppTokensListResponse = { tokens: Array }; + +export const OAuthAppTokensListResponse$zodSchema: z.ZodType< + OAuthAppTokensListResponse +> = z.object({ + tokens: z.array(OAuthTokenListItem$zodSchema), +}).describe( + "Response body for `GET /oauth-clients/{appId}/tokens` (`listAppTokens`).\n", +); diff --git a/src/models/oauthappwithsecret.ts b/src/models/oauthappwithsecret.ts new file mode 100644 index 00000000..938b955c --- /dev/null +++ b/src/models/oauthappwithsecret.ts @@ -0,0 +1,79 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +/** + * App status + */ +export const OAuthAppWithSecretStatus = { + Active: "active", + Suspended: "suspended", + Revoked: "revoked", +} as const; +/** + * App status + */ +export type OAuthAppWithSecretStatus = ClosedEnum< + typeof OAuthAppWithSecretStatus +>; + +export const OAuthAppWithSecretStatus$zodSchema = z.enum([ + "active", + "suspended", + "revoked", +]).describe("App status"); + +/** + * OAuth app details (without secret). Fields under `required:` always appear + * + * @remarks + * in `toAppResponse` (`oauth.app.service.ts`); optional URL/description fields + * are only present when set by the caller. + */ +export type OAuthAppWithSecret = { + id: string; + slug: string; + clientId: string; + name: string; + description?: string | undefined; + redirectUris: Array; + allowedGrantTypes: Array; + allowedScopes: Array; + status: OAuthAppWithSecretStatus; + homepageUrl?: string | undefined; + privacyPolicyUrl?: string | undefined; + termsOfServiceUrl?: string | undefined; + isConfidential: boolean; + accessTokenLifetime: number; + refreshTokenLifetime: number; + createdAt: string; + updatedAt: string; + clientSecret: string; +}; + +export const OAuthAppWithSecret$zodSchema: z.ZodType = z + .object({ + accessTokenLifetime: z.int(), + allowedGrantTypes: z.array(z.string()), + allowedScopes: z.array(z.string()), + clientId: z.string(), + clientSecret: z.string(), + createdAt: z.iso.datetime({ offset: true }), + description: z.string().optional(), + homepageUrl: z.string().optional(), + id: z.string(), + isConfidential: z.boolean(), + name: z.string(), + privacyPolicyUrl: z.string().optional(), + redirectUris: z.array(z.string()), + refreshTokenLifetime: z.int(), + slug: z.string(), + status: OAuthAppWithSecretStatus$zodSchema, + termsOfServiceUrl: z.string().optional(), + updatedAt: z.iso.datetime({ offset: true }), + }).describe( + "OAuth app details (without secret). Fields under `required:` always appear\nin `toAppResponse` (`oauth.app.service.ts`); optional URL/description fields\nare only present when set by the caller.\n", + ); diff --git a/src/models/oauthclientmanagementratelimiterror.ts b/src/models/oauthclientmanagementratelimiterror.ts new file mode 100644 index 00000000..14714d0b --- /dev/null +++ b/src/models/oauthclientmanagementratelimiterror.ts @@ -0,0 +1,34 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export type OAuthClientManagementRateLimitErrorError = { + code: string; + message: string; + retryAfter?: number | null | undefined; +}; + +export const OAuthClientManagementRateLimitErrorError$zodSchema: z.ZodType< + OAuthClientManagementRateLimitErrorError +> = z.object({ + code: z.string(), + message: z.string(), + retryAfter: z.int().nullable().optional(), +}); + +/** + * JSON body when OAuth client management routes exceed the per-minute rate limit (same limiter as other `/oauth-clients/*` routes). + */ +export type OAuthClientManagementRateLimitError = { + error: OAuthClientManagementRateLimitErrorError; +}; + +export const OAuthClientManagementRateLimitError$zodSchema: z.ZodType< + OAuthClientManagementRateLimitError +> = z.object({ + error: z.lazy(() => OAuthClientManagementRateLimitErrorError$zodSchema), +}).describe( + "JSON body when OAuth client management routes exceed the per-minute rate limit (same limiter as other `/oauth-clients/*` routes).", +); diff --git a/src/models/oauthcredentials.ts b/src/models/oauthcredentials.ts new file mode 100644 index 00000000..856f40c3 --- /dev/null +++ b/src/models/oauthcredentials.ts @@ -0,0 +1,22 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Credentials for OAuth authentication (Microsoft, Azure AD, generic OAuth) + */ +export type OAuthCredentials = { + accessToken: string; + idToken?: string | undefined; +}; + +export const OAuthCredentials$zodSchema: z.ZodType = z.object( + { + accessToken: z.string(), + idToken: z.string().optional(), + }, +).describe( + "Credentials for OAuth authentication (Microsoft, Azure AD, generic OAuth)", +); diff --git a/src/models/oautherrorresponse.ts b/src/models/oautherrorresponse.ts new file mode 100644 index 00000000..60ec7b1c --- /dev/null +++ b/src/models/oautherrorresponse.ts @@ -0,0 +1,78 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +/** + * Error code. Common values: + * + * @remarks + * - `invalid_request` - Missing or invalid parameter + * - `invalid_client` - Client authentication failed + * - `invalid_grant` - Invalid authorization code or refresh token + * - `unauthorized_client` - Client not authorized for this grant type + * - `unsupported_grant_type` - Grant type not supported + * - `invalid_scope` - Requested scope is invalid or exceeds allowed + * - `access_denied` - User denied authorization + */ +export const ErrorEnum = { + InvalidRequest: "invalid_request", + InvalidClient: "invalid_client", + InvalidGrant: "invalid_grant", + UnauthorizedClient: "unauthorized_client", + UnsupportedGrantType: "unsupported_grant_type", + InvalidScope: "invalid_scope", + AccessDenied: "access_denied", + ServerError: "server_error", +} as const; +/** + * Error code. Common values: + * + * @remarks + * - `invalid_request` - Missing or invalid parameter + * - `invalid_client` - Client authentication failed + * - `invalid_grant` - Invalid authorization code or refresh token + * - `unauthorized_client` - Client not authorized for this grant type + * - `unsupported_grant_type` - Grant type not supported + * - `invalid_scope` - Requested scope is invalid or exceeds allowed + * - `access_denied` - User denied authorization + */ +export type ErrorEnum = ClosedEnum; + +export const ErrorEnum$zodSchema = z.enum([ + "invalid_request", + "invalid_client", + "invalid_grant", + "unauthorized_client", + "unsupported_grant_type", + "invalid_scope", + "access_denied", + "server_error", +]).describe( + "Error code. Common values:\n- `invalid_request` - Missing or invalid parameter\n- `invalid_client` - Client authentication failed\n- `invalid_grant` - Invalid authorization code or refresh token\n- `unauthorized_client` - Client not authorized for this grant type\n- `unsupported_grant_type` - Grant type not supported\n- `invalid_scope` - Requested scope is invalid or exceeds allowed\n- `access_denied` - User denied authorization\n", +); + +/** + * OAuth 2.0 Error Response (RFC 6749 Section 5.2). + * + * @remarks + * Standard error format for OAuth endpoints. + */ +export type OAuthErrorResponse = { + error: ErrorEnum; + error_description?: string | undefined; + error_uri?: string | undefined; + state?: string | undefined; +}; + +export const OAuthErrorResponse$zodSchema: z.ZodType = z + .object({ + error: ErrorEnum$zodSchema, + error_description: z.string().optional(), + error_uri: z.string().optional(), + state: z.string().optional(), + }).describe( + "OAuth 2.0 Error Response (RFC 6749 Section 5.2).\nStandard error format for OAuth endpoints.\n", + ); diff --git a/src/models/oauthintrospectop.ts b/src/models/oauthintrospectop.ts new file mode 100644 index 00000000..8bf29183 --- /dev/null +++ b/src/models/oauthintrospectop.ts @@ -0,0 +1,30 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + OAuthClientManagementRateLimitError, + OAuthClientManagementRateLimitError$zodSchema, +} from "./oauthclientmanagementratelimiterror.js"; +import { + OAuthErrorResponse, + OAuthErrorResponse$zodSchema, +} from "./oautherrorresponse.js"; +import { + OAuthIntrospectResponse, + OAuthIntrospectResponse$zodSchema, +} from "./oauthintrospectresponse.js"; + +export type OauthIntrospectResponseResponse = + | OAuthIntrospectResponse + | OAuthErrorResponse + | OAuthClientManagementRateLimitError; + +export const OauthIntrospectResponseResponse$zodSchema: z.ZodType< + OauthIntrospectResponseResponse +> = z.union([ + OAuthIntrospectResponse$zodSchema, + OAuthErrorResponse$zodSchema, + OAuthClientManagementRateLimitError$zodSchema, +]); diff --git a/src/models/oauthintrospectrequest.ts b/src/models/oauthintrospectrequest.ts new file mode 100644 index 00000000..723b0b46 --- /dev/null +++ b/src/models/oauthintrospectrequest.ts @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +/** + * Hint about token type + */ +export const OAuthIntrospectRequestTokenTypeHint = { + AccessToken: "access_token", + RefreshToken: "refresh_token", +} as const; +/** + * Hint about token type + */ +export type OAuthIntrospectRequestTokenTypeHint = ClosedEnum< + typeof OAuthIntrospectRequestTokenTypeHint +>; + +export const OAuthIntrospectRequestTokenTypeHint$zodSchema = z.enum([ + "access_token", + "refresh_token", +]).describe("Hint about token type"); + +/** + * OAuth 2.0 Token Introspection Request (RFC 7662). + * + * @remarks + * Check if a token is active and get its metadata. + */ +export type OAuthIntrospectRequest = { + token: string; + token_type_hint?: OAuthIntrospectRequestTokenTypeHint | undefined; + client_id: string; + client_secret?: string | undefined; +}; + +export const OAuthIntrospectRequest$zodSchema: z.ZodType< + OAuthIntrospectRequest +> = z.object({ + client_id: z.string(), + client_secret: z.string().optional(), + token: z.string(), + token_type_hint: OAuthIntrospectRequestTokenTypeHint$zodSchema.optional(), +}).describe( + "OAuth 2.0 Token Introspection Request (RFC 7662).\nCheck if a token is active and get its metadata.\n", +); diff --git a/src/models/oauthintrospectresponse.ts b/src/models/oauthintrospectresponse.ts new file mode 100644 index 00000000..2d9a49ea --- /dev/null +++ b/src/models/oauthintrospectresponse.ts @@ -0,0 +1,45 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * OAuth 2.0 Token Introspection Response (RFC 7662). + * + * @remarks + * Contains token metadata if active, or just `active: false` if not. + */ +export type OAuthIntrospectResponse = { + active: boolean; + scope?: string | undefined; + client_id?: string | undefined; + username?: string | undefined; + token_type?: string | undefined; + exp?: number | undefined; + iat?: number | undefined; + nbf?: number | undefined; + user_id?: string | undefined; + aud?: string | undefined; + iss?: string | undefined; + jti?: string | undefined; +}; + +export const OAuthIntrospectResponse$zodSchema: z.ZodType< + OAuthIntrospectResponse +> = z.object({ + active: z.boolean(), + aud: z.string().optional(), + client_id: z.string().optional(), + exp: z.int().optional(), + iat: z.int().optional(), + iss: z.string().optional(), + jti: z.string().optional(), + nbf: z.int().optional(), + scope: z.string().optional(), + token_type: z.string().optional(), + user_id: z.string().optional(), + username: z.string().optional(), +}).describe( + "OAuth 2.0 Token Introspection Response (RFC 7662).\nContains token metadata if active, or just `active: false` if not.\n", +); diff --git a/src/models/oauthrevokeop.ts b/src/models/oauthrevokeop.ts new file mode 100644 index 00000000..01e749e9 --- /dev/null +++ b/src/models/oauthrevokeop.ts @@ -0,0 +1,23 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + OAuthClientManagementRateLimitError, + OAuthClientManagementRateLimitError$zodSchema, +} from "./oauthclientmanagementratelimiterror.js"; +import { + OAuthErrorResponse, + OAuthErrorResponse$zodSchema, +} from "./oautherrorresponse.js"; + +export type OauthRevokeResponse = + | OAuthErrorResponse + | OAuthClientManagementRateLimitError; + +export const OauthRevokeResponse$zodSchema: z.ZodType = z + .union([ + OAuthErrorResponse$zodSchema, + OAuthClientManagementRateLimitError$zodSchema, + ]); diff --git a/src/models/oauthrevokerequest.ts b/src/models/oauthrevokerequest.ts new file mode 100644 index 00000000..ee54a914 --- /dev/null +++ b/src/models/oauthrevokerequest.ts @@ -0,0 +1,48 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +/** + * Hint about token type (optional, improves performance) + */ +export const OAuthRevokeRequestTokenTypeHint = { + AccessToken: "access_token", + RefreshToken: "refresh_token", +} as const; +/** + * Hint about token type (optional, improves performance) + */ +export type OAuthRevokeRequestTokenTypeHint = ClosedEnum< + typeof OAuthRevokeRequestTokenTypeHint +>; + +export const OAuthRevokeRequestTokenTypeHint$zodSchema = z.enum([ + "access_token", + "refresh_token", +]).describe("Hint about token type (optional, improves performance)"); + +/** + * OAuth 2.0 Token Revocation Request (RFC 7009). + * + * @remarks + * Revokes an access or refresh token. + */ +export type OAuthRevokeRequest = { + token: string; + token_type_hint?: OAuthRevokeRequestTokenTypeHint | undefined; + client_id: string; + client_secret?: string | undefined; +}; + +export const OAuthRevokeRequest$zodSchema: z.ZodType = z + .object({ + client_id: z.string(), + client_secret: z.string().optional(), + token: z.string(), + token_type_hint: OAuthRevokeRequestTokenTypeHint$zodSchema.optional(), + }).describe( + "OAuth 2.0 Token Revocation Request (RFC 7009).\nRevokes an access or refresh token.\n", + ); diff --git a/src/models/oauthscopeinfo.ts b/src/models/oauthscopeinfo.ts new file mode 100644 index 00000000..bb1326cd --- /dev/null +++ b/src/models/oauthscopeinfo.ts @@ -0,0 +1,22 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Information about an OAuth scope + */ +export type OAuthScopeInfo = { + name: string; + description: string; + category: string; + requiresUserConsent: boolean; +}; + +export const OAuthScopeInfo$zodSchema: z.ZodType = z.object({ + category: z.string(), + description: z.string(), + name: z.string(), + requiresUserConsent: z.boolean(), +}).describe("Information about an OAuth scope"); diff --git a/src/models/oauthscopesgroupedresponse.ts b/src/models/oauthscopesgroupedresponse.ts new file mode 100644 index 00000000..3f0d901f --- /dev/null +++ b/src/models/oauthscopesgroupedresponse.ts @@ -0,0 +1,25 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { OAuthScopeInfo, OAuthScopeInfo$zodSchema } from "./oauthscopeinfo.js"; + +/** + * OAuth scopes available to the signed-in user for app registration, grouped by category label. + * + * @remarks + * Category keys are UI labels (e.g. `Identity`, `Knowledge Base`); each maps to a list of scopes in that group. + * Categories defined in server config may appear with an **empty array** when every scope in that category is restricted for the caller's role (e.g. non–org-admin users never receive admin-only scopes). + */ +export type OAuthScopesGroupedResponse = { + scopes: { [k: string]: Array }; +}; + +export const OAuthScopesGroupedResponse$zodSchema: z.ZodType< + OAuthScopesGroupedResponse +> = z.object({ + scopes: z.record(z.string(), z.array(OAuthScopeInfo$zodSchema)), +}).describe( + "OAuth scopes available to the signed-in user for app registration, grouped by category label.\nCategory keys are UI labels (e.g. `Identity`, `Knowledge Base`); each maps to a list of scopes in that group.\nCategories defined in server config may appear with an **empty array** when every scope in that category is restricted for the caller's role (e.g. non–org-admin users never receive admin-only scopes).\n", +); diff --git a/src/models/oauthtokenlistitem.ts b/src/models/oauthtokenlistitem.ts new file mode 100644 index 00000000..1c20241e --- /dev/null +++ b/src/models/oauthtokenlistitem.ts @@ -0,0 +1,53 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +/** + * Type of token + */ +export const TokenType = { + Access: "access", + Refresh: "refresh", +} as const; +/** + * Type of token + */ +export type TokenType = ClosedEnum; + +export const TokenType$zodSchema = z.enum([ + "access", + "refresh", +]).describe("Type of token"); + +/** + * Information about an issued token (one element returned by `listTokensForApp` + * + * @remarks + * in `oauth_token.service.ts`). `userId` is omitted for client-credentials access + * tokens; all other fields are always populated. + */ +export type OAuthTokenListItem = { + id: string; + tokenType: TokenType; + userId?: string | undefined; + scopes: Array; + createdAt: string; + expiresAt: string; + isRevoked: boolean; +}; + +export const OAuthTokenListItem$zodSchema: z.ZodType = z + .object({ + createdAt: z.iso.datetime({ offset: true }), + expiresAt: z.iso.datetime({ offset: true }), + id: z.string(), + isRevoked: z.boolean(), + scopes: z.array(z.string()), + tokenType: TokenType$zodSchema, + userId: z.string().optional(), + }).describe( + "Information about an issued token (one element returned by `listTokensForApp`\nin `oauth_token.service.ts`). `userId` is omitted for client-credentials access\ntokens; all other fields are always populated.\n", + ); diff --git a/src/models/oauthtokenop.ts b/src/models/oauthtokenop.ts new file mode 100644 index 00000000..05193b75 --- /dev/null +++ b/src/models/oauthtokenop.ts @@ -0,0 +1,33 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; +import { + OAuthClientManagementRateLimitError, + OAuthClientManagementRateLimitError$zodSchema, +} from "./oauthclientmanagementratelimiterror.js"; +import { + OAuthErrorResponse, + OAuthErrorResponse$zodSchema, +} from "./oautherrorresponse.js"; +import { + OAuthTokenResponse, + OAuthTokenResponse$zodSchema, +} from "./oauthtokenresponse.js"; + +export type OauthTokenResponseResponse = + | ErrorResponse + | OAuthErrorResponse + | OAuthClientManagementRateLimitError + | OAuthTokenResponse; + +export const OauthTokenResponseResponse$zodSchema: z.ZodType< + OauthTokenResponseResponse +> = z.union([ + ErrorResponse$zodSchema, + OAuthErrorResponse$zodSchema, + OAuthClientManagementRateLimitError$zodSchema, + OAuthTokenResponse$zodSchema, +]); diff --git a/src/models/oauthtokenrequest.ts b/src/models/oauthtokenrequest.ts new file mode 100644 index 00000000..c07f83a6 --- /dev/null +++ b/src/models/oauthtokenrequest.ts @@ -0,0 +1,68 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +/** + * OAuth grant type: + * + * @remarks + * - `authorization_code`: Exchange auth code for tokens + * - `client_credentials`: Machine-to-machine auth + * - `refresh_token`: Get new access token using refresh token + */ +export const GrantType = { + AuthorizationCode: "authorization_code", + ClientCredentials: "client_credentials", + RefreshToken: "refresh_token", +} as const; +/** + * OAuth grant type: + * + * @remarks + * - `authorization_code`: Exchange auth code for tokens + * - `client_credentials`: Machine-to-machine auth + * - `refresh_token`: Get new access token using refresh token + */ +export type GrantType = ClosedEnum; + +export const GrantType$zodSchema = z.enum([ + "authorization_code", + "client_credentials", + "refresh_token", +]).describe( + "OAuth grant type:\n- `authorization_code`: Exchange auth code for tokens\n- `client_credentials`: Machine-to-machine auth\n- `refresh_token`: Get new access token using refresh token\n", +); + +/** + * OAuth 2.0 Token Request (RFC 6749 Section 4.1.3). + * + * @remarks + * Request body for exchanging authorization code or credentials for tokens. + */ +export type OAuthTokenRequest = { + grant_type: GrantType; + code?: string | undefined; + redirect_uri?: string | undefined; + client_id?: string | undefined; + client_secret?: string | undefined; + refresh_token?: string | undefined; + scope?: string | undefined; + code_verifier?: string | undefined; +}; + +export const OAuthTokenRequest$zodSchema: z.ZodType = z + .object({ + client_id: z.string().optional(), + client_secret: z.string().optional(), + code: z.string().optional(), + code_verifier: z.string().optional(), + grant_type: GrantType$zodSchema, + redirect_uri: z.string().optional(), + refresh_token: z.string().optional(), + scope: z.string().optional(), + }).describe( + "OAuth 2.0 Token Request (RFC 6749 Section 4.1.3).\nRequest body for exchanging authorization code or credentials for tokens.\n", + ); diff --git a/src/models/oauthtokenresponse.ts b/src/models/oauthtokenresponse.ts new file mode 100644 index 00000000..28d0024a --- /dev/null +++ b/src/models/oauthtokenresponse.ts @@ -0,0 +1,32 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * OAuth 2.0 Token Response (RFC 6749 Section 5.1). + * + * @remarks + * Contains the access token and optional refresh/ID tokens. + */ +export type OAuthTokenResponse = { + access_token?: string | undefined; + token_type?: string | undefined; + expires_in?: number | undefined; + refresh_token?: string | undefined; + scope?: string | undefined; + id_token?: string | undefined; +}; + +export const OAuthTokenResponse$zodSchema: z.ZodType = z + .object({ + access_token: z.string().optional(), + expires_in: z.int().optional(), + id_token: z.string().optional(), + refresh_token: z.string().optional(), + scope: z.string().optional(), + token_type: z.string().optional(), + }).describe( + "OAuth 2.0 Token Response (RFC 6749 Section 5.1).\nContains the access token and optional refresh/ID tokens.\n", + ); diff --git a/src/models/oauthuserinforesponse.ts b/src/models/oauthuserinforesponse.ts new file mode 100644 index 00000000..8ceb7821 --- /dev/null +++ b/src/models/oauthuserinforesponse.ts @@ -0,0 +1,36 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * OpenID Connect UserInfo Response. + * + * @remarks + * Contains claims about the authenticated user. + */ +export type OAuthUserInfoResponse = { + user_id: string; + name?: string | undefined; + given_name?: string | undefined; + family_name?: string | undefined; + email?: string | undefined; + email_verified?: boolean | undefined; + picture?: string | undefined; + updated_at?: number | undefined; +}; + +export const OAuthUserInfoResponse$zodSchema: z.ZodType = + z.object({ + email: z.string().optional(), + email_verified: z.boolean().optional(), + family_name: z.string().optional(), + given_name: z.string().optional(), + name: z.string().optional(), + picture: z.string().optional(), + updated_at: z.int().optional(), + user_id: z.string(), + }).describe( + "OpenID Connect UserInfo Response.\nContains claims about the authenticated user.\n", + ); diff --git a/src/models/organization.ts b/src/models/organization.ts new file mode 100644 index 00000000..ea97238f --- /dev/null +++ b/src/models/organization.ts @@ -0,0 +1,75 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { Address, Address$zodSchema } from "./address.js"; + +/** + * Type of account + */ +export const AccountType = { + Individual: "individual", + Business: "business", +} as const; +/** + * Type of account + */ +export type AccountType = ClosedEnum; + +export const AccountType$zodSchema = z.enum([ + "individual", + "business", +]).describe("Type of account"); + +/** + * Onboarding status + */ +export const OnBoardingStatus = { + Configured: "configured", + NotConfigured: "notConfigured", + Skipped: "skipped", +} as const; +/** + * Onboarding status + */ +export type OnBoardingStatus = ClosedEnum; + +export const OnBoardingStatus$zodSchema = z.enum([ + "configured", + "notConfigured", + "skipped", +]).describe("Onboarding status"); + +export type Organization = { + _id: string; + slug: string; + registeredName: string; + shortName?: string | undefined; + domain: string; + contactEmail: string; + accountType: AccountType; + permanentAddress?: Address | undefined; + onBoardingStatus: OnBoardingStatus; + isDeleted?: boolean | undefined; + _v: number; + createdAt: string; + updatedAt: string; +}; + +export const Organization$zodSchema: z.ZodType = z.object({ + _id: z.string(), + _v: z.int(), + accountType: AccountType$zodSchema, + contactEmail: z.string(), + createdAt: z.iso.datetime({ offset: true }), + domain: z.string(), + isDeleted: z.boolean().default(false), + onBoardingStatus: OnBoardingStatus$zodSchema, + permanentAddress: Address$zodSchema.optional(), + registeredName: z.string(), + shortName: z.string().optional(), + slug: z.string(), + updatedAt: z.iso.datetime({ offset: true }), +}); diff --git a/src/models/orgauthconfigcreaterequest.ts b/src/models/orgauthconfigcreaterequest.ts new file mode 100644 index 00000000..fad02f99 --- /dev/null +++ b/src/models/orgauthconfigcreaterequest.ts @@ -0,0 +1,24 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Request to create initial organization auth configuration + */ +export type OrgAuthConfigCreateRequest = { + contactEmail: string; + registeredName: string; + adminFullName: string; + sendEmail?: boolean | undefined; +}; + +export const OrgAuthConfigCreateRequest$zodSchema: z.ZodType< + OrgAuthConfigCreateRequest +> = z.object({ + adminFullName: z.string(), + contactEmail: z.string(), + registeredName: z.string(), + sendEmail: z.boolean().default(false), +}).describe("Request to create initial organization auth configuration"); diff --git a/src/models/orgauthconfigsetupresponse.ts b/src/models/orgauthconfigsetupresponse.ts new file mode 100644 index 00000000..4a0096ee --- /dev/null +++ b/src/models/orgauthconfigsetupresponse.ts @@ -0,0 +1,16 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Response from setting up organization auth configuration + */ +export type OrgAuthConfigSetupResponse = { message: string }; + +export const OrgAuthConfigSetupResponse$zodSchema: z.ZodType< + OrgAuthConfigSetupResponse +> = z.object({ + message: z.string(), +}).describe("Response from setting up organization auth configuration"); diff --git a/src/models/otpcredentials.ts b/src/models/otpcredentials.ts new file mode 100644 index 00000000..5176049d --- /dev/null +++ b/src/models/otpcredentials.ts @@ -0,0 +1,14 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Credentials for OTP authentication + */ +export type OtpCredentials = { otp: string }; + +export const OtpCredentials$zodSchema: z.ZodType = z.object({ + otp: z.string(), +}).describe("Credentials for OTP authentication"); diff --git a/src/models/paginationinfo.ts b/src/models/paginationinfo.ts deleted file mode 100644 index 731ae963..00000000 --- a/src/models/paginationinfo.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; - -/** - * Standard pagination block returned alongside list responses - * - * @remarks - * (e.g. `{ items: [...], pagination: PaginationInfo }`). - */ -export type PaginationInfo = { - page?: number | undefined; - limit?: number | undefined; - totalCount?: number | undefined; - totalPages?: number | undefined; - hasNextPage?: boolean | undefined; - hasPrevPage?: boolean | undefined; -}; - -export const PaginationInfo$zodSchema: z.ZodType = z.object({ - hasNextPage: z.boolean().optional(), - hasPrevPage: z.boolean().optional(), - limit: z.int().optional(), - page: z.int().optional(), - totalCount: z.int().optional(), - totalPages: z.int().optional(), -}).describe( - "Standard pagination block returned alongside list responses\n(e.g. `{ items: [...], pagination: PaginationInfo }`).\n", -); diff --git a/src/models/passwordcredentials.ts b/src/models/passwordcredentials.ts new file mode 100644 index 00000000..d398c201 --- /dev/null +++ b/src/models/passwordcredentials.ts @@ -0,0 +1,15 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Credentials for password authentication + */ +export type PasswordCredentials = { password: string }; + +export const PasswordCredentials$zodSchema: z.ZodType = z + .object({ + password: z.string(), + }).describe("Credentials for password authentication"); diff --git a/src/models/persistedsemanticsearch.ts b/src/models/persistedsemanticsearch.ts new file mode 100644 index 00000000..0a7d1ac1 --- /dev/null +++ b/src/models/persistedsemanticsearch.ts @@ -0,0 +1,64 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + PersistedSemanticSearchCitation, + PersistedSemanticSearchCitation$zodSchema, +} from "./persistedsemanticsearchcitation.js"; +import { + PersistedSemanticSearchSharedWithEntry, + PersistedSemanticSearchSharedWithEntry$zodSchema, +} from "./persistedsemanticsearchsharedwithentry.js"; + +/** + * Persisted search document as returned to clients. + * + * @remarks + * `records` is a string-valued map: each value is `JSON.stringify()`, + * keyed by the source record's `_id` or `_key`. Clients must `JSON.parse` + * each value to recover the underlying record object (whose shape resembles + * `SemanticSearchGraphRecord`). This intentionally differs from the + * `searchResponse.records` array on the POST `/search` response, which is + * passed through from the retrieval service untouched. + */ +export type PersistedSemanticSearch = { + _id: string; + _v: number; + query: string; + limit: number; + orgId: string; + userId: string; + citationIds: Array; + records: { [k: string]: string }; + isShared: boolean; + shareLink?: string | undefined; + sharedWith: Array; + isArchived: boolean; + archivedBy?: string | null | undefined; + createdAt: string; + updatedAt: string; +}; + +export const PersistedSemanticSearch$zodSchema: z.ZodType< + PersistedSemanticSearch +> = z.object({ + _id: z.string(), + _v: z.int(), + archivedBy: z.string().nullable().optional(), + citationIds: z.array(PersistedSemanticSearchCitation$zodSchema), + createdAt: z.iso.datetime({ offset: true }), + isArchived: z.boolean(), + isShared: z.boolean(), + limit: z.int(), + orgId: z.string(), + query: z.string(), + records: z.record(z.string(), z.string()), + shareLink: z.string().optional(), + sharedWith: z.array(PersistedSemanticSearchSharedWithEntry$zodSchema), + updatedAt: z.iso.datetime({ offset: true }), + userId: z.string(), +}).describe( + "Persisted search document as returned to clients.\n`records` is a string-valued map: each value is `JSON.stringify()`,\nkeyed by the source record's `_id` or `_key`. Clients must `JSON.parse`\neach value to recover the underlying record object (whose shape resembles\n`SemanticSearchGraphRecord`). This intentionally differs from the\n`searchResponse.records` array on the POST `/search` response, which is\npassed through from the retrieval service untouched.\n", +); diff --git a/src/models/persistedsemanticsearchboundingbox.ts b/src/models/persistedsemanticsearchboundingbox.ts new file mode 100644 index 00000000..b41e2252 --- /dev/null +++ b/src/models/persistedsemanticsearchboundingbox.ts @@ -0,0 +1,27 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Bounding box subdocument embedded in persisted citation metadata. + * + * @remarks + * `boundingBoxSchema` does not set `_id: false`, so Mongoose auto-injects an `_id`. + */ +export type PersistedSemanticSearchBoundingBox = { + _id: string; + x: number; + y: number; +}; + +export const PersistedSemanticSearchBoundingBox$zodSchema: z.ZodType< + PersistedSemanticSearchBoundingBox +> = z.object({ + _id: z.string(), + x: z.number(), + y: z.number(), +}).describe( + "Bounding box subdocument embedded in persisted citation metadata.\n`boundingBoxSchema` does not set `_id: false`, so Mongoose auto-injects an `_id`.\n", +); diff --git a/src/models/persistedsemanticsearchcitation.ts b/src/models/persistedsemanticsearchcitation.ts new file mode 100644 index 00000000..fff5373f --- /dev/null +++ b/src/models/persistedsemanticsearchcitation.ts @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + PersistedSemanticSearchCitationMetadata, + PersistedSemanticSearchCitationMetadata$zodSchema, +} from "./persistedsemanticsearchcitationmetadata.js"; + +/** + * Populated citation document referenced from a persisted search. + * + * @remarks + * The controller strips `__v` via `populate({ select: '-__v' })`. + */ +export type PersistedSemanticSearchCitation = { + _id: string; + content: string; + chunkIndex: number; + citationType: string; + metadata: PersistedSemanticSearchCitationMetadata; + createdAt: string; + updatedAt: string; +}; + +export const PersistedSemanticSearchCitation$zodSchema: z.ZodType< + PersistedSemanticSearchCitation +> = z.object({ + _id: z.string(), + chunkIndex: z.int(), + citationType: z.string(), + content: z.string(), + createdAt: z.iso.datetime({ offset: true }), + metadata: PersistedSemanticSearchCitationMetadata$zodSchema, + updatedAt: z.iso.datetime({ offset: true }), +}).describe( + "Populated citation document referenced from a persisted search.\nThe controller strips `__v` via `populate({ select: '-__v' })`.\n", +); diff --git a/src/models/persistedsemanticsearchcitationmetadata.ts b/src/models/persistedsemanticsearchcitationmetadata.ts new file mode 100644 index 00000000..4d0eaf4a --- /dev/null +++ b/src/models/persistedsemanticsearchcitationmetadata.ts @@ -0,0 +1,72 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + PersistedSemanticSearchBoundingBox, + PersistedSemanticSearchBoundingBox$zodSchema, +} from "./persistedsemanticsearchboundingbox.js"; + +/** + * Citation metadata as persisted in MongoDB. Required fields mirror the + * + * @remarks + * Mongoose schema's `required: true` flags; the rest are optional and + * may come through as `null` because the AI retrieval service emits + * explicit nulls for absent fields. + */ +export type PersistedSemanticSearchCitationMetadata = { + orgId: string; + mimeType: string; + recordId: string; + recordName: string; + origin: string; + recordVersion?: number | null | undefined; + extension?: string | null | undefined; + webUrl?: string | null | undefined; + previewRenderable?: boolean | null | undefined; + hideWeburl?: boolean | null | undefined; + connector?: string | null | undefined; + recordType?: string | null | undefined; + blockNum?: Array | null | undefined; + pageNum?: Array | null | undefined; + sheetNum?: number | null | undefined; + sheetName?: string | null | undefined; + bounding_box?: Array | null | undefined; + blockType?: string | null | undefined; + blockText?: string | null | undefined; + departments?: Array | null | undefined; + languages?: Array | null | undefined; + topics?: Array | null | undefined; +}; + +export const PersistedSemanticSearchCitationMetadata$zodSchema: z.ZodType< + PersistedSemanticSearchCitationMetadata +> = z.object({ + blockNum: z.array(z.number().nullable()).nullable().optional(), + blockText: z.string().nullable().optional(), + blockType: z.string().nullable().optional(), + bounding_box: z.array(PersistedSemanticSearchBoundingBox$zodSchema).nullable() + .optional(), + connector: z.string().nullable().optional(), + departments: z.array(z.string()).nullable().optional(), + extension: z.string().nullable().optional(), + hideWeburl: z.boolean().nullable().optional(), + languages: z.array(z.string()).nullable().optional(), + mimeType: z.string(), + orgId: z.string(), + origin: z.string(), + pageNum: z.array(z.number().nullable()).nullable().optional(), + previewRenderable: z.boolean().nullable().optional(), + recordId: z.string(), + recordName: z.string(), + recordType: z.string().nullable().optional(), + recordVersion: z.int().nullable().optional(), + sheetName: z.string().nullable().optional(), + sheetNum: z.number().nullable().optional(), + topics: z.array(z.string()).nullable().optional(), + webUrl: z.string().nullable().optional(), +}).describe( + "Citation metadata as persisted in MongoDB. Required fields mirror the\nMongoose schema's `required: true` flags; the rest are optional and\nmay come through as `null` because the AI retrieval service emits\nexplicit nulls for absent fields.\n", +); diff --git a/src/models/persistedsemanticsearchsharedwithentry.ts b/src/models/persistedsemanticsearchsharedwithentry.ts new file mode 100644 index 00000000..6f656e4f --- /dev/null +++ b/src/models/persistedsemanticsearchsharedwithentry.ts @@ -0,0 +1,40 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +export const PersistedSemanticSearchSharedWithEntryAccessLevel = { + Read: "read", + Write: "write", +} as const; +export type PersistedSemanticSearchSharedWithEntryAccessLevel = ClosedEnum< + typeof PersistedSemanticSearchSharedWithEntryAccessLevel +>; + +export const PersistedSemanticSearchSharedWithEntryAccessLevel$zodSchema = z + .enum([ + "read", + "write", + ]); + +/** + * Entry inside `sharedWith[]`. The schema sets `_id: false` on these + * + * @remarks + * sub-docs, so no auto-injected `_id` is present. + */ +export type PersistedSemanticSearchSharedWithEntry = { + userId: string; + accessLevel: PersistedSemanticSearchSharedWithEntryAccessLevel; +}; + +export const PersistedSemanticSearchSharedWithEntry$zodSchema: z.ZodType< + PersistedSemanticSearchSharedWithEntry +> = z.object({ + accessLevel: PersistedSemanticSearchSharedWithEntryAccessLevel$zodSchema, + userId: z.string(), +}).describe( + "Entry inside `sharedWith[]`. The schema sets `_id: false` on these\nsub-docs, so no auto-injected `_id` is present.\n", +); diff --git a/src/models/refreshtokenop.ts b/src/models/refreshtokenop.ts new file mode 100644 index 00000000..a746e305 --- /dev/null +++ b/src/models/refreshtokenop.ts @@ -0,0 +1,28 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; +import { + RefreshTokenResponse, + RefreshTokenResponse$zodSchema, +} from "./refreshtokenresponse.js"; + +export type RefreshTokenSecurity = { scopedToken: string }; + +export const RefreshTokenSecurity$zodSchema: z.ZodType = z + .object({ + scopedToken: z.string().describe( + "Scoped JWT token for service-to-service authentication.\nFormat: \"Bearer {scoped_token}\"\nRequired scopes vary by endpoint.\n", + ), + }); + +export type RefreshTokenResponseResponse = RefreshTokenResponse | ErrorResponse; + +export const RefreshTokenResponseResponse$zodSchema: z.ZodType< + RefreshTokenResponseResponse +> = z.union([ + RefreshTokenResponse$zodSchema, + ErrorResponse$zodSchema, +]); diff --git a/src/models/refreshtokenresponse.ts b/src/models/refreshtokenresponse.ts new file mode 100644 index 00000000..b4ceba65 --- /dev/null +++ b/src/models/refreshtokenresponse.ts @@ -0,0 +1,23 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + RefreshTokenUser, + RefreshTokenUser$zodSchema, +} from "./refreshtokenuser.js"; + +/** + * Response with new access token + */ +export type RefreshTokenResponse = { + user: RefreshTokenUser; + accessToken: string; +}; + +export const RefreshTokenResponse$zodSchema: z.ZodType = z + .object({ + accessToken: z.string(), + user: RefreshTokenUser$zodSchema, + }).describe("Response with new access token"); diff --git a/src/models/refreshtokenuser.ts b/src/models/refreshtokenuser.ts new file mode 100644 index 00000000..80138a10 --- /dev/null +++ b/src/models/refreshtokenuser.ts @@ -0,0 +1,42 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * User record returned with a refreshed access token + */ +export type RefreshTokenUser = { + _id: string; + orgId: string; + email: string; + fullName: string; + firstName?: string | undefined; + lastName?: string | undefined; + designation?: string | undefined; + hasLoggedIn: boolean; + isDeleted: boolean; + slug: string; + createdAt: string; + updatedAt: string; + _v: number; +}; + +export const RefreshTokenUser$zodSchema: z.ZodType = z.object( + { + _id: z.string(), + _v: z.int(), + createdAt: z.string(), + designation: z.string().optional(), + email: z.string(), + firstName: z.string().optional(), + fullName: z.string(), + hasLoggedIn: z.boolean(), + isDeleted: z.boolean(), + lastName: z.string().optional(), + orgId: z.string(), + slug: z.string(), + updatedAt: z.string(), + }, +).describe("User record returned with a refreshed access token"); diff --git a/src/models/regenerateoauthappsecretop.ts b/src/models/regenerateoauthappsecretop.ts new file mode 100644 index 00000000..83e21b78 --- /dev/null +++ b/src/models/regenerateoauthappsecretop.ts @@ -0,0 +1,38 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + ApplicationJsonErrorResponse, + ApplicationJsonErrorResponse$zodSchema, +} from "./applicationjsonerrorresponse.js"; +import { + OAuthClientManagementRateLimitError, + OAuthClientManagementRateLimitError$zodSchema, +} from "./oauthclientmanagementratelimiterror.js"; +import { + RegenerateOAuthAppSecretResponse, + RegenerateOAuthAppSecretResponse$zodSchema, +} from "./regenerateoauthappsecretresponse.js"; + +export type RegenerateOAuthAppSecretRequest = { appId: string }; + +export const RegenerateOAuthAppSecretRequest$zodSchema: z.ZodType< + RegenerateOAuthAppSecretRequest +> = z.object({ + appId: z.string().describe("OAuth app ID"), +}); + +export type RegenerateOAuthAppSecretResponseResponse = + | RegenerateOAuthAppSecretResponse + | ApplicationJsonErrorResponse + | OAuthClientManagementRateLimitError; + +export const RegenerateOAuthAppSecretResponseResponse$zodSchema: z.ZodType< + RegenerateOAuthAppSecretResponseResponse +> = z.union([ + RegenerateOAuthAppSecretResponse$zodSchema, + ApplicationJsonErrorResponse$zodSchema, + OAuthClientManagementRateLimitError$zodSchema, +]); diff --git a/src/models/regenerateoauthappsecretresponse.ts b/src/models/regenerateoauthappsecretresponse.ts new file mode 100644 index 00000000..6c0af455 --- /dev/null +++ b/src/models/regenerateoauthappsecretresponse.ts @@ -0,0 +1,26 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Response body for `POST /oauth-clients/{appId}/regenerate-secret` (`regenerateSecret`). + * + * @remarks + */ +export type RegenerateOAuthAppSecretResponse = { + message: string; + clientId: string; + clientSecret: string; +}; + +export const RegenerateOAuthAppSecretResponse$zodSchema: z.ZodType< + RegenerateOAuthAppSecretResponse +> = z.object({ + clientId: z.string(), + clientSecret: z.string(), + message: z.string(), +}).describe( + "Response body for `POST /oauth-clients/{appId}/regenerate-secret` (`regenerateSecret`).\n", +); diff --git a/src/models/requestmeta.ts b/src/models/requestmeta.ts new file mode 100644 index 00000000..af5a4dd3 --- /dev/null +++ b/src/models/requestmeta.ts @@ -0,0 +1,20 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Basic request metadata returned by the API. + */ +export type RequestMeta = { + requestId?: string | undefined; + timestamp: string; + duration: number; +}; + +export const RequestMeta$zodSchema: z.ZodType = z.object({ + duration: z.int(), + requestId: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }), +}).describe("Basic request metadata returned by the API."); diff --git a/src/models/resetpasswordop.ts b/src/models/resetpasswordop.ts new file mode 100644 index 00000000..af8b2893 --- /dev/null +++ b/src/models/resetpasswordop.ts @@ -0,0 +1,36 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AuthenticatedPasswordResetResponse, + AuthenticatedPasswordResetResponse$zodSchema, +} from "./authenticatedpasswordresetresponse.js"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; + +/** + * Request payload + */ +export type ResetPasswordRequest = { + currentPassword: string; + newPassword: string; + cfTurnstileResponse?: string | undefined; +}; + +export const ResetPasswordRequest$zodSchema: z.ZodType = z + .object({ + cfTurnstileResponse: z.string().optional(), + currentPassword: z.string(), + newPassword: z.string(), + }).describe("Request payload"); + +export type ResetPasswordResponse = + | AuthenticatedPasswordResetResponse + | ErrorResponse; + +export const ResetPasswordResponse$zodSchema: z.ZodType = + z.union([ + AuthenticatedPasswordResetResponse$zodSchema, + ErrorResponse$zodSchema, + ]); diff --git a/src/models/revokealloauthapptokensop.ts b/src/models/revokealloauthapptokensop.ts new file mode 100644 index 00000000..8158b3a1 --- /dev/null +++ b/src/models/revokealloauthapptokensop.ts @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + ApplicationJsonErrorResponse, + ApplicationJsonErrorResponse$zodSchema, +} from "./applicationjsonerrorresponse.js"; +import { + OAuthClientManagementRateLimitError, + OAuthClientManagementRateLimitError$zodSchema, +} from "./oauthclientmanagementratelimiterror.js"; + +export type RevokeAllOAuthAppTokensRequest = { appId: string }; + +export const RevokeAllOAuthAppTokensRequest$zodSchema: z.ZodType< + RevokeAllOAuthAppTokensRequest +> = z.object({ + appId: z.string().describe("OAuth app ID"), +}); + +/** + * All tokens revoked + */ +export type RevokeAllOAuthAppTokensResponseBody = { + message?: string | undefined; + count?: number | undefined; +}; + +export const RevokeAllOAuthAppTokensResponseBody$zodSchema: z.ZodType< + RevokeAllOAuthAppTokensResponseBody +> = z.object({ + count: z.int().optional(), + message: z.string().optional(), +}).describe("All tokens revoked"); + +export type RevokeAllOAuthAppTokensResponse = + | ApplicationJsonErrorResponse + | OAuthClientManagementRateLimitError + | RevokeAllOAuthAppTokensResponseBody; + +export const RevokeAllOAuthAppTokensResponse$zodSchema: z.ZodType< + RevokeAllOAuthAppTokensResponse +> = z.union([ + ApplicationJsonErrorResponse$zodSchema, + OAuthClientManagementRateLimitError$zodSchema, + z.lazy(() => RevokeAllOAuthAppTokensResponseBody$zodSchema), +]); diff --git a/src/models/schemeoauth2.ts b/src/models/schemeoauth2.ts index d2935cbf..7511fbdb 100644 --- a/src/models/schemeoauth2.ts +++ b/src/models/schemeoauth2.ts @@ -10,6 +10,7 @@ import * as z from "zod"; * @remarks * Supports authorization_code (with PKCE) and client_credentials flows. * OAuth tokens are Bearer JWTs — use the same Authorization header as regular tokens. + * For **client_credentials**, machine JWTs may use `userId === client_id`; the Node gateway resolves the OAuth app creator and forwards **`x-oauth-user-id`** to Python where applicable — see **OAuth Provider** tag. */ export type SchemeOauth2 = { clientID: string; @@ -19,14 +20,14 @@ export type SchemeOauth2 = { export const SchemeOauth2$zodSchema: z.ZodType = z.object({ clientID: z.string().describe( - "OAuth 2.0 authentication with fine-grained scopes.\nSupports authorization_code (with PKCE) and client_credentials flows.\nOAuth tokens are Bearer JWTs — use the same Authorization header as regular tokens.\n client identifier", + "OAuth 2.0 authentication with fine-grained scopes.\nSupports authorization_code (with PKCE) and client_credentials flows.\nOAuth tokens are Bearer JWTs — use the same Authorization header as regular tokens.\nFor **client_credentials**, machine JWTs may use `userId === client_id`; the Node gateway resolves the OAuth app creator and forwards **`x-oauth-user-id`** to Python where applicable — see **OAuth Provider** tag.\n client identifier", ), clientSecret: z.string().describe( - "OAuth 2.0 authentication with fine-grained scopes.\nSupports authorization_code (with PKCE) and client_credentials flows.\nOAuth tokens are Bearer JWTs — use the same Authorization header as regular tokens.\n client secret", + "OAuth 2.0 authentication with fine-grained scopes.\nSupports authorization_code (with PKCE) and client_credentials flows.\nOAuth tokens are Bearer JWTs — use the same Authorization header as regular tokens.\nFor **client_credentials**, machine JWTs may use `userId === client_id`; the Node gateway resolves the OAuth app creator and forwards **`x-oauth-user-id`** to Python where applicable — see **OAuth Provider** tag.\n client secret", ), tokenURL: z.string().default("/api/v1/oauth2/token").describe( - "OAuth 2.0 authentication with fine-grained scopes.\nSupports authorization_code (with PKCE) and client_credentials flows.\nOAuth tokens are Bearer JWTs — use the same Authorization header as regular tokens.\n token URL", + "OAuth 2.0 authentication with fine-grained scopes.\nSupports authorization_code (with PKCE) and client_credentials flows.\nOAuth tokens are Bearer JWTs — use the same Authorization header as regular tokens.\nFor **client_credentials**, machine JWTs may use `userId === client_id`; the Node gateway resolves the OAuth app creator and forwards **`x-oauth-user-id`** to Python where applicable — see **OAuth Provider** tag.\n token URL", ), }).describe( - "OAuth 2.0 authentication with fine-grained scopes.\nSupports authorization_code (with PKCE) and client_credentials flows.\nOAuth tokens are Bearer JWTs — use the same Authorization header as regular tokens.\n", + "OAuth 2.0 authentication with fine-grained scopes.\nSupports authorization_code (with PKCE) and client_credentials flows.\nOAuth tokens are Bearer JWTs — use the same Authorization header as regular tokens.\nFor **client_credentials**, machine JWTs may use `userId === client_id`; the Node gateway resolves the OAuth app creator and forwards **`x-oauth-user-id`** to Python where applicable — see **OAuth Provider** tag.\n", ); diff --git a/src/models/searcharchivedconversationsop.ts b/src/models/searcharchivedconversationsop.ts new file mode 100644 index 00000000..449642e5 --- /dev/null +++ b/src/models/searcharchivedconversationsop.ts @@ -0,0 +1,283 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +export type SearchArchivedConversationsRequest = { + search: string; + page?: number | undefined; + limit?: number | undefined; +}; + +export const SearchArchivedConversationsRequest$zodSchema: z.ZodType< + SearchArchivedConversationsRequest +> = z.object({ + limit: z.int().default(20).describe("Items per page"), + page: z.int().default(1).describe("Page number (1-indexed)"), + search: z.string().describe( + "Search term to match against conversation titles and message content (max 1000 chars)", + ), +}); + +export const SearchArchivedConversationsStatus = { + None: "None", + Inprogress: "Inprogress", + Complete: "Complete", + Failed: "Failed", +} as const; +export type SearchArchivedConversationsStatus = ClosedEnum< + typeof SearchArchivedConversationsStatus +>; + +export const SearchArchivedConversationsStatus$zodSchema = z.enum([ + "None", + "Inprogress", + "Complete", + "Failed", +]); + +export type SearchArchivedConversationsModelInfo = { + modelKey?: string | undefined; + modelName?: string | undefined; + modelFriendlyName?: string | undefined; + modelProvider?: string | undefined; + chatMode?: string | undefined; +}; + +export const SearchArchivedConversationsModelInfo$zodSchema: z.ZodType< + SearchArchivedConversationsModelInfo +> = z.object({ + chatMode: z.string().optional(), + modelFriendlyName: z.string().optional(), + modelKey: z.string().optional(), + modelName: z.string().optional(), + modelProvider: z.string().optional(), +}); + +export const SearchArchivedConversationsSharedWithAccessLevel = { + Read: "read", + Write: "write", +} as const; +export type SearchArchivedConversationsSharedWithAccessLevel = ClosedEnum< + typeof SearchArchivedConversationsSharedWithAccessLevel +>; + +export const SearchArchivedConversationsSharedWithAccessLevel$zodSchema = z + .enum([ + "read", + "write", + ]); + +export type SearchArchivedConversationsSharedWith = { + userId?: string | undefined; + accessLevel?: SearchArchivedConversationsSharedWithAccessLevel | undefined; +}; + +export const SearchArchivedConversationsSharedWith$zodSchema: z.ZodType< + SearchArchivedConversationsSharedWith +> = z.object({ + accessLevel: SearchArchivedConversationsSharedWithAccessLevel$zodSchema + .optional(), + userId: z.string().optional(), +}); + +export type SearchArchivedConversationsConversationError = { + message?: string | undefined; + errorType?: string | undefined; + timestamp?: string | undefined; + messageId?: string | undefined; + stack?: string | undefined; + metadata?: { [k: string]: any } | undefined; +}; + +export const SearchArchivedConversationsConversationError$zodSchema: z.ZodType< + SearchArchivedConversationsConversationError +> = z.object({ + errorType: z.string().optional(), + message: z.string().optional(), + messageId: z.string().optional(), + metadata: z.record(z.string(), z.any()).optional(), + stack: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }).optional(), +}); + +export const SearchArchivedConversationsAccessLevel = { + Read: "read", + Write: "write", +} as const; +export type SearchArchivedConversationsAccessLevel = ClosedEnum< + typeof SearchArchivedConversationsAccessLevel +>; + +export const SearchArchivedConversationsAccessLevel$zodSchema = z.enum([ + "read", + "write", +]); + +/** + * Origin collection of the conversation + */ +export const SearchArchivedConversationsSource = { + Assistant: "assistant", + Agent: "agent", +} as const; +/** + * Origin collection of the conversation + */ +export type SearchArchivedConversationsSource = ClosedEnum< + typeof SearchArchivedConversationsSource +>; + +export const SearchArchivedConversationsSource$zodSchema = z.enum([ + "assistant", + "agent", +]).describe("Origin collection of the conversation"); + +/** + * Conversation summary returned by list endpoints. Identical to + * + * @remarks + * `Conversation` but omits `messages` to keep list payloads small. + * Fetch a single conversation to retrieve its messages. + */ +export type SearchArchivedConversationsConversation = { + _id?: string | undefined; + userId?: string | undefined; + orgId?: string | undefined; + title?: string | undefined; + initiator?: string | undefined; + status?: SearchArchivedConversationsStatus | undefined; + failReason?: string | undefined; + modelInfo?: SearchArchivedConversationsModelInfo | undefined; + isShared?: boolean | undefined; + shareLink?: string | undefined; + sharedWith?: Array | undefined; + isArchived?: boolean | undefined; + archivedBy?: string | null | undefined; + isDeleted?: boolean | undefined; + deletedBy?: string | undefined; + conversationErrors?: + | Array + | undefined; + metadata?: { [k: string]: any } | undefined; + lastActivityAt?: number | undefined; + createdAt?: string | undefined; + updatedAt?: string | undefined; + isOwner?: boolean | undefined; + accessLevel?: SearchArchivedConversationsAccessLevel | undefined; + source?: SearchArchivedConversationsSource | undefined; + agentKey?: string | undefined; + archivedAt?: string | undefined; +}; + +export const SearchArchivedConversationsConversation$zodSchema: z.ZodType< + SearchArchivedConversationsConversation +> = z.object({ + _id: z.string().optional(), + accessLevel: SearchArchivedConversationsAccessLevel$zodSchema.optional(), + agentKey: z.string().optional(), + archivedAt: z.iso.datetime({ offset: true }).optional(), + archivedBy: z.string().nullable().optional(), + conversationErrors: z.array( + z.lazy(() => SearchArchivedConversationsConversationError$zodSchema), + ).optional(), + createdAt: z.iso.datetime({ offset: true }).optional(), + deletedBy: z.string().optional(), + failReason: z.string().optional(), + initiator: z.string().optional(), + isArchived: z.boolean().optional(), + isDeleted: z.boolean().optional(), + isOwner: z.boolean().optional(), + isShared: z.boolean().optional(), + lastActivityAt: z.int().optional(), + metadata: z.record(z.string(), z.any()).optional(), + modelInfo: z.lazy(() => SearchArchivedConversationsModelInfo$zodSchema) + .optional(), + orgId: z.string().optional(), + shareLink: z.string().optional(), + sharedWith: z.array( + z.lazy(() => SearchArchivedConversationsSharedWith$zodSchema), + ).optional(), + source: SearchArchivedConversationsSource$zodSchema.optional(), + status: SearchArchivedConversationsStatus$zodSchema.optional(), + title: z.string().optional(), + updatedAt: z.iso.datetime({ offset: true }).optional(), + userId: z.string().optional(), +}).describe( + "Conversation summary returned by list endpoints. Identical to\n`Conversation` but omits `messages` to keep list payloads small.\nFetch a single conversation to retrieve its messages.\n", +); + +export type SearchArchivedConversationsPagination = { + page?: number | undefined; + limit?: number | undefined; + totalCount?: number | undefined; + totalPages?: number | undefined; + hasNextPage?: boolean | undefined; + hasPrevPage?: boolean | undefined; +}; + +export const SearchArchivedConversationsPagination$zodSchema: z.ZodType< + SearchArchivedConversationsPagination +> = z.object({ + hasNextPage: z.boolean().optional(), + hasPrevPage: z.boolean().optional(), + limit: z.int().optional(), + page: z.int().optional(), + totalCount: z.int().optional(), + totalPages: z.int().optional(), +}); + +export type SearchArchivedConversationsSummary = { + totalMatches?: number | undefined; + assistantMatches?: number | undefined; + agentMatches?: number | undefined; + searchQuery?: string | undefined; +}; + +export const SearchArchivedConversationsSummary$zodSchema: z.ZodType< + SearchArchivedConversationsSummary +> = z.object({ + agentMatches: z.int().optional(), + assistantMatches: z.int().optional(), + searchQuery: z.string().optional(), + totalMatches: z.int().optional(), +}); + +export type SearchArchivedConversationsMeta = { + requestId?: string | undefined; + timestamp?: string | undefined; + duration?: number | undefined; +}; + +export const SearchArchivedConversationsMeta$zodSchema: z.ZodType< + SearchArchivedConversationsMeta +> = z.object({ + duration: z.int().optional(), + requestId: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }).optional(), +}); + +/** + * Search results across archived conversations + */ +export type SearchArchivedConversationsResponse = { + conversations?: Array | undefined; + pagination?: SearchArchivedConversationsPagination | undefined; + summary?: SearchArchivedConversationsSummary | undefined; + meta?: SearchArchivedConversationsMeta | undefined; +}; + +export const SearchArchivedConversationsResponse$zodSchema: z.ZodType< + SearchArchivedConversationsResponse +> = z.object({ + conversations: z.array( + z.lazy(() => SearchArchivedConversationsConversation$zodSchema), + ).optional(), + meta: z.lazy(() => SearchArchivedConversationsMeta$zodSchema).optional(), + pagination: z.lazy(() => SearchArchivedConversationsPagination$zodSchema) + .optional(), + summary: z.lazy(() => SearchArchivedConversationsSummary$zodSchema) + .optional(), +}).describe("Search results across archived conversations"); diff --git a/src/models/searchhistoryop.ts b/src/models/searchhistoryop.ts new file mode 100644 index 00000000..88e06853 --- /dev/null +++ b/src/models/searchhistoryop.ts @@ -0,0 +1,239 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + SemanticSearchHistoryResponse, + SemanticSearchHistoryResponse$zodSchema, +} from "./semanticsearchhistoryresponse.js"; + +/** + * Field used to sort results. Any value other than `createdAt`, + * + * @remarks + * `lastActivityAt`, or `title` is treated as `lastActivityAt`. + */ +export const SearchHistorySortBy = { + CreatedAt: "createdAt", + LastActivityAt: "lastActivityAt", + Title: "title", +} as const; +/** + * Field used to sort results. Any value other than `createdAt`, + * + * @remarks + * `lastActivityAt`, or `title` is treated as `lastActivityAt`. + */ +export type SearchHistorySortBy = ClosedEnum; + +export const SearchHistorySortBy$zodSchema = z.enum([ + "createdAt", + "lastActivityAt", + "title", +]).describe( + "Field used to sort results. Any value other than `createdAt`,\n`lastActivityAt`, or `title` is treated as `lastActivityAt`.\n", +); + +/** + * Sort direction applied to `sortBy`. + */ +export const SearchHistorySortOrder = { + Asc: "asc", + Desc: "desc", +} as const; +/** + * Sort direction applied to `sortBy`. + */ +export type SearchHistorySortOrder = ClosedEnum; + +export const SearchHistorySortOrder$zodSchema = z.enum([ + "asc", + "desc", +]).describe("Sort direction applied to `sortBy`."); + +/** + * Filter results by their shared status. Accepted values are + * + * @remarks + * `'true'` / `'1'` (return only shared searches) and + * `'false'` / `'0'` (exclude shared searches). Matching is + * case-insensitive and surrounding whitespace is trimmed. + */ +export const SearchHistoryShared = { + True: "true", + False: "false", + One: "1", + Zero: "0", +} as const; +/** + * Filter results by their shared status. Accepted values are + * + * @remarks + * `'true'` / `'1'` (return only shared searches) and + * `'false'` / `'0'` (exclude shared searches). Matching is + * case-insensitive and surrounding whitespace is trimmed. + */ +export type SearchHistoryShared = ClosedEnum; + +export const SearchHistoryShared$zodSchema = z.enum([ + "true", + "false", + "1", + "0", +]).describe( + "Filter results by their shared status. Accepted values are\n`'true'` / `'1'` (return only shared searches) and\n`'false'` / `'0'` (exclude shared searches). Matching is\ncase-insensitive and surrounding whitespace is trimmed.\n", +); + +export type SearchHistoryRequest = { + page?: number | undefined; + limit?: number | undefined; + sortBy?: SearchHistorySortBy | undefined; + sortOrder?: SearchHistorySortOrder | undefined; + search?: string | undefined; + shared?: SearchHistoryShared | undefined; + startDate?: string | undefined; + endDate?: string | undefined; +}; + +export const SearchHistoryRequest$zodSchema: z.ZodType = z + .object({ + endDate: z.iso.datetime({ offset: true }).describe( + "ISO 8601 timestamp used as the upper bound for a search's creation date.", + ).optional(), + limit: z.int().default(20).describe( + "Number of items per page. Values are clamped to the range `[1, 100]`.", + ), + page: z.int().default(1).describe( + "Page number to return. Must be within `[1, 1000]`.", + ), + search: z.string().describe( + "Case-insensitive substring to match against a search's title and\nmessage content. Regex metacharacters are escaped automatically.\nValues longer than 1000 characters are rejected with `400`.\n", + ).optional(), + shared: SearchHistoryShared$zodSchema.optional(), + sortBy: SearchHistorySortBy$zodSchema.default("lastActivityAt"), + sortOrder: SearchHistorySortOrder$zodSchema.default("desc"), + startDate: z.iso.datetime({ offset: true }).describe( + "ISO 8601 timestamp used as the lower bound for a search's creation date.", + ).optional(), + }); + +/** + * Error payload. + */ +export type SearchHistoryInternalServerErrorError = { + code: string; + message: string; +}; + +export const SearchHistoryInternalServerErrorError$zodSchema: z.ZodType< + SearchHistoryInternalServerErrorError +> = z.object({ + code: z.string(), + message: z.string(), +}).describe("Error payload."); + +/** + * Error envelope for a failed request. + */ +export type SearchHistoryInternalServerErrorResponseBody = { + error: SearchHistoryInternalServerErrorError; +}; + +export const SearchHistoryInternalServerErrorResponseBody$zodSchema: z.ZodType< + SearchHistoryInternalServerErrorResponseBody +> = z.object({ + error: z.lazy(() => SearchHistoryInternalServerErrorError$zodSchema), +}).describe("Error envelope for a failed request."); + +/** + * Error payload. + */ +export type SearchHistoryForbiddenError = { code: string; message: string }; + +export const SearchHistoryForbiddenError$zodSchema: z.ZodType< + SearchHistoryForbiddenError +> = z.object({ + code: z.string(), + message: z.string(), +}).describe("Error payload."); + +/** + * Error envelope for a failed request. + */ +export type SearchHistoryForbiddenResponseBody = { + error: SearchHistoryForbiddenError; +}; + +export const SearchHistoryForbiddenResponseBody$zodSchema: z.ZodType< + SearchHistoryForbiddenResponseBody +> = z.object({ + error: z.lazy(() => SearchHistoryForbiddenError$zodSchema), +}).describe("Error envelope for a failed request."); + +/** + * Error payload. + */ +export type SearchHistoryUnauthorizedError = { code: string; message: string }; + +export const SearchHistoryUnauthorizedError$zodSchema: z.ZodType< + SearchHistoryUnauthorizedError +> = z.object({ + code: z.string(), + message: z.string(), +}).describe("Error payload."); + +/** + * Error envelope for a failed request. + */ +export type SearchHistoryUnauthorizedResponseBody = { + error: SearchHistoryUnauthorizedError; +}; + +export const SearchHistoryUnauthorizedResponseBody$zodSchema: z.ZodType< + SearchHistoryUnauthorizedResponseBody +> = z.object({ + error: z.lazy(() => SearchHistoryUnauthorizedError$zodSchema), +}).describe("Error envelope for a failed request."); + +/** + * Error payload. + */ +export type SearchHistoryBadRequestError = { code: string; message: string }; + +export const SearchHistoryBadRequestError$zodSchema: z.ZodType< + SearchHistoryBadRequestError +> = z.object({ + code: z.string(), + message: z.string(), +}).describe("Error payload."); + +/** + * Error envelope for a failed request. + */ +export type SearchHistoryBadRequestResponseBody = { + error: SearchHistoryBadRequestError; +}; + +export const SearchHistoryBadRequestResponseBody$zodSchema: z.ZodType< + SearchHistoryBadRequestResponseBody +> = z.object({ + error: z.lazy(() => SearchHistoryBadRequestError$zodSchema), +}).describe("Error envelope for a failed request."); + +export type SearchHistoryResponse = + | SemanticSearchHistoryResponse + | SearchHistoryBadRequestResponseBody + | SearchHistoryUnauthorizedResponseBody + | SearchHistoryForbiddenResponseBody + | SearchHistoryInternalServerErrorResponseBody; + +export const SearchHistoryResponse$zodSchema: z.ZodType = + z.union([ + SemanticSearchHistoryResponse$zodSchema, + z.lazy(() => SearchHistoryBadRequestResponseBody$zodSchema), + z.lazy(() => SearchHistoryUnauthorizedResponseBody$zodSchema), + z.lazy(() => SearchHistoryForbiddenResponseBody$zodSchema), + z.lazy(() => SearchHistoryInternalServerErrorResponseBody$zodSchema), + ]); diff --git a/src/models/searchhit.ts b/src/models/searchhit.ts deleted file mode 100644 index 40c529a5..00000000 --- a/src/models/searchhit.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { - SearchHitMetadata, - SearchHitMetadata$zodSchema, -} from "./searchhitmetadata.js"; - -/** - * A single matching chunk from semantic search. The `metadata.recordId` - * - * @remarks - * field is the value to pass to `GET /knowledgeBase/stream/record/{recordId}` - * when downloading the source file. - */ -export type SearchHit = { - score: number; - citationType?: string | undefined; - content: string; - block_type?: string | undefined; - block_index?: number | undefined; - virtual_record_id?: string | undefined; - metadata: SearchHitMetadata; -}; - -export const SearchHit$zodSchema: z.ZodType = z.object({ - block_index: z.int().optional(), - block_type: z.string().optional(), - citationType: z.string().optional(), - content: z.string(), - metadata: SearchHitMetadata$zodSchema, - score: z.number(), - virtual_record_id: z.string().optional(), -}).describe( - "A single matching chunk from semantic search. The `metadata.recordId`\nfield is the value to pass to `GET /knowledgeBase/stream/record/{recordId}`\nwhen downloading the source file.\n", -); diff --git a/src/models/searchhitmetadata.ts b/src/models/searchhitmetadata.ts deleted file mode 100644 index 898e330e..00000000 --- a/src/models/searchhitmetadata.ts +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ClosedEnum } from "../types/enums.js"; - -export const SearchHitMetadataOrigin = { - Upload: "UPLOAD", - Connector: "CONNECTOR", -} as const; -export type SearchHitMetadataOrigin = ClosedEnum< - typeof SearchHitMetadataOrigin ->; - -export const SearchHitMetadataOrigin$zodSchema = z.enum([ - "UPLOAD", - "CONNECTOR", -]); - -export type SearchHitMetadataBoundingBox = { - x?: number | undefined; - y?: number | undefined; -}; - -export const SearchHitMetadataBoundingBox$zodSchema: z.ZodType< - SearchHitMetadataBoundingBox -> = z.object({ - x: z.number().optional(), - y: z.number().optional(), -}); - -/** - * Per-hit metadata. The fields you almost always need are `recordId`, - * - * @remarks - * `recordName`, `mimeType`, and `webUrl`. - */ -export type SearchHitMetadata = { - orgId: string; - recordId: string; - virtualRecordId?: string | undefined; - recordName: string; - recordType?: string | undefined; - recordVersion?: number | undefined; - origin: SearchHitMetadataOrigin; - connector?: string | undefined; - connectorId?: string | undefined; - kbId?: string | null | undefined; - mimeType?: string | undefined; - extension?: string | undefined; - webUrl?: string | undefined; - previewRenderable?: boolean | undefined; - hideWeburl?: boolean | undefined; - blockText?: string | undefined; - blockType?: string | undefined; - blockIndex?: number | undefined; - blockNum?: Array | undefined; - pageNum?: Array | undefined; - bounding_box?: Array | null | undefined; - isBlock?: boolean | undefined; - isBlockGroup?: boolean | undefined; - point_id?: string | undefined; -}; - -export const SearchHitMetadata$zodSchema: z.ZodType = z - .object({ - blockIndex: z.int().optional(), - blockNum: z.array(z.int().nullable()).optional(), - blockText: z.string().optional(), - blockType: z.string().optional(), - bounding_box: z.array(z.lazy(() => SearchHitMetadataBoundingBox$zodSchema)) - .nullable().optional(), - connector: z.string().optional(), - connectorId: z.string().optional(), - extension: z.string().optional(), - hideWeburl: z.boolean().optional(), - isBlock: z.boolean().optional(), - isBlockGroup: z.boolean().optional(), - kbId: z.string().nullable().optional(), - mimeType: z.string().optional(), - orgId: z.string(), - origin: SearchHitMetadataOrigin$zodSchema, - pageNum: z.array(z.int().nullable()).optional(), - point_id: z.string().optional(), - previewRenderable: z.boolean().optional(), - recordId: z.string(), - recordName: z.string(), - recordType: z.string().optional(), - recordVersion: z.int().optional(), - virtualRecordId: z.string().optional(), - webUrl: z.string().optional(), - }).describe( - "Per-hit metadata. The fields you almost always need are `recordId`,\n`recordName`, `mimeType`, and `webUrl`.\n", - ); diff --git a/src/models/searchrecordsummary.ts b/src/models/searchrecordsummary.ts deleted file mode 100644 index 2c611c31..00000000 --- a/src/models/searchrecordsummary.ts +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ClosedEnum } from "../types/enums.js"; - -export const SearchRecordSummaryOrigin = { - Upload: "UPLOAD", - Connector: "CONNECTOR", -} as const; -export type SearchRecordSummaryOrigin = ClosedEnum< - typeof SearchRecordSummaryOrigin ->; - -export const SearchRecordSummaryOrigin$zodSchema = z.enum([ - "UPLOAD", - "CONNECTOR", -]); - -export const IndexingStatus = { - NotStarted: "NOT_STARTED", - InProgress: "IN_PROGRESS", - Completed: "COMPLETED", - Failed: "FAILED", -} as const; -export type IndexingStatus = ClosedEnum; - -export const IndexingStatus$zodSchema = z.enum([ - "NOT_STARTED", - "IN_PROGRESS", - "COMPLETED", - "FAILED", -]); - -export const ExtractionStatus = { - NotStarted: "NOT_STARTED", - InProgress: "IN_PROGRESS", - Completed: "COMPLETED", - Failed: "FAILED", -} as const; -export type ExtractionStatus = ClosedEnum; - -export const ExtractionStatus$zodSchema = z.enum([ - "NOT_STARTED", - "IN_PROGRESS", - "COMPLETED", - "FAILED", -]); - -/** - * Record-level summary surfaced under `searchResponse.records[]` and - * - * @remarks - * `searchResponse.virtual_to_record_map`. Mirrors the row stored in the - * records collection — strip down to the few fields you need - * (`_key` / `recordName` / `mimeType` / `webUrl`). - */ -export type SearchRecordSummary = { - _key?: string | undefined; - _id?: string | undefined; - _rev?: string | undefined; - orgId?: string | undefined; - recordName?: string | undefined; - recordType?: string | undefined; - externalRecordId?: string | undefined; - externalRevisionId?: string | undefined; - externalGroupId?: string | undefined; - recordGroupId?: string | undefined; - version?: number | undefined; - origin?: SearchRecordSummaryOrigin | undefined; - connectorName?: string | undefined; - connectorId?: string | undefined; - mimeType?: string | undefined; - webUrl?: string | undefined; - sizeInBytes?: number | undefined; - md5Checksum?: string | undefined; - indexingStatus?: IndexingStatus | undefined; - extractionStatus?: ExtractionStatus | undefined; - isDeleted?: boolean | undefined; - isArchived?: boolean | undefined; - isShared?: boolean | undefined; - isInternal?: boolean | undefined; - previewRenderable?: boolean | undefined; - hideWeburl?: boolean | undefined; - isVLMOcrProcessed?: boolean | undefined; - isDirty?: boolean | undefined; - isDependentNode?: boolean | undefined; - virtualRecordId?: string | undefined; - createdAtTimestamp?: number | undefined; - updatedAtTimestamp?: number | undefined; - sourceCreatedAtTimestamp?: number | undefined; - sourceLastModifiedTimestamp?: number | undefined; - lastIndexTimestamp?: number | undefined; - lastExtractionTimestamp?: number | undefined; -}; - -export const SearchRecordSummary$zodSchema: z.ZodType = z - .object({ - _id: z.string().optional(), - _key: z.string().optional(), - _rev: z.string().optional(), - connectorId: z.string().optional(), - connectorName: z.string().optional(), - createdAtTimestamp: z.int().optional(), - externalGroupId: z.string().optional(), - externalRecordId: z.string().optional(), - externalRevisionId: z.string().optional(), - extractionStatus: ExtractionStatus$zodSchema.optional(), - hideWeburl: z.boolean().optional(), - indexingStatus: IndexingStatus$zodSchema.optional(), - isArchived: z.boolean().optional(), - isDeleted: z.boolean().optional(), - isDependentNode: z.boolean().optional(), - isDirty: z.boolean().optional(), - isInternal: z.boolean().optional(), - isShared: z.boolean().optional(), - isVLMOcrProcessed: z.boolean().optional(), - lastExtractionTimestamp: z.int().optional(), - lastIndexTimestamp: z.int().optional(), - md5Checksum: z.string().optional(), - mimeType: z.string().optional(), - orgId: z.string().optional(), - origin: SearchRecordSummaryOrigin$zodSchema.optional(), - previewRenderable: z.boolean().optional(), - recordGroupId: z.string().optional(), - recordName: z.string().optional(), - recordType: z.string().optional(), - sizeInBytes: z.int().optional(), - sourceCreatedAtTimestamp: z.int().optional(), - sourceLastModifiedTimestamp: z.int().optional(), - updatedAtTimestamp: z.int().optional(), - version: z.int().optional(), - virtualRecordId: z.string().optional(), - webUrl: z.string().optional(), - }).describe( - "Record-level summary surfaced under `searchResponse.records[]` and\n`searchResponse.virtual_to_record_map`. Mirrors the row stored in the\nrecords collection — strip down to the few fields you need\n(`_key` / `recordName` / `mimeType` / `webUrl`).\n", - ); diff --git a/src/models/searchresponsepayload.ts b/src/models/searchresponsepayload.ts deleted file mode 100644 index 40d3de655..00000000 --- a/src/models/searchresponsepayload.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { SearchHit, SearchHit$zodSchema } from "./searchhit.js"; -import { - SearchRecordSummary, - SearchRecordSummary$zodSchema, -} from "./searchrecordsummary.js"; - -/** - * The actual results body produced by the upstream search service. - */ -export type SearchResponsePayload = { - searchResults: Array; - records: Array; - virtual_to_record_map?: { [k: string]: SearchRecordSummary } | undefined; - status: string; - status_code: number; - message?: string | undefined; -}; - -export const SearchResponsePayload$zodSchema: z.ZodType = - z.object({ - message: z.string().optional(), - records: z.array(SearchRecordSummary$zodSchema), - searchResults: z.array(SearchHit$zodSchema), - status: z.string(), - status_code: z.int(), - virtual_to_record_map: z.record(z.string(), SearchRecordSummary$zodSchema) - .optional(), - }).describe( - "The actual results body produced by the upstream search service.", - ); diff --git a/src/models/searchresult.ts b/src/models/searchresult.ts deleted file mode 100644 index 4c20301c..00000000 --- a/src/models/searchresult.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { - SearchResponsePayload, - SearchResponsePayload$zodSchema, -} from "./searchresponsepayload.js"; - -/** - * Top-level response from `POST /search`. The search is also persisted - * - * @remarks - * and can later be fetched by `searchId`. - */ -export type SearchResult = { - searchId: string; - searchResponse: SearchResponsePayload; -}; - -export const SearchResult$zodSchema: z.ZodType = z.object({ - searchId: z.string(), - searchResponse: SearchResponsePayload$zodSchema, -}).describe( - "Top-level response from `POST /search`. The search is also persisted\nand can later be fetched by `searchId`.\n", -); diff --git a/src/models/semanticsearchairesponse.ts b/src/models/semanticsearchairesponse.ts new file mode 100644 index 00000000..74f41b01 --- /dev/null +++ b/src/models/semanticsearchairesponse.ts @@ -0,0 +1,53 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + SemanticSearchAppliedFilters, + SemanticSearchAppliedFilters$zodSchema, +} from "./semanticsearchappliedfilters.js"; +import { + SemanticSearchGraphRecord, + SemanticSearchGraphRecord$zodSchema, +} from "./semanticsearchgraphrecord.js"; +import { + SemanticSearchHit, + SemanticSearchHit$zodSchema, +} from "./semanticsearchhit.js"; + +/** + * Payload returned by the AI retrieval service for a semantic search (embedded in `searchResponse`). + * + * @remarks + * Optional `virtual_to_record_map` maps each virtual record id (string key) to one resolved graph record document. + * Empty responses from the retrieval layer omit `virtual_to_record_map`; success payloads may include it alongside hits and records. + */ +export type SemanticSearchAiResponse = { + searchResults: Array; + records: Array; + status: string; + status_code: number; + message: string; + appliedFilters?: SemanticSearchAppliedFilters | undefined; + virtual_to_record_map?: + | { [k: string]: SemanticSearchGraphRecord } + | undefined; +}; + +export const SemanticSearchAiResponse$zodSchema: z.ZodType< + SemanticSearchAiResponse +> = z.object({ + appliedFilters: SemanticSearchAppliedFilters$zodSchema.optional(), + message: z.string(), + records: z.array(SemanticSearchGraphRecord$zodSchema), + searchResults: z.array(SemanticSearchHit$zodSchema), + status: z.string(), + status_code: z.int(), + virtual_to_record_map: z.record( + z.string(), + SemanticSearchGraphRecord$zodSchema, + ).optional(), +}).describe( + "Payload returned by the AI retrieval service for a semantic search (embedded in `searchResponse`).\nOptional `virtual_to_record_map` maps each virtual record id (string key) to one resolved graph record document.\nEmpty responses from the retrieval layer omit `virtual_to_record_map`; success payloads may include it alongside hits and records.\n", +); diff --git a/src/models/semanticsearchappliedfilters.ts b/src/models/semanticsearchappliedfilters.ts new file mode 100644 index 00000000..52bd2f79 --- /dev/null +++ b/src/models/semanticsearchappliedfilters.ts @@ -0,0 +1,20 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Present when KB filters were applied to the search request. + */ +export type SemanticSearchAppliedFilters = { + kb: Array; + kb_count: number; +}; + +export const SemanticSearchAppliedFilters$zodSchema: z.ZodType< + SemanticSearchAppliedFilters +> = z.object({ + kb: z.array(z.string()), + kb_count: z.int(), +}).describe("Present when KB filters were applied to the search request."); diff --git a/src/models/semanticsearchboundingbox.ts b/src/models/semanticsearchboundingbox.ts new file mode 100644 index 00000000..bc8f5efc --- /dev/null +++ b/src/models/semanticsearchboundingbox.ts @@ -0,0 +1,20 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Normalized bounding region for a chunk (when available). + */ +export type SemanticSearchBoundingBox = { + x?: number | undefined; + y?: number | undefined; +}; + +export const SemanticSearchBoundingBox$zodSchema: z.ZodType< + SemanticSearchBoundingBox +> = z.object({ + x: z.number().optional(), + y: z.number().optional(), +}).describe("Normalized bounding region for a chunk (when available)."); diff --git a/src/models/semanticsearchexecuteresponse.ts b/src/models/semanticsearchexecuteresponse.ts new file mode 100644 index 00000000..a5e558e7 --- /dev/null +++ b/src/models/semanticsearchexecuteresponse.ts @@ -0,0 +1,31 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + SemanticSearchAiResponse, + SemanticSearchAiResponse$zodSchema, +} from "./semanticsearchairesponse.js"; + +/** + * Immediate POST `/search` response: persisted search id plus the raw retrieval payload. + * + * @remarks + * SDK-oriented modeling: named fields only at this level; dynamic-key maps inside `searchResponse` use + * `additionalProperties` with a `$ref` (e.g. `virtual_to_record_map`) rather than boolean `additionalProperties: true`, + * so generated clients retain typed values where possible. + */ +export type SemanticSearchExecuteResponse = { + searchId: string; + searchResponse: SemanticSearchAiResponse; +}; + +export const SemanticSearchExecuteResponse$zodSchema: z.ZodType< + SemanticSearchExecuteResponse +> = z.object({ + searchId: z.string(), + searchResponse: SemanticSearchAiResponse$zodSchema, +}).describe( + "Immediate POST `/search` response: persisted search id plus the raw retrieval payload.\nSDK-oriented modeling: named fields only at this level; dynamic-key maps inside `searchResponse` use\n`additionalProperties` with a `$ref` (e.g. `virtual_to_record_map`) rather than boolean `additionalProperties: true`,\nso generated clients retain typed values where possible.\n", +); diff --git a/src/models/semanticsearchfilters.ts b/src/models/semanticsearchfilters.ts deleted file mode 100644 index af3c5bb0..00000000 --- a/src/models/semanticsearchfilters.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; - -/** - * Optional scope for `POST /search`. Each list narrows the search; an - * - * @remarks - * empty list (or omitting the field) means "no restriction on this - * dimension". The full default `{ "apps": [], "kb": [], "departments": - * [], "moduleIds": [], "appSpecificRecordTypes": [] }` searches across - * every record the caller is allowed to see. - */ -export type SemanticSearchFilters = { - apps?: Array | undefined; - kb?: Array | undefined; - departments?: Array | undefined; - moduleIds?: Array | undefined; - appSpecificRecordTypes?: Array | undefined; -}; - -export const SemanticSearchFilters$zodSchema: z.ZodType = - z.object({ - appSpecificRecordTypes: z.array(z.string()).optional(), - apps: z.array(z.string()).optional(), - departments: z.array(z.string()).optional(), - kb: z.array(z.string()).optional(), - moduleIds: z.array(z.string()).optional(), - }).describe( - "Optional scope for `POST /search`. Each list narrows the search; an\nempty list (or omitting the field) means \"no restriction on this\ndimension\". The full default `{ \"apps\": [], \"kb\": [], \"departments\":\n[], \"moduleIds\": [], \"appSpecificRecordTypes\": [] }` searches across\nevery record the caller is allowed to see.\n", - ); diff --git a/src/models/semanticsearchgraphrecord.ts b/src/models/semanticsearchgraphrecord.ts new file mode 100644 index 00000000..d4b3bcc6 --- /dev/null +++ b/src/models/semanticsearchgraphrecord.ts @@ -0,0 +1,117 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Graph record vertex returned in `records` and as values of `virtual_to_record_map`. + * + * @remarks + * All listed fields are optional in the schema so partial or evolving documents validate; typical Arango documents + * usually include `_key`, `_id`, `_rev`, `orgId`, `recordName`, `externalRecordId`, `recordType`, `origin`, + * `createdAtTimestamp`, and `connectorId`. Extend this schema when new stable fields appear on Record vertices. + */ +export type SemanticSearchGraphRecord = { + _key?: string | null | undefined; + _id?: string | null | undefined; + _rev?: string | null | undefined; + recordName?: string | null | undefined; + externalRecordId?: string | null | undefined; + recordType?: string | null | undefined; + origin?: string | null | undefined; + createdAtTimestamp?: number | null | undefined; + connectorId?: string | null | undefined; + orgId?: string | null | undefined; + updatedAtTimestamp?: number | null | undefined; + externalGroupId?: string | null | undefined; + externalParentId?: string | null | undefined; + externalRevisionId?: string | null | undefined; + externalRootGroupId?: string | null | undefined; + recordGroupId?: string | null | undefined; + version?: number | null | undefined; + connectorName?: string | null | undefined; + mimeType?: string | null | undefined; + webUrl?: string | null | undefined; + lastSyncTimestamp?: number | null | undefined; + sourceCreatedAtTimestamp?: number | null | undefined; + sourceLastModifiedTimestamp?: number | null | undefined; + isDeleted?: boolean | null | undefined; + isArchived?: boolean | null | undefined; + isVLMOcrProcessed?: boolean | null | undefined; + deletedByUserId?: string | null | undefined; + indexingStatus?: string | null | undefined; + extractionStatus?: string | null | undefined; + isLatestVersion?: boolean | null | undefined; + isDirty?: boolean | null | undefined; + reason?: string | null | undefined; + lastIndexTimestamp?: number | null | undefined; + lastExtractionTimestamp?: number | null | undefined; + summaryDocumentId?: string | null | undefined; + virtualRecordId?: string | null | undefined; + previewRenderable?: boolean | null | undefined; + isShared?: boolean | null | undefined; + isDependentNode?: boolean | null | undefined; + parentNodeId?: string | null | undefined; + hideWeburl?: boolean | null | undefined; + isInternal?: boolean | null | undefined; + md5Checksum?: string | null | undefined; + sizeInBytes?: number | null | undefined; + definition?: string | null | undefined; + sourceTables?: Array | null | undefined; + rowCount?: number | null | undefined; +}; + +export const SemanticSearchGraphRecord$zodSchema: z.ZodType< + SemanticSearchGraphRecord +> = z.object({ + _id: z.string().nullable().optional(), + _key: z.string().nullable().optional(), + _rev: z.string().nullable().optional(), + connectorId: z.string().nullable().optional(), + connectorName: z.string().nullable().optional(), + createdAtTimestamp: z.number().nullable().optional(), + definition: z.string().nullable().optional(), + deletedByUserId: z.string().nullable().optional(), + externalGroupId: z.string().nullable().optional(), + externalParentId: z.string().nullable().optional(), + externalRecordId: z.string().nullable().optional(), + externalRevisionId: z.string().nullable().optional(), + externalRootGroupId: z.string().nullable().optional(), + extractionStatus: z.string().nullable().optional(), + hideWeburl: z.boolean().nullable().optional(), + indexingStatus: z.string().nullable().optional(), + isArchived: z.boolean().nullable().optional(), + isDeleted: z.boolean().nullable().optional(), + isDependentNode: z.boolean().nullable().optional(), + isDirty: z.boolean().nullable().optional(), + isInternal: z.boolean().nullable().optional(), + isLatestVersion: z.boolean().nullable().optional(), + isShared: z.boolean().nullable().optional(), + isVLMOcrProcessed: z.boolean().nullable().optional(), + lastExtractionTimestamp: z.number().nullable().optional(), + lastIndexTimestamp: z.number().nullable().optional(), + lastSyncTimestamp: z.number().nullable().optional(), + md5Checksum: z.string().nullable().optional(), + mimeType: z.string().nullable().optional(), + orgId: z.string().nullable().optional(), + origin: z.string().nullable().optional(), + parentNodeId: z.string().nullable().optional(), + previewRenderable: z.boolean().nullable().optional(), + reason: z.string().nullable().optional(), + recordGroupId: z.string().nullable().optional(), + recordName: z.string().nullable().optional(), + recordType: z.string().nullable().optional(), + rowCount: z.number().nullable().optional(), + sizeInBytes: z.number().nullable().optional(), + sourceCreatedAtTimestamp: z.number().nullable().optional(), + sourceLastModifiedTimestamp: z.number().nullable().optional(), + sourceTables: z.array(z.string()).nullable().optional(), + summaryDocumentId: z.string().nullable().optional(), + updatedAtTimestamp: z.number().nullable().optional(), + version: z.number().nullable().optional(), + virtualRecordId: z.string().nullable().optional(), + webUrl: z.string().nullable().optional(), +}).describe( + "Graph record vertex returned in `records` and as values of `virtual_to_record_map`.\nAll listed fields are optional in the schema so partial or evolving documents validate; typical Arango documents\nusually include `_key`, `_id`, `_rev`, `orgId`, `recordName`, `externalRecordId`, `recordType`, `origin`,\n`createdAtTimestamp`, and `connectorId`. Extend this schema when new stable fields appear on Record vertices.\n", +); diff --git a/src/models/semanticsearchhistoryapplieddaterange.ts b/src/models/semanticsearchhistoryapplieddaterange.ts new file mode 100644 index 00000000..92d5aa58 --- /dev/null +++ b/src/models/semanticsearchhistoryapplieddaterange.ts @@ -0,0 +1,28 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Echoed back only when the caller passed `startDate` and/or `endDate`. + * + * @remarks + * Each bound is an ISO 8601 string when set; the field is absent when + * the corresponding query param was omitted (utils.ts:480-486 reads + * `appliedFilters.createdAt.$gte?.toISOString()` directly, so missing + * bounds become `undefined` and drop out of the JSON). + */ +export type SemanticSearchHistoryAppliedDateRange = { + start?: string | undefined; + end?: string | undefined; +}; + +export const SemanticSearchHistoryAppliedDateRange$zodSchema: z.ZodType< + SemanticSearchHistoryAppliedDateRange +> = z.object({ + end: z.iso.datetime({ offset: true }).optional(), + start: z.iso.datetime({ offset: true }).optional(), +}).describe( + "Echoed back only when the caller passed `startDate` and/or `endDate`.\nEach bound is an ISO 8601 string when set; the field is absent when\nthe corresponding query param was omitted (utils.ts:480-486 reads\n`appliedFilters.createdAt.$gte?.toISOString()` directly, so missing\nbounds become `undefined` and drop out of the JSON).\n", +); diff --git a/src/models/semanticsearchhistorydaterange.ts b/src/models/semanticsearchhistorydaterange.ts new file mode 100644 index 00000000..e01b2d5c --- /dev/null +++ b/src/models/semanticsearchhistorydaterange.ts @@ -0,0 +1,30 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export type Current = { start: string | null; end: string | null }; + +export const Current$zodSchema: z.ZodType = z.object({ + end: z.string().nullable(), + start: z.string().nullable(), +}); + +export type SemanticSearchHistoryDateRange = { + type: string; + description: string; + format: string; + current: Current; + applied: boolean; +}; + +export const SemanticSearchHistoryDateRange$zodSchema: z.ZodType< + SemanticSearchHistoryDateRange +> = z.object({ + applied: z.boolean(), + current: z.lazy(() => Current$zodSchema), + description: z.string(), + format: z.string(), + type: z.string(), +}); diff --git a/src/models/semanticsearchhistoryfilters.ts b/src/models/semanticsearchhistoryfilters.ts new file mode 100644 index 00000000..d25ceaf2 --- /dev/null +++ b/src/models/semanticsearchhistoryfilters.ts @@ -0,0 +1,25 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + SemanticSearchHistoryFiltersApplied, + SemanticSearchHistoryFiltersApplied$zodSchema, +} from "./semanticsearchhistoryfiltersapplied.js"; +import { + SemanticSearchHistoryFiltersAvailable, + SemanticSearchHistoryFiltersAvailable$zodSchema, +} from "./semanticsearchhistoryfiltersavailable.js"; + +export type SemanticSearchHistoryFilters = { + applied: SemanticSearchHistoryFiltersApplied; + available: SemanticSearchHistoryFiltersAvailable; +}; + +export const SemanticSearchHistoryFilters$zodSchema: z.ZodType< + SemanticSearchHistoryFilters +> = z.object({ + applied: SemanticSearchHistoryFiltersApplied$zodSchema, + available: SemanticSearchHistoryFiltersAvailable$zodSchema, +}); diff --git a/src/models/semanticsearchhistoryfiltersapplied.ts b/src/models/semanticsearchhistoryfiltersapplied.ts new file mode 100644 index 00000000..671d0279 --- /dev/null +++ b/src/models/semanticsearchhistoryfiltersapplied.ts @@ -0,0 +1,101 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + SemanticSearchHistoryAppliedDateRange, + SemanticSearchHistoryAppliedDateRange$zodSchema, +} from "./semanticsearchhistoryapplieddaterange.js"; + +export const Filter = { + Page: "page", + Limit: "limit", + Search: "search", + Shared: "shared", + Tags: "tags", + MinMessages: "minMessages", + SortBy: "sortBy", + SortOrder: "sortOrder", + StartDate: "startDate", + EndDate: "endDate", + MessageType: "messageType", + DateRange: "dateRange", +} as const; +export type Filter = ClosedEnum; + +export const Filter$zodSchema = z.enum([ + "page", + "limit", + "search", + "shared", + "tags", + "minMessages", + "sortBy", + "sortOrder", + "startDate", + "endDate", + "messageType", + "dateRange", +]); + +export type Values = { + page?: number | undefined; + limit?: number | undefined; + search?: string | undefined; + shared?: string | undefined; + tags?: string | undefined; + minMessages?: string | undefined; + sortBy?: string | undefined; + sortOrder?: string | undefined; + startDate?: string | undefined; + endDate?: string | undefined; + messageType?: string | undefined; + dateRange?: SemanticSearchHistoryAppliedDateRange | undefined; +}; + +export const Values$zodSchema: z.ZodType = z.object({ + dateRange: SemanticSearchHistoryAppliedDateRange$zodSchema.optional(), + endDate: z.string().optional(), + limit: z.int().optional(), + messageType: z.string().optional(), + minMessages: z.string().optional(), + page: z.int().optional(), + search: z.string().optional(), + shared: z.string().optional(), + sortBy: z.string().optional(), + sortOrder: z.string().optional(), + startDate: z.string().optional(), + tags: z.string().optional(), +}); + +/** + * Echo of which filters the caller actually supplied, built by + * + * @remarks + * `buildFiltersMetadata` (utils.ts:430-486). `page` and `limit` always + * appear because they are normalised to defaults before being recorded, + * so `filters` is never empty and `values` always contains at least + * `{ page, limit }`. Other keys appear only when the matching query + * param was non-empty (or, for `dateRange`, when `createdAt` was set + * on the Mongo filter). + * + * `values` keys are scalar strings rather than typed primitives + * (`'true'`/`'false'`, `'5'`, etc.) because they are passed through + * from `req.query` as Express parsed them — only `page` and `limit` + * are coerced to integers via `safeParsePagination`. + */ +export type SemanticSearchHistoryFiltersApplied = { + filters: Array; + values: Values; +}; + +export const SemanticSearchHistoryFiltersApplied$zodSchema: z.ZodType< + SemanticSearchHistoryFiltersApplied +> = z.object({ + filters: z.array(Filter$zodSchema), + values: z.lazy(() => Values$zodSchema), +}).describe( + "Echo of which filters the caller actually supplied, built by\n`buildFiltersMetadata` (utils.ts:430-486). `page` and `limit` always\nappear because they are normalised to defaults before being recorded,\nso `filters` is never empty and `values` always contains at least\n`{ page, limit }`. Other keys appear only when the matching query\nparam was non-empty (or, for `dateRange`, when `createdAt` was set\non the Mongo filter).\n\n`values` keys are scalar strings rather than typed primitives\n(`'true'`/`'false'`, `'5'`, etc.) because they are passed through\nfrom `req.query` as Express parsed them — only `page` and `limit`\nare coerced to integers via `safeParsePagination`.\n", +); diff --git a/src/models/semanticsearchhistoryfiltersavailable.ts b/src/models/semanticsearchhistoryfiltersavailable.ts new file mode 100644 index 00000000..d82ee078 --- /dev/null +++ b/src/models/semanticsearchhistoryfiltersavailable.ts @@ -0,0 +1,100 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + SemanticSearchHistoryDateRange, + SemanticSearchHistoryDateRange$zodSchema, +} from "./semanticsearchhistorydaterange.js"; +import { + SemanticSearchHistoryFilterToggle, + SemanticSearchHistoryFilterToggle$zodSchema, +} from "./semanticsearchhistoryfiltertoggle.js"; +import { + SemanticSearchHistoryPaginationField, + SemanticSearchHistoryPaginationField$zodSchema, +} from "./semanticsearchhistorypaginationfield.js"; +import { + SemanticSearchHistorySortField, + SemanticSearchHistorySortField$zodSchema, +} from "./semanticsearchhistorysortfield.js"; + +export type SemanticSearchHistoryFiltersAvailablePagination = { + page: SemanticSearchHistoryPaginationField; + limit: SemanticSearchHistoryPaginationField; +}; + +export const SemanticSearchHistoryFiltersAvailablePagination$zodSchema: + z.ZodType = z.object({ + limit: SemanticSearchHistoryPaginationField$zodSchema, + page: SemanticSearchHistoryPaginationField$zodSchema, + }); + +export type Sorting = { + sortBy: SemanticSearchHistorySortField; + sortOrder: SemanticSearchHistorySortField; +}; + +export const Sorting$zodSchema: z.ZodType = z.object({ + sortBy: SemanticSearchHistorySortField$zodSchema, + sortOrder: SemanticSearchHistorySortField$zodSchema, +}); + +export type DateFilters = { dateRange: SemanticSearchHistoryDateRange }; + +export const DateFilters$zodSchema: z.ZodType = z.object({ + dateRange: SemanticSearchHistoryDateRange$zodSchema, +}); + +export type MessageFilters = { messageType: SemanticSearchHistoryFilterToggle }; + +export const MessageFilters$zodSchema: z.ZodType = z.object({ + messageType: SemanticSearchHistoryFilterToggle$zodSchema, +}); + +export type SortingMessages = { + sortBy: SemanticSearchHistorySortField; + sortOrder: SemanticSearchHistorySortField; +}; + +export const SortingMessages$zodSchema: z.ZodType = z.object({ + sortBy: SemanticSearchHistorySortField$zodSchema, + sortOrder: SemanticSearchHistorySortField$zodSchema, +}); + +/** + * Catalogue of filters the endpoint supports, plus their current values + * + * @remarks + * and `applied` flags. Built by `buildFiltersMetadata` (utils.ts:430-624). + */ +export type SemanticSearchHistoryFiltersAvailable = { + shared: SemanticSearchHistoryFilterToggle; + tags: SemanticSearchHistoryFilterToggle; + minMessages: SemanticSearchHistoryFilterToggle; + search: SemanticSearchHistoryFilterToggle; + pagination: SemanticSearchHistoryFiltersAvailablePagination; + sorting: Sorting; + dateFilters: DateFilters; + messageFilters: MessageFilters; + sortingMessages: SortingMessages; +}; + +export const SemanticSearchHistoryFiltersAvailable$zodSchema: z.ZodType< + SemanticSearchHistoryFiltersAvailable +> = z.object({ + dateFilters: z.lazy(() => DateFilters$zodSchema), + messageFilters: z.lazy(() => MessageFilters$zodSchema), + minMessages: SemanticSearchHistoryFilterToggle$zodSchema, + pagination: z.lazy(() => + SemanticSearchHistoryFiltersAvailablePagination$zodSchema + ), + search: SemanticSearchHistoryFilterToggle$zodSchema, + shared: SemanticSearchHistoryFilterToggle$zodSchema, + sorting: z.lazy(() => Sorting$zodSchema), + sortingMessages: z.lazy(() => SortingMessages$zodSchema), + tags: SemanticSearchHistoryFilterToggle$zodSchema, +}).describe( + "Catalogue of filters the endpoint supports, plus their current values\nand `applied` flags. Built by `buildFiltersMetadata` (utils.ts:430-624).\n", +); diff --git a/src/models/semanticsearchhistoryfiltertoggle.ts b/src/models/semanticsearchhistoryfiltertoggle.ts new file mode 100644 index 00000000..150b3ddd --- /dev/null +++ b/src/models/semanticsearchhistoryfiltertoggle.ts @@ -0,0 +1,35 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Generic "filter X is available, current value is Y" block used for + * + * @remarks + * `shared`, `tags`, `minMessages`, `search`, and `messageType`. Either + * `type` (free-form value) or `values` (enum of allowed strings) is + * present, not both. `current` is the caller-supplied value passed + * through from `req.query`, hence string-or-null even when `type` is + * `'number'`. + */ +export type SemanticSearchHistoryFilterToggle = { + type?: string | undefined; + values?: Array | undefined; + description: string; + current: string | null; + applied: boolean; +}; + +export const SemanticSearchHistoryFilterToggle$zodSchema: z.ZodType< + SemanticSearchHistoryFilterToggle +> = z.object({ + applied: z.boolean(), + current: z.string().nullable(), + description: z.string(), + type: z.string().optional(), + values: z.array(z.string()).optional(), +}).describe( + "Generic \"filter X is available, current value is Y\" block used for\n`shared`, `tags`, `minMessages`, `search`, and `messageType`. Either\n`type` (free-form value) or `values` (enum of allowed strings) is\npresent, not both. `current` is the caller-supplied value passed\nthrough from `req.query`, hence string-or-null even when `type` is\n`'number'`.\n", +); diff --git a/src/models/semanticsearchhistoryitem.ts b/src/models/semanticsearchhistoryitem.ts new file mode 100644 index 00000000..6623a58e --- /dev/null +++ b/src/models/semanticsearchhistoryitem.ts @@ -0,0 +1,63 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + PersistedSemanticSearchSharedWithEntry, + PersistedSemanticSearchSharedWithEntry$zodSchema, +} from "./persistedsemanticsearchsharedwithentry.js"; + +/** + * One persisted search row as returned by `GET /search`. Mirrors the + * + * @remarks + * persisted search document except `citationIds` is an array of + * ObjectId strings (citations are not populated on the list endpoint, + * unlike `GET /search/{searchId}`). + * + * `shareLink` is absent from the JSON when the search has not been + * shared. `archivedBy` is `null` on rows that were previously archived + * and then unarchived, and absent on rows that have never been + * archived. The list endpoint already filters out currently-archived + * rows, so a string user-id value never appears here in practice. + */ +export type SemanticSearchHistoryItem = { + _id: string; + _v: number; + query: string; + limit: number; + orgId: string; + userId: string; + citationIds: Array; + records: { [k: string]: string }; + isShared: boolean; + shareLink?: string | undefined; + sharedWith: Array; + isArchived: boolean; + archivedBy?: string | null | undefined; + createdAt: string; + updatedAt: string; +}; + +export const SemanticSearchHistoryItem$zodSchema: z.ZodType< + SemanticSearchHistoryItem +> = z.object({ + _id: z.string(), + _v: z.int(), + archivedBy: z.string().nullable().optional(), + citationIds: z.array(z.string()), + createdAt: z.iso.datetime({ offset: true }), + isArchived: z.boolean(), + isShared: z.boolean(), + limit: z.int(), + orgId: z.string(), + query: z.string(), + records: z.record(z.string(), z.string()), + shareLink: z.string().optional(), + sharedWith: z.array(PersistedSemanticSearchSharedWithEntry$zodSchema), + updatedAt: z.iso.datetime({ offset: true }), + userId: z.string(), +}).describe( + "One persisted search row as returned by `GET /search`. Mirrors the\npersisted search document except `citationIds` is an array of\nObjectId strings (citations are not populated on the list endpoint,\nunlike `GET /search/{searchId}`).\n\n`shareLink` is absent from the JSON when the search has not been\nshared. `archivedBy` is `null` on rows that were previously archived\nand then unarchived, and absent on rows that have never been\narchived. The list endpoint already filters out currently-archived\nrows, so a string user-id value never appears here in practice.\n", +); diff --git a/src/models/semanticsearchhistorymeta.ts b/src/models/semanticsearchhistorymeta.ts new file mode 100644 index 00000000..21ede3b9 --- /dev/null +++ b/src/models/semanticsearchhistorymeta.ts @@ -0,0 +1,27 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * `requestId` comes from `req.context?.requestId` and is omitted from + * + * @remarks + * the JSON when upstream middleware did not set it. + */ +export type SemanticSearchHistoryMeta = { + requestId?: string | undefined; + timestamp: string; + duration: number; +}; + +export const SemanticSearchHistoryMeta$zodSchema: z.ZodType< + SemanticSearchHistoryMeta +> = z.object({ + duration: z.int(), + requestId: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }), +}).describe( + "`requestId` comes from `req.context?.requestId` and is omitted from\nthe JSON when upstream middleware did not set it.\n", +); diff --git a/src/models/semanticsearchhistorypagination.ts b/src/models/semanticsearchhistorypagination.ts new file mode 100644 index 00000000..8b6a0044 --- /dev/null +++ b/src/models/semanticsearchhistorypagination.ts @@ -0,0 +1,34 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Pagination block emitted by `buildPaginationMetadata` (utils.ts:417). + * + * @remarks + * `totalPages` is `Math.ceil(totalCount / limit)`, so an empty result + * has `totalPages: 0`, not `1`. + */ +export type SemanticSearchHistoryPagination = { + page: number; + limit: number; + totalCount: number; + totalPages: number; + hasNextPage: boolean; + hasPrevPage: boolean; +}; + +export const SemanticSearchHistoryPagination$zodSchema: z.ZodType< + SemanticSearchHistoryPagination +> = z.object({ + hasNextPage: z.boolean(), + hasPrevPage: z.boolean(), + limit: z.int(), + page: z.int(), + totalCount: z.int(), + totalPages: z.int(), +}).describe( + "Pagination block emitted by `buildPaginationMetadata` (utils.ts:417).\n`totalPages` is `Math.ceil(totalCount / limit)`, so an empty result\nhas `totalPages: 0`, not `1`.\n", +); diff --git a/src/models/semanticsearchhistorypaginationfield.ts b/src/models/semanticsearchhistorypaginationfield.ts new file mode 100644 index 00000000..1b360e44 --- /dev/null +++ b/src/models/semanticsearchhistorypaginationfield.ts @@ -0,0 +1,27 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export type SemanticSearchHistoryPaginationField = { + type: string; + current: number; + min: number; + max: number; + default: number; + description: string; + applied: boolean; +}; + +export const SemanticSearchHistoryPaginationField$zodSchema: z.ZodType< + SemanticSearchHistoryPaginationField +> = z.object({ + applied: z.boolean(), + current: z.int(), + default: z.int(), + description: z.string(), + max: z.int(), + min: z.int(), + type: z.string(), +}); diff --git a/src/models/semanticsearchhistoryresponse.ts b/src/models/semanticsearchhistoryresponse.ts new file mode 100644 index 00000000..fb013af1 --- /dev/null +++ b/src/models/semanticsearchhistoryresponse.ts @@ -0,0 +1,46 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + SemanticSearchHistoryFilters, + SemanticSearchHistoryFilters$zodSchema, +} from "./semanticsearchhistoryfilters.js"; +import { + SemanticSearchHistoryItem, + SemanticSearchHistoryItem$zodSchema, +} from "./semanticsearchhistoryitem.js"; +import { + SemanticSearchHistoryMeta, + SemanticSearchHistoryMeta$zodSchema, +} from "./semanticsearchhistorymeta.js"; +import { + SemanticSearchHistoryPagination, + SemanticSearchHistoryPagination$zodSchema, +} from "./semanticsearchhistorypagination.js"; + +/** + * Envelope returned by `GET /search`. The handler runs `find()` plus + * + * @remarks + * `countDocuments()` in parallel and assembles `{ searchHistory, + * pagination, filters, meta }` (es_controller.ts:3925-3973). + */ +export type SemanticSearchHistoryResponse = { + searchHistory: Array; + pagination: SemanticSearchHistoryPagination; + filters: SemanticSearchHistoryFilters; + meta: SemanticSearchHistoryMeta; +}; + +export const SemanticSearchHistoryResponse$zodSchema: z.ZodType< + SemanticSearchHistoryResponse +> = z.object({ + filters: SemanticSearchHistoryFilters$zodSchema, + meta: SemanticSearchHistoryMeta$zodSchema, + pagination: SemanticSearchHistoryPagination$zodSchema, + searchHistory: z.array(SemanticSearchHistoryItem$zodSchema), +}).describe( + "Envelope returned by `GET /search`. The handler runs `find()` plus\n`countDocuments()` in parallel and assembles `{ searchHistory,\npagination, filters, meta }` (es_controller.ts:3925-3973).\n", +); diff --git a/src/models/semanticsearchhistorysortfield.ts b/src/models/semanticsearchhistorysortfield.ts new file mode 100644 index 00000000..343b9362 --- /dev/null +++ b/src/models/semanticsearchhistorysortfield.ts @@ -0,0 +1,33 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Used for `available.sorting.{sortBy,sortOrder}` and + * + * @remarks + * `available.sortingMessages.{sortBy,sortOrder}`. The `applied` flag + * is present on `sorting.*` and absent on `sortingMessages.*`, so it + * is optional here. + */ +export type SemanticSearchHistorySortField = { + values: Array; + default: string; + description: string; + current: string; + applied?: boolean | undefined; +}; + +export const SemanticSearchHistorySortField$zodSchema: z.ZodType< + SemanticSearchHistorySortField +> = z.object({ + applied: z.boolean().optional(), + current: z.string(), + default: z.string(), + description: z.string(), + values: z.array(z.string()), +}).describe( + "Used for `available.sorting.{sortBy,sortOrder}` and\n`available.sortingMessages.{sortBy,sortOrder}`. The `applied` flag\nis present on `sorting.*` and absent on `sortingMessages.*`, so it\nis optional here.\n", +); diff --git a/src/models/semanticsearchhit.ts b/src/models/semanticsearchhit.ts new file mode 100644 index 00000000..29c43eed --- /dev/null +++ b/src/models/semanticsearchhit.ts @@ -0,0 +1,41 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + SemanticSearchHitMetadata, + SemanticSearchHitMetadata$zodSchema, +} from "./semanticsearchhitmetadata.js"; + +/** + * One search hit returned by the retrieval service. Most hits use string `content`; + * + * @remarks + * table or grouped blocks may serialize structured payloads as JSON arrays. + * Listed fields are the documented contract; extend this schema when new stable top-level keys are introduced. + */ +export type SemanticSearchHit = { + score?: number | null | undefined; + citationType?: string | null | undefined; + chunkIndex?: number | null | undefined; + metadata?: SemanticSearchHitMetadata | undefined; + content?: string | null | undefined; + virtual_record_id?: string | null | undefined; + block_type?: string | null | undefined; + block_index?: number | null | undefined; +}; + +export const SemanticSearchHit$zodSchema: z.ZodType = z + .object({ + block_index: z.int().nullable().optional(), + block_type: z.string().nullable().optional(), + chunkIndex: z.int().nullable().optional(), + citationType: z.string().nullable().optional(), + content: z.string().nullable().optional(), + metadata: SemanticSearchHitMetadata$zodSchema.optional(), + score: z.number().nullable().optional(), + virtual_record_id: z.string().nullable().optional(), + }).describe( + "One search hit returned by the retrieval service. Most hits use string `content`;\ntable or grouped blocks may serialize structured payloads as JSON arrays.\nListed fields are the documented contract; extend this schema when new stable top-level keys are introduced.\n", + ); diff --git a/src/models/semanticsearchhitmetadata.ts b/src/models/semanticsearchhitmetadata.ts new file mode 100644 index 00000000..5437d1ae --- /dev/null +++ b/src/models/semanticsearchhitmetadata.ts @@ -0,0 +1,133 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + SemanticSearchBoundingBox, + SemanticSearchBoundingBox$zodSchema, +} from "./semanticsearchboundingbox.js"; + +export type RecordVersion = string | number; + +export const RecordVersion$zodSchema: z.ZodType = z.union([ + z.string(), + z.number(), +]); + +/** + * Qdrant point identifier attached during vector lookup (shape varies by deployment). + */ +export type PointId = string | number | number; + +export const PointId$zodSchema: z.ZodType = z.union([ + z.string(), + z.int(), + z.number(), +]).describe( + "Qdrant point identifier attached during vector lookup (shape varies by deployment).", +); + +/** + * Per-hit metadata after retrieval enrichment (record + vector context). + * + * @remarks + * Listed fields are the documented contract; Qdrant or pipeline updates may add more keys over time—extend this schema when new stable fields appear. + */ +export type SemanticSearchHitMetadata = { + orgId?: string | null | undefined; + recordId?: string | null | undefined; + virtualRecordId?: string | null | undefined; + recordName?: string | null | undefined; + recordType?: string | null | undefined; + recordVersion?: string | number | null | undefined; + origin?: string | null | undefined; + connector?: string | null | undefined; + connectorId?: string | null | undefined; + connectorName?: string | null | undefined; + blockText?: string | null | undefined; + blockType?: string | null | undefined; + bounding_box?: Array | null | undefined; + pageNum?: Array | null | undefined; + extension?: string | null | undefined; + mimeType?: string | null | undefined; + blockNum?: Array | null | undefined; + chunkIndex?: number | null | undefined; + sheetName?: string | null | undefined; + sheetNum?: number | null | undefined; + webUrl?: string | null | undefined; + previewRenderable?: boolean | null | undefined; + hideWeburl?: boolean | null | undefined; + categories?: Array | null | undefined; + departments?: Array | null | undefined; + topics?: Array | null | undefined; + languages?: Array | null | undefined; + subcategoryLevel1?: string | null | undefined; + subcategoryLevel2?: string | null | undefined; + subcategoryLevel3?: string | null | undefined; + score?: number | null | undefined; + _id?: string | null | undefined; + _collection_name?: string | null | undefined; + blockIndex?: number | null | undefined; + blockId?: string | null | undefined; + isBlock?: boolean | null | undefined; + isBlockGroup?: boolean | null | undefined; + isRecordSummary?: boolean | null | undefined; + kbId?: string | null | undefined; + point_id?: string | number | number | null | undefined; +}; + +export const SemanticSearchHitMetadata$zodSchema: z.ZodType< + SemanticSearchHitMetadata +> = z.object({ + _collection_name: z.string().nullable().optional(), + _id: z.string().nullable().optional(), + blockId: z.string().nullable().optional(), + blockIndex: z.int().nullable().optional(), + blockNum: z.array(z.number()).nullable().optional(), + blockText: z.string().nullable().optional(), + blockType: z.string().nullable().optional(), + bounding_box: z.array(SemanticSearchBoundingBox$zodSchema).nullable() + .optional(), + categories: z.array(z.string()).nullable().optional(), + chunkIndex: z.int().nullable().optional(), + connector: z.string().nullable().optional(), + connectorId: z.string().nullable().optional(), + connectorName: z.string().nullable().optional(), + departments: z.array(z.string()).nullable().optional(), + extension: z.string().nullable().optional(), + hideWeburl: z.boolean().nullable().optional(), + isBlock: z.boolean().nullable().optional(), + isBlockGroup: z.boolean().nullable().optional(), + isRecordSummary: z.boolean().nullable().optional(), + kbId: z.string().nullable().optional(), + languages: z.array(z.string()).nullable().optional(), + mimeType: z.string().nullable().optional(), + orgId: z.string().nullable().optional(), + origin: z.string().nullable().optional(), + pageNum: z.array(z.int().nullable()).nullable().optional(), + point_id: z.union([ + z.string(), + z.int(), + z.number(), + ]).nullable().optional(), + previewRenderable: z.boolean().nullable().optional(), + recordId: z.string().nullable().optional(), + recordName: z.string().nullable().optional(), + recordType: z.string().nullable().optional(), + recordVersion: z.union([ + z.string(), + z.number(), + ]).nullable().optional(), + score: z.number().nullable().optional(), + sheetName: z.string().nullable().optional(), + sheetNum: z.int().nullable().optional(), + subcategoryLevel1: z.string().nullable().optional(), + subcategoryLevel2: z.string().nullable().optional(), + subcategoryLevel3: z.string().nullable().optional(), + topics: z.array(z.string()).nullable().optional(), + virtualRecordId: z.string().nullable().optional(), + webUrl: z.string().nullable().optional(), +}).describe( + "Per-hit metadata after retrieval enrichment (record + vector context).\nListed fields are the documented contract; Qdrant or pipeline updates may add more keys over time—extend this schema when new stable fields appear.\n", +); diff --git a/src/models/semanticsearchrequest.ts b/src/models/semanticsearchrequest.ts index 000da7c6..8c2697aa 100644 --- a/src/models/semanticsearchrequest.ts +++ b/src/models/semanticsearchrequest.ts @@ -3,58 +3,35 @@ */ import * as z from "zod"; -import { - SemanticSearchFilters, - SemanticSearchFilters$zodSchema, -} from "./semanticsearchfilters.js"; +import { Filters, Filters$zodSchema } from "./filters.js"; /** - * Request body for `POST /search`. Performs a semantic vector search + * Request body for performing semantic search across the enterprise knowledge base. * * @remarks - * across the caller's organization and persists a search record that - * can later be retrieved via `GET /search/{searchId}`.

    - * How Semantic Search Works:
    - *
      - *
    1. Query is converted to vector embeddings
    2. - *
    3. Similar content is found using vector similarity
    4. - *
    5. Results are ranked by relevance score
    6. - *
    7. Matching chunks with metadata are returned
    8. - *
    - * Filtering: Use `filters` to narrow scope by connector, - * knowledge base, department, module, or record type. See - * `SemanticSearchFilters`.

    - * Notes for programmatic / MCP callers:
    - *
      - *
    • To resolve a filename or topic to a downloadable record, call - * this endpoint and read - * searchResponse.searchResults[*].metadata.recordId - * (or any key of searchResponse.virtual_to_record_map). - * Then pass that id to - * GET /knowledgeBase/stream/record/{recordId}.
    • - *
    • Use limit aggressively (5–10) when searching just to - * resolve a record id; raise it only when you need ranked snippets.
    • - *
    + * + * **How Semantic Search Works:** + * + * 1. Query is converted to vector embeddings + * 2. Similar content is found using vector similarity + * 3. Results are ranked by relevance score + * 4. Matching chunks with metadata are returned + * + * **Filtering:** + * + * Use filters to narrow search scope to specific apps or knowledge bases. */ export type SemanticSearchRequest = { query: string; - filters?: SemanticSearchFilters | undefined; + filters?: Filters | undefined; limit?: number | undefined; - modelKey?: string | undefined; - modelName?: string | undefined; - modelFriendlyName?: string | undefined; - chatMode?: string | undefined; }; export const SemanticSearchRequest$zodSchema: z.ZodType = z.object({ - chatMode: z.string().optional(), - filters: SemanticSearchFilters$zodSchema.optional(), + filters: Filters$zodSchema.optional(), limit: z.int().default(10), - modelFriendlyName: z.string().optional(), - modelKey: z.string().optional(), - modelName: z.string().optional(), query: z.string(), }).describe( - "Request body for `POST /search`. Performs a semantic vector search\nacross the caller's organization and persists a search record that\ncan later be retrieved via `GET /search/{searchId}`.

    \nHow Semantic Search Works:
    \n
      \n
    1. Query is converted to vector embeddings
    2. \n
    3. Similar content is found using vector similarity
    4. \n
    5. Results are ranked by relevance score
    6. \n
    7. Matching chunks with metadata are returned
    8. \n
    \nFiltering: Use `filters` to narrow scope by connector,\nknowledge base, department, module, or record type. See\n`SemanticSearchFilters`.

    \nNotes for programmatic / MCP callers:
    \n
      \n
    • To resolve a filename or topic to a downloadable record, call\n this endpoint and read\n searchResponse.searchResults[*].metadata.recordId\n (or any key of searchResponse.virtual_to_record_map).\n Then pass that id to\n GET /knowledgeBase/stream/record/{recordId}.
    • \n
    • Use limit aggressively (5–10) when searching just to\n resolve a record id; raise it only when you need ranked snippets.
    • \n
    \n", + "Request body for performing semantic search across the enterprise knowledge base.\n\n**How Semantic Search Works:**\n\n1. Query is converted to vector embeddings\n2. Similar content is found using vector similarity\n3. Results are ranked by relevance score\n4. Matching chunks with metadata are returned\n\n**Filtering:**\n\nUse filters to narrow search scope to specific apps or knowledge bases.\n", ); diff --git a/src/models/setupauthconfigop.ts b/src/models/setupauthconfigop.ts new file mode 100644 index 00000000..2f75d7ec --- /dev/null +++ b/src/models/setupauthconfigop.ts @@ -0,0 +1,21 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; +import { + OrgAuthConfigSetupResponse, + OrgAuthConfigSetupResponse$zodSchema, +} from "./orgauthconfigsetupresponse.js"; + +export type SetUpAuthConfigResponse = + | OrgAuthConfigSetupResponse + | ErrorResponse; + +export const SetUpAuthConfigResponse$zodSchema: z.ZodType< + SetUpAuthConfigResponse +> = z.union([ + OrgAuthConfigSetupResponse$zodSchema, + ErrorResponse$zodSchema, +]); diff --git a/src/models/ssecompletedata.ts b/src/models/ssecompletedata.ts deleted file mode 100644 index 86597017..00000000 --- a/src/models/ssecompletedata.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { Conversation, Conversation$zodSchema } from "./conversation.js"; - -export type SSECompleteDataMeta = { - requestId?: string | undefined; - timestamp?: string | undefined; - duration?: number | undefined; -}; - -export const SSECompleteDataMeta$zodSchema: z.ZodType = z - .object({ - duration: z.int().optional(), - requestId: z.string().optional(), - timestamp: z.iso.datetime({ offset: true }).optional(), - }); - -/** - * Payload for the `complete` SSE event, sent once the answer is finalized. - */ -export type SSECompleteData = { - conversation?: Conversation | undefined; - meta?: SSECompleteDataMeta | undefined; -}; - -export const SSECompleteData$zodSchema: z.ZodType = z.object({ - conversation: Conversation$zodSchema.optional(), - meta: z.lazy(() => SSECompleteDataMeta$zodSchema).optional(), -}).describe( - "Payload for the `complete` SSE event, sent once the answer is finalized.", -); diff --git a/src/models/storedagentconversation.ts b/src/models/storedagentconversation.ts new file mode 100644 index 00000000..8dde005f --- /dev/null +++ b/src/models/storedagentconversation.ts @@ -0,0 +1,153 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + ConversationModelInfo, + ConversationModelInfo$zodSchema, +} from "./conversationmodelinfo.js"; +import { Message, Message$zodSchema } from "./message.js"; + +export const StoredAgentConversationStatus = { + None: "None", + Inprogress: "Inprogress", + Complete: "Complete", + Failed: "Failed", +} as const; +export type StoredAgentConversationStatus = ClosedEnum< + typeof StoredAgentConversationStatus +>; + +export const StoredAgentConversationStatus$zodSchema = z.enum([ + "None", + "Inprogress", + "Complete", + "Failed", +]); + +export const StoredAgentConversationAccessLevel = { + Read: "read", + Write: "write", +} as const; +export type StoredAgentConversationAccessLevel = ClosedEnum< + typeof StoredAgentConversationAccessLevel +>; + +export const StoredAgentConversationAccessLevel$zodSchema = z.enum([ + "read", + "write", +]); + +export type StoredAgentConversationSharedWith = { + userId?: string | undefined; + accessLevel?: StoredAgentConversationAccessLevel | undefined; +}; + +export const StoredAgentConversationSharedWith$zodSchema: z.ZodType< + StoredAgentConversationSharedWith +> = z.object({ + accessLevel: StoredAgentConversationAccessLevel$zodSchema.optional(), + userId: z.string().optional(), +}); + +export type StoredAgentConversationConversationError = { + _id?: string | undefined; + message?: string | undefined; + errorType?: string | undefined; + timestamp?: string | undefined; + messageId?: string | undefined; + stack?: string | undefined; + metadata?: { [k: string]: any } | undefined; +}; + +export const StoredAgentConversationConversationError$zodSchema: z.ZodType< + StoredAgentConversationConversationError +> = z.object({ + _id: z.string().optional(), + errorType: z.string().optional(), + message: z.string().optional(), + messageId: z.string().optional(), + metadata: z.record(z.string(), z.any()).optional(), + stack: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }).optional(), +}); + +export const StoredAgentConversationConversationSource = { + AgentChat: "agent_chat", +} as const; +export type StoredAgentConversationConversationSource = ClosedEnum< + typeof StoredAgentConversationConversationSource +>; + +export const StoredAgentConversationConversationSource$zodSchema = z.enum([ + "agent_chat", +]); + +/** + * Stored agent conversation document returned by non-list endpoints. + * + * @remarks + */ +export type StoredAgentConversation = { + _id?: string | undefined; + agentKey?: string | undefined; + userId?: string | undefined; + orgId?: string | undefined; + title?: string | undefined; + initiator?: string | undefined; + messages?: Array | undefined; + status?: StoredAgentConversationStatus | undefined; + failReason?: string | undefined; + modelInfo?: ConversationModelInfo | undefined; + isShared?: boolean | undefined; + shareLink?: string | undefined; + sharedWith?: Array | undefined; + isArchived?: boolean | undefined; + archivedBy?: string | null | undefined; + isDeleted?: boolean | undefined; + deletedBy?: string | null | undefined; + conversationErrors?: + | Array + | undefined; + conversationSource?: StoredAgentConversationConversationSource | undefined; + lastActivityAt?: number | undefined; + createdAt?: string | undefined; + updatedAt?: string | undefined; + _v?: number | undefined; +}; + +export const StoredAgentConversation$zodSchema: z.ZodType< + StoredAgentConversation +> = z.object({ + _id: z.string().optional(), + _v: z.int().optional(), + agentKey: z.string().optional(), + archivedBy: z.string().nullable().optional(), + conversationErrors: z.array( + z.lazy(() => StoredAgentConversationConversationError$zodSchema), + ).optional(), + conversationSource: StoredAgentConversationConversationSource$zodSchema + .optional(), + createdAt: z.iso.datetime({ offset: true }).optional(), + deletedBy: z.string().nullable().optional(), + failReason: z.string().optional(), + initiator: z.string().optional(), + isArchived: z.boolean().optional(), + isDeleted: z.boolean().optional(), + isShared: z.boolean().optional(), + lastActivityAt: z.int().optional(), + messages: z.array(Message$zodSchema).optional(), + modelInfo: ConversationModelInfo$zodSchema.optional(), + orgId: z.string().optional(), + shareLink: z.string().optional(), + sharedWith: z.array(z.lazy(() => StoredAgentConversationSharedWith$zodSchema)) + .optional(), + status: StoredAgentConversationStatus$zodSchema.optional(), + title: z.string().optional(), + updatedAt: z.iso.datetime({ offset: true }).optional(), + userId: z.string().optional(), +}).describe( + "Stored agent conversation document returned by non-list endpoints.\n", +); diff --git a/src/models/streamrecordbufferop.ts b/src/models/streamrecordbufferop.ts deleted file mode 100644 index ab9b5c0b..00000000 --- a/src/models/streamrecordbufferop.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import * as b64$ from "../lib/base64.js"; - -export type StreamRecordBufferRequest = { - recordId: string; - convertTo?: string | undefined; -}; - -export const StreamRecordBufferRequest$zodSchema: z.ZodType< - StreamRecordBufferRequest -> = z.object({ - convertTo: z.string().describe( - "Optional target format for server-side conversion (e.g. `pdf`).\nWhen omitted, the original file is streamed as-is.\n", - ).optional(), - recordId: z.string().describe( - "Record identifier — typically a UUID for connector-sourced records\nand an ObjectId for uploaded records. Treated as an opaque string;\nobtain it from a chat citation (`metadata.recordId`) or from a\n`POST /search` result (`searchResponse.searchResults[*].metadata.recordId`).\n", - ), -}); - -/** - * Internal error or upstream stream failure. If the failure occurs - * - * @remarks - * after bytes have started flowing, the connection is closed - * mid-stream rather than returning JSON. - */ -export type StreamRecordBufferInternalServerErrorResponseBody = { - error?: string | undefined; -}; - -export const StreamRecordBufferInternalServerErrorResponseBody$zodSchema: - z.ZodType = z.object({ - error: z.string().optional(), - }).describe( - "Internal error or upstream stream failure. If the failure occurs\nafter bytes have started flowing, the connection is closed\nmid-stream rather than returning JSON.\n", - ); - -/** - * Record not found. - */ -export type StreamRecordBufferNotFoundResponseBody = { - error?: string | undefined; -}; - -export const StreamRecordBufferNotFoundResponseBody$zodSchema: z.ZodType< - StreamRecordBufferNotFoundResponseBody -> = z.object({ - error: z.string().optional(), -}).describe("Record not found."); - -/** - * Forbidden — the authenticated user does not have read permission - * - * @remarks - * on this record's knowledge base. - */ -export type StreamRecordBufferForbiddenResponseBody = { - error?: string | undefined; -}; - -export const StreamRecordBufferForbiddenResponseBody$zodSchema: z.ZodType< - StreamRecordBufferForbiddenResponseBody -> = z.object({ - error: z.string().optional(), -}).describe( - "Forbidden — the authenticated user does not have read permission\non this record's knowledge base.\n", -); - -export type StreamRecordBufferResponseResult = - | Uint8Array - | string - | Uint8Array - | string - | StreamRecordBufferForbiddenResponseBody - | StreamRecordBufferNotFoundResponseBody - | StreamRecordBufferInternalServerErrorResponseBody; - -export const StreamRecordBufferResponseResult$zodSchema: z.ZodType< - StreamRecordBufferResponseResult -> = z.union([ - z.string().describe("Base64-encoded binary content").transform( - b64$.bytesFromBase64, - ), - z.string().describe("Base64-encoded binary content").transform( - b64$.bytesFromBase64, - ), - z.lazy(() => StreamRecordBufferForbiddenResponseBody$zodSchema), - z.lazy(() => StreamRecordBufferNotFoundResponseBody$zodSchema), - z.lazy(() => StreamRecordBufferInternalServerErrorResponseBody$zodSchema), -]); - -export type StreamRecordBufferResponse = { - Headers: { [k: string]: Array }; - Result?: - | Uint8Array - | string - | Uint8Array - | string - | StreamRecordBufferForbiddenResponseBody - | StreamRecordBufferNotFoundResponseBody - | StreamRecordBufferInternalServerErrorResponseBody - | undefined; -}; - -export const StreamRecordBufferResponse$zodSchema: z.ZodType< - StreamRecordBufferResponse -> = z.object({ - Headers: z.record(z.string(), z.array(z.string())).default({}), - Result: z.union([ - z.string().describe("Base64-encoded binary content").transform( - b64$.bytesFromBase64, - ), - z.string().describe("Base64-encoded binary content").transform( - b64$.bytesFromBase64, - ), - z.lazy(() => StreamRecordBufferForbiddenResponseBody$zodSchema), - z.lazy(() => StreamRecordBufferNotFoundResponseBody$zodSchema), - z.lazy(() => StreamRecordBufferInternalServerErrorResponseBody$zodSchema), - ]).optional(), -}); diff --git a/src/models/suspendoauthappop.ts b/src/models/suspendoauthappop.ts new file mode 100644 index 00000000..a6536f2c --- /dev/null +++ b/src/models/suspendoauthappop.ts @@ -0,0 +1,38 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + ApplicationJsonErrorResponse, + ApplicationJsonErrorResponse$zodSchema, +} from "./applicationjsonerrorresponse.js"; +import { + OAuthClientManagementRateLimitError, + OAuthClientManagementRateLimitError$zodSchema, +} from "./oauthclientmanagementratelimiterror.js"; +import { + SuspendOAuthAppResponse, + SuspendOAuthAppResponse$zodSchema, +} from "./suspendoauthappresponse.js"; + +export type SuspendOAuthAppRequest = { appId: string }; + +export const SuspendOAuthAppRequest$zodSchema: z.ZodType< + SuspendOAuthAppRequest +> = z.object({ + appId: z.string().describe("OAuth app ID"), +}); + +export type SuspendOAuthAppResponseResponse = + | SuspendOAuthAppResponse + | ApplicationJsonErrorResponse + | OAuthClientManagementRateLimitError; + +export const SuspendOAuthAppResponseResponse$zodSchema: z.ZodType< + SuspendOAuthAppResponseResponse +> = z.union([ + SuspendOAuthAppResponse$zodSchema, + ApplicationJsonErrorResponse$zodSchema, + OAuthClientManagementRateLimitError$zodSchema, +]); diff --git a/src/models/suspendoauthappresponse.ts b/src/models/suspendoauthappresponse.ts new file mode 100644 index 00000000..d7fcefc8 --- /dev/null +++ b/src/models/suspendoauthappresponse.ts @@ -0,0 +1,30 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + OAuthAppResponse, + OAuthAppResponse$zodSchema, +} from "./oauthappresponse.js"; + +/** + * Response body for `POST /oauth-clients/{appId}/suspend` + * + * @remarks + * (`oauth.app.controller.ts` `suspendApp`). Suspended app (never includes + * `clientSecret`) is nested under `app`. + */ +export type SuspendOAuthAppResponse = { + message: string; + app: OAuthAppResponse; +}; + +export const SuspendOAuthAppResponse$zodSchema: z.ZodType< + SuspendOAuthAppResponse +> = z.object({ + app: OAuthAppResponse$zodSchema, + message: z.string(), +}).describe( + "Response body for `POST /oauth-clients/{appId}/suspend`\n(`oauth.app.controller.ts` `suspendApp`). Suspended app (never includes\n`clientSecret`) is nested under `app`.\n", +); diff --git a/src/models/teammembersummary.ts b/src/models/teammembersummary.ts deleted file mode 100644 index 88a5008c..00000000 --- a/src/models/teammembersummary.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ClosedEnum } from "../types/enums.js"; - -export const TeamMemberSummaryRole = { - Owner: "OWNER", - Admin: "ADMIN", - Writer: "WRITER", - Reader: "READER", -} as const; -export type TeamMemberSummaryRole = ClosedEnum; - -export const TeamMemberSummaryRole$zodSchema = z.enum([ - "OWNER", - "ADMIN", - "WRITER", - "READER", -]); - -/** - * Compact membership row embedded in `GET /teams/user/teams`. Joins - * - * @remarks - * the user node, the user document, and the membership edge into a - * single flat object suitable for rendering a team member list. - */ -export type TeamMemberSummary = { - id?: string | undefined; - userId?: string | undefined; - userName?: string | undefined; - userEmail?: string | undefined; - role?: TeamMemberSummaryRole | undefined; - joinedAt?: number | undefined; - isOwner?: boolean | undefined; -}; - -export const TeamMemberSummary$zodSchema: z.ZodType = z - .object({ - id: z.string().optional(), - isOwner: z.boolean().optional(), - joinedAt: z.int().optional(), - role: TeamMemberSummaryRole$zodSchema.optional(), - userEmail: z.string().optional(), - userId: z.string().optional(), - userName: z.string().optional(), - }).describe( - "Compact membership row embedded in `GET /teams/user/teams`. Joins\nthe user node, the user document, and the membership edge into a\nsingle flat object suitable for rendering a team member list.\n", - ); diff --git a/src/models/teampermissionedge.ts b/src/models/teampermissionedge.ts deleted file mode 100644 index a2b125b0..00000000 --- a/src/models/teampermissionedge.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ClosedEnum } from "../types/enums.js"; - -/** - * Whether this permission was granted directly or via group. - */ -export const TeamPermissionEdgeType = { - User: "USER", - Group: "GROUP", -} as const; -/** - * Whether this permission was granted directly or via group. - */ -export type TeamPermissionEdgeType = ClosedEnum; - -export const TeamPermissionEdgeType$zodSchema = z.enum([ - "USER", - "GROUP", -]).describe("Whether this permission was granted directly or via group."); - -export const TeamPermissionEdgeRole = { - Owner: "OWNER", - Admin: "ADMIN", - Writer: "WRITER", - Reader: "READER", -} as const; -export type TeamPermissionEdgeRole = ClosedEnum; - -export const TeamPermissionEdgeRole$zodSchema = z.enum([ - "OWNER", - "ADMIN", - "WRITER", - "READER", -]); - -/** - * ArangoDB permission edge between a user and a team — surfaced by - * - * @remarks - * `GET /teams/user/teams` as `currentUserPermission` so callers know - * what role the authenticated user holds in the team. - */ -export type TeamPermissionEdge = { - _key?: string | undefined; - _id?: string | undefined; - _from?: string | undefined; - _to?: string | undefined; - _rev?: string | undefined; - type?: TeamPermissionEdgeType | undefined; - role?: TeamPermissionEdgeRole | undefined; - createdAtTimestamp?: number | undefined; - updatedAtTimestamp?: number | undefined; -}; - -export const TeamPermissionEdge$zodSchema: z.ZodType = z - .object({ - _from: z.string().optional(), - _id: z.string().optional(), - _key: z.string().optional(), - _rev: z.string().optional(), - _to: z.string().optional(), - createdAtTimestamp: z.int().optional(), - role: TeamPermissionEdgeRole$zodSchema.optional(), - type: TeamPermissionEdgeType$zodSchema.optional(), - updatedAtTimestamp: z.int().optional(), - }).describe( - "ArangoDB permission edge between a user and a team — surfaced by\n`GET /teams/user/teams` as `currentUserPermission` so callers know\nwhat role the authenticated user holds in the team.\n", - ); diff --git a/src/models/unarchiveagentconversationop.ts b/src/models/unarchiveagentconversationop.ts new file mode 100644 index 00000000..39befd62 --- /dev/null +++ b/src/models/unarchiveagentconversationop.ts @@ -0,0 +1,33 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AgentConversationUnarchiveResponse, + AgentConversationUnarchiveResponse$zodSchema, +} from "./agentconversationunarchiveresponse.js"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; + +export type UnarchiveAgentConversationRequest = { + agentKey: string; + conversationId: string; +}; + +export const UnarchiveAgentConversationRequest$zodSchema: z.ZodType< + UnarchiveAgentConversationRequest +> = z.object({ + agentKey: z.string(), + conversationId: z.string(), +}); + +export type UnarchiveAgentConversationResponse = + | AgentConversationUnarchiveResponse + | ErrorResponse; + +export const UnarchiveAgentConversationResponse$zodSchema: z.ZodType< + UnarchiveAgentConversationResponse +> = z.union([ + AgentConversationUnarchiveResponse$zodSchema, + ErrorResponse$zodSchema, +]); diff --git a/src/models/unarchiveconversationop.ts b/src/models/unarchiveconversationop.ts new file mode 100644 index 00000000..5f3d58ba --- /dev/null +++ b/src/models/unarchiveconversationop.ts @@ -0,0 +1,66 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +export type UnarchiveConversationRequest = { conversationId: string }; + +export const UnarchiveConversationRequest$zodSchema: z.ZodType< + UnarchiveConversationRequest +> = z.object({ + conversationId: z.string().describe("Conversation identifier"), +}); + +/** + * New archive status of the conversation + */ +export const UnarchiveConversationStatus = { + Unarchived: "unarchived", +} as const; +/** + * New archive status of the conversation + */ +export type UnarchiveConversationStatus = ClosedEnum< + typeof UnarchiveConversationStatus +>; + +export const UnarchiveConversationStatus$zodSchema = z.enum([ + "unarchived", +]).describe("New archive status of the conversation"); + +export type UnarchiveConversationMeta = { + requestId?: string | undefined; + timestamp?: string | undefined; + duration?: number | undefined; +}; + +export const UnarchiveConversationMeta$zodSchema: z.ZodType< + UnarchiveConversationMeta +> = z.object({ + duration: z.int().optional(), + requestId: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }).optional(), +}); + +/** + * Conversation unarchived successfully + */ +export type UnarchiveConversationResponse = { + id?: string | undefined; + status?: UnarchiveConversationStatus | undefined; + unarchivedBy?: string | undefined; + unarchivedAt?: string | undefined; + meta?: UnarchiveConversationMeta | undefined; +}; + +export const UnarchiveConversationResponse$zodSchema: z.ZodType< + UnarchiveConversationResponse +> = z.object({ + id: z.string().optional(), + meta: z.lazy(() => UnarchiveConversationMeta$zodSchema).optional(), + status: UnarchiveConversationStatus$zodSchema.optional(), + unarchivedAt: z.iso.datetime({ offset: true }).optional(), + unarchivedBy: z.string().optional(), +}).describe("Conversation unarchived successfully"); diff --git a/src/models/unarchivesearchop.ts b/src/models/unarchivesearchop.ts new file mode 100644 index 00000000..b99ce278 --- /dev/null +++ b/src/models/unarchivesearchop.ts @@ -0,0 +1,63 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +export type UnarchiveSearchRequest = { searchId: string }; + +export const UnarchiveSearchRequest$zodSchema: z.ZodType< + UnarchiveSearchRequest +> = z.object({ + searchId: z.string().describe("Unique search identifier"), +}); + +/** + * Resulting status of the search after the operation. + */ +export const UnarchiveSearchStatus = { + Unarchived: "unarchived", +} as const; +/** + * Resulting status of the search after the operation. + */ +export type UnarchiveSearchStatus = ClosedEnum; + +export const UnarchiveSearchStatus$zodSchema = z.enum([ + "unarchived", +]).describe("Resulting status of the search after the operation."); + +export type UnarchiveSearchMeta = { + requestId?: string | undefined; + timestamp: string; + duration: number; +}; + +export const UnarchiveSearchMeta$zodSchema: z.ZodType = z + .object({ + duration: z.int(), + requestId: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }), + }); + +/** + * Search unarchived successfully + */ +export type UnarchiveSearchResponse = { + id: string; + status: UnarchiveSearchStatus; + unarchivedBy: string; + unarchivedAt: string; + meta: UnarchiveSearchMeta; +}; + +export const UnarchiveSearchResponse$zodSchema: z.ZodType< + UnarchiveSearchResponse +> = z.object({ + id: z.string(), + meta: z.lazy(() => UnarchiveSearchMeta$zodSchema), + status: UnarchiveSearchStatus$zodSchema, + unarchivedAt: z.iso.datetime({ offset: true }), + unarchivedBy: z.string(), +}).describe("Search unarchived successfully"); diff --git a/src/models/updateagentconversationmessagefeedbackop.ts b/src/models/updateagentconversationmessagefeedbackop.ts new file mode 100644 index 00000000..52b60c8e --- /dev/null +++ b/src/models/updateagentconversationmessagefeedbackop.ts @@ -0,0 +1,29 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + MessageFeedbackSubmitRequest, + MessageFeedbackSubmitRequest$zodSchema, +} from "./messagefeedbacksubmitrequest.js"; + +export type UpdateAgentConversationMessageFeedbackRequest = { + agentKey: string; + conversationId: string; + messageId: string; + body: MessageFeedbackSubmitRequest; +}; + +export const UpdateAgentConversationMessageFeedbackRequest$zodSchema: z.ZodType< + UpdateAgentConversationMessageFeedbackRequest +> = z.object({ + agentKey: z.string().describe( + "Unique agent identifier (gateway Zod requires non-empty string).", + ), + body: MessageFeedbackSubmitRequest$zodSchema, + conversationId: z.string().describe("Unique conversation identifier."), + messageId: z.string().describe( + "Identifier of the bot-response message being rated.", + ), +}); diff --git a/src/models/updateagentconversationtitleop.ts b/src/models/updateagentconversationtitleop.ts new file mode 100644 index 00000000..697a5154 --- /dev/null +++ b/src/models/updateagentconversationtitleop.ts @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AgentConversationTitleUpdateResponse, + AgentConversationTitleUpdateResponse$zodSchema, +} from "./agentconversationtitleupdateresponse.js"; +import { + ConversationTitleUpdateRequest, + ConversationTitleUpdateRequest$zodSchema, +} from "./conversationtitleupdaterequest.js"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; + +export type UpdateAgentConversationTitleRequest = { + agentKey: string; + conversationId: string; + body: ConversationTitleUpdateRequest; +}; + +export const UpdateAgentConversationTitleRequest$zodSchema: z.ZodType< + UpdateAgentConversationTitleRequest +> = z.object({ + agentKey: z.string(), + body: ConversationTitleUpdateRequest$zodSchema, + conversationId: z.string(), +}); + +export type UpdateAgentConversationTitleResponse = + | AgentConversationTitleUpdateResponse + | ErrorResponse; + +export const UpdateAgentConversationTitleResponse$zodSchema: z.ZodType< + UpdateAgentConversationTitleResponse +> = z.union([ + AgentConversationTitleUpdateResponse$zodSchema, + ErrorResponse$zodSchema, +]); diff --git a/src/models/updateagentop.ts b/src/models/updateagentop.ts new file mode 100644 index 00000000..0b86b9be --- /dev/null +++ b/src/models/updateagentop.ts @@ -0,0 +1,30 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + AgentUpdateRequest, + AgentUpdateRequest$zodSchema, +} from "./agentupdaterequest.js"; +import { + AgentUpdateResponse, + AgentUpdateResponse$zodSchema, +} from "./agentupdateresponse.js"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; + +export type UpdateAgentRequest = { agentKey: string; body: AgentUpdateRequest }; + +export const UpdateAgentRequest$zodSchema: z.ZodType = z + .object({ + agentKey: z.string().describe("Unique agent identifier"), + body: AgentUpdateRequest$zodSchema, + }); + +export type UpdateAgentResponse = AgentUpdateResponse | ErrorResponse; + +export const UpdateAgentResponse$zodSchema: z.ZodType = z + .union([ + AgentUpdateResponse$zodSchema, + ErrorResponse$zodSchema, + ]); diff --git a/src/models/updateauthmethodop.ts b/src/models/updateauthmethodop.ts new file mode 100644 index 00000000..c512a2b7 --- /dev/null +++ b/src/models/updateauthmethodop.ts @@ -0,0 +1,33 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { AuthStep, AuthStep$zodSchema } from "./authstep.js"; +import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js"; +import { + UpdateAuthMethodResponse, + UpdateAuthMethodResponse$zodSchema, +} from "./updateauthmethodresponse.js"; + +/** + * Request payload + */ +export type UpdateAuthMethodRequest = { authMethod: Array }; + +export const UpdateAuthMethodRequest$zodSchema: z.ZodType< + UpdateAuthMethodRequest +> = z.object({ + authMethod: z.array(AuthStep$zodSchema), +}).describe("Request payload"); + +export type UpdateAuthMethodResponseResponse = + | UpdateAuthMethodResponse + | ErrorResponse; + +export const UpdateAuthMethodResponseResponse$zodSchema: z.ZodType< + UpdateAuthMethodResponseResponse +> = z.union([ + UpdateAuthMethodResponse$zodSchema, + ErrorResponse$zodSchema, +]); diff --git a/src/models/updateauthmethodresponse.ts b/src/models/updateauthmethodresponse.ts new file mode 100644 index 00000000..7f12ff7a --- /dev/null +++ b/src/models/updateauthmethodresponse.ts @@ -0,0 +1,21 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { AuthStep, AuthStep$zodSchema } from "./authstep.js"; + +/** + * Response after updating organization authentication methods + */ +export type UpdateAuthMethodResponse = { + message: string; + authMethod: Array; +}; + +export const UpdateAuthMethodResponse$zodSchema: z.ZodType< + UpdateAuthMethodResponse +> = z.object({ + authMethod: z.array(AuthStep$zodSchema), + message: z.string(), +}).describe("Response after updating organization authentication methods"); diff --git a/src/models/updateconversationtitleop.ts b/src/models/updateconversationtitleop.ts new file mode 100644 index 00000000..3c155fea --- /dev/null +++ b/src/models/updateconversationtitleop.ts @@ -0,0 +1,355 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + AppliedFilterNode, + AppliedFilterNode$zodSchema, +} from "./appliedfilternode.js"; +import { + ChatAttachmentRef, + ChatAttachmentRef$zodSchema, +} from "./chatattachmentref.js"; +import { + CitationReference, + CitationReference$zodSchema, +} from "./citationreference.js"; +import { + ConversationModelInfo, + ConversationModelInfo$zodSchema, +} from "./conversationmodelinfo.js"; +import { + FollowUpQuestion, + FollowUpQuestion$zodSchema, +} from "./followupquestion.js"; +import { + MessageFeedback, + MessageFeedback$zodSchema, +} from "./messagefeedback.js"; + +/** + * Request payload + */ +export type UpdateConversationTitleRequestBody = { title: string }; + +export const UpdateConversationTitleRequestBody$zodSchema: z.ZodType< + UpdateConversationTitleRequestBody +> = z.object({ + title: z.string(), +}).describe("Request payload"); + +export type UpdateConversationTitleRequest = { + conversationId: string; + body: UpdateConversationTitleRequestBody; +}; + +export const UpdateConversationTitleRequest$zodSchema: z.ZodType< + UpdateConversationTitleRequest +> = z.object({ + body: z.lazy(() => UpdateConversationTitleRequestBody$zodSchema), + conversationId: z.string().describe("Unique conversation identifier"), +}); + +export const UpdateConversationTitleMessageType = { + UserQuery: "user_query", + BotResponse: "bot_response", + Error: "error", + Feedback: "feedback", + System: "system", +} as const; +export type UpdateConversationTitleMessageType = ClosedEnum< + typeof UpdateConversationTitleMessageType +>; + +export const UpdateConversationTitleMessageType$zodSchema = z.enum([ + "user_query", + "bot_response", + "error", + "feedback", + "system", +]); + +export const UpdateConversationTitleContentFormat = { + Markdown: "MARKDOWN", + Json: "JSON", + Html: "HTML", +} as const; +export type UpdateConversationTitleContentFormat = ClosedEnum< + typeof UpdateConversationTitleContentFormat +>; + +export const UpdateConversationTitleContentFormat$zodSchema = z.enum([ + "MARKDOWN", + "JSON", + "HTML", +]); + +export type UpdateConversationTitleReferenceDatum = { + name?: string | undefined; + id?: string | undefined; + type?: string | undefined; + app?: string | undefined; + webUrl?: string | undefined; + metadata?: { [k: string]: string } | undefined; +}; + +export const UpdateConversationTitleReferenceDatum$zodSchema: z.ZodType< + UpdateConversationTitleReferenceDatum +> = z.object({ + app: z.string().optional(), + id: z.string().optional(), + metadata: z.record(z.string(), z.string()).optional(), + name: z.string().optional(), + type: z.string().optional(), + webUrl: z.string().optional(), +}); + +export type UpdateConversationTitleAppliedFilters = { + apps?: Array | undefined; + kb?: Array | undefined; +}; + +export const UpdateConversationTitleAppliedFilters$zodSchema: z.ZodType< + UpdateConversationTitleAppliedFilters +> = z.object({ + apps: z.array(AppliedFilterNode$zodSchema).optional(), + kb: z.array(AppliedFilterNode$zodSchema).optional(), +}); + +export type UpdateConversationTitleMetadata = { + processingTimeMs?: number | undefined; + modelVersion?: string | undefined; + aiTransactionId?: string | undefined; + reason?: string | undefined; +}; + +export const UpdateConversationTitleMetadata$zodSchema: z.ZodType< + UpdateConversationTitleMetadata +> = z.object({ + aiTransactionId: z.string().optional(), + modelVersion: z.string().optional(), + processingTimeMs: z.number().optional(), + reason: z.string().optional(), +}); + +export type UpdateConversationTitleMessage = { + _id: string; + messageType: UpdateConversationTitleMessageType; + content: string; + contentFormat?: UpdateConversationTitleContentFormat | undefined; + confidence?: string | undefined; + citations: Array; + followUpQuestions: Array; + feedback: Array; + referenceData: Array; + modelInfo?: ConversationModelInfo | undefined; + appliedFilters?: UpdateConversationTitleAppliedFilters | undefined; + attachments?: Array | undefined; + metadata?: UpdateConversationTitleMetadata | undefined; + createdAt: string; + updatedAt: string; +}; + +export const UpdateConversationTitleMessage$zodSchema: z.ZodType< + UpdateConversationTitleMessage +> = z.object({ + _id: z.string(), + appliedFilters: z.lazy(() => UpdateConversationTitleAppliedFilters$zodSchema) + .optional(), + attachments: z.array(ChatAttachmentRef$zodSchema).optional(), + citations: z.array(CitationReference$zodSchema), + confidence: z.string().optional(), + content: z.string(), + contentFormat: UpdateConversationTitleContentFormat$zodSchema.default( + "MARKDOWN", + ), + createdAt: z.iso.datetime({ offset: true }), + feedback: z.array(MessageFeedback$zodSchema), + followUpQuestions: z.array(FollowUpQuestion$zodSchema), + messageType: UpdateConversationTitleMessageType$zodSchema, + metadata: z.lazy(() => UpdateConversationTitleMetadata$zodSchema).optional(), + modelInfo: ConversationModelInfo$zodSchema.optional(), + referenceData: z.array( + z.lazy(() => UpdateConversationTitleReferenceDatum$zodSchema), + ), + updatedAt: z.iso.datetime({ offset: true }), +}); + +/** + * Current status of the conversation: + * + * @remarks + * - `None` — no activity yet + * - `Inprogress` — AI is processing + * - `Complete` — response ready + * - `Failed` — error occurred + */ +export const UpdateConversationTitleStatus = { + None: "None", + Inprogress: "Inprogress", + Complete: "Complete", + Failed: "Failed", +} as const; +/** + * Current status of the conversation: + * + * @remarks + * - `None` — no activity yet + * - `Inprogress` — AI is processing + * - `Complete` — response ready + * - `Failed` — error occurred + */ +export type UpdateConversationTitleStatus = ClosedEnum< + typeof UpdateConversationTitleStatus +>; + +export const UpdateConversationTitleStatus$zodSchema = z.enum([ + "None", + "Inprogress", + "Complete", + "Failed", +]).describe( + "Current status of the conversation:\n- `None` — no activity yet\n- `Inprogress` — AI is processing\n- `Complete` — response ready\n- `Failed` — error occurred\n", +); + +export const UpdateConversationTitleAccessLevel = { + Read: "read", + Write: "write", +} as const; +export type UpdateConversationTitleAccessLevel = ClosedEnum< + typeof UpdateConversationTitleAccessLevel +>; + +export const UpdateConversationTitleAccessLevel$zodSchema = z.enum([ + "read", + "write", +]); + +export type UpdateConversationTitleSharedWith = { + userId: string; + accessLevel?: UpdateConversationTitleAccessLevel | undefined; +}; + +export const UpdateConversationTitleSharedWith$zodSchema: z.ZodType< + UpdateConversationTitleSharedWith +> = z.object({ + accessLevel: UpdateConversationTitleAccessLevel$zodSchema.default("read"), + userId: z.string(), +}); + +export type UpdateConversationTitleConversationError = { + _id: string; + message: string; + errorType?: string | undefined; + timestamp: string; + messageId?: string | undefined; + stack?: string | undefined; + metadata?: { [k: string]: any } | undefined; +}; + +export const UpdateConversationTitleConversationError$zodSchema: z.ZodType< + UpdateConversationTitleConversationError +> = z.object({ + _id: z.string(), + errorType: z.string().optional(), + message: z.string(), + messageId: z.string().optional(), + metadata: z.record(z.string(), z.any()).optional(), + stack: z.string().optional(), + timestamp: z.iso.datetime({ offset: true }), +}); + +/** + * The full conversation document after the title update, + * + * @remarks + * returned as stored in MongoDB. + */ +export type UpdateConversationTitleConversation = { + _id: string; + userId: string; + orgId: string; + title?: string | undefined; + initiator: string; + messages: Array; + status?: UpdateConversationTitleStatus | undefined; + failReason?: string | undefined; + modelInfo?: ConversationModelInfo | undefined; + isShared?: boolean | undefined; + shareLink?: string | undefined; + sharedWith: Array; + isArchived?: boolean | undefined; + archivedBy?: string | null | undefined; + isDeleted?: boolean | undefined; + deletedBy?: string | undefined; + conversationErrors: Array; + metadata?: { [k: string]: any } | undefined; + lastActivityAt: number; + createdAt: string; + updatedAt: string; + _v: number; +}; + +export const UpdateConversationTitleConversation$zodSchema: z.ZodType< + UpdateConversationTitleConversation +> = z.object({ + _id: z.string(), + _v: z.int(), + archivedBy: z.string().nullable().optional(), + conversationErrors: z.array( + z.lazy(() => UpdateConversationTitleConversationError$zodSchema), + ), + createdAt: z.iso.datetime({ offset: true }), + deletedBy: z.string().optional(), + failReason: z.string().optional(), + initiator: z.string(), + isArchived: z.boolean().default(false), + isDeleted: z.boolean().default(false), + isShared: z.boolean().default(false), + lastActivityAt: z.int(), + messages: z.array(z.lazy(() => UpdateConversationTitleMessage$zodSchema)), + metadata: z.record(z.string(), z.any()).optional(), + modelInfo: ConversationModelInfo$zodSchema.optional(), + orgId: z.string(), + shareLink: z.string().optional(), + sharedWith: z.array( + z.lazy(() => UpdateConversationTitleSharedWith$zodSchema), + ), + status: UpdateConversationTitleStatus$zodSchema.optional(), + title: z.string().optional(), + updatedAt: z.iso.datetime({ offset: true }), + userId: z.string(), +}).describe( + "The full conversation document after the title update,\nreturned as stored in MongoDB.\n", +); + +export type UpdateConversationTitleMeta = { + requestId: string; + timestamp: string; + duration: number; +}; + +export const UpdateConversationTitleMeta$zodSchema: z.ZodType< + UpdateConversationTitleMeta +> = z.object({ + duration: z.int(), + requestId: z.string(), + timestamp: z.iso.datetime({ offset: true }), +}); + +/** + * Title updated successfully + */ +export type UpdateConversationTitleResponse = { + conversation: UpdateConversationTitleConversation; + meta: UpdateConversationTitleMeta; +}; + +export const UpdateConversationTitleResponse$zodSchema: z.ZodType< + UpdateConversationTitleResponse +> = z.object({ + conversation: z.lazy(() => UpdateConversationTitleConversation$zodSchema), + meta: z.lazy(() => UpdateConversationTitleMeta$zodSchema), +}).describe("Title updated successfully"); diff --git a/src/models/updatemessagefeedbackop.ts b/src/models/updatemessagefeedbackop.ts new file mode 100644 index 00000000..428735e0 --- /dev/null +++ b/src/models/updatemessagefeedbackop.ts @@ -0,0 +1,25 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + MessageFeedbackSubmitRequest, + MessageFeedbackSubmitRequest$zodSchema, +} from "./messagefeedbacksubmitrequest.js"; + +export type UpdateMessageFeedbackRequest = { + conversationId: string; + messageId: string; + body: MessageFeedbackSubmitRequest; +}; + +export const UpdateMessageFeedbackRequest$zodSchema: z.ZodType< + UpdateMessageFeedbackRequest +> = z.object({ + body: MessageFeedbackSubmitRequest$zodSchema, + conversationId: z.string().describe("Unique conversation identifier."), + messageId: z.string().describe( + "Identifier of the bot-response message being rated.", + ), +}); diff --git a/src/models/updateoauthappop.ts b/src/models/updateoauthappop.ts new file mode 100644 index 00000000..9086e5e2 --- /dev/null +++ b/src/models/updateoauthappop.ts @@ -0,0 +1,46 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + ApplicationJsonErrorResponse, + ApplicationJsonErrorResponse$zodSchema, +} from "./applicationjsonerrorresponse.js"; +import { + OAuthClientManagementRateLimitError, + OAuthClientManagementRateLimitError$zodSchema, +} from "./oauthclientmanagementratelimiterror.js"; +import { + UpdateOAuthAppRequest, + UpdateOAuthAppRequest$zodSchema, +} from "./updateoauthapprequest.js"; +import { + UpdateOAuthAppResponse, + UpdateOAuthAppResponse$zodSchema, +} from "./updateoauthappresponse.js"; + +export type UpdateOAuthAppRequestRequest = { + appId: string; + body: UpdateOAuthAppRequest; +}; + +export const UpdateOAuthAppRequestRequest$zodSchema: z.ZodType< + UpdateOAuthAppRequestRequest +> = z.object({ + appId: z.string().describe("OAuth app ID"), + body: UpdateOAuthAppRequest$zodSchema, +}); + +export type UpdateOAuthAppResponseResponse = + | UpdateOAuthAppResponse + | ApplicationJsonErrorResponse + | OAuthClientManagementRateLimitError; + +export const UpdateOAuthAppResponseResponse$zodSchema: z.ZodType< + UpdateOAuthAppResponseResponse +> = z.union([ + UpdateOAuthAppResponse$zodSchema, + ApplicationJsonErrorResponse$zodSchema, + OAuthClientManagementRateLimitError$zodSchema, +]); diff --git a/src/models/updateoauthapprequest.ts b/src/models/updateoauthapprequest.ts new file mode 100644 index 00000000..cd439147 --- /dev/null +++ b/src/models/updateoauthapprequest.ts @@ -0,0 +1,60 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +export const UpdateOAuthAppRequestAllowedGrantType = { + AuthorizationCode: "authorization_code", + ClientCredentials: "client_credentials", + RefreshToken: "refresh_token", +} as const; +export type UpdateOAuthAppRequestAllowedGrantType = ClosedEnum< + typeof UpdateOAuthAppRequestAllowedGrantType +>; + +export const UpdateOAuthAppRequestAllowedGrantType$zodSchema = z.enum([ + "authorization_code", + "client_credentials", + "refresh_token", +]); + +/** + * Request to update an OAuth app (`updateAppSchema` in `oauth.validators.ts`). + * + * @remarks + * + * All fields are optional — include only fields that should change. URL fields (`homepageUrl`, `privacyPolicyUrl`, `termsOfServiceUrl`) accept `null` to clear them (nullable in Zod). + * + * **Redirect rule (Zod refine):** If `allowedGrantTypes` includes `authorization_code` and `redirectUris` is present in the body, `redirectUris` must contain at least one URI. + */ +export type UpdateOAuthAppRequest = { + name?: string | undefined; + description?: string | undefined; + redirectUris?: Array | undefined; + allowedGrantTypes?: Array | undefined; + allowedScopes?: Array | undefined; + homepageUrl?: string | null | undefined; + privacyPolicyUrl?: string | null | undefined; + termsOfServiceUrl?: string | null | undefined; + accessTokenLifetime?: number | undefined; + refreshTokenLifetime?: number | undefined; +}; + +export const UpdateOAuthAppRequest$zodSchema: z.ZodType = + z.object({ + accessTokenLifetime: z.int().optional(), + allowedGrantTypes: z.array(UpdateOAuthAppRequestAllowedGrantType$zodSchema) + .optional(), + allowedScopes: z.array(z.string()).optional(), + description: z.string().optional(), + homepageUrl: z.string().nullable().optional(), + name: z.string().optional(), + privacyPolicyUrl: z.string().nullable().optional(), + redirectUris: z.array(z.string()).optional(), + refreshTokenLifetime: z.int().optional(), + termsOfServiceUrl: z.string().nullable().optional(), + }).describe( + "Request to update an OAuth app (`updateAppSchema` in `oauth.validators.ts`).\n\nAll fields are optional — include only fields that should change. URL fields (`homepageUrl`, `privacyPolicyUrl`, `termsOfServiceUrl`) accept `null` to clear them (nullable in Zod).\n\n**Redirect rule (Zod refine):** If `allowedGrantTypes` includes `authorization_code` and `redirectUris` is present in the body, `redirectUris` must contain at least one URI.\n", + ); diff --git a/src/models/updateoauthappresponse.ts b/src/models/updateoauthappresponse.ts new file mode 100644 index 00000000..5723565e --- /dev/null +++ b/src/models/updateoauthappresponse.ts @@ -0,0 +1,26 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + OAuthAppResponse, + OAuthAppResponse$zodSchema, +} from "./oauthappresponse.js"; + +/** + * Response body for `PUT /oauth-clients/{appId}` (`oauth.app.controller.ts` `updateApp`). + * + * @remarks + * Updated app (never includes `clientSecret`) is nested under `app`. + */ +export type UpdateOAuthAppResponse = { message: string; app: OAuthAppResponse }; + +export const UpdateOAuthAppResponse$zodSchema: z.ZodType< + UpdateOAuthAppResponse +> = z.object({ + app: OAuthAppResponse$zodSchema, + message: z.string(), +}).describe( + "Response body for `PUT /oauth-clients/{appId}` (`oauth.app.controller.ts` `updateApp`).\nUpdated app (never includes `clientSecret`) is nested under `app`.\n", +); diff --git a/src/models/uploadagentconversationchatattachmentsop.ts b/src/models/uploadagentconversationchatattachmentsop.ts new file mode 100644 index 00000000..92b3ae09 --- /dev/null +++ b/src/models/uploadagentconversationchatattachmentsop.ts @@ -0,0 +1,45 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import * as b64$ from "../lib/base64.js"; + +export type FileT = { fileName: string; content: Uint8Array | string }; + +export const FileT$zodSchema: z.ZodType = z.object({ + content: z.string().describe("Base64-encoded binary content").transform( + b64$.bytesFromBase64, + ), + fileName: z.string(), +}); + +/** + * Multipart form with attachment files and optional `conversationId`. + */ +export type UploadAgentConversationChatAttachmentsRequestBody = { + conversationId?: string | undefined; + files: Array; +}; + +export const UploadAgentConversationChatAttachmentsRequestBody$zodSchema: + z.ZodType = z.object({ + conversationId: z.string().optional(), + files: z.array(z.lazy(() => FileT$zodSchema)), + }).describe( + "Multipart form with attachment files and optional `conversationId`.", + ); + +export type UploadAgentConversationChatAttachmentsRequest = { + agentKey: string; + body: UploadAgentConversationChatAttachmentsRequestBody; +}; + +export const UploadAgentConversationChatAttachmentsRequest$zodSchema: z.ZodType< + UploadAgentConversationChatAttachmentsRequest +> = z.object({ + agentKey: z.string(), + body: z.lazy(() => + UploadAgentConversationChatAttachmentsRequestBody$zodSchema + ), +}); diff --git a/src/models/user.ts b/src/models/user.ts deleted file mode 100644 index 6c2f6077..00000000 --- a/src/models/user.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { Address, Address$zodSchema } from "./address.js"; - -/** - * User account in an organization - */ -export type User = { - _id?: string | undefined; - slug?: string | undefined; - orgId: string; - fullName?: string | undefined; - firstName?: string | undefined; - lastName?: string | undefined; - middleName?: string | undefined; - email: string; - mobile?: string | undefined; - hasLoggedIn?: boolean | undefined; - designation?: string | undefined; - address?: Address | undefined; - dataCollectionConsent?: boolean | undefined; - isDeleted?: boolean | undefined; - deletedBy?: string | undefined; - profilePicture?: string | null | undefined; - _v?: number | undefined; - createdAt?: string | undefined; - updatedAt?: string | undefined; -}; - -export const User$zodSchema: z.ZodType = z.object({ - _id: z.string().optional(), - _v: z.int().optional(), - address: Address$zodSchema.optional(), - createdAt: z.iso.datetime({ offset: true }).optional(), - dataCollectionConsent: z.boolean().optional(), - deletedBy: z.string().optional(), - designation: z.string().optional(), - email: z.string(), - firstName: z.string().optional(), - fullName: z.string().optional(), - hasLoggedIn: z.boolean().default(false), - isDeleted: z.boolean().default(false), - lastName: z.string().optional(), - middleName: z.string().optional(), - mobile: z.string().optional(), - orgId: z.string(), - profilePicture: z.string().nullable().optional(), - slug: z.string().optional(), - updatedAt: z.iso.datetime({ offset: true }).optional(), -}).describe("User account in an organization"); diff --git a/src/models/usergrouplistitem.ts b/src/models/usergrouplistitem.ts deleted file mode 100644 index 7a4e62ca..00000000 --- a/src/models/usergrouplistitem.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ClosedEnum } from "../types/enums.js"; - -export const UserGroupListItemType = { - Admin: "admin", - Standard: "standard", - Everyone: "everyone", - Custom: "custom", -} as const; -export type UserGroupListItemType = ClosedEnum; - -export const UserGroupListItemType$zodSchema = z.enum([ - "admin", - "standard", - "everyone", - "custom", -]); - -/** - * Single user group as returned by `GET /userGroups`. Mirrors the - * - * @remarks - * persisted document plus a denormalized `userCount`. The compact - * embedded form used inside user list responses is `UserGroupRef`; - * the canonical full document is `UserGroup`. - */ -export type UserGroupListItem = { - _id?: string | undefined; - name?: string | undefined; - type?: UserGroupListItemType | undefined; - orgId?: string | undefined; - slug?: string | undefined; - isDeleted?: boolean | undefined; - userCount?: number | undefined; - createdAt?: string | undefined; - updatedAt?: string | undefined; -}; - -export const UserGroupListItem$zodSchema: z.ZodType = z - .object({ - _id: z.string().optional(), - createdAt: z.iso.datetime({ offset: true }).optional(), - isDeleted: z.boolean().default(false), - name: z.string().optional(), - orgId: z.string().optional(), - slug: z.string().optional(), - type: UserGroupListItemType$zodSchema.optional(), - updatedAt: z.iso.datetime({ offset: true }).optional(), - userCount: z.int().optional(), - }).describe( - "Single user group as returned by `GET /userGroups`. Mirrors the\npersisted document plus a denormalized `userCount`. The compact\nembedded form used inside user list responses is `UserGroupRef`;\nthe canonical full document is `UserGroup`.\n", - ); diff --git a/src/models/usergrouplistresponse.ts b/src/models/usergrouplistresponse.ts deleted file mode 100644 index a8b00058..00000000 --- a/src/models/usergrouplistresponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { PaginationInfo, PaginationInfo$zodSchema } from "./paginationinfo.js"; -import { - UserGroupListItem, - UserGroupListItem$zodSchema, -} from "./usergrouplistitem.js"; - -/** - * Paginated response from `GET /userGroups`. - */ -export type UserGroupListResponse = { - groups: Array; - pagination: PaginationInfo; -}; - -export const UserGroupListResponse$zodSchema: z.ZodType = - z.object({ - groups: z.array(UserGroupListItem$zodSchema), - pagination: PaginationInfo$zodSchema, - }).describe("Paginated response from `GET /userGroups`."); diff --git a/src/models/usergroupref.ts b/src/models/usergroupref.ts deleted file mode 100644 index 8eb5bde9..00000000 --- a/src/models/usergroupref.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ClosedEnum } from "../types/enums.js"; - -export const UserGroupRefType = { - Admin: "admin", - Standard: "standard", - Everyone: "everyone", - Custom: "custom", -} as const; -export type UserGroupRefType = ClosedEnum; - -export const UserGroupRefType$zodSchema = z.enum([ - "admin", - "standard", - "everyone", - "custom", -]); - -/** - * Compact reference to a user group as embedded in user list responses. - * - * @remarks - * For the full group document use `GET /userGroups/{id}` / - * the `UserGroup` schema. - */ -export type UserGroupRef = { - _id?: string | undefined; - name?: string | undefined; - type?: UserGroupRefType | undefined; -}; - -export const UserGroupRef$zodSchema: z.ZodType = z.object({ - _id: z.string().optional(), - name: z.string().optional(), - type: UserGroupRefType$zodSchema.optional(), -}).describe( - "Compact reference to a user group as embedded in user list responses.\nFor the full group document use `GET /userGroups/{id}` /\nthe `UserGroup` schema.\n", -); diff --git a/src/models/userlistitem.ts b/src/models/userlistitem.ts deleted file mode 100644 index 62dd9c7c..00000000 --- a/src/models/userlistitem.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ClosedEnum } from "../types/enums.js"; -import { UserGroupRef, UserGroupRef$zodSchema } from "./usergroupref.js"; - -/** - * High-level org role derived from group membership. - * - * @remarks - * `Admin` if the user belongs to the `admin` group, otherwise - * `Member`. - */ -export const UserListItemRole = { - Admin: "Admin", - Member: "Member", -} as const; -/** - * High-level org role derived from group membership. - * - * @remarks - * `Admin` if the user belongs to the `admin` group, otherwise - * `Member`. - */ -export type UserListItemRole = ClosedEnum; - -export const UserListItemRole$zodSchema = z.enum([ - "Admin", - "Member", -]).describe( - "High-level org role derived from group membership.\n`Admin` if the user belongs to the `admin` group, otherwise\n`Member`.\n", -); - -/** - * Trimmed user representation returned by `GET /users` and similar - * - * @remarks - * list endpoints. Differs from the full `User` schema: includes - * list-only fields (`role`, `groupCount`, `userGroups`, `isActive`, - * `isBlocked`) and uses millisecond Unix timestamps - * (`createdAtTimestamp`, `updatedAtTimestamp`) instead of ISO - * date-times. - */ -export type UserListItem = { - id?: string | undefined; - userId?: string | undefined; - orgId?: string | undefined; - name?: string | undefined; - email?: string | undefined; - role?: UserListItemRole | undefined; - isActive?: boolean | undefined; - isBlocked?: boolean | undefined; - hasLoggedIn?: boolean | undefined; - groupCount?: number | undefined; - userGroups?: Array | undefined; - createdAtTimestamp?: number | undefined; - updatedAtTimestamp?: number | undefined; -}; - -export const UserListItem$zodSchema: z.ZodType = z.object({ - createdAtTimestamp: z.int().optional(), - email: z.string().optional(), - groupCount: z.int().optional(), - hasLoggedIn: z.boolean().optional(), - id: z.string().optional(), - isActive: z.boolean().optional(), - isBlocked: z.boolean().optional(), - name: z.string().optional(), - orgId: z.string().optional(), - role: UserListItemRole$zodSchema.optional(), - updatedAtTimestamp: z.int().optional(), - userGroups: z.array(UserGroupRef$zodSchema).optional(), - userId: z.string().optional(), -}).describe( - "Trimmed user representation returned by `GET /users` and similar\nlist endpoints. Differs from the full `User` schema: includes\nlist-only fields (`role`, `groupCount`, `userGroups`, `isActive`,\n`isBlocked`) and uses millisecond Unix timestamps\n(`createdAtTimestamp`, `updatedAtTimestamp`) instead of ISO\ndate-times.\n", -); diff --git a/src/models/userlistresponse.ts b/src/models/userlistresponse.ts deleted file mode 100644 index c0cc3185..00000000 --- a/src/models/userlistresponse.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { PaginationInfo, PaginationInfo$zodSchema } from "./paginationinfo.js"; -import { UserListItem, UserListItem$zodSchema } from "./userlistitem.js"; - -/** - * Paginated response from `GET /users`. - */ -export type UserListResponse = { - users: Array; - pagination: PaginationInfo; -}; - -export const UserListResponse$zodSchema: z.ZodType = z.object( - { - pagination: PaginationInfo$zodSchema, - users: z.array(UserListItem$zodSchema), - }, -).describe("Paginated response from `GET /users`."); diff --git a/src/models/userteammembership.ts b/src/models/userteammembership.ts deleted file mode 100644 index e779c15c..00000000 --- a/src/models/userteammembership.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { - TeamMemberSummary, - TeamMemberSummary$zodSchema, -} from "./teammembersummary.js"; -import { - TeamPermissionEdge, - TeamPermissionEdge$zodSchema, -} from "./teampermissionedge.js"; - -/** - * Per-caller view of a team, as returned by `GET /teams/user/teams`. - * - * @remarks - * Extends the canonical `Team` document with the caller's - * `currentUserPermission` edge and capability flags - * (`canEdit` / `canDelete` / `canManageMembers`) computed from that - * permission. - */ -export type UserTeamMembership = { - id: string; - name: string; - description?: string | null | undefined; - createdBy?: string | undefined; - orgId: string; - memberCount?: number | undefined; - members?: Array | undefined; - createdAtTimestamp?: number | undefined; - updatedAtTimestamp?: number | undefined; - currentUserPermission?: TeamPermissionEdge | undefined; - canEdit?: boolean | undefined; - canDelete?: boolean | undefined; - canManageMembers?: boolean | undefined; -}; - -export const UserTeamMembership$zodSchema: z.ZodType = z - .object({ - canDelete: z.boolean().optional(), - canEdit: z.boolean().optional(), - canManageMembers: z.boolean().optional(), - createdAtTimestamp: z.int().optional(), - createdBy: z.string().optional(), - currentUserPermission: TeamPermissionEdge$zodSchema.optional(), - description: z.string().nullable().optional(), - id: z.string(), - memberCount: z.int().optional(), - members: z.array(TeamMemberSummary$zodSchema).optional(), - name: z.string(), - orgId: z.string(), - updatedAtTimestamp: z.int().optional(), - }).describe( - "Per-caller view of a team, as returned by `GET /teams/user/teams`.\nExtends the canonical `Team` document with the caller's\n`currentUserPermission` edge and capability flags\n(`canEdit` / `canDelete` / `canManageMembers`) computed from that\npermission.\n", - ); diff --git a/src/models/userteamsresponse.ts b/src/models/userteamsresponse.ts deleted file mode 100644 index 4e2a9b01..00000000 --- a/src/models/userteamsresponse.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ClosedEnum } from "../types/enums.js"; -import { - CompactPaginationInfo, - CompactPaginationInfo$zodSchema, -} from "./compactpaginationinfo.js"; -import { - UserTeamMembership, - UserTeamMembership$zodSchema, -} from "./userteammembership.js"; - -export const UserTeamsResponseStatus = { - Success: "success", - Error: "error", -} as const; -export type UserTeamsResponseStatus = ClosedEnum< - typeof UserTeamsResponseStatus ->; - -export const UserTeamsResponseStatus$zodSchema = z.enum([ - "success", - "error", -]); - -/** - * Paginated response from `GET /teams/user/teams`. - */ -export type UserTeamsResponse = { - status: UserTeamsResponseStatus; - message?: string | undefined; - teams: Array; - pagination: CompactPaginationInfo; -}; - -export const UserTeamsResponse$zodSchema: z.ZodType = z - .object({ - message: z.string().optional(), - pagination: CompactPaginationInfo$zodSchema, - status: UserTeamsResponseStatus$zodSchema, - teams: z.array(UserTeamMembership$zodSchema), - }).describe("Paginated response from `GET /teams/user/teams`."); diff --git a/src/models/websearchprovideritem.ts b/src/models/websearchprovideritem.ts new file mode 100644 index 00000000..6c9bfb85 --- /dev/null +++ b/src/models/websearchprovideritem.ts @@ -0,0 +1,29 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { + WebSearchProviderType, + WebSearchProviderType$zodSchema, +} from "./websearchprovidertype.js"; + +/** + * Web search provider configuration item returned by getWebSearchProviders + */ +export type WebSearchProviderItem = { + provider: WebSearchProviderType; + providerKey: string; + configuration: { [k: string]: any }; + isDefault: boolean; +}; + +export const WebSearchProviderItem$zodSchema: z.ZodType = + z.object({ + configuration: z.record(z.string(), z.any()), + isDefault: z.boolean(), + provider: WebSearchProviderType$zodSchema, + providerKey: z.string(), + }).describe( + "Web search provider configuration item returned by getWebSearchProviders", + ); diff --git a/src/models/websearchprovidersresponse.ts b/src/models/websearchprovidersresponse.ts new file mode 100644 index 00000000..203ac65c --- /dev/null +++ b/src/models/websearchprovidersresponse.ts @@ -0,0 +1,44 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; +import { + WebSearchProviderItem, + WebSearchProviderItem$zodSchema, +} from "./websearchprovideritem.js"; +import { + WebSearchSettings, + WebSearchSettings$zodSchema, +} from "./websearchsettings.js"; + +export const WebSearchProvidersResponseStatus = { + Success: "success", +} as const; +export type WebSearchProvidersResponseStatus = ClosedEnum< + typeof WebSearchProvidersResponseStatus +>; + +export const WebSearchProvidersResponseStatus$zodSchema = z.enum([ + "success", +]); + +/** + * Response for getWebSearchProviders + */ +export type WebSearchProvidersResponse = { + status: WebSearchProvidersResponseStatus; + providers: Array; + settings: WebSearchSettings; + message: string; +}; + +export const WebSearchProvidersResponse$zodSchema: z.ZodType< + WebSearchProvidersResponse +> = z.object({ + message: z.string(), + providers: z.array(WebSearchProviderItem$zodSchema), + settings: WebSearchSettings$zodSchema, + status: WebSearchProvidersResponseStatus$zodSchema, +}).describe("Response for getWebSearchProviders"); diff --git a/src/models/websearchprovidertype.ts b/src/models/websearchprovidertype.ts new file mode 100644 index 00000000..8ed72996 --- /dev/null +++ b/src/models/websearchprovidertype.ts @@ -0,0 +1,27 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { ClosedEnum } from "../types/enums.js"; + +/** + * Supported web search provider + */ +export const WebSearchProviderType = { + Duckduckgo: "duckduckgo", + Serper: "serper", + Tavily: "tavily", + Exa: "exa", +} as const; +/** + * Supported web search provider + */ +export type WebSearchProviderType = ClosedEnum; + +export const WebSearchProviderType$zodSchema = z.enum([ + "duckduckgo", + "serper", + "tavily", + "exa", +]).describe("Supported web search provider"); diff --git a/src/models/websearchsettings.ts b/src/models/websearchsettings.ts new file mode 100644 index 00000000..f9ec16a8 --- /dev/null +++ b/src/models/websearchsettings.ts @@ -0,0 +1,21 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +/** + * Normalized web search global settings returned by getWebSearchProviders + */ +export type WebSearchSettings = { + includeImages: boolean; + maxImages?: number | undefined; +}; + +export const WebSearchSettings$zodSchema: z.ZodType = z + .object({ + includeImages: z.boolean(), + maxImages: z.int().optional(), + }).describe( + "Normalized web search global settings returned by getWebSearchProviders", + ); diff --git a/src/tool-names.ts b/src/tool-names.ts index ff73559b..a0bd5c1c 100644 --- a/src/tool-names.ts +++ b/src/tool-names.ts @@ -1,23 +1,6 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + // Auto-generated at build time -export const toolNames: Array<{ name: string; description: string }>= [ - { - "name": "pipeshub_sources", - "description": "Discover available chat sources and AI models in one call.\n\nReturns up to three sections:\n\n- `sources` — every connector instance the org has wired up plus the\n synthetic `knowledgeBase_` entry for the org's KB. Each\n item's `id` is exactly the value to put in `pipeshub_chat`'s or\n `pipeshub_search`'s `apps` filter.\n- `llmModels` — chat / generation models. Each item's `modelKey`\n is the value to pass on `pipeshub_chat` / `pipeshub_search` as\n `modelKey`. Pick `isDefault: true` unless the user asks for a\n specific model.\n- `embeddingModels` — vector embedding models (only fetched when\n explicitly requested via `include`).\n\nCall this once at the start of a session and cache the result —\nsources and models change infrequently. `sources` and `llmModels`\nare returned by default; pass `include` to override." - }, - { - "name": "pipeshub_chat", - "description": "**Default tool for anything PipesHub-related.** Use this whenever the\nuser asks about their documents, files, knowledge base, company\npolicies, or anything that could plausibly be answered by content in\ntheir PipesHub-indexed sources (Drive, Box, Confluence, Slack, Gmail,\nJira, the org's KB, ...). Do NOT answer those from your own knowledge —\n`pipeshub_chat` grounds the answer in the user's actual data and\nreturns citations.\n\n**When to pick this over other tools:**\n- \"What does say about X?\" → `pipeshub_chat` (NOT search;\n search is only for locating files by name).\n- \"Summarize .\" → `pipeshub_chat`.\n- \"What's our policy on Y?\" → `pipeshub_chat`.\n- \"What do we know about Z?\" → `pipeshub_chat`.\n- \"Find / locate the file named X\" → `pipeshub_search` (then\n `pipeshub_download_record` if the user wants the bytes).\n\n**Conversation lifecycle** — one tool, both start and continue:\n\n- **First turn**: omit `conversationId`. The server creates a new\n conversation; capture `conversationId` from the response.\n- **Follow-up turn**: pass the `conversationId` from the previous\n response. Server-side context is preserved — do NOT replay earlier\n messages, and `filters` is ignored on follow-ups (set once at\n creation).\n\nOnly re-omit `conversationId` (start a fresh conversation) when the\nuser explicitly asks to start over / clear context.\n\nThe response contains the AI's `answer` plus `citations`. To download a\ncited document, take `citations[*].recordId` and call\n`pipeshub_download_record`." - }, - { - "name": "pipeshub_search", - "description": "Vector / semantic search across the org's indexed documents.\n\n**Use this only when the user wants to LOCATE a document** — by name,\ntopic, or a phrase to grep for. For \"what does the document say about\nX?\" or any open-ended question, use `pipeshub_chat` instead, which\ndoes the retrieval internally and grounds the answer in citations.\n\nTypical uses:\n- Resolve a filename / phrase into a `recordId` for\n `pipeshub_download_record`.\n- Show the user a ranked list of matching files when they ask \"find /\n search for X\".\n\nThe response is trimmed to one row per hit:\n`{ recordId, recordName, score, snippet, mimeType, webUrl, ... }`.\nHighest `score` first; multiple hits may share the same `recordId`\n(different chunks of the same record)." - }, - { - "name": "pipeshub_download_record", - "description": "Stream the binary content of a single record from PipesHub.\n\nTypical sources for the `recordId`:\n- A chat citation:\n `pipeshub_chat` response → `citations[*].recordId`.\n- A search result:\n `pipeshub_search` response → `hits[*].recordId` /\n `uniqueRecords[*].recordId`.\n\nResponse `Content-Type` is forwarded from the upstream service —\n`application/pdf`, `application/octet-stream`, etc. Binary content is\nreturned base64-encoded; text content is returned inline." - }, - { - "name": "pipeshub_directory", - "description": "Look up people, groups, and teams in PipesHub. One tool with five\nactions — pick the right `action`:\n\n- `whoami` — who is the caller? Use this whenever you need the\n authenticated user's own id, email, or full name (e.g. before\n `get_user` on themselves).\n- `list_users` — search / page through org users.\n- `get_user` — full `User` document for one user (requires `userId`).\n- `list_groups` — list user groups with `userCount`.\n- `list_my_teams` — teams the caller belongs to, with capability flags\n (`canEdit` / `canDelete` / `canManageMembers`).\n\nOutput shape varies by action; see each action's docs above." - } -]; +export const toolNames: Array<{ name: string; description: string }> = [];