@xemahq/kernel-contracts 0.39.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/connector/index.d.ts +1 -0
  2. package/dist/connector/index.d.ts.map +1 -1
  3. package/dist/connector/index.js +1 -0
  4. package/dist/connector/index.js.map +1 -1
  5. package/dist/connector/lib/canonical-operation-binding.d.ts +18 -0
  6. package/dist/connector/lib/canonical-operation-binding.d.ts.map +1 -0
  7. package/dist/connector/lib/canonical-operation-binding.js +76 -0
  8. package/dist/connector/lib/canonical-operation-binding.js.map +1 -0
  9. package/dist/connector/lib/connector-descriptor.d.ts +4 -0
  10. package/dist/connector/lib/connector-descriptor.d.ts.map +1 -1
  11. package/dist/connector/lib/connector-descriptor.js +12 -0
  12. package/dist/connector/lib/connector-descriptor.js.map +1 -1
  13. package/dist/connector/lib/integration-provider-contribution.d.ts +3 -2
  14. package/dist/connector/lib/integration-provider-contribution.d.ts.map +1 -1
  15. package/dist/enterprise-context/index.d.ts +5 -0
  16. package/dist/enterprise-context/index.d.ts.map +1 -0
  17. package/dist/enterprise-context/index.js +21 -0
  18. package/dist/enterprise-context/index.js.map +1 -0
  19. package/dist/enterprise-context/lib/context-bundle.d.ts +13 -0
  20. package/dist/enterprise-context/lib/context-bundle.d.ts.map +1 -0
  21. package/dist/enterprise-context/lib/context-bundle.js +3 -0
  22. package/dist/enterprise-context/lib/context-bundle.js.map +1 -0
  23. package/dist/enterprise-context/lib/context-document.d.ts +9 -0
  24. package/dist/enterprise-context/lib/context-document.d.ts.map +1 -0
  25. package/dist/enterprise-context/lib/context-document.js +3 -0
  26. package/dist/enterprise-context/lib/context-document.js.map +1 -0
  27. package/dist/enterprise-context/lib/context-mount-entry.d.ts +8 -0
  28. package/dist/enterprise-context/lib/context-mount-entry.d.ts.map +1 -0
  29. package/dist/enterprise-context/lib/context-mount-entry.js +5 -0
  30. package/dist/enterprise-context/lib/context-mount-entry.js.map +1 -0
  31. package/dist/enterprise-context/lib/dropped-context.d.ts +9 -0
  32. package/dist/enterprise-context/lib/dropped-context.d.ts.map +1 -0
  33. package/dist/enterprise-context/lib/dropped-context.js +8 -0
  34. package/dist/enterprise-context/lib/dropped-context.js.map +1 -0
  35. package/package.json +1 -1
  36. package/src/connector/index.ts +1 -0
  37. package/src/connector/lib/canonical-operation-binding.ts +160 -0
  38. package/src/connector/lib/connector-descriptor.ts +29 -0
  39. package/src/enterprise-context/index.ts +4 -0
  40. package/src/enterprise-context/lib/context-bundle.ts +35 -0
  41. package/src/enterprise-context/lib/context-document.ts +23 -0
  42. package/src/enterprise-context/lib/context-mount-entry.ts +29 -0
  43. package/src/enterprise-context/lib/dropped-context.ts +24 -0
@@ -3,6 +3,7 @@ export * from './lib/connector-adapter-kind';
3
3
  export * from './lib/connector-http-request';
4
4
  export * from './lib/capability';
5
5
  export * from './lib/credential-kind';
6
+ export * from './lib/canonical-operation-binding';
6
7
  export * from './lib/credential-strategy-contribution';
7
8
  export * from './lib/onboarding-manifest';
8
9
  export * from './lib/provider-descriptor';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connector/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wCAAwC,CAAC;AACvD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yCAAyC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connector/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mCAAmC,CAAC;AAClD,cAAc,wCAAwC,CAAC;AACvD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yCAAyC,CAAC"}
@@ -19,6 +19,7 @@ __exportStar(require("./lib/connector-adapter-kind"), exports);
19
19
  __exportStar(require("./lib/connector-http-request"), exports);
20
20
  __exportStar(require("./lib/capability"), exports);
21
21
  __exportStar(require("./lib/credential-kind"), exports);
22
+ __exportStar(require("./lib/canonical-operation-binding"), exports);
22
23
  __exportStar(require("./lib/credential-strategy-contribution"), exports);
23
24
  __exportStar(require("./lib/onboarding-manifest"), exports);
24
25
  __exportStar(require("./lib/provider-descriptor"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connector/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,+DAA6C;AAC7C,+DAA6C;AAC7C,mDAAiC;AACjC,wDAAsC;AACtC,yEAAuD;AACvD,4DAA0C;AAC1C,4DAA0C;AAC1C,wDAAsC;AACtC,6DAA2C;AAC3C,wDAAsC;AACtC,oDAAkC;AAClC,2DAAyC;AACzC,6DAA2C;AAC3C,0EAAwD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connector/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,+DAA6C;AAC7C,+DAA6C;AAC7C,mDAAiC;AACjC,wDAAsC;AACtC,oEAAkD;AAClD,yEAAuD;AACvD,4DAA0C;AAC1C,4DAA0C;AAC1C,wDAAsC;AACtC,6DAA2C;AAC3C,wDAAsC;AACtC,oDAAkC;AAClC,2DAAyC;AACzC,6DAA2C;AAC3C,0EAAwD"}
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { type CanonicalObjectTypeRef } from '../../canonical-object';
3
+ export declare enum CanonicalMappingDirection {
4
+ Read = "read",
5
+ Write = "write"
6
+ }
7
+ export declare const CanonicalMappingDirectionSchema: z.ZodEnum<typeof CanonicalMappingDirection>;
8
+ export interface CanonicalOperationBinding {
9
+ readonly objectType: CanonicalObjectTypeRef;
10
+ readonly direction: CanonicalMappingDirection;
11
+ readonly fieldMap?: Readonly<Record<string, string>>;
12
+ }
13
+ export declare const CanonicalOperationBindingSchema: z.ZodType<CanonicalOperationBinding>;
14
+ export declare function getByPath(source: unknown, path: string): unknown;
15
+ export declare function setByPath(target: Record<string, unknown>, path: string, value: unknown): void;
16
+ export declare function projectProviderToCanonical(providerRecord: unknown, fieldMap: Readonly<Record<string, string>>): Record<string, unknown>;
17
+ export declare function projectCanonicalToProvider(canonicalObject: Readonly<Record<string, unknown>>, fieldMap: Readonly<Record<string, string>>): Record<string, unknown>;
18
+ //# sourceMappingURL=canonical-operation-binding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonical-operation-binding.d.ts","sourceRoot":"","sources":["../../../src/connector/lib/canonical-operation-binding.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,wBAAwB,CAAC;AAGhC,oBAAY,yBAAyB;IAEnC,IAAI,SAAS;IAEb,KAAK,UAAU;CAChB;AAED,eAAO,MAAM,+BAA+B,6CAA0C,CAAC;AAqCvF,MAAM,WAAW,yBAAyB;IAExC,QAAQ,CAAC,UAAU,EAAE,sBAAsB,CAAC;IAE5C,QAAQ,CAAC,SAAS,EAAE,yBAAyB,CAAC;IAM9C,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACtD;AAED,eAAO,MAAM,+BAA+B,EAAE,CAAC,CAAC,OAAO,CAAC,yBAAyB,CAK1B,CAAC;AAGxD,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAShE;AAGD,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GACb,IAAI,CAYN;AAOD,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,OAAO,EACvB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACzC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASzB;AAMD,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAClD,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACzC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASzB"}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CanonicalOperationBindingSchema = exports.CanonicalMappingDirectionSchema = exports.CanonicalMappingDirection = void 0;
4
+ exports.getByPath = getByPath;
5
+ exports.setByPath = setByPath;
6
+ exports.projectProviderToCanonical = projectProviderToCanonical;
7
+ exports.projectCanonicalToProvider = projectCanonicalToProvider;
8
+ const zod_1 = require("zod");
9
+ const canonical_object_1 = require("../../canonical-object");
10
+ var CanonicalMappingDirection;
11
+ (function (CanonicalMappingDirection) {
12
+ CanonicalMappingDirection["Read"] = "read";
13
+ CanonicalMappingDirection["Write"] = "write";
14
+ })(CanonicalMappingDirection || (exports.CanonicalMappingDirection = CanonicalMappingDirection = {}));
15
+ exports.CanonicalMappingDirectionSchema = zod_1.z.nativeEnum(CanonicalMappingDirection);
16
+ const CANONICAL_FIELD_MAP_MAX = 100;
17
+ const CanonicalFieldMapSchema = zod_1.z
18
+ .record(zod_1.z
19
+ .string()
20
+ .min(1)
21
+ .max(200)
22
+ .regex(/^[A-Za-z][A-Za-z0-9_]*$/, 'canonical field name must be identifier-like'), zod_1.z
23
+ .string()
24
+ .min(1)
25
+ .max(400)
26
+ .regex(/^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/, 'provider path must be a dot-path of identifier segments'))
27
+ .refine((m) => Object.keys(m).length <= CANONICAL_FIELD_MAP_MAX, `at most ${CANONICAL_FIELD_MAP_MAX} mapped fields`);
28
+ exports.CanonicalOperationBindingSchema = zod_1.z.strictObject({
29
+ objectType: canonical_object_1.CanonicalObjectTypeRefSchema,
30
+ direction: exports.CanonicalMappingDirectionSchema,
31
+ fieldMap: CanonicalFieldMapSchema.optional(),
32
+ });
33
+ function getByPath(source, path) {
34
+ let cursor = source;
35
+ for (const segment of path.split('.')) {
36
+ if (cursor === null || typeof cursor !== 'object') {
37
+ return undefined;
38
+ }
39
+ cursor = cursor[segment];
40
+ }
41
+ return cursor;
42
+ }
43
+ function setByPath(target, path, value) {
44
+ const segments = path.split('.');
45
+ let cursor = target;
46
+ for (let i = 0; i < segments.length - 1; i++) {
47
+ const key = segments[i];
48
+ const next = cursor[key];
49
+ if (next === null || typeof next !== 'object' || Array.isArray(next)) {
50
+ cursor[key] = {};
51
+ }
52
+ cursor = cursor[key];
53
+ }
54
+ cursor[segments[segments.length - 1]] = value;
55
+ }
56
+ function projectProviderToCanonical(providerRecord, fieldMap) {
57
+ const out = {};
58
+ for (const [canonicalField, providerPath] of Object.entries(fieldMap)) {
59
+ const value = getByPath(providerRecord, providerPath);
60
+ if (value !== undefined) {
61
+ out[canonicalField] = value;
62
+ }
63
+ }
64
+ return out;
65
+ }
66
+ function projectCanonicalToProvider(canonicalObject, fieldMap) {
67
+ const out = {};
68
+ for (const [canonicalField, providerPath] of Object.entries(fieldMap)) {
69
+ const value = canonicalObject[canonicalField];
70
+ if (value !== undefined) {
71
+ setByPath(out, providerPath, value);
72
+ }
73
+ }
74
+ return out;
75
+ }
76
+ //# sourceMappingURL=canonical-operation-binding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonical-operation-binding.js","sourceRoot":"","sources":["../../../src/connector/lib/canonical-operation-binding.ts"],"names":[],"mappings":";;;AA8FA,8BASC;AAGD,8BAgBC;AAOD,gEAYC;AAMD,gEAYC;AA1ID,6BAAwB;AAExB,6DAGgC;AAGhC,IAAY,yBAKX;AALD,WAAY,yBAAyB;IAEnC,0CAAa,CAAA;IAEb,4CAAe,CAAA;AACjB,CAAC,EALW,yBAAyB,yCAAzB,yBAAyB,QAKpC;AAEY,QAAA,+BAA+B,GAAG,OAAC,CAAC,UAAU,CAAC,yBAAyB,CAAC,CAAC;AAGvF,MAAM,uBAAuB,GAAG,GAAG,CAAC;AASpC,MAAM,uBAAuB,GAAG,OAAC;KAC9B,MAAM,CACL,OAAC;KACE,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,KAAK,CAAC,yBAAyB,EAAE,8CAA8C,CAAC,EACnF,OAAC;KACE,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,KAAK,CACJ,qDAAqD,EACrD,yDAAyD,CAC1D,CACJ;KACA,MAAM,CACL,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,uBAAuB,EACvD,WAAW,uBAAuB,gBAAgB,CACnD,CAAC;AAmBS,QAAA,+BAA+B,GAC1C,OAAC,CAAC,YAAY,CAAC;IACb,U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xC,cAAuB,EACvB,QAA0C;IAE1C,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,cAAc,EAAE,YAAY,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtE,MAAM,KAAK,GAAG,SAAS,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;QACtD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,GAAG,CAAC,cAAc,CAAC,GAAG,KAAK,CAAC;QAC9B,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAMD,SAAgB,0BAA0B,CACxC,eAAkD,EAClD,QAA0C;IAE1C,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,cAAc,EAAE,YAAY,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtE,MAAM,KAAK,GAAG,eAAe,CAAC,cAAc,CAAC,CAAC;QAC9C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,SAAS,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { type CapabilityRef } from '../../capability';
3
+ import { type CanonicalOperationBinding } from './canonical-operation-binding';
3
4
  import { type CredentialKindRef } from './credential-kind';
4
5
  import { ConnectorAdapterKind } from './connector-adapter-kind';
5
6
  import { type ConnectorHttpRequestTemplate } from './connector-http-request';
@@ -10,6 +11,7 @@ export interface ConnectorOperationDescriptor {
10
11
  readonly scopes: readonly string[];
11
12
  readonly requiresConnection: boolean;
12
13
  readonly httpRequest?: ConnectorHttpRequestTemplate;
14
+ readonly canonical?: CanonicalOperationBinding;
13
15
  }
14
16
  export declare const ConnectorOperationDescriptorSchema: z.ZodObject<{
15
17
  capabilityRef: z.ZodType<CapabilityRef, unknown, z.core.$ZodTypeInternals<CapabilityRef, unknown>>;
@@ -29,6 +31,7 @@ export declare const ConnectorOperationDescriptorSchema: z.ZodObject<{
29
31
  queryParamName: z.ZodOptional<z.ZodString>;
30
32
  }, z.core.$strict>;
31
33
  }, z.core.$strict>>;
34
+ canonical: z.ZodOptional<z.ZodType<CanonicalOperationBinding, unknown, z.core.$ZodTypeInternals<CanonicalOperationBinding, unknown>>>;
32
35
  }, z.core.$strict>;
33
36
  export interface ConnectorDescriptor {
34
37
  readonly connectorKey: string;
@@ -68,6 +71,7 @@ export declare const ConnectorDescriptorSchema: z.ZodObject<{
68
71
  queryParamName: z.ZodOptional<z.ZodString>;
69
72
  }, z.core.$strict>;
70
73
  }, z.core.$strict>>;
74
+ canonical: z.ZodOptional<z.ZodType<CanonicalOperationBinding, unknown, z.core.$ZodTypeInternals<CanonicalOperationBinding, unknown>>>;
71
75
  }, z.core.$strict>>>>;
72
76
  }, z.core.$strict>;
73
77
  type AssertExtends<T extends U, U> = T;
@@ -1 +1 @@
1
- {"version":3,"file":"connector-descriptor.d.ts","sourceRoot":"","sources":["../../../src/connector/lib/connector-descriptor.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE3E,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,oBAAoB,EAErB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAkBrD,MAAM,WAAW,4BAA4B;IAO3C,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IAKtC,QAAQ,CAAC,WAAW,EAAE,oBAAoB,CAAC;IAQ3C,QAAQ,CAAC,MAAM,EAAE,SAAS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BAAmB,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;CAC9E,CAAC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConnectorDescriptorSchema = exports.ConnectorOperationDescriptorSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const capability_1 = require("../../capability");
6
+ const canonical_operation_binding_1 = require("./canonical-operation-binding");
6
7
  const credential_kind_1 = require("./credential-kind");
7
8
  const connector_adapter_kind_1 = require("./connector-adapter-kind");
8
9
  const connector_http_request_1 = require("./connector-http-request");
@@ -13,6 +14,7 @@ exports.ConnectorOperationDescriptorSchema = zod_1.z
13
14
  scopes: zod_1.z.array(zod_1.z.string()).readonly(),
14
15
  requiresConnection: zod_1.z.boolean(),
15
16
  httpRequest: connector_http_request_1.ConnectorHttpRequestTemplateSchema.optional(),
17
+ canonical: canonical_operation_binding_1.CanonicalOperationBindingSchema.optional(),
16
18
  })
17
19
  .superRefine((op, ctx) => {
18
20
  const isDeclarative = op.adapterKind === connector_adapter_kind_1.ConnectorAdapterKind.DeclarativeHttp;
@@ -31,6 +33,16 @@ exports.ConnectorOperationDescriptorSchema = zod_1.z
31
33
  message: `httpRequest is only valid for adapterKind="declarative-http" (got "${op.adapterKind}").`,
32
34
  });
33
35
  }
36
+ if (isDeclarative &&
37
+ op.canonical !== undefined &&
38
+ op.canonical.fieldMap === undefined) {
39
+ ctx.addIssue({
40
+ code: 'custom',
41
+ path: ['canonical', 'fieldMap'],
42
+ message: 'A declarative-http operation bound to a canonical type MUST declare ' +
43
+ 'canonical.fieldMap (there is no code path to map records).',
44
+ });
45
+ }
34
46
  });
35
47
  exports.ConnectorDescriptorSchema = zod_1.z.strictObject({
36
48
  connectorKey: zod_1.z.string().min(1),
@@ -1 +1 @@
1
- {"version":3,"file":"connector-descriptor.js","sourceRoot":"","sources":["../../../src/connector/lib/connector-descriptor.ts"],"names":[],"mappings":";;;AAoBA,6BAAwB;AAExB,i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AAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,UAAU,EAAE,OAAC,CAAC,KAAK,CAAC,0CAAkC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAC9E,CAAC,CAAC"}
@@ -3,9 +3,9 @@ import { ConnectorAdapterKind } from './connector-adapter-kind';
3
3
  export declare const ContributedProviderDescriptorSchema: z.ZodObject<{
4
4
  description: z.ZodString;
5
5
  displayName: z.ZodString;
6
+ category: z.ZodString;
6
7
  providerKey: z.ZodString;
7
8
  iconName: z.ZodString;
8
- category: z.ZodString;
9
9
  apiBaseUrl: z.ZodOptional<z.ZodString>;
10
10
  appAuthKind: z.ZodEnum<typeof import("./provider-descriptor").ProviderAppAuthKind>;
11
11
  appCredentialSchema: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
@@ -31,9 +31,9 @@ export declare const IntegrationProviderContributionManifestSchema: z.ZodObject<
31
31
  provider: z.ZodObject<{
32
32
  description: z.ZodString;
33
33
  displayName: z.ZodString;
34
+ category: z.ZodString;
34
35
  providerKey: z.ZodString;
35
36
  iconName: z.ZodString;
36
- category: z.ZodString;
37
37
  apiBaseUrl: z.ZodOptional<z.ZodString>;
38
38
  appAuthKind: z.ZodEnum<typeof import("./provider-descriptor").ProviderAppAuthKind>;
39
39
  appCredentialSchema: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
@@ -81,6 +81,7 @@ export declare const IntegrationProviderContributionManifestSchema: z.ZodObject<
81
81
  queryParamName: z.ZodOptional<z.ZodString>;
82
82
  }, z.core.$strict>;
83
83
  }, z.core.$strict>>;
84
+ canonical: z.ZodOptional<z.ZodType<import("./canonical-operation-binding").CanonicalOperationBinding, unknown, z.core.$ZodTypeInternals<import("./canonical-operation-binding").CanonicalOperationBinding, unknown>>>;
84
85
  }, z.core.$strict>>>>;
85
86
  }, z.core.$strict>>>;
86
87
  }, z.core.$strict>;
@@ -1 +1 @@
1
- {"version":3,"file":"integration-provider-contribution.d.ts","sourceRoot":"","sources":["../../../src/connector/lib/integration-provider-contribution.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AA0BhE,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;kBACK,CAAC;AAEtD,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,mCAAmC,CAC3C,CAAC;AAQF,eAAO,MAAM,6CAA6C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAqEtD,CAAC;AAEL,MAAM,MAAM,uCAAuC,GAAG,CAAC,CAAC,KAAK,CAC3D,OAAO,6CAA6C,CACrD,CAAC"}
1
+ {"version":3,"file":"integration-provider-contribution.d.ts","sourceRoot":"","sources":["../../../src/connector/lib/integration-provider-contribution.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AA0BhE,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;kBACK,CAAC;AAEtD,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,mCAAmC,CAC3C,CAAC;AAQF,eAAO,MAAM,6CAA6C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAqEtD,CAAC;AAEL,MAAM,MAAM,uCAAuC,GAAG,CAAC,CAAC,KAAK,CAC3D,OAAO,6CAA6C,CACrD,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './lib/context-document';
2
+ export * from './lib/context-mount-entry';
3
+ export * from './lib/dropped-context';
4
+ export * from './lib/context-bundle';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/enterprise-context/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./lib/context-document"), exports);
18
+ __exportStar(require("./lib/context-mount-entry"), exports);
19
+ __exportStar(require("./lib/dropped-context"), exports);
20
+ __exportStar(require("./lib/context-bundle"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/enterprise-context/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,4DAA0C;AAC1C,wDAAsC;AACtC,uDAAqC"}
@@ -0,0 +1,13 @@
1
+ import type { ContextDocument } from './context-document';
2
+ import type { ContextMountEntry } from './context-mount-entry';
3
+ import type { DroppedContextDocument } from './dropped-context';
4
+ export interface ContextBundle {
5
+ readonly objectType: string;
6
+ readonly primary?: Readonly<Record<string, unknown>>;
7
+ readonly documents: readonly ContextDocument[];
8
+ readonly mountPlan: readonly ContextMountEntry[];
9
+ readonly dropped: readonly DroppedContextDocument[];
10
+ readonly byteBudget: number;
11
+ readonly bytesUsed: number;
12
+ }
13
+ //# sourceMappingURL=context-bundle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-bundle.d.ts","sourceRoot":"","sources":["../../../src/enterprise-context/lib/context-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAoBhE,MAAM,WAAW,aAAa;IAE5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,SAAS,EAAE,SAAS,eAAe,EAAE,CAAC;IAC/C,QAAQ,CAAC,SAAS,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACjD,QAAQ,CAAC,OAAO,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAEpD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=context-bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-bundle.js","sourceRoot":"","sources":["../../../src/enterprise-context/lib/context-bundle.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ export interface ContextDocument {
2
+ readonly ref: string;
3
+ readonly docType: string;
4
+ readonly title?: string;
5
+ readonly summary?: string;
6
+ readonly content?: string;
7
+ readonly score: number;
8
+ }
9
+ //# sourceMappingURL=context-document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-document.d.ts","sourceRoot":"","sources":["../../../src/enterprise-context/lib/context-document.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,eAAe;IAE9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAE1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAE1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=context-document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-document.js","sourceRoot":"","sources":["../../../src/enterprise-context/lib/context-document.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import type { MountSource } from '../../workflow';
2
+ export declare const CONTEXT_MOUNT_MODE: "read-only";
3
+ export type ContextMountMode = typeof CONTEXT_MOUNT_MODE;
4
+ export interface ContextMountEntry {
5
+ readonly mode: ContextMountMode;
6
+ readonly source: MountSource;
7
+ }
8
+ //# sourceMappingURL=context-mount-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-mount-entry.d.ts","sourceRoot":"","sources":["../../../src/enterprise-context/lib/context-mount-entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAWlD,eAAO,MAAM,kBAAkB,EAAG,WAAoB,CAAC;AAEvD,MAAM,MAAM,gBAAgB,GAAG,OAAO,kBAAkB,CAAC;AAYzD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CONTEXT_MOUNT_MODE = void 0;
4
+ exports.CONTEXT_MOUNT_MODE = 'read-only';
5
+ //# sourceMappingURL=context-mount-entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-mount-entry.js","sourceRoot":"","sources":["../../../src/enterprise-context/lib/context-mount-entry.ts"],"names":[],"mappings":";;;AAWa,QAAA,kBAAkB,GAAG,WAAoB,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare enum DroppedContextReason {
2
+ BYTE_BUDGET_EXCEEDED = "BYTE_BUDGET_EXCEEDED"
3
+ }
4
+ export interface DroppedContextDocument {
5
+ readonly ref: string;
6
+ readonly bytes: number;
7
+ readonly reason: DroppedContextReason;
8
+ }
9
+ //# sourceMappingURL=dropped-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropped-context.d.ts","sourceRoot":"","sources":["../../../src/enterprise-context/lib/dropped-context.ts"],"names":[],"mappings":"AAWA,oBAAY,oBAAoB;IAE9B,oBAAoB,yBAAyB;CAC9C;AAGD,MAAM,WAAW,sBAAsB;IAErC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;CACvC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DroppedContextReason = void 0;
4
+ var DroppedContextReason;
5
+ (function (DroppedContextReason) {
6
+ DroppedContextReason["BYTE_BUDGET_EXCEEDED"] = "BYTE_BUDGET_EXCEEDED";
7
+ })(DroppedContextReason || (exports.DroppedContextReason = DroppedContextReason = {}));
8
+ //# sourceMappingURL=dropped-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropped-context.js","sourceRoot":"","sources":["../../../src/enterprise-context/lib/dropped-context.ts"],"names":[],"mappings":";;;AAWA,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAE9B,qEAA6C,CAAA;AAC/C,CAAC,EAHW,oBAAoB,oCAApB,oBAAoB,QAG/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xemahq/kernel-contracts",
3
- "version": "0.39.0",
3
+ "version": "0.41.0",
4
4
  "description": "Consolidated Xema OS kernel wire contracts — pure types + zod schemas for the kernel protocol surfaces. One package, one npm scope, wildcard per-surface subpath exports. No framework/runtime deps.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Neuralchowder Inc. <developer@xema.dev> (https://xema.dev)",
@@ -3,6 +3,7 @@ export * from './lib/connector-adapter-kind';
3
3
  export * from './lib/connector-http-request';
4
4
  export * from './lib/capability';
5
5
  export * from './lib/credential-kind';
6
+ export * from './lib/canonical-operation-binding';
6
7
  export * from './lib/credential-strategy-contribution';
7
8
  export * from './lib/onboarding-manifest';
8
9
  export * from './lib/provider-descriptor';
@@ -0,0 +1,160 @@
1
+ /**
2
+ * ─────────────────────────────────────────────────────────────────────────
3
+ * Canonical operation binding — the connector↔CDM mapping seam (B1b)
4
+ *
5
+ * A connector operation can BIND to a canonical business-object type (declared
6
+ * via `ContributionKind.CanonicalObjectType`) so the gateway maps between the
7
+ * provider's shape and the shared Common Data Model:
8
+ *
9
+ * - direction `read` — the operation FETCHES provider records; the gateway
10
+ * projects each provider record → a canonical object (provider → canonical).
11
+ * - direction `write` — the operation CREATES/UPDATES; the gateway projects
12
+ * the caller's canonical object → the provider payload (canonical → provider).
13
+ *
14
+ * For DECLARATIVE-HTTP operations (no code) the mapping is the declarative
15
+ * `fieldMap`: canonical-field → provider JSON dot-path. For NATIVE code modules
16
+ * the module's `toCanonical`/`fromCanonical` functions take precedence and the
17
+ * `fieldMap` is optional. This is the counterpart to the inbound `EventMapper`
18
+ * (raw event → canonical envelope): here it's raw record ↔ canonical object.
19
+ * ─────────────────────────────────────────────────────────────────────────
20
+ */
21
+
22
+ import { z } from 'zod';
23
+
24
+ import {
25
+ CanonicalObjectTypeRefSchema,
26
+ type CanonicalObjectTypeRef,
27
+ } from '../../canonical-object';
28
+
29
+ /** Which way a bound operation maps between provider records and canonical objects. */
30
+ export enum CanonicalMappingDirection {
31
+ /** Operation reads provider records → gateway emits canonical objects. */
32
+ Read = 'read',
33
+ /** Operation writes; caller supplies a canonical object → gateway emits provider payload. */
34
+ Write = 'write',
35
+ }
36
+
37
+ export const CanonicalMappingDirectionSchema = z.nativeEnum(CanonicalMappingDirection);
38
+
39
+ /** Cap on the number of mapped fields, keeping the binding small + bounded. */
40
+ const CANONICAL_FIELD_MAP_MAX = 100;
41
+
42
+ /**
43
+ * Declarative field mapping: canonical-object field-name → a dot-path into the
44
+ * provider record (read) or the provider payload (write). e.g.
45
+ * `{ "name": "attributes.customer_name", "amount": "value.total" }`.
46
+ * Dot segments address nested objects; bracket/array indexing is out of scope
47
+ * (deliberately — keep the DSL deterministic and small).
48
+ */
49
+ const CanonicalFieldMapSchema = z
50
+ .record(
51
+ z
52
+ .string()
53
+ .min(1)
54
+ .max(200)
55
+ .regex(/^[A-Za-z][A-Za-z0-9_]*$/, 'canonical field name must be identifier-like'),
56
+ z
57
+ .string()
58
+ .min(1)
59
+ .max(400)
60
+ .regex(
61
+ /^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/,
62
+ 'provider path must be a dot-path of identifier segments',
63
+ ),
64
+ )
65
+ .refine(
66
+ (m) => Object.keys(m).length <= CANONICAL_FIELD_MAP_MAX,
67
+ `at most ${CANONICAL_FIELD_MAP_MAX} mapped fields`,
68
+ );
69
+
70
+ /**
71
+ * Binds a connector operation to a canonical object type + the mapping applied
72
+ * at the gateway seam.
73
+ */
74
+ export interface CanonicalOperationBinding {
75
+ /** The canonical business-object type this operation reads or writes. */
76
+ readonly objectType: CanonicalObjectTypeRef;
77
+ /** Read (provider → canonical) or write (canonical → provider). */
78
+ readonly direction: CanonicalMappingDirection;
79
+ /**
80
+ * canonical-field → provider dot-path. REQUIRED for declarative-http
81
+ * operations (there is no code); OPTIONAL for native modules whose
82
+ * `toCanonical`/`fromCanonical` map instead.
83
+ */
84
+ readonly fieldMap?: Readonly<Record<string, string>>;
85
+ }
86
+
87
+ export const CanonicalOperationBindingSchema: z.ZodType<CanonicalOperationBinding> =
88
+ z.strictObject({
89
+ objectType: CanonicalObjectTypeRefSchema,
90
+ direction: CanonicalMappingDirectionSchema,
91
+ fieldMap: CanonicalFieldMapSchema.optional(),
92
+ }) as unknown as z.ZodType<CanonicalOperationBinding>;
93
+
94
+ /** Read a dot-path (`a.b.c`) out of a record; `undefined` if any segment is missing. */
95
+ export function getByPath(source: unknown, path: string): unknown {
96
+ let cursor: unknown = source;
97
+ for (const segment of path.split('.')) {
98
+ if (cursor === null || typeof cursor !== 'object') {
99
+ return undefined;
100
+ }
101
+ cursor = (cursor as Record<string, unknown>)[segment];
102
+ }
103
+ return cursor;
104
+ }
105
+
106
+ /** Set a dot-path (`a.b.c`) on a plain object, creating intermediate objects. */
107
+ export function setByPath(
108
+ target: Record<string, unknown>,
109
+ path: string,
110
+ value: unknown,
111
+ ): void {
112
+ const segments = path.split('.');
113
+ let cursor: Record<string, unknown> = target;
114
+ for (let i = 0; i < segments.length - 1; i++) {
115
+ const key = segments[i]!;
116
+ const next = cursor[key];
117
+ if (next === null || typeof next !== 'object' || Array.isArray(next)) {
118
+ cursor[key] = {};
119
+ }
120
+ cursor = cursor[key] as Record<string, unknown>;
121
+ }
122
+ cursor[segments[segments.length - 1]!] = value;
123
+ }
124
+
125
+ /**
126
+ * Project a provider record into a canonical object using a `read` fieldMap.
127
+ * Deterministic + pure; a missing provider path yields an absent canonical
128
+ * field (never throws). Centralized so the gateway + any validator agree.
129
+ */
130
+ export function projectProviderToCanonical(
131
+ providerRecord: unknown,
132
+ fieldMap: Readonly<Record<string, string>>,
133
+ ): Record<string, unknown> {
134
+ const out: Record<string, unknown> = {};
135
+ for (const [canonicalField, providerPath] of Object.entries(fieldMap)) {
136
+ const value = getByPath(providerRecord, providerPath);
137
+ if (value !== undefined) {
138
+ out[canonicalField] = value;
139
+ }
140
+ }
141
+ return out;
142
+ }
143
+
144
+ /**
145
+ * Project a canonical object into a provider payload using a `write` fieldMap.
146
+ * Deterministic + pure; an absent canonical field is skipped.
147
+ */
148
+ export function projectCanonicalToProvider(
149
+ canonicalObject: Readonly<Record<string, unknown>>,
150
+ fieldMap: Readonly<Record<string, string>>,
151
+ ): Record<string, unknown> {
152
+ const out: Record<string, unknown> = {};
153
+ for (const [canonicalField, providerPath] of Object.entries(fieldMap)) {
154
+ const value = canonicalObject[canonicalField];
155
+ if (value !== undefined) {
156
+ setByPath(out, providerPath, value);
157
+ }
158
+ }
159
+ return out;
160
+ }
@@ -22,6 +22,10 @@ import { z } from 'zod';
22
22
 
23
23
  import { CapabilityRefSchema, type CapabilityRef } from '../../capability';
24
24
 
25
+ import {
26
+ CanonicalOperationBindingSchema,
27
+ type CanonicalOperationBinding,
28
+ } from './canonical-operation-binding';
25
29
  import {
26
30
  CredentialKindRefSchema,
27
31
  type CredentialKindRef,
@@ -91,6 +95,15 @@ export interface ConnectorOperationDescriptor {
91
95
  * fails fast at the contribution boundary.
92
96
  */
93
97
  readonly httpRequest?: ConnectorHttpRequestTemplate;
98
+ /**
99
+ * Optional binding to a canonical business-object type (the CDM seam, B1b).
100
+ * When present, the gateway maps between the provider shape and the canonical
101
+ * object: `read` projects fetched provider records → canonical objects,
102
+ * `write` projects a caller's canonical object → the provider payload. A
103
+ * declarative-http operation with a binding MUST carry a `fieldMap` (there is
104
+ * no code to map); a native operation may omit it (its module maps).
105
+ */
106
+ readonly canonical?: CanonicalOperationBinding;
94
107
  }
95
108
 
96
109
  /**
@@ -105,6 +118,7 @@ export const ConnectorOperationDescriptorSchema = z
105
118
  scopes: z.array(z.string()).readonly(),
106
119
  requiresConnection: z.boolean(),
107
120
  httpRequest: ConnectorHttpRequestTemplateSchema.optional(),
121
+ canonical: CanonicalOperationBindingSchema.optional(),
108
122
  })
109
123
  .superRefine((op, ctx) => {
110
124
  const isDeclarative =
@@ -125,6 +139,21 @@ export const ConnectorOperationDescriptorSchema = z
125
139
  message: `httpRequest is only valid for adapterKind="declarative-http" (got "${op.adapterKind}").`,
126
140
  });
127
141
  }
142
+ // A declarative-http operation bound to a canonical type has no code to map
143
+ // with — it MUST carry a declarative fieldMap.
144
+ if (
145
+ isDeclarative &&
146
+ op.canonical !== undefined &&
147
+ op.canonical.fieldMap === undefined
148
+ ) {
149
+ ctx.addIssue({
150
+ code: 'custom',
151
+ path: ['canonical', 'fieldMap'],
152
+ message:
153
+ 'A declarative-http operation bound to a canonical type MUST declare ' +
154
+ 'canonical.fieldMap (there is no code path to map records).',
155
+ });
156
+ }
128
157
  });
129
158
 
130
159
  /**
@@ -0,0 +1,4 @@
1
+ export * from './lib/context-document';
2
+ export * from './lib/context-mount-entry';
3
+ export * from './lib/dropped-context';
4
+ export * from './lib/context-bundle';
@@ -0,0 +1,35 @@
1
+ import type { ContextDocument } from './context-document';
2
+ import type { ContextMountEntry } from './context-mount-entry';
3
+ import type { DroppedContextDocument } from './dropped-context';
4
+
5
+ /**
6
+ * The assembled Enterprise-Context bundle — the result of retrieving and
7
+ * ranking documents about a canonical object and packing them into a
8
+ * budget-bounded, materialisable mount plan.
9
+ *
10
+ * The bundle is producer-neutral: the first producer is
11
+ * connector-gateway-api's enterprise-context module, but the shape is a
12
+ * kernel contract so any assembler and any consumer (e.g. an agent-session
13
+ * launch that materialises the mount plan) agree on the wire.
14
+ *
15
+ * `primary` is the canonical entity echoed back verbatim (the retrieval
16
+ * subject), serialised into the first `static-literal` mount entry. It is
17
+ * the raw object, not a ranked {@link ContextDocument}. `documents` are the
18
+ * ranked retrieval hits; `mountPlan` materialises the entity plus every
19
+ * document that fit the budget; `dropped` lists documents excluded by the
20
+ * budget. `bytesUsed` is the total content bytes actually placed in the
21
+ * mount plan and never exceeds `byteBudget`.
22
+ */
23
+ export interface ContextBundle {
24
+ /** The canonical object type this bundle was assembled for. */
25
+ readonly objectType: string;
26
+ /** The canonical entity echoed back (the retrieval subject). */
27
+ readonly primary?: Readonly<Record<string, unknown>>;
28
+ readonly documents: readonly ContextDocument[];
29
+ readonly mountPlan: readonly ContextMountEntry[];
30
+ readonly dropped: readonly DroppedContextDocument[];
31
+ /** Total content-byte budget applied while packing the mount plan. */
32
+ readonly byteBudget: number;
33
+ /** Total content bytes materialised in the mount plan (≤ `byteBudget`). */
34
+ readonly bytesUsed: number;
35
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * One retrieved, ranked document included in an assembled
3
+ * {@link ContextBundle}. Sourced from a search/retrieval pass over the
4
+ * canonical-object corpus; `score` is the fused relevance (max across
5
+ * retrieval passes).
6
+ *
7
+ * `content` is the retrieved body (a summary/snippet when the retrieval
8
+ * pass does not return full content). It is the same string materialised
9
+ * as the document's `static-literal` mount bytes when the document fits
10
+ * the byte budget.
11
+ */
12
+ export interface ContextDocument {
13
+ /** Stable document reference, e.g. `kb_page:src_abc123`. */
14
+ readonly ref: string;
15
+ /** Document type discriminator, e.g. `kb_page`. */
16
+ readonly docType: string;
17
+ readonly title?: string;
18
+ readonly summary?: string;
19
+ /** Retrieved content (summary/snippet when full content is unavailable). */
20
+ readonly content?: string;
21
+ /** Fused relevance score (max across retrieval passes). */
22
+ readonly score: number;
23
+ }
@@ -0,0 +1,29 @@
1
+ import type { MountSource } from '../../workflow';
2
+
3
+ /**
4
+ * Access mode of a context mount entry. Assembled enterprise context is
5
+ * never written by the agent, so the mode is closed to `read-only`.
6
+ *
7
+ * Modelled as a single-value closed type (const + `typeof` type) rather
8
+ * than a two-member enum: the domain today has exactly one legal value and
9
+ * a wider mode would misrepresent the contract. A future read-write context
10
+ * mode is a deliberate contract change, not an open string.
11
+ */
12
+ export const CONTEXT_MOUNT_MODE = 'read-only' as const;
13
+
14
+ export type ContextMountMode = typeof CONTEXT_MOUNT_MODE;
15
+
16
+ /**
17
+ * One materialisable mount entry in an assembled {@link ContextBundle}.
18
+ *
19
+ * `source` is the full kernel {@link MountSource} discriminated union — not
20
+ * narrowed to the `static-literal` variant the first producer
21
+ * (connector-gateway-api) emits — so future producers can attach other
22
+ * kinds (e.g. `kb-pages`) without a contract change. The session's
23
+ * mount-apply pipeline materialises every entry as a typed mount, so the
24
+ * assembled context lands under `/workspace/` as real files.
25
+ */
26
+ export interface ContextMountEntry {
27
+ readonly mode: ContextMountMode;
28
+ readonly source: MountSource;
29
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Why a retrieved document was excluded from an assembled
3
+ * {@link ContextBundle}. Closed set — a dropped document is always
4
+ * reported (never silently discarded), and the reason is a typed enum so
5
+ * consumers can branch on it without string matching.
6
+ *
7
+ * Today the only exclusion path is the byte-budget cap applied while
8
+ * charging ranked documents against the bundle's `byteBudget`. New
9
+ * exclusion reasons extend this enum (one member) — do not introduce a
10
+ * free-form reason string.
11
+ */
12
+ export enum DroppedContextReason {
13
+ /** Adding the document's content would exceed the bundle byte budget. */
14
+ BYTE_BUDGET_EXCEEDED = 'BYTE_BUDGET_EXCEEDED',
15
+ }
16
+
17
+ /** A document excluded from the bundle — reported, never silently dropped. */
18
+ export interface DroppedContextDocument {
19
+ /** Stable document reference of the excluded document. */
20
+ readonly ref: string;
21
+ /** Content byte-size that would have been added had it been included. */
22
+ readonly bytes: number;
23
+ readonly reason: DroppedContextReason;
24
+ }