@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,11 +8,32 @@ 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
 
18
+ function _interopNamespaceDefault(e) {
19
+ var n = Object.create(null);
20
+ if (e) {
21
+ Object.keys(e).forEach(function (k) {
22
+ if (k !== 'default') {
23
+ var d = Object.getOwnPropertyDescriptor(e, k);
24
+ Object.defineProperty(n, k, d.get ? d : {
25
+ enumerable: true,
26
+ get: function () { return e[k]; }
27
+ });
28
+ }
29
+ });
30
+ }
31
+ n.default = e;
32
+ return Object.freeze(n);
33
+ }
34
+
35
+ var yaml__namespace = /*#__PURE__*/_interopNamespaceDefault(yaml);
36
+
16
37
  exports.ErrorType = void 0;
17
38
  (function (ErrorType) {
18
39
  ErrorType["BAD_REQUEST"] = "bad_request";
@@ -3471,6 +3492,7 @@ exports.WorkspaceElementType = void 0;
3471
3492
  WorkspaceElementType["ExternalEventPull"] = "external-event-pull";
3472
3493
  WorkspaceElementType["Screen"] = "screen";
3473
3494
  WorkspaceElementType["ActionRunLogRecord"] = "action-run-log-record";
3495
+ WorkspaceElementType["ConnectedProduct"] = "connected-product";
3474
3496
  })(exports.WorkspaceElementType || (exports.WorkspaceElementType = {}));
3475
3497
  exports.WorkspaceEventType = void 0;
3476
3498
  (function (WorkspaceEventType) {
@@ -3549,6 +3571,10 @@ const BaseIntegrationLevelMembraneInterfaceEditableProperties = BaseMembraneInte
3549
3571
  .string()
3550
3572
  .optional()
3551
3573
  .describe('UUID of the integration; alternative to integrationId when creating from export. Resolved to integrationId by the API.'),
3574
+ integrationKey: z.z
3575
+ .string()
3576
+ .optional()
3577
+ .describe('Key of the integration; alternative to integrationId. Resolved to integrationId by the API.'),
3552
3578
  parentId: z.z
3553
3579
  .string()
3554
3580
  .optional()
@@ -3557,6 +3583,10 @@ const BaseIntegrationLevelMembraneInterfaceEditableProperties = BaseMembraneInte
3557
3583
  .string()
3558
3584
  .optional()
3559
3585
  .describe('UUID of the parent element; alternative to parentId when creating (e.g. from export). Resolved to parentId by the API.'),
3586
+ parentKey: z.z
3587
+ .string()
3588
+ .optional()
3589
+ .describe('Key of the parent element; alternative to parentId. Resolved to parentId by the API.'),
3560
3590
  connectionId: z.z
3561
3591
  .string()
3562
3592
  .optional()
@@ -3713,6 +3743,8 @@ const FieldMappingSpecificProperties = z.z.object({
3713
3743
  instanceKey: z.z.string().optional(),
3714
3744
  fieldMappingId: z.z.string().optional(),
3715
3745
  universalFieldMappingId: z.z.string().optional(),
3746
+ dataSourceId: z.z.string().optional(),
3747
+ dataSourceUuid: z.z.string().optional(),
3716
3748
  dataSourceKey: z.z.string().optional(),
3717
3749
  appSchema: DataSchema.optional(),
3718
3750
  direction: z.z.enum(exports.FieldMappingDirection).optional(),
@@ -3914,6 +3946,41 @@ const ActionReadOnlyProperties = BaseIntegrationLevelMembraneInterfaceReadOnlyPr
3914
3946
  const BaseAction = BaseMembraneInterface.merge(ActionEditableProperties).merge(ActionReadOnlyProperties);
3915
3947
  const BaseActionInstance = BaseAction;
3916
3948
 
3949
+ const CONNECTION_REQUEST_SCREEN_PATH = 'screens/connect';
3950
+ const CONNECTION_REQUEST_ID_PARAM = 'connectionRequestId';
3951
+ function getConnectionRequestUrl(baseUri, requestId) {
3952
+ return `${baseUri}/${CONNECTION_REQUEST_SCREEN_PATH}?${CONNECTION_REQUEST_ID_PARAM}=${requestId}`;
3953
+ }
3954
+ const CreateConnectionRequestPayload = z.z.object({
3955
+ integrationId: z.z.string().optional(),
3956
+ integrationKey: z.z.string().optional(),
3957
+ connectorId: z.z.string().optional(),
3958
+ connectorVersion: z.z.string().optional(),
3959
+ connectionId: z.z.string().optional(),
3960
+ name: z.z.string().optional(),
3961
+ allowMultipleConnections: z.z.boolean().optional(),
3962
+ connectorParameters: z.z.record(z.z.string(), z.z.unknown()).optional(),
3963
+ redirectUri: z.z.string().url().optional(),
3964
+ });
3965
+ const ConnectionRequest = z.z.object({
3966
+ requestId: z.z.string(),
3967
+ tenantId: z.z.string(),
3968
+ integrationId: z.z.string().optional(),
3969
+ integrationKey: z.z.string().optional(),
3970
+ connectorId: z.z.string().optional(),
3971
+ connectorVersion: z.z.string().optional(),
3972
+ connectionId: z.z.string().optional(),
3973
+ name: z.z.string().optional(),
3974
+ allowMultipleConnections: z.z.boolean().optional(),
3975
+ connectorParameters: z.z.record(z.z.string(), z.z.unknown()).optional(),
3976
+ redirectUri: z.z.string().url().optional(),
3977
+ status: z.z.enum(['pending', 'success', 'cancelled', 'error']),
3978
+ resultConnectionId: z.z.string().optional(),
3979
+ resultError: ErrorDataSchema.optional(),
3980
+ createdAt: z.z.coerce.date(),
3981
+ url: z.z.string(),
3982
+ });
3983
+
3917
3984
  const ConnectionEditableProperties = z.z.object({
3918
3985
  name: z.z.string().optional(),
3919
3986
  meta: z.z.record(z.z.string(), z.z.any()).optional(),
@@ -3922,14 +3989,6 @@ const ConnectionEditableProperties = z.z.object({
3922
3989
  connectorParameters: z.z.unknown().optional(),
3923
3990
  input: z.z.unknown().optional(),
3924
3991
  });
3925
- const ConnectionRequest = z.z.object({
3926
- path: z.z.any(),
3927
- method: z.z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']).optional(),
3928
- pathParameters: z.z.record(z.z.string(), z.z.string()).optional(),
3929
- headers: z.z.record(z.z.string(), z.z.string()).optional(),
3930
- query: z.z.record(z.z.string(), z.z.string()).optional(),
3931
- data: z.z.any().optional(),
3932
- });
3933
3992
  const BaseConnection = BaseWorkspaceElement.extend({
3934
3993
  ...TenantLayerElement.shape,
3935
3994
  name: z.z.string(),
@@ -8946,6 +9005,18 @@ const ConnectorEventHandlerMethods = {
8946
9005
  },
8947
9006
  };
8948
9007
 
9008
+ const ConnectorAuthSuccessRecord = z.z.object({
9009
+ id: z.z.string(),
9010
+ connectorId: z.z.string(),
9011
+ connectorVersion: z.z.string(),
9012
+ authOptionKey: z.z.string().optional(),
9013
+ connectorParameters: z.z.any().optional(),
9014
+ connectionInput: z.z.any().optional(),
9015
+ credentials: z.z.any().optional(),
9016
+ logs: z.z.array(z.z.any()),
9017
+ createdAt: z.z.string(),
9018
+ });
9019
+
8949
9020
  const CONNECTOR_VERSION_DEVELOPMENT = 'dev';
8950
9021
  const CONNECTOR_VERSION_LATEST = 'latest';
8951
9022
  const CONNECTOR_CATEGORIES = [
@@ -8994,7 +9065,8 @@ const ConnectorSpec = z.z.object({
8994
9065
  operations: z.z.array(z.z.any()).optional(),
8995
9066
  test: ConnectorMethodImplementation.optional(),
8996
9067
  hasReadme: z.z.boolean().optional(),
8997
- appUuid: z.z.string().optional(),
9068
+ externalAppId: z.z.string().optional(),
9069
+ appUuid: z.z.string().optional().describe('[INTERNAL] Deprecated: resolved to externalAppId'),
8998
9070
  knowledgeBaseUuid: z.z.string().optional(),
8999
9071
  workspaceId: z.z.string().optional(),
9000
9072
  data: z.z.any().optional(),
@@ -9086,7 +9158,9 @@ const WriteableConnectorFields = z.z
9086
9158
  key: z.z.string().optional(),
9087
9159
  name: z.z.string().optional(),
9088
9160
  logoUri: z.z.string().optional(),
9089
- appUuid: z.z.string().optional(),
9161
+ externalAppId: z.z.string().optional(),
9162
+ externalAppUuid: z.z.string().optional(),
9163
+ appUuid: z.z.string().optional().describe('[INTERNAL] Deprecated: resolved to externalAppId'),
9090
9164
  categories: z.z.array(z.z.string()).optional(),
9091
9165
  })
9092
9166
  .extend(WritableConnectorVersionData.shape);
@@ -9102,7 +9176,7 @@ const BaseConnector = z.z.object({
9102
9176
  id: z.z.string(),
9103
9177
  key: z.z.string(),
9104
9178
  uuid: z.z.string(),
9105
- appUuid: z.z.string().optional(),
9179
+ externalAppId: z.z.string().optional(),
9106
9180
  name: z.z.string(),
9107
9181
  logoUri: z.z.string(),
9108
9182
  categories: z.z.array(z.z.string()).optional(),
@@ -9738,25 +9812,30 @@ const BaseIntegration = BaseMembraneInterface.extend({
9738
9812
  hasGlobalWebhooks: z.z.boolean().optional(),
9739
9813
  hasUdm: z.z.boolean().optional(),
9740
9814
  isTest: z.z.boolean().optional(),
9741
- appUuid: z.z.string().optional(),
9815
+ externalAppId: z.z.string().optional(),
9816
+ appUuid: z.z.string().optional().describe('[INTERNAL] Deprecated: Use externalAppId instead'),
9742
9817
  isDeactivated: z.z.boolean().optional(),
9743
9818
  authType: z.z.enum(CONNECTOR_AUTH_TYPES).optional(),
9744
9819
  optionsConfig: IntegrationOptions.optional(),
9745
9820
  });
9746
9821
  const IntegrationEditableProperties = BaseMembraneInterfaceEditableProperties.extend({
9747
9822
  logoUri: z.z.string().optional(),
9748
- appUuid: z.z.string().optional(),
9823
+ externalAppId: z.z.string().optional(),
9824
+ externalAppUuid: z.z.string().optional(),
9825
+ appUuid: z.z.string().optional().describe('[INTERNAL] Deprecated: resolved to externalAppId'),
9749
9826
  oAuthCallbackUri: z.z.url().or(z.z.literal('')).optional(),
9750
9827
  logoBase64: z.z.string().optional(),
9751
9828
  connectorVersion: z.z.string().optional(),
9752
9829
  connectorId: z.z.string().optional(),
9753
9830
  connectorUuid: z.z.string().optional(),
9831
+ connectorKey: z.z
9832
+ .string()
9833
+ .optional()
9834
+ .describe('Key of the connector; alternative to connectorId. Resolved to connectorId by the API.'),
9754
9835
  parameters: z.z.record(z.z.string(), z.z.any()).optional(),
9755
9836
  optionsConfig: IntegrationOptions.optional(),
9756
9837
  });
9757
- const IntegrationExportProperties = IntegrationEditableProperties.extend({
9758
- connectorUuid: z.z.string().optional(),
9759
- });
9838
+ const IntegrationExportProperties = IntegrationEditableProperties;
9760
9839
  const AppliedToIntegrations = (elementSchema) => z.z.array(z.z.object({
9761
9840
  element: elementSchema,
9762
9841
  integration: BaseIntegration,
@@ -10063,6 +10142,26 @@ const BaseActionRunLogRecord = ActivityLogRecord.extend({
10063
10142
  meta: z.z.record(z.z.string(), z.z.any()).optional(),
10064
10143
  });
10065
10144
 
10145
+ const ConnectedProductType = z.z.enum(['ai-agent', 'app']);
10146
+ const ConnectedProductAudience = z.z.enum(['personal', 'customers']);
10147
+ const AiAgentAudience = ConnectedProductAudience;
10148
+ const AiAgentType = z.z.enum(['openclaw', 'claude', 'chatgpt', 'custom']);
10149
+ const AiAgentParameters = z.z.object({
10150
+ agentType: AiAgentType.optional(),
10151
+ });
10152
+ const BaseConnectedProduct = z.z.object({
10153
+ id: z.z.string(),
10154
+ name: z.z.string(),
10155
+ key: z.z.string(),
10156
+ type: ConnectedProductType,
10157
+ audience: ConnectedProductAudience.optional(),
10158
+ parameters: AiAgentParameters.optional(),
10159
+ isConnected: z.z.boolean().optional(),
10160
+ lastApiRequestDate: z.z.string().optional(),
10161
+ createdAt: z.z.string().optional(),
10162
+ archivedAt: z.z.string().optional(),
10163
+ });
10164
+
10066
10165
  const ActionApiResponse = BaseAction.extend({
10067
10166
  integration: BaseIntegration.optional(),
10068
10167
  user: BaseCustomer.optional(),
@@ -10313,6 +10412,7 @@ const ConnectPayload = z.z.object({
10313
10412
  allowMultipleConnections: z.z.boolean().optional(),
10314
10413
  redirectUri: z.z.string().optional(),
10315
10414
  customState: z.z.string().optional(),
10415
+ connectionRequestId: z.z.string().optional(),
10316
10416
  });
10317
10417
  const ConnectUIOptions = ConnectPayload.omit({ input: true, redirectUri: true }).extend({
10318
10418
  theme: z.z.enum(['light', 'dark', 'auto']).optional(),
@@ -11185,6 +11285,29 @@ const IncomingWebhookApiResponse = z.z.object({
11185
11285
  subscription: BaseExternalEventSubscription.optional(),
11186
11286
  });
11187
11287
 
11288
+ const CreateConnectedProductRequest = z.z.object({
11289
+ name: z.z.string(),
11290
+ type: ConnectedProductType,
11291
+ audience: ConnectedProductAudience.optional(),
11292
+ parameters: AiAgentParameters.optional(),
11293
+ });
11294
+ const UpdateConnectedProductRequest = z.z.object({
11295
+ name: z.z.string().optional(),
11296
+ type: ConnectedProductType.optional(),
11297
+ audience: ConnectedProductAudience.optional(),
11298
+ parameters: AiAgentParameters.optional(),
11299
+ });
11300
+ const FindConnectedProductsQuery = z.z
11301
+ .object({
11302
+ type: ConnectedProductType.optional(),
11303
+ audience: ConnectedProductAudience.optional(),
11304
+ key: z.z.string().optional(),
11305
+ })
11306
+ .merge(PaginationQuery)
11307
+ .merge(SearchQuery)
11308
+ .merge(IncludeArchivedQuery);
11309
+ const ConnectedProductApiResponse = BaseConnectedProduct;
11310
+
11188
11311
  class DependencyError extends MembraneError {
11189
11312
  constructor(arg, workspaceElementReference) {
11190
11313
  super(arg);
@@ -11780,6 +11903,13 @@ const WorkspaceElementSpecs = {
11780
11903
  hasKey: true,
11781
11904
  isProOnly: true,
11782
11905
  },
11906
+ [exports.WorkspaceElementType.ConnectedProduct]: {
11907
+ type: exports.WorkspaceElementType.ConnectedProduct,
11908
+ apiPath: 'connected-products',
11909
+ name: 'Connected Product',
11910
+ namePlural: 'Connected Products',
11911
+ hasKey: true,
11912
+ },
11783
11913
  };
11784
11914
  function getEditablePathsForElementType(elementType) {
11785
11915
  return getEditablePathsForElementType$1(WorkspaceElementSpecs, elementType);
@@ -12756,13 +12886,14 @@ exports.WorkspaceElementChangeType = void 0;
12756
12886
  WorkspaceElementChangeType["DELETE"] = "delete";
12757
12887
  })(exports.WorkspaceElementChangeType || (exports.WorkspaceElementChangeType = {}));
12758
12888
  function compareWorkspaceExports(baseExport, targetExport, options = { includeDeletions: true }) {
12759
- const changes = [];
12889
+ const changes = {};
12760
12890
  const comparison = {
12761
12891
  [exports.WorkspaceElementChangeType.CREATE]: new Set(),
12762
12892
  [exports.WorkspaceElementChangeType.UPDATE]: new Set(),
12763
12893
  [exports.WorkspaceElementChangeType.DELETE]: new Set(),
12764
12894
  };
12765
12895
  const sourceUuidByTargetUuid = new Map();
12896
+ const diffs = [];
12766
12897
  const integrationMap = buildIntegrationsMap([
12767
12898
  ...(baseExport[exports.WorkspaceElementType.Integration] || []),
12768
12899
  ...(targetExport[exports.WorkspaceElementType.Integration] || []),
@@ -12777,35 +12908,46 @@ function compareWorkspaceExports(baseExport, targetExport, options = { includeDe
12777
12908
  for (const element of baseElements) {
12778
12909
  const intIdentifier = getIntegrationIdentifier(element, integrationMap);
12779
12910
  const selector = getElementSelector(type, element.key, intIdentifier);
12780
- baseMap.set(selector, element);
12911
+ baseMap.set(selector, { type, element });
12781
12912
  allSelectors.add(selector);
12782
12913
  }
12783
12914
  const targetElements = targetExport[type] || [];
12784
12915
  for (const element of targetElements) {
12785
12916
  const intIdentifier = getIntegrationIdentifier(element, integrationMap);
12786
12917
  const selector = getElementSelector(type, element.key, intIdentifier);
12787
- targetMap.set(selector, element);
12918
+ targetMap.set(selector, { type, element });
12788
12919
  allSelectors.add(selector);
12789
12920
  }
12790
12921
  }
12791
12922
  for (const selector of allSelectors) {
12792
- const baseElement = baseMap.get(selector);
12793
- const targetElement = targetMap.get(selector);
12794
- if (baseElement && targetElement && baseElement.uuid !== targetElement.uuid) {
12795
- sourceUuidByTargetUuid.set(targetElement.uuid, baseElement.uuid);
12923
+ const base = baseMap.get(selector);
12924
+ const target = targetMap.get(selector);
12925
+ if (base && target && base.element.uuid !== target.element.uuid) {
12926
+ sourceUuidByTargetUuid.set(target.element.uuid, base.element.uuid);
12796
12927
  }
12797
- const change = compareElementExports(baseElement, targetElement);
12928
+ const change = compareElementExports(base === null || base === void 0 ? void 0 : base.element, target === null || target === void 0 ? void 0 : target.element);
12798
12929
  if (options.includeDeletions === false && (change === null || change === void 0 ? void 0 : change.type) === exports.WorkspaceElementChangeType.DELETE) {
12799
12930
  continue;
12800
12931
  }
12801
- if (change) {
12802
- changes.push(change);
12932
+ if (!change) {
12933
+ continue;
12803
12934
  }
12804
- }
12805
- changes.forEach((change) => {
12935
+ const subject = target || base;
12936
+ const integrationKey = getIntegrationIdentifier(subject.element, integrationMap);
12937
+ const path = getMembraneElementPath(subject.type, subject.element.key, integrationKey);
12938
+ changes[change.uuid] = { elementType: subject.type, path };
12806
12939
  comparison[change.type].add(change.uuid);
12807
- });
12808
- return { comparison, sourceUuidByTargetUuid };
12940
+ if (options.includeDiff) {
12941
+ const baseYaml = base ? yaml__namespace.dump(base.element) : '';
12942
+ const targetYaml = target ? yaml__namespace.dump(target.element) : '';
12943
+ diffs.push(diff.createTwoFilesPatch(`a/${path}`, `b/${path}`, baseYaml, targetYaml));
12944
+ }
12945
+ }
12946
+ const result = { comparison, changes, sourceUuidByTargetUuid };
12947
+ if (options.includeDiff) {
12948
+ result.diff = diffs.join('\n').trim();
12949
+ }
12950
+ return result;
12809
12951
  }
12810
12952
  function compareElementExports(baseElement, targetElement) {
12811
12953
  if (baseElement && !targetElement) {
@@ -14399,7 +14541,7 @@ class ConnectionProxy {
14399
14541
  }
14400
14542
  }
14401
14543
  async function createOrUpdateConnection(options) {
14402
- const { connectionId, integrationKey, integrationId, connectorId, connectorVersion, name, input, connectorParameters, allowMultipleConnections, authOptionKey, apiUri, token, redirectUri, onPopupClosed, } = options !== null && options !== void 0 ? options : {};
14544
+ const { connectionId, integrationKey, integrationId, connectorId, connectorVersion, name, input, connectorParameters, allowMultipleConnections, authOptionKey, connectionRequestId, apiUri, token, redirectUri, onPopupClosed, } = options !== null && options !== void 0 ? options : {};
14403
14545
  let connectionType = await detectConnectionType(options);
14404
14546
  if (redirectUri) {
14405
14547
  connectionType = ConnectionType.REDIRECT;
@@ -14419,6 +14561,7 @@ async function createOrUpdateConnection(options) {
14419
14561
  name,
14420
14562
  authOptionKey,
14421
14563
  allowMultipleConnections,
14564
+ connectionRequestId,
14422
14565
  requestId,
14423
14566
  redirectUri,
14424
14567
  };
@@ -14436,6 +14579,7 @@ async function createOrUpdateConnection(options) {
14436
14579
  const { stopSSE } = createSSEListener({
14437
14580
  apiUri: apiUri,
14438
14581
  requestId,
14582
+ token,
14439
14583
  handler: eventHandler,
14440
14584
  });
14441
14585
  function cleanup() {
@@ -14550,8 +14694,8 @@ const createCrossWindowListener = ({ handler }) => {
14550
14694
  },
14551
14695
  };
14552
14696
  };
14553
- const createSSEListener = ({ apiUri, requestId, handler, }) => {
14554
- const sseUrl = urljoin(apiUri, '/sse/connection-events', requestId);
14697
+ const createSSEListener = ({ apiUri, requestId, token, handler, }) => {
14698
+ const sseUrl = urljoin(apiUri, '/sse/connection-events', requestId) + `?token=${encodeURIComponent(token)}`;
14555
14699
  let eventSource = null;
14556
14700
  const closeSseConnection = () => {
14557
14701
  eventSource === null || eventSource === void 0 ? void 0 : eventSource.close();
@@ -15072,6 +15216,8 @@ exports.AgentName = void 0;
15072
15216
  AgentName["MEMBRANE"] = "membrane";
15073
15217
  AgentName["MEMBRANE_CORE"] = "membrane-core";
15074
15218
  AgentName["SELF_INTEGRATING"] = "self-integrating";
15219
+ AgentName["CONNECTION_BUILDING"] = "connection-building";
15220
+ AgentName["ACTION_BUILDING"] = "action-building";
15075
15221
  AgentName["UNIVERSE"] = "universe";
15076
15222
  })(exports.AgentName || (exports.AgentName = {}));
15077
15223
  const AgentSession = z.z.object({
@@ -15085,7 +15231,9 @@ const AgentSession = z.z.object({
15085
15231
  status: z.z.enum(exports.AgentSessionStatus),
15086
15232
  prompt: z.z.string(),
15087
15233
  error: ErrorDataSchema.optional(),
15088
- lastActivityAt: z.z.iso.datetime(),
15234
+ lastActivityAt: z.z.iso
15235
+ .datetime()
15236
+ .describe('Last meaningful session progress timestamp used for inactivity timeout checks.'),
15089
15237
  title: z.z.string().optional(),
15090
15238
  summary: z.z.string().optional(),
15091
15239
  cost: z.z.number().optional(),
@@ -15112,7 +15260,10 @@ const AgentSessionInputSchema = z.z.object({
15112
15260
  });
15113
15261
  const PatchAgentSessionSchema = z.z.object({
15114
15262
  state: z.z.enum(exports.AgentSessionState).optional(),
15115
- lastActivityAt: z.z.iso.datetime().optional(),
15263
+ lastActivityAt: z.z.iso
15264
+ .datetime()
15265
+ .optional()
15266
+ .describe('Last meaningful session progress timestamp used for inactivity timeout checks.'),
15116
15267
  title: z.z.string().optional(),
15117
15268
  summary: z.z.string().optional(),
15118
15269
  cost: z.z.number().optional(),
@@ -15121,6 +15272,27 @@ const PatchAgentSessionSchema = z.z.object({
15121
15272
  status: z.z.enum(exports.AgentSessionStatus).optional(),
15122
15273
  });
15123
15274
 
15275
+ const SessionCredentials = z.z.object({
15276
+ accessKeyId: z.z.string().min(1),
15277
+ secretAccessKey: z.z.string().min(1),
15278
+ sessionToken: z.z.string().min(1),
15279
+ });
15280
+ const SessionParameters = z.z.object({
15281
+ id: z.z.string().optional(),
15282
+ accessToken: z.z.string().optional(),
15283
+ credentials: SessionCredentials.optional(),
15284
+ apiUri: z.z.string().optional(),
15285
+ prompt: z.z.string().optional(),
15286
+ elementType: z.z.string().optional(),
15287
+ elementId: z.z.string().optional(),
15288
+ customerId: z.z.string().optional(),
15289
+ opencodeSessionUuid: z.z.string().optional(),
15290
+ sessionFilesZipUri: z.z.string().optional(),
15291
+ openRouterApiKey: z.z.string().optional(),
15292
+ modelId: z.z.string().optional(),
15293
+ agentName: z.z.enum(exports.AgentName).optional(),
15294
+ });
15295
+
15124
15296
  exports.AsyncRequestStatus = void 0;
15125
15297
  (function (AsyncRequestStatus) {
15126
15298
  AsyncRequestStatus["PENDING"] = "pending";
@@ -15158,6 +15330,46 @@ const ValidateSelfHostingTokenResponse = z.z.object({
15158
15330
  orgName: z.z.string().optional(),
15159
15331
  });
15160
15332
 
15333
+ const CLIENT_TOKEN_GRANT_TYPES = ['mcp-oauth', 'cli-oauth', 'agent-session', 'api'];
15334
+ const ClientTokenGrantType = z.z.enum(CLIENT_TOKEN_GRANT_TYPES);
15335
+ const ClientToken = z.z.object({
15336
+ id: z.z.string(),
15337
+ workspaceId: z.z.string().optional(),
15338
+ platformUserId: z.z.string().optional(),
15339
+ tenantId: z.z.string().optional(),
15340
+ grantType: ClientTokenGrantType,
15341
+ grantId: z.z.string().optional(),
15342
+ grantName: z.z.string().optional(),
15343
+ connectedProductId: z.z.string().optional(),
15344
+ createdAt: z.z.string(),
15345
+ });
15346
+ const CreateClientTokenResponse = ClientToken.extend({
15347
+ accessToken: z.z.string(),
15348
+ });
15349
+ const CreateClientTokenRequest = z.z.object({
15350
+ grantType: ClientTokenGrantType,
15351
+ grantId: z.z.string(),
15352
+ grantName: z.z.string(),
15353
+ tenantId: z.z.string().optional(),
15354
+ productKey: z.z.string().optional(),
15355
+ });
15356
+ const ClientTokenListResponse = z.z.object({
15357
+ items: z.z.array(ClientToken),
15358
+ });
15359
+
15360
+ const MEMBRANE_CLI_CLIENT_ID = 'membrane-cli';
15361
+ const OAUTH_SCOPE_PLATFORM_USER = 'platform-user';
15362
+ const OAUTH_SCOPE_TENANT = 'tenant';
15363
+ const OAUTH_SCOPES = [OAUTH_SCOPE_PLATFORM_USER, OAUTH_SCOPE_TENANT];
15364
+ const OAuthTokenResponse = z.z.object({
15365
+ access_token: z.z.string(),
15366
+ token_type: z.z.string(),
15367
+ expires_in: z.z.number(),
15368
+ refresh_token: z.z.string().optional(),
15369
+ default_workspace_key: z.z.string().optional(),
15370
+ default_tenant_key: z.z.string().optional(),
15371
+ });
15372
+
15161
15373
  const CONSOLE_ACCOUNT_API_TOKEN_PATH = 'settings/account/api-token';
15162
15374
 
15163
15375
  class UI {
@@ -15617,6 +15829,9 @@ exports.ActivityLogRecord = ActivityLogRecord;
15617
15829
  exports.ActivityStatsQuery = ActivityStatsQuery;
15618
15830
  exports.AgentSession = AgentSession;
15619
15831
  exports.AgentSessionInputSchema = AgentSessionInputSchema;
15832
+ exports.AiAgentAudience = AiAgentAudience;
15833
+ exports.AiAgentParameters = AiAgentParameters;
15834
+ exports.AiAgentType = AiAgentType;
15620
15835
  exports.Alert = Alert;
15621
15836
  exports.AlertDeliverySettingsSchema = AlertDeliverySettingsSchema;
15622
15837
  exports.AlertSchema = AlertSchema;
@@ -15652,6 +15867,7 @@ exports.BaseAppDataSchema = BaseAppDataSchema;
15652
15867
  exports.BaseAppDataSchemaInstance = BaseAppDataSchemaInstance;
15653
15868
  exports.BaseAppEventSubscription = BaseAppEventSubscription;
15654
15869
  exports.BaseAppEventType = BaseAppEventType;
15870
+ exports.BaseConnectedProduct = BaseConnectedProduct;
15655
15871
  exports.BaseConnection = BaseConnection;
15656
15872
  exports.BaseConnector = BaseConnector;
15657
15873
  exports.BaseCustomer = BaseCustomer;
@@ -15681,6 +15897,9 @@ exports.BaseOrgUser = BaseOrgUser;
15681
15897
  exports.BasePackage = BasePackage;
15682
15898
  exports.BaseScreen = BaseScreen;
15683
15899
  exports.BaseWorkspaceElement = BaseWorkspaceElement;
15900
+ exports.CLIENT_TOKEN_GRANT_TYPES = CLIENT_TOKEN_GRANT_TYPES;
15901
+ exports.CONNECTION_REQUEST_ID_PARAM = CONNECTION_REQUEST_ID_PARAM;
15902
+ exports.CONNECTION_REQUEST_SCREEN_PATH = CONNECTION_REQUEST_SCREEN_PATH;
15684
15903
  exports.CONNECTOR_AUTH_TYPES = CONNECTOR_AUTH_TYPES;
15685
15904
  exports.CONNECTOR_CATEGORIES = CONNECTOR_CATEGORIES;
15686
15905
  exports.CONNECTOR_DATA_DIR = CONNECTOR_DATA_DIR;
@@ -15695,6 +15914,9 @@ exports.CONSOLE_ACCOUNT_API_TOKEN_PATH = CONSOLE_ACCOUNT_API_TOKEN_PATH;
15695
15914
  exports.CheckpointApiResponse = CheckpointApiResponse;
15696
15915
  exports.CheckpointDiffOperationSchema = CheckpointDiffOperationSchema;
15697
15916
  exports.CheckpointDiffResponseSchema = CheckpointDiffResponseSchema;
15917
+ exports.ClientToken = ClientToken;
15918
+ exports.ClientTokenGrantType = ClientTokenGrantType;
15919
+ exports.ClientTokenListResponse = ClientTokenListResponse;
15698
15920
  exports.CommonFindElementsQuery = CommonFindElementsQuery;
15699
15921
  exports.CommonFindInstancesQuery = CommonFindInstancesQuery;
15700
15922
  exports.CommonInstancesListQuery = CommonInstancesListQuery;
@@ -15704,6 +15926,9 @@ exports.ConcurrencyError = ConcurrencyError;
15704
15926
  exports.ConfigurationError = ConfigurationError;
15705
15927
  exports.ConnectPayload = ConnectPayload;
15706
15928
  exports.ConnectUIOptions = ConnectUIOptions;
15929
+ exports.ConnectedProductApiResponse = ConnectedProductApiResponse;
15930
+ exports.ConnectedProductAudience = ConnectedProductAudience;
15931
+ exports.ConnectedProductType = ConnectedProductType;
15707
15932
  exports.ConnectionAccessor = ConnectionAccessor;
15708
15933
  exports.ConnectionApiResponse = ConnectionApiResponse;
15709
15934
  exports.ConnectionApiResponseWithSecrets = ConnectionApiResponseWithSecrets;
@@ -15741,6 +15966,7 @@ exports.ConnectorAuthOAuth1 = ConnectorAuthOAuth1;
15741
15966
  exports.ConnectorAuthOAuth2 = ConnectorAuthOAuth2;
15742
15967
  exports.ConnectorAuthProxy = ConnectorAuthProxy;
15743
15968
  exports.ConnectorAuthSpec = ConnectorAuthSpec;
15969
+ exports.ConnectorAuthSuccessRecord = ConnectorAuthSuccessRecord;
15744
15970
  exports.ConnectorAuthWithFunctions = ConnectorAuthWithFunctions;
15745
15971
  exports.ConnectorDataCollectionEventImplementationType = ConnectorDataCollectionEventImplementationType;
15746
15972
  exports.ConnectorDataCollectionMethodKeys = ConnectorDataCollectionMethodKeys;
@@ -15771,7 +15997,11 @@ exports.CreateActionInstanceRequest = CreateActionInstanceRequest;
15771
15997
  exports.CreateActionRequest = CreateActionRequest;
15772
15998
  exports.CreateAgentSession = CreateAgentSession;
15773
15999
  exports.CreateAlert = CreateAlert;
16000
+ exports.CreateClientTokenRequest = CreateClientTokenRequest;
16001
+ exports.CreateClientTokenResponse = CreateClientTokenResponse;
16002
+ exports.CreateConnectedProductRequest = CreateConnectedProductRequest;
15774
16003
  exports.CreateConnectionRequest = CreateConnectionRequest;
16004
+ exports.CreateConnectionRequestPayload = CreateConnectionRequestPayload;
15775
16005
  exports.CreateConnectorRequest = CreateConnectorRequest;
15776
16006
  exports.CreateCustomerRequest = CreateCustomerRequest;
15777
16007
  exports.CreateDataLinkTableRequest = CreateDataLinkTableRequest;
@@ -15903,6 +16133,7 @@ exports.FindAppDataSchemasQuery = FindAppDataSchemasQuery;
15903
16133
  exports.FindAppEventSubscriptionsQuery = FindAppEventSubscriptionsQuery;
15904
16134
  exports.FindAppEventTypesQuery = FindAppEventTypesQuery;
15905
16135
  exports.FindAppEventsQuery = FindAppEventsQuery;
16136
+ exports.FindConnectedProductsQuery = FindConnectedProductsQuery;
15906
16137
  exports.FindConnectionsQuery = FindConnectionsQuery;
15907
16138
  exports.FindConnectionsResponse = FindConnectionsResponse;
15908
16139
  exports.FindCustomersQuery = FindCustomersQuery;
@@ -16010,6 +16241,7 @@ exports.ListFlowInstancesForConnectionQuery = ListFlowInstancesForConnectionQuer
16010
16241
  exports.ListIncomingWebhooksQuery = ListIncomingWebhooksQuery;
16011
16242
  exports.ListPublicConnectorsQuery = ListPublicConnectorsQuery;
16012
16243
  exports.ListPublicPackagesQuery = ListPublicPackagesQuery;
16244
+ exports.MEMBRANE_CLI_CLIENT_ID = MEMBRANE_CLI_CLIENT_ID;
16013
16245
  exports.MEMBRANE_ELEMENT_CONFIG_FILE_NAME = MEMBRANE_ELEMENT_CONFIG_FILE_NAME;
16014
16246
  exports.MIN_FULL_SYNC_INTERVAL_SECONDS = MIN_FULL_SYNC_INTERVAL_SECONDS;
16015
16247
  exports.MIN_PULL_UPDATES_INTERVAL_SECONDS = MIN_PULL_UPDATES_INTERVAL_SECONDS;
@@ -16025,6 +16257,10 @@ exports.NotAuthenticatedError = NotAuthenticatedError;
16025
16257
  exports.NotFoundError = NotFoundError;
16026
16258
  exports.OAUTH1_CONFIG_SCHEMA = OAUTH1_CONFIG_SCHEMA;
16027
16259
  exports.OAUTH_CONFIG_SCHEMA = OAUTH_CONFIG_SCHEMA;
16260
+ exports.OAUTH_SCOPES = OAUTH_SCOPES;
16261
+ exports.OAUTH_SCOPE_PLATFORM_USER = OAUTH_SCOPE_PLATFORM_USER;
16262
+ exports.OAUTH_SCOPE_TENANT = OAUTH_SCOPE_TENANT;
16263
+ exports.OAuthTokenResponse = OAuthTokenResponse;
16028
16264
  exports.OpenRouterNotConfiguredError = OpenRouterNotConfiguredError;
16029
16265
  exports.OpenapiMappingSchema = OpenapiMappingSchema;
16030
16266
  exports.OperationMappingFunction = OperationMappingFunction;
@@ -16076,12 +16312,15 @@ exports.ScreensAccessor = ScreensAccessor;
16076
16312
  exports.SearchQuery = SearchQuery;
16077
16313
  exports.SelfAccessor = SelfAccessor;
16078
16314
  exports.SelfHostingToken = SelfHostingToken;
16315
+ exports.SessionCredentials = SessionCredentials;
16316
+ exports.SessionParameters = SessionParameters;
16079
16317
  exports.StatsFilterQuery = StatsFilterQuery;
16080
16318
  exports.TenantLayerElement = TenantLayerElement;
16081
16319
  exports.UNIFIED_DATA_MODELS = UNIFIED_DATA_MODELS;
16082
16320
  exports.UnitRunError = UnitRunError;
16083
16321
  exports.UpdateActionInstanceRequest = UpdateActionInstanceRequest;
16084
16322
  exports.UpdateActionRequest = UpdateActionRequest;
16323
+ exports.UpdateConnectedProductRequest = UpdateConnectedProductRequest;
16085
16324
  exports.UpdateConnectionRequest = UpdateConnectionRequest;
16086
16325
  exports.UpdateConnectorRequest = UpdateConnectorRequest;
16087
16326
  exports.UpdateCustomerRequest = UpdateCustomerRequest;
@@ -16157,6 +16396,7 @@ exports.getAlertTypesByCategory = getAlertTypesByCategory;
16157
16396
  exports.getAllEventMethodFilePaths = getAllEventMethodFilePaths;
16158
16397
  exports.getBusinessDaysBetween = getBusinessDaysBetween;
16159
16398
  exports.getChildNodeKeys = getChildNodeKeys;
16399
+ exports.getConnectionRequestUrl = getConnectionRequestUrl;
16160
16400
  exports.getConnectorSpecPath = getConnectorSpecPath;
16161
16401
  exports.getConnectorVersionPath = getConnectorVersionPath;
16162
16402
  exports.getDataCollectionCreateFields = getDataCollectionCreateFields;