@membranehq/sdk 0.17.0 → 0.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/bundle.d.ts +91 -1
  2. package/dist/bundle.js +22 -17
  3. package/dist/bundle.js.map +1 -1
  4. package/dist/dts/accessors/connections-accessors.d.ts +2 -0
  5. package/dist/dts/accessors/integrations-accessors.d.ts +1 -0
  6. package/dist/dts/agent/index.d.ts +1 -0
  7. package/dist/dts/agent/session.d.ts +2 -0
  8. package/dist/dts/agent/worker-contracts.d.ts +43 -0
  9. package/dist/dts/client-tokens/index.d.ts +1 -0
  10. package/dist/dts/client-tokens/types.d.ts +76 -0
  11. package/dist/dts/client.d.ts +1 -1
  12. package/dist/dts/index.browser.d.ts +2 -0
  13. package/dist/dts/oauth/index.d.ts +1 -0
  14. package/dist/dts/oauth/types.d.ts +15 -0
  15. package/dist/dts/workspace-elements/api/action-run-log-records-api.d.ts +10 -0
  16. package/dist/dts/workspace-elements/api/actions-api.d.ts +24 -0
  17. package/dist/dts/workspace-elements/api/connected-products-api.d.ts +83 -0
  18. package/dist/dts/workspace-elements/api/connections-api.d.ts +5 -0
  19. package/dist/dts/workspace-elements/api/data-link-table-instances-api.d.ts +1 -0
  20. package/dist/dts/workspace-elements/api/data-sources-api.d.ts +20 -0
  21. package/dist/dts/workspace-elements/api/external-api-logs-api.d.ts +1 -0
  22. package/dist/dts/workspace-elements/api/external-event-log-records-api.d.ts +1 -0
  23. package/dist/dts/workspace-elements/api/external-event-pulls-api.d.ts +1 -0
  24. package/dist/dts/workspace-elements/api/external-event-subscriptions-api.d.ts +1 -0
  25. package/dist/dts/workspace-elements/api/external-events-api.d.ts +1 -0
  26. package/dist/dts/workspace-elements/api/field-mappings-api.d.ts +44 -0
  27. package/dist/dts/workspace-elements/api/flow-runs-api.d.ts +6 -0
  28. package/dist/dts/workspace-elements/api/flows-api.d.ts +20 -0
  29. package/dist/dts/workspace-elements/api/index.d.ts +1 -0
  30. package/dist/dts/workspace-elements/api/integrations-api.d.ts +7 -0
  31. package/dist/dts/workspace-elements/api/packages-api.d.ts +9 -0
  32. package/dist/dts/workspace-elements/base/action-instances/index.d.ts +2 -0
  33. package/dist/dts/workspace-elements/base/actions/index.d.ts +6 -0
  34. package/dist/dts/workspace-elements/base/connected-products/index.d.ts +58 -0
  35. package/dist/dts/workspace-elements/base/connection-requests/index.d.ts +41 -0
  36. package/dist/dts/workspace-elements/base/connections/index.d.ts +0 -15
  37. package/dist/dts/workspace-elements/base/connectors/auth-success-records.d.ts +13 -0
  38. package/dist/dts/workspace-elements/base/connectors/index.d.ts +13 -2
  39. package/dist/dts/workspace-elements/base/data-sources/index.d.ts +8 -0
  40. package/dist/dts/workspace-elements/base/field-mappings/index.d.ts +14 -0
  41. package/dist/dts/workspace-elements/base/flows/index.d.ts +6 -0
  42. package/dist/dts/workspace-elements/base/index.d.ts +2 -0
  43. package/dist/dts/workspace-elements/base/integrations/index.d.ts +9 -1
  44. package/dist/dts/workspace-elements/base/packages/index.d.ts +4 -0
  45. package/dist/dts/workspace-elements/types.d.ts +6 -1
  46. package/dist/dts/workspaces/compare.d.ts +7 -0
  47. package/dist/index.browser.d.mts +557 -21
  48. package/dist/index.browser.d.ts +557 -21
  49. package/dist/index.browser.js +275 -35
  50. package/dist/index.browser.js.map +1 -1
  51. package/dist/index.browser.mjs +229 -36
  52. package/dist/index.browser.mjs.map +1 -1
  53. package/dist/index.node.d.mts +557 -21
  54. package/dist/index.node.d.ts +557 -21
  55. package/dist/index.node.js +257 -37
  56. package/dist/index.node.js.map +1 -1
  57. package/dist/index.node.mjs +229 -37
  58. package/dist/index.node.mjs.map +1 -1
  59. package/package.json +2 -1
@@ -8,13 +8,14 @@ var deepEqual = require('fast-deep-equal');
8
8
  var structuredClonePolyfill = require('@ungap/structured-clone');
9
9
  var urljoin = require('url-join');
10
10
  var v4 = require('zod-validation-error/v4');
11
+ var diff = require('diff');
12
+ var yaml = require('js-yaml');
11
13
  var qs = require('qs');
12
14
  var penpal = require('penpal');
13
15
  var axiosOriginal = require('axios');
14
16
  var zodValidationError = require('zod-validation-error');
15
17
  var fs = require('fs');
16
18
  var path = require('path');
17
- var yaml = require('js-yaml');
18
19
 
19
20
  function _interopNamespaceDefault(e) {
20
21
  var n = Object.create(null);
@@ -33,9 +34,9 @@ function _interopNamespaceDefault(e) {
33
34
  return Object.freeze(n);
34
35
  }
35
36
 
37
+ var yaml__namespace = /*#__PURE__*/_interopNamespaceDefault(yaml);
36
38
  var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
37
39
  var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
38
- var yaml__namespace = /*#__PURE__*/_interopNamespaceDefault(yaml);
39
40
 
40
41
  exports.ErrorType = void 0;
41
42
  (function (ErrorType) {
@@ -3495,6 +3496,7 @@ exports.WorkspaceElementType = void 0;
3495
3496
  WorkspaceElementType["ExternalEventPull"] = "external-event-pull";
3496
3497
  WorkspaceElementType["Screen"] = "screen";
3497
3498
  WorkspaceElementType["ActionRunLogRecord"] = "action-run-log-record";
3499
+ WorkspaceElementType["ConnectedProduct"] = "connected-product";
3498
3500
  })(exports.WorkspaceElementType || (exports.WorkspaceElementType = {}));
3499
3501
  exports.WorkspaceEventType = void 0;
3500
3502
  (function (WorkspaceEventType) {
@@ -3573,6 +3575,10 @@ const BaseIntegrationLevelMembraneInterfaceEditableProperties = BaseMembraneInte
3573
3575
  .string()
3574
3576
  .optional()
3575
3577
  .describe('UUID of the integration; alternative to integrationId when creating from export. Resolved to integrationId by the API.'),
3578
+ integrationKey: z.z
3579
+ .string()
3580
+ .optional()
3581
+ .describe('Key of the integration; alternative to integrationId. Resolved to integrationId by the API.'),
3576
3582
  parentId: z.z
3577
3583
  .string()
3578
3584
  .optional()
@@ -3581,6 +3587,10 @@ const BaseIntegrationLevelMembraneInterfaceEditableProperties = BaseMembraneInte
3581
3587
  .string()
3582
3588
  .optional()
3583
3589
  .describe('UUID of the parent element; alternative to parentId when creating (e.g. from export). Resolved to parentId by the API.'),
3590
+ parentKey: z.z
3591
+ .string()
3592
+ .optional()
3593
+ .describe('Key of the parent element; alternative to parentId. Resolved to parentId by the API.'),
3584
3594
  connectionId: z.z
3585
3595
  .string()
3586
3596
  .optional()
@@ -3737,6 +3747,8 @@ const FieldMappingSpecificProperties = z.z.object({
3737
3747
  instanceKey: z.z.string().optional(),
3738
3748
  fieldMappingId: z.z.string().optional(),
3739
3749
  universalFieldMappingId: z.z.string().optional(),
3750
+ dataSourceId: z.z.string().optional(),
3751
+ dataSourceUuid: z.z.string().optional(),
3740
3752
  dataSourceKey: z.z.string().optional(),
3741
3753
  appSchema: DataSchema.optional(),
3742
3754
  direction: z.z.enum(exports.FieldMappingDirection).optional(),
@@ -3938,6 +3950,41 @@ const ActionReadOnlyProperties = BaseIntegrationLevelMembraneInterfaceReadOnlyPr
3938
3950
  const BaseAction = BaseMembraneInterface.merge(ActionEditableProperties).merge(ActionReadOnlyProperties);
3939
3951
  const BaseActionInstance = BaseAction;
3940
3952
 
3953
+ const CONNECTION_REQUEST_SCREEN_PATH = 'screens/connect';
3954
+ const CONNECTION_REQUEST_ID_PARAM = 'connectionRequestId';
3955
+ function getConnectionRequestUrl(baseUri, requestId) {
3956
+ return `${baseUri}/${CONNECTION_REQUEST_SCREEN_PATH}?${CONNECTION_REQUEST_ID_PARAM}=${requestId}`;
3957
+ }
3958
+ const CreateConnectionRequestPayload = z.z.object({
3959
+ integrationId: z.z.string().optional(),
3960
+ integrationKey: z.z.string().optional(),
3961
+ connectorId: z.z.string().optional(),
3962
+ connectorVersion: z.z.string().optional(),
3963
+ connectionId: z.z.string().optional(),
3964
+ name: z.z.string().optional(),
3965
+ allowMultipleConnections: z.z.boolean().optional(),
3966
+ connectorParameters: z.z.record(z.z.string(), z.z.unknown()).optional(),
3967
+ redirectUri: z.z.string().url().optional(),
3968
+ });
3969
+ const ConnectionRequest = z.z.object({
3970
+ requestId: z.z.string(),
3971
+ tenantId: z.z.string(),
3972
+ integrationId: z.z.string().optional(),
3973
+ integrationKey: z.z.string().optional(),
3974
+ connectorId: z.z.string().optional(),
3975
+ connectorVersion: z.z.string().optional(),
3976
+ connectionId: z.z.string().optional(),
3977
+ name: z.z.string().optional(),
3978
+ allowMultipleConnections: z.z.boolean().optional(),
3979
+ connectorParameters: z.z.record(z.z.string(), z.z.unknown()).optional(),
3980
+ redirectUri: z.z.string().url().optional(),
3981
+ status: z.z.enum(['pending', 'success', 'cancelled', 'error']),
3982
+ resultConnectionId: z.z.string().optional(),
3983
+ resultError: ErrorDataSchema.optional(),
3984
+ createdAt: z.z.coerce.date(),
3985
+ url: z.z.string(),
3986
+ });
3987
+
3941
3988
  const ConnectionEditableProperties = z.z.object({
3942
3989
  name: z.z.string().optional(),
3943
3990
  meta: z.z.record(z.z.string(), z.z.any()).optional(),
@@ -3946,14 +3993,6 @@ const ConnectionEditableProperties = z.z.object({
3946
3993
  connectorParameters: z.z.unknown().optional(),
3947
3994
  input: z.z.unknown().optional(),
3948
3995
  });
3949
- const ConnectionRequest = z.z.object({
3950
- path: z.z.any(),
3951
- method: z.z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']).optional(),
3952
- pathParameters: z.z.record(z.z.string(), z.z.string()).optional(),
3953
- headers: z.z.record(z.z.string(), z.z.string()).optional(),
3954
- query: z.z.record(z.z.string(), z.z.string()).optional(),
3955
- data: z.z.any().optional(),
3956
- });
3957
3996
  const BaseConnection = BaseWorkspaceElement.extend({
3958
3997
  ...TenantLayerElement.shape,
3959
3998
  name: z.z.string(),
@@ -8970,6 +9009,18 @@ const ConnectorEventHandlerMethods = {
8970
9009
  },
8971
9010
  };
8972
9011
 
9012
+ const ConnectorAuthSuccessRecord = z.z.object({
9013
+ id: z.z.string(),
9014
+ connectorId: z.z.string(),
9015
+ connectorVersion: z.z.string(),
9016
+ authOptionKey: z.z.string().optional(),
9017
+ connectorParameters: z.z.any().optional(),
9018
+ connectionInput: z.z.any().optional(),
9019
+ credentials: z.z.any().optional(),
9020
+ logs: z.z.array(z.z.any()),
9021
+ createdAt: z.z.string(),
9022
+ });
9023
+
8973
9024
  const CONNECTOR_VERSION_DEVELOPMENT = 'dev';
8974
9025
  const CONNECTOR_VERSION_LATEST = 'latest';
8975
9026
  const CONNECTOR_CATEGORIES = [
@@ -9018,7 +9069,8 @@ const ConnectorSpec = z.z.object({
9018
9069
  operations: z.z.array(z.z.any()).optional(),
9019
9070
  test: ConnectorMethodImplementation.optional(),
9020
9071
  hasReadme: z.z.boolean().optional(),
9021
- appUuid: z.z.string().optional(),
9072
+ externalAppId: z.z.string().optional(),
9073
+ appUuid: z.z.string().optional().describe('[INTERNAL] Deprecated: resolved to externalAppId'),
9022
9074
  knowledgeBaseUuid: z.z.string().optional(),
9023
9075
  workspaceId: z.z.string().optional(),
9024
9076
  data: z.z.any().optional(),
@@ -9110,7 +9162,9 @@ const WriteableConnectorFields = z.z
9110
9162
  key: z.z.string().optional(),
9111
9163
  name: z.z.string().optional(),
9112
9164
  logoUri: z.z.string().optional(),
9113
- appUuid: z.z.string().optional(),
9165
+ externalAppId: z.z.string().optional(),
9166
+ externalAppUuid: z.z.string().optional(),
9167
+ appUuid: z.z.string().optional().describe('[INTERNAL] Deprecated: resolved to externalAppId'),
9114
9168
  categories: z.z.array(z.z.string()).optional(),
9115
9169
  })
9116
9170
  .extend(WritableConnectorVersionData.shape);
@@ -9126,7 +9180,7 @@ const BaseConnector = z.z.object({
9126
9180
  id: z.z.string(),
9127
9181
  key: z.z.string(),
9128
9182
  uuid: z.z.string(),
9129
- appUuid: z.z.string().optional(),
9183
+ externalAppId: z.z.string().optional(),
9130
9184
  name: z.z.string(),
9131
9185
  logoUri: z.z.string(),
9132
9186
  categories: z.z.array(z.z.string()).optional(),
@@ -9762,25 +9816,30 @@ const BaseIntegration = BaseMembraneInterface.extend({
9762
9816
  hasGlobalWebhooks: z.z.boolean().optional(),
9763
9817
  hasUdm: z.z.boolean().optional(),
9764
9818
  isTest: z.z.boolean().optional(),
9765
- appUuid: z.z.string().optional(),
9819
+ externalAppId: z.z.string().optional(),
9820
+ appUuid: z.z.string().optional().describe('[INTERNAL] Deprecated: Use externalAppId instead'),
9766
9821
  isDeactivated: z.z.boolean().optional(),
9767
9822
  authType: z.z.enum(CONNECTOR_AUTH_TYPES).optional(),
9768
9823
  optionsConfig: IntegrationOptions.optional(),
9769
9824
  });
9770
9825
  const IntegrationEditableProperties = BaseMembraneInterfaceEditableProperties.extend({
9771
9826
  logoUri: z.z.string().optional(),
9772
- appUuid: z.z.string().optional(),
9827
+ externalAppId: z.z.string().optional(),
9828
+ externalAppUuid: z.z.string().optional(),
9829
+ appUuid: z.z.string().optional().describe('[INTERNAL] Deprecated: resolved to externalAppId'),
9773
9830
  oAuthCallbackUri: z.z.url().or(z.z.literal('')).optional(),
9774
9831
  logoBase64: z.z.string().optional(),
9775
9832
  connectorVersion: z.z.string().optional(),
9776
9833
  connectorId: z.z.string().optional(),
9777
9834
  connectorUuid: z.z.string().optional(),
9835
+ connectorKey: z.z
9836
+ .string()
9837
+ .optional()
9838
+ .describe('Key of the connector; alternative to connectorId. Resolved to connectorId by the API.'),
9778
9839
  parameters: z.z.record(z.z.string(), z.z.any()).optional(),
9779
9840
  optionsConfig: IntegrationOptions.optional(),
9780
9841
  });
9781
- const IntegrationExportProperties = IntegrationEditableProperties.extend({
9782
- connectorUuid: z.z.string().optional(),
9783
- });
9842
+ const IntegrationExportProperties = IntegrationEditableProperties;
9784
9843
  const AppliedToIntegrations = (elementSchema) => z.z.array(z.z.object({
9785
9844
  element: elementSchema,
9786
9845
  integration: BaseIntegration,
@@ -10087,6 +10146,26 @@ const BaseActionRunLogRecord = ActivityLogRecord.extend({
10087
10146
  meta: z.z.record(z.z.string(), z.z.any()).optional(),
10088
10147
  });
10089
10148
 
10149
+ const ConnectedProductType = z.z.enum(['ai-agent', 'app']);
10150
+ const ConnectedProductAudience = z.z.enum(['personal', 'customers']);
10151
+ const AiAgentAudience = ConnectedProductAudience;
10152
+ const AiAgentType = z.z.enum(['openclaw', 'claude', 'chatgpt', 'custom']);
10153
+ const AiAgentParameters = z.z.object({
10154
+ agentType: AiAgentType.optional(),
10155
+ });
10156
+ const BaseConnectedProduct = z.z.object({
10157
+ id: z.z.string(),
10158
+ name: z.z.string(),
10159
+ key: z.z.string(),
10160
+ type: ConnectedProductType,
10161
+ audience: ConnectedProductAudience.optional(),
10162
+ parameters: AiAgentParameters.optional(),
10163
+ isConnected: z.z.boolean().optional(),
10164
+ lastApiRequestDate: z.z.string().optional(),
10165
+ createdAt: z.z.string().optional(),
10166
+ archivedAt: z.z.string().optional(),
10167
+ });
10168
+
10090
10169
  const ActionApiResponse = BaseAction.extend({
10091
10170
  integration: BaseIntegration.optional(),
10092
10171
  user: BaseCustomer.optional(),
@@ -10337,6 +10416,7 @@ const ConnectPayload = z.z.object({
10337
10416
  allowMultipleConnections: z.z.boolean().optional(),
10338
10417
  redirectUri: z.z.string().optional(),
10339
10418
  customState: z.z.string().optional(),
10419
+ connectionRequestId: z.z.string().optional(),
10340
10420
  });
10341
10421
  const ConnectUIOptions = ConnectPayload.omit({ input: true, redirectUri: true }).extend({
10342
10422
  theme: z.z.enum(['light', 'dark', 'auto']).optional(),
@@ -11209,6 +11289,29 @@ const IncomingWebhookApiResponse = z.z.object({
11209
11289
  subscription: BaseExternalEventSubscription.optional(),
11210
11290
  });
11211
11291
 
11292
+ const CreateConnectedProductRequest = z.z.object({
11293
+ name: z.z.string(),
11294
+ type: ConnectedProductType,
11295
+ audience: ConnectedProductAudience.optional(),
11296
+ parameters: AiAgentParameters.optional(),
11297
+ });
11298
+ const UpdateConnectedProductRequest = z.z.object({
11299
+ name: z.z.string().optional(),
11300
+ type: ConnectedProductType.optional(),
11301
+ audience: ConnectedProductAudience.optional(),
11302
+ parameters: AiAgentParameters.optional(),
11303
+ });
11304
+ const FindConnectedProductsQuery = z.z
11305
+ .object({
11306
+ type: ConnectedProductType.optional(),
11307
+ audience: ConnectedProductAudience.optional(),
11308
+ key: z.z.string().optional(),
11309
+ })
11310
+ .merge(PaginationQuery)
11311
+ .merge(SearchQuery)
11312
+ .merge(IncludeArchivedQuery);
11313
+ const ConnectedProductApiResponse = BaseConnectedProduct;
11314
+
11212
11315
  class DependencyError extends MembraneError {
11213
11316
  constructor(arg, workspaceElementReference) {
11214
11317
  super(arg);
@@ -11804,6 +11907,13 @@ const WorkspaceElementSpecs = {
11804
11907
  hasKey: true,
11805
11908
  isProOnly: true,
11806
11909
  },
11910
+ [exports.WorkspaceElementType.ConnectedProduct]: {
11911
+ type: exports.WorkspaceElementType.ConnectedProduct,
11912
+ apiPath: 'connected-products',
11913
+ name: 'Connected Product',
11914
+ namePlural: 'Connected Products',
11915
+ hasKey: true,
11916
+ },
11807
11917
  };
11808
11918
  function getEditablePathsForElementType(elementType) {
11809
11919
  return getEditablePathsForElementType$1(WorkspaceElementSpecs, elementType);
@@ -12780,13 +12890,14 @@ exports.WorkspaceElementChangeType = void 0;
12780
12890
  WorkspaceElementChangeType["DELETE"] = "delete";
12781
12891
  })(exports.WorkspaceElementChangeType || (exports.WorkspaceElementChangeType = {}));
12782
12892
  function compareWorkspaceExports(baseExport, targetExport, options = { includeDeletions: true }) {
12783
- const changes = [];
12893
+ const changes = {};
12784
12894
  const comparison = {
12785
12895
  [exports.WorkspaceElementChangeType.CREATE]: new Set(),
12786
12896
  [exports.WorkspaceElementChangeType.UPDATE]: new Set(),
12787
12897
  [exports.WorkspaceElementChangeType.DELETE]: new Set(),
12788
12898
  };
12789
12899
  const sourceUuidByTargetUuid = new Map();
12900
+ const diffs = [];
12790
12901
  const integrationMap = buildIntegrationsMap([
12791
12902
  ...(baseExport[exports.WorkspaceElementType.Integration] || []),
12792
12903
  ...(targetExport[exports.WorkspaceElementType.Integration] || []),
@@ -12801,35 +12912,46 @@ function compareWorkspaceExports(baseExport, targetExport, options = { includeDe
12801
12912
  for (const element of baseElements) {
12802
12913
  const intIdentifier = getIntegrationIdentifier(element, integrationMap);
12803
12914
  const selector = getElementSelector(type, element.key, intIdentifier);
12804
- baseMap.set(selector, element);
12915
+ baseMap.set(selector, { type, element });
12805
12916
  allSelectors.add(selector);
12806
12917
  }
12807
12918
  const targetElements = targetExport[type] || [];
12808
12919
  for (const element of targetElements) {
12809
12920
  const intIdentifier = getIntegrationIdentifier(element, integrationMap);
12810
12921
  const selector = getElementSelector(type, element.key, intIdentifier);
12811
- targetMap.set(selector, element);
12922
+ targetMap.set(selector, { type, element });
12812
12923
  allSelectors.add(selector);
12813
12924
  }
12814
12925
  }
12815
12926
  for (const selector of allSelectors) {
12816
- const baseElement = baseMap.get(selector);
12817
- const targetElement = targetMap.get(selector);
12818
- if (baseElement && targetElement && baseElement.uuid !== targetElement.uuid) {
12819
- sourceUuidByTargetUuid.set(targetElement.uuid, baseElement.uuid);
12927
+ const base = baseMap.get(selector);
12928
+ const target = targetMap.get(selector);
12929
+ if (base && target && base.element.uuid !== target.element.uuid) {
12930
+ sourceUuidByTargetUuid.set(target.element.uuid, base.element.uuid);
12820
12931
  }
12821
- const change = compareElementExports(baseElement, targetElement);
12932
+ const change = compareElementExports(base === null || base === void 0 ? void 0 : base.element, target === null || target === void 0 ? void 0 : target.element);
12822
12933
  if (options.includeDeletions === false && (change === null || change === void 0 ? void 0 : change.type) === exports.WorkspaceElementChangeType.DELETE) {
12823
12934
  continue;
12824
12935
  }
12825
- if (change) {
12826
- changes.push(change);
12936
+ if (!change) {
12937
+ continue;
12827
12938
  }
12828
- }
12829
- changes.forEach((change) => {
12939
+ const subject = target || base;
12940
+ const integrationKey = getIntegrationIdentifier(subject.element, integrationMap);
12941
+ const path = getMembraneElementPath(subject.type, subject.element.key, integrationKey);
12942
+ changes[change.uuid] = { elementType: subject.type, path };
12830
12943
  comparison[change.type].add(change.uuid);
12831
- });
12832
- return { comparison, sourceUuidByTargetUuid };
12944
+ if (options.includeDiff) {
12945
+ const baseYaml = base ? yaml__namespace.dump(base.element) : '';
12946
+ const targetYaml = target ? yaml__namespace.dump(target.element) : '';
12947
+ diffs.push(diff.createTwoFilesPatch(`a/${path}`, `b/${path}`, baseYaml, targetYaml));
12948
+ }
12949
+ }
12950
+ const result = { comparison, changes, sourceUuidByTargetUuid };
12951
+ if (options.includeDiff) {
12952
+ result.diff = diffs.join('\n').trim();
12953
+ }
12954
+ return result;
12833
12955
  }
12834
12956
  function compareElementExports(baseElement, targetElement) {
12835
12957
  if (baseElement && !targetElement) {
@@ -14423,7 +14545,7 @@ class ConnectionProxy {
14423
14545
  }
14424
14546
  }
14425
14547
  async function createOrUpdateConnection(options) {
14426
- const { connectionId, integrationKey, integrationId, connectorId, connectorVersion, name, input, connectorParameters, allowMultipleConnections, authOptionKey, apiUri, token, redirectUri, onPopupClosed, } = options !== null && options !== void 0 ? options : {};
14548
+ const { connectionId, integrationKey, integrationId, connectorId, connectorVersion, name, input, connectorParameters, allowMultipleConnections, authOptionKey, connectionRequestId, apiUri, token, redirectUri, onPopupClosed, } = options !== null && options !== void 0 ? options : {};
14427
14549
  let connectionType = await detectConnectionType(options);
14428
14550
  if (redirectUri) {
14429
14551
  connectionType = ConnectionType.REDIRECT;
@@ -14443,6 +14565,7 @@ async function createOrUpdateConnection(options) {
14443
14565
  name,
14444
14566
  authOptionKey,
14445
14567
  allowMultipleConnections,
14568
+ connectionRequestId,
14446
14569
  requestId,
14447
14570
  redirectUri,
14448
14571
  };
@@ -14460,6 +14583,7 @@ async function createOrUpdateConnection(options) {
14460
14583
  const { stopSSE } = createSSEListener({
14461
14584
  apiUri: apiUri,
14462
14585
  requestId,
14586
+ token,
14463
14587
  handler: eventHandler,
14464
14588
  });
14465
14589
  function cleanup() {
@@ -14574,8 +14698,8 @@ const createCrossWindowListener = ({ handler }) => {
14574
14698
  },
14575
14699
  };
14576
14700
  };
14577
- const createSSEListener = ({ apiUri, requestId, handler, }) => {
14578
- const sseUrl = urljoin(apiUri, '/sse/connection-events', requestId);
14701
+ const createSSEListener = ({ apiUri, requestId, token, handler, }) => {
14702
+ const sseUrl = urljoin(apiUri, '/sse/connection-events', requestId) + `?token=${encodeURIComponent(token)}`;
14579
14703
  let eventSource = null;
14580
14704
  const closeSseConnection = () => {
14581
14705
  eventSource === null || eventSource === void 0 ? void 0 : eventSource.close();
@@ -15096,6 +15220,8 @@ exports.AgentName = void 0;
15096
15220
  AgentName["MEMBRANE"] = "membrane";
15097
15221
  AgentName["MEMBRANE_CORE"] = "membrane-core";
15098
15222
  AgentName["SELF_INTEGRATING"] = "self-integrating";
15223
+ AgentName["CONNECTION_BUILDING"] = "connection-building";
15224
+ AgentName["ACTION_BUILDING"] = "action-building";
15099
15225
  AgentName["UNIVERSE"] = "universe";
15100
15226
  })(exports.AgentName || (exports.AgentName = {}));
15101
15227
  const AgentSession = z.z.object({
@@ -15109,7 +15235,9 @@ const AgentSession = z.z.object({
15109
15235
  status: z.z.enum(exports.AgentSessionStatus),
15110
15236
  prompt: z.z.string(),
15111
15237
  error: ErrorDataSchema.optional(),
15112
- lastActivityAt: z.z.iso.datetime(),
15238
+ lastActivityAt: z.z.iso
15239
+ .datetime()
15240
+ .describe('Last meaningful session progress timestamp used for inactivity timeout checks.'),
15113
15241
  title: z.z.string().optional(),
15114
15242
  summary: z.z.string().optional(),
15115
15243
  cost: z.z.number().optional(),
@@ -15136,7 +15264,10 @@ const AgentSessionInputSchema = z.z.object({
15136
15264
  });
15137
15265
  const PatchAgentSessionSchema = z.z.object({
15138
15266
  state: z.z.enum(exports.AgentSessionState).optional(),
15139
- lastActivityAt: z.z.iso.datetime().optional(),
15267
+ lastActivityAt: z.z.iso
15268
+ .datetime()
15269
+ .optional()
15270
+ .describe('Last meaningful session progress timestamp used for inactivity timeout checks.'),
15140
15271
  title: z.z.string().optional(),
15141
15272
  summary: z.z.string().optional(),
15142
15273
  cost: z.z.number().optional(),
@@ -15145,6 +15276,27 @@ const PatchAgentSessionSchema = z.z.object({
15145
15276
  status: z.z.enum(exports.AgentSessionStatus).optional(),
15146
15277
  });
15147
15278
 
15279
+ const SessionCredentials = z.z.object({
15280
+ accessKeyId: z.z.string().min(1),
15281
+ secretAccessKey: z.z.string().min(1),
15282
+ sessionToken: z.z.string().min(1),
15283
+ });
15284
+ const SessionParameters = z.z.object({
15285
+ id: z.z.string().optional(),
15286
+ accessToken: z.z.string().optional(),
15287
+ credentials: SessionCredentials.optional(),
15288
+ apiUri: z.z.string().optional(),
15289
+ prompt: z.z.string().optional(),
15290
+ elementType: z.z.string().optional(),
15291
+ elementId: z.z.string().optional(),
15292
+ customerId: z.z.string().optional(),
15293
+ opencodeSessionUuid: z.z.string().optional(),
15294
+ sessionFilesZipUri: z.z.string().optional(),
15295
+ openRouterApiKey: z.z.string().optional(),
15296
+ modelId: z.z.string().optional(),
15297
+ agentName: z.z.enum(exports.AgentName).optional(),
15298
+ });
15299
+
15148
15300
  exports.AsyncRequestStatus = void 0;
15149
15301
  (function (AsyncRequestStatus) {
15150
15302
  AsyncRequestStatus["PENDING"] = "pending";
@@ -15182,6 +15334,46 @@ const ValidateSelfHostingTokenResponse = z.z.object({
15182
15334
  orgName: z.z.string().optional(),
15183
15335
  });
15184
15336
 
15337
+ const CLIENT_TOKEN_GRANT_TYPES = ['mcp-oauth', 'cli-oauth', 'agent-session', 'api'];
15338
+ const ClientTokenGrantType = z.z.enum(CLIENT_TOKEN_GRANT_TYPES);
15339
+ const ClientToken = z.z.object({
15340
+ id: z.z.string(),
15341
+ workspaceId: z.z.string().optional(),
15342
+ platformUserId: z.z.string().optional(),
15343
+ tenantId: z.z.string().optional(),
15344
+ grantType: ClientTokenGrantType,
15345
+ grantId: z.z.string().optional(),
15346
+ grantName: z.z.string().optional(),
15347
+ connectedProductId: z.z.string().optional(),
15348
+ createdAt: z.z.string(),
15349
+ });
15350
+ const CreateClientTokenResponse = ClientToken.extend({
15351
+ accessToken: z.z.string(),
15352
+ });
15353
+ const CreateClientTokenRequest = z.z.object({
15354
+ grantType: ClientTokenGrantType,
15355
+ grantId: z.z.string(),
15356
+ grantName: z.z.string(),
15357
+ tenantId: z.z.string().optional(),
15358
+ productKey: z.z.string().optional(),
15359
+ });
15360
+ const ClientTokenListResponse = z.z.object({
15361
+ items: z.z.array(ClientToken),
15362
+ });
15363
+
15364
+ const MEMBRANE_CLI_CLIENT_ID = 'membrane-cli';
15365
+ const OAUTH_SCOPE_PLATFORM_USER = 'platform-user';
15366
+ const OAUTH_SCOPE_TENANT = 'tenant';
15367
+ const OAUTH_SCOPES = [OAUTH_SCOPE_PLATFORM_USER, OAUTH_SCOPE_TENANT];
15368
+ const OAuthTokenResponse = z.z.object({
15369
+ access_token: z.z.string(),
15370
+ token_type: z.z.string(),
15371
+ expires_in: z.z.number(),
15372
+ refresh_token: z.z.string().optional(),
15373
+ default_workspace_key: z.z.string().optional(),
15374
+ default_tenant_key: z.z.string().optional(),
15375
+ });
15376
+
15185
15377
  const CONSOLE_ACCOUNT_API_TOKEN_PATH = 'settings/account/api-token';
15186
15378
 
15187
15379
  class UI {
@@ -15821,6 +16013,9 @@ exports.ActivityLogRecord = ActivityLogRecord;
15821
16013
  exports.ActivityStatsQuery = ActivityStatsQuery;
15822
16014
  exports.AgentSession = AgentSession;
15823
16015
  exports.AgentSessionInputSchema = AgentSessionInputSchema;
16016
+ exports.AiAgentAudience = AiAgentAudience;
16017
+ exports.AiAgentParameters = AiAgentParameters;
16018
+ exports.AiAgentType = AiAgentType;
15824
16019
  exports.Alert = Alert;
15825
16020
  exports.AlertDeliverySettingsSchema = AlertDeliverySettingsSchema;
15826
16021
  exports.AlertSchema = AlertSchema;
@@ -15856,6 +16051,7 @@ exports.BaseAppDataSchema = BaseAppDataSchema;
15856
16051
  exports.BaseAppDataSchemaInstance = BaseAppDataSchemaInstance;
15857
16052
  exports.BaseAppEventSubscription = BaseAppEventSubscription;
15858
16053
  exports.BaseAppEventType = BaseAppEventType;
16054
+ exports.BaseConnectedProduct = BaseConnectedProduct;
15859
16055
  exports.BaseConnection = BaseConnection;
15860
16056
  exports.BaseConnector = BaseConnector;
15861
16057
  exports.BaseCustomer = BaseCustomer;
@@ -15885,7 +16081,10 @@ exports.BaseOrgUser = BaseOrgUser;
15885
16081
  exports.BasePackage = BasePackage;
15886
16082
  exports.BaseScreen = BaseScreen;
15887
16083
  exports.BaseWorkspaceElement = BaseWorkspaceElement;
16084
+ exports.CLIENT_TOKEN_GRANT_TYPES = CLIENT_TOKEN_GRANT_TYPES;
15888
16085
  exports.CONFIG_FILE_NAME = CONFIG_FILE_NAME;
16086
+ exports.CONNECTION_REQUEST_ID_PARAM = CONNECTION_REQUEST_ID_PARAM;
16087
+ exports.CONNECTION_REQUEST_SCREEN_PATH = CONNECTION_REQUEST_SCREEN_PATH;
15889
16088
  exports.CONNECTOR_AUTH_TYPES = CONNECTOR_AUTH_TYPES;
15890
16089
  exports.CONNECTOR_CATEGORIES = CONNECTOR_CATEGORIES;
15891
16090
  exports.CONNECTOR_DATA_DIR = CONNECTOR_DATA_DIR;
@@ -15900,6 +16099,9 @@ exports.CONSOLE_ACCOUNT_API_TOKEN_PATH = CONSOLE_ACCOUNT_API_TOKEN_PATH;
15900
16099
  exports.CheckpointApiResponse = CheckpointApiResponse;
15901
16100
  exports.CheckpointDiffOperationSchema = CheckpointDiffOperationSchema;
15902
16101
  exports.CheckpointDiffResponseSchema = CheckpointDiffResponseSchema;
16102
+ exports.ClientToken = ClientToken;
16103
+ exports.ClientTokenGrantType = ClientTokenGrantType;
16104
+ exports.ClientTokenListResponse = ClientTokenListResponse;
15903
16105
  exports.CommonFindElementsQuery = CommonFindElementsQuery;
15904
16106
  exports.CommonFindInstancesQuery = CommonFindInstancesQuery;
15905
16107
  exports.CommonInstancesListQuery = CommonInstancesListQuery;
@@ -15909,6 +16111,9 @@ exports.ConcurrencyError = ConcurrencyError;
15909
16111
  exports.ConfigurationError = ConfigurationError;
15910
16112
  exports.ConnectPayload = ConnectPayload;
15911
16113
  exports.ConnectUIOptions = ConnectUIOptions;
16114
+ exports.ConnectedProductApiResponse = ConnectedProductApiResponse;
16115
+ exports.ConnectedProductAudience = ConnectedProductAudience;
16116
+ exports.ConnectedProductType = ConnectedProductType;
15912
16117
  exports.ConnectionAccessor = ConnectionAccessor;
15913
16118
  exports.ConnectionApiResponse = ConnectionApiResponse;
15914
16119
  exports.ConnectionApiResponseWithSecrets = ConnectionApiResponseWithSecrets;
@@ -15946,6 +16151,7 @@ exports.ConnectorAuthOAuth1 = ConnectorAuthOAuth1;
15946
16151
  exports.ConnectorAuthOAuth2 = ConnectorAuthOAuth2;
15947
16152
  exports.ConnectorAuthProxy = ConnectorAuthProxy;
15948
16153
  exports.ConnectorAuthSpec = ConnectorAuthSpec;
16154
+ exports.ConnectorAuthSuccessRecord = ConnectorAuthSuccessRecord;
15949
16155
  exports.ConnectorAuthWithFunctions = ConnectorAuthWithFunctions;
15950
16156
  exports.ConnectorDataCollectionEventImplementationType = ConnectorDataCollectionEventImplementationType;
15951
16157
  exports.ConnectorDataCollectionMethodKeys = ConnectorDataCollectionMethodKeys;
@@ -15976,7 +16182,11 @@ exports.CreateActionInstanceRequest = CreateActionInstanceRequest;
15976
16182
  exports.CreateActionRequest = CreateActionRequest;
15977
16183
  exports.CreateAgentSession = CreateAgentSession;
15978
16184
  exports.CreateAlert = CreateAlert;
16185
+ exports.CreateClientTokenRequest = CreateClientTokenRequest;
16186
+ exports.CreateClientTokenResponse = CreateClientTokenResponse;
16187
+ exports.CreateConnectedProductRequest = CreateConnectedProductRequest;
15979
16188
  exports.CreateConnectionRequest = CreateConnectionRequest;
16189
+ exports.CreateConnectionRequestPayload = CreateConnectionRequestPayload;
15980
16190
  exports.CreateConnectorRequest = CreateConnectorRequest;
15981
16191
  exports.CreateCustomerRequest = CreateCustomerRequest;
15982
16192
  exports.CreateDataLinkTableRequest = CreateDataLinkTableRequest;
@@ -16108,6 +16318,7 @@ exports.FindAppDataSchemasQuery = FindAppDataSchemasQuery;
16108
16318
  exports.FindAppEventSubscriptionsQuery = FindAppEventSubscriptionsQuery;
16109
16319
  exports.FindAppEventTypesQuery = FindAppEventTypesQuery;
16110
16320
  exports.FindAppEventsQuery = FindAppEventsQuery;
16321
+ exports.FindConnectedProductsQuery = FindConnectedProductsQuery;
16111
16322
  exports.FindConnectionsQuery = FindConnectionsQuery;
16112
16323
  exports.FindConnectionsResponse = FindConnectionsResponse;
16113
16324
  exports.FindCustomersQuery = FindCustomersQuery;
@@ -16215,6 +16426,7 @@ exports.ListFlowInstancesForConnectionQuery = ListFlowInstancesForConnectionQuer
16215
16426
  exports.ListIncomingWebhooksQuery = ListIncomingWebhooksQuery;
16216
16427
  exports.ListPublicConnectorsQuery = ListPublicConnectorsQuery;
16217
16428
  exports.ListPublicPackagesQuery = ListPublicPackagesQuery;
16429
+ exports.MEMBRANE_CLI_CLIENT_ID = MEMBRANE_CLI_CLIENT_ID;
16218
16430
  exports.MEMBRANE_ELEMENT_CONFIG_FILE_NAME = MEMBRANE_ELEMENT_CONFIG_FILE_NAME;
16219
16431
  exports.MIN_FULL_SYNC_INTERVAL_SECONDS = MIN_FULL_SYNC_INTERVAL_SECONDS;
16220
16432
  exports.MIN_PULL_UPDATES_INTERVAL_SECONDS = MIN_PULL_UPDATES_INTERVAL_SECONDS;
@@ -16231,6 +16443,10 @@ exports.NotAuthenticatedError = NotAuthenticatedError;
16231
16443
  exports.NotFoundError = NotFoundError;
16232
16444
  exports.OAUTH1_CONFIG_SCHEMA = OAUTH1_CONFIG_SCHEMA;
16233
16445
  exports.OAUTH_CONFIG_SCHEMA = OAUTH_CONFIG_SCHEMA;
16446
+ exports.OAUTH_SCOPES = OAUTH_SCOPES;
16447
+ exports.OAUTH_SCOPE_PLATFORM_USER = OAUTH_SCOPE_PLATFORM_USER;
16448
+ exports.OAUTH_SCOPE_TENANT = OAUTH_SCOPE_TENANT;
16449
+ exports.OAuthTokenResponse = OAuthTokenResponse;
16234
16450
  exports.OpenRouterNotConfiguredError = OpenRouterNotConfiguredError;
16235
16451
  exports.OpenapiMappingSchema = OpenapiMappingSchema;
16236
16452
  exports.OperationMappingFunction = OperationMappingFunction;
@@ -16282,12 +16498,15 @@ exports.ScreensAccessor = ScreensAccessor;
16282
16498
  exports.SearchQuery = SearchQuery;
16283
16499
  exports.SelfAccessor = SelfAccessor;
16284
16500
  exports.SelfHostingToken = SelfHostingToken;
16501
+ exports.SessionCredentials = SessionCredentials;
16502
+ exports.SessionParameters = SessionParameters;
16285
16503
  exports.StatsFilterQuery = StatsFilterQuery;
16286
16504
  exports.TenantLayerElement = TenantLayerElement;
16287
16505
  exports.UNIFIED_DATA_MODELS = UNIFIED_DATA_MODELS;
16288
16506
  exports.UnitRunError = UnitRunError;
16289
16507
  exports.UpdateActionInstanceRequest = UpdateActionInstanceRequest;
16290
16508
  exports.UpdateActionRequest = UpdateActionRequest;
16509
+ exports.UpdateConnectedProductRequest = UpdateConnectedProductRequest;
16291
16510
  exports.UpdateConnectionRequest = UpdateConnectionRequest;
16292
16511
  exports.UpdateConnectorRequest = UpdateConnectorRequest;
16293
16512
  exports.UpdateCustomerRequest = UpdateCustomerRequest;
@@ -16363,6 +16582,7 @@ exports.getAlertTypesByCategory = getAlertTypesByCategory;
16363
16582
  exports.getAllEventMethodFilePaths = getAllEventMethodFilePaths;
16364
16583
  exports.getBusinessDaysBetween = getBusinessDaysBetween;
16365
16584
  exports.getChildNodeKeys = getChildNodeKeys;
16585
+ exports.getConnectionRequestUrl = getConnectionRequestUrl;
16366
16586
  exports.getConnectorSpecPath = getConnectorSpecPath;
16367
16587
  exports.getConnectorVersionPath = getConnectorVersionPath;
16368
16588
  exports.getDataCollectionCreateFields = getDataCollectionCreateFields;