@copilotkit/shared 1.70.1 → 1.70.3

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 (70) hide show
  1. package/dist/attachments/types.d.cts +10 -0
  2. package/dist/attachments/types.d.cts.map +1 -1
  3. package/dist/attachments/types.d.mts +10 -0
  4. package/dist/attachments/types.d.mts.map +1 -1
  5. package/dist/index.cjs +8 -5
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +5 -3
  8. package/dist/index.d.cts.map +1 -1
  9. package/dist/index.d.mts +5 -4
  10. package/dist/index.d.mts.map +1 -1
  11. package/dist/index.mjs +5 -4
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/index.umd.js +226 -197
  14. package/dist/index.umd.js.map +1 -1
  15. package/dist/package.cjs +1 -1
  16. package/dist/package.mjs +1 -1
  17. package/dist/telemetry/index.cjs +15 -0
  18. package/dist/telemetry/index.d.cts +5 -0
  19. package/dist/telemetry/index.d.mts +4 -2
  20. package/dist/telemetry/index.mjs +6 -0
  21. package/dist/telemetry/telemetry-client.cjs +4 -13
  22. package/dist/telemetry/telemetry-client.cjs.map +1 -1
  23. package/dist/telemetry/telemetry-client.d.cts +2 -8
  24. package/dist/telemetry/telemetry-client.d.cts.map +1 -1
  25. package/dist/telemetry/telemetry-client.d.mts +2 -8
  26. package/dist/telemetry/telemetry-client.d.mts.map +1 -1
  27. package/dist/telemetry/telemetry-client.mjs +4 -12
  28. package/dist/telemetry/telemetry-client.mjs.map +1 -1
  29. package/dist/telemetry/telemetry-disabled.cjs +20 -0
  30. package/dist/telemetry/telemetry-disabled.cjs.map +1 -0
  31. package/dist/telemetry/telemetry-disabled.d.cts +16 -0
  32. package/dist/telemetry/telemetry-disabled.d.cts.map +1 -0
  33. package/dist/telemetry/telemetry-disabled.d.mts +16 -0
  34. package/dist/telemetry/telemetry-disabled.d.mts.map +1 -0
  35. package/dist/telemetry/telemetry-disabled.mjs +19 -0
  36. package/dist/telemetry/telemetry-disabled.mjs.map +1 -0
  37. package/dist/utils/index.cjs +1 -0
  38. package/dist/utils/index.cjs.map +1 -1
  39. package/dist/utils/index.d.cts +2 -1
  40. package/dist/utils/index.d.cts.map +1 -1
  41. package/dist/utils/index.d.mts +2 -1
  42. package/dist/utils/index.d.mts.map +1 -1
  43. package/dist/utils/index.mjs +1 -0
  44. package/dist/utils/index.mjs.map +1 -1
  45. package/dist/utils/inspector-learning.cjs +185 -0
  46. package/dist/utils/inspector-learning.cjs.map +1 -0
  47. package/dist/utils/inspector-learning.d.cts +91 -0
  48. package/dist/utils/inspector-learning.d.cts.map +1 -0
  49. package/dist/utils/inspector-learning.d.mts +91 -0
  50. package/dist/utils/inspector-learning.d.mts.map +1 -0
  51. package/dist/utils/inspector-learning.mjs +182 -0
  52. package/dist/utils/inspector-learning.mjs.map +1 -0
  53. package/dist/utils/types.cjs.map +1 -1
  54. package/dist/utils/types.d.cts +13 -2
  55. package/dist/utils/types.d.cts.map +1 -1
  56. package/dist/utils/types.d.mts +13 -2
  57. package/dist/utils/types.d.mts.map +1 -1
  58. package/dist/utils/types.mjs.map +1 -1
  59. package/package.json +12 -1
  60. package/src/__tests__/license-context.test.ts +22 -1
  61. package/src/__tests__/root-entry-browser-safety.test.ts +85 -0
  62. package/src/attachments/types.ts +10 -0
  63. package/src/index.ts +27 -2
  64. package/src/telemetry/telemetry-client.ts +2 -17
  65. package/src/telemetry/telemetry-disabled.ts +22 -0
  66. package/src/utils/index.ts +1 -0
  67. package/src/utils/inspector-learning.test.ts +213 -0
  68. package/src/utils/inspector-learning.ts +423 -0
  69. package/src/utils/types.ts +16 -1
  70. package/tsdown.config.ts +4 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","names":[],"sources":["../../src/utils/types.ts"],"sourcesContent":["import type { AgentCapabilities } from \"@ag-ui/core\";\n\nexport type MaybePromise<T> = T | PromiseLike<T>;\n\n/**\n * More specific utility for records with at least one key\n */\nexport type NonEmptyRecord<T> =\n T extends Record<string, unknown>\n ? keyof T extends never\n ? never\n : T\n : never;\n\n/**\n * Type representing an agent's basic information\n */\nexport interface AgentDescription {\n name: string;\n className: string;\n description: string;\n capabilities?: AgentCapabilities;\n}\n\nexport type RuntimeMode = \"sse\" | \"intelligence\";\n\nexport const RUNTIME_MODE_SSE = \"sse\" as const;\nexport const RUNTIME_MODE_INTELLIGENCE = \"intelligence\" as const;\n\nexport interface IntelligenceRuntimeInfo {\n wsUrl: string;\n}\n\nexport interface ThreadEndpointRuntimeInfo {\n list: boolean;\n inspect: boolean;\n mutations: boolean;\n realtimeMetadata: boolean;\n}\n\nexport type RuntimeLicenseStatus =\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"expiring\"\n | \"invalid\"\n | \"unknown\";\n\n/** Runtime entitlement authority resolved by a managed or self-hosted backend. */\ninterface RuntimeEntitlement {\n /** Whether the resolved entitlement currently grants product access. */\n active: boolean;\n /** Deployment authority that produced this entitlement. */\n source: \"managedOrgSubscription\" | \"selfHostedDeploymentLicense\";\n /** Boolean feature grants keyed by stable feature id. */\n features: Record<string, boolean>;\n /** Numeric limits keyed by stable feature id. */\n limits: Record<string, number>;\n /** Optional catalog plan code supplied by the entitlement authority. */\n planCode?: string;\n /** Optional lower-level source metadata supplied by the authority. */\n entitlementSource?: string;\n}\n\n/** Public diagnostic returned when Runtime entitlement resolution is not ready. */\ninterface RuntimeEntitlementError {\n /** Stable backend or SDK error code. */\n code: string;\n /** Safe human-readable diagnostic. */\n message: string;\n /** Whether a later resolution attempt may succeed without reconfiguration. */\n retryable: boolean;\n /** Optional originating request correlation id. */\n requestId?: string;\n /** Optional originating trace correlation id. */\n traceId?: string;\n}\n\n/** Successfully resolved Runtime entitlement response. */\ninterface RuntimeEntitlementReadyResponse {\n status: \"ready\";\n entitlement: RuntimeEntitlement;\n error?: never;\n}\n\n/** Structured non-ready Runtime entitlement response. */\ninterface RuntimeEntitlementErrorResponse {\n status: \"degraded\" | \"misconfigured\" | \"unavailable\";\n entitlement?: never;\n error: RuntimeEntitlementError;\n}\n\n/** Final structured Runtime entitlement response exposed through `/info`. */\nexport type RuntimeEntitlementResponse =\n | RuntimeEntitlementReadyResponse\n | RuntimeEntitlementErrorResponse;\n\nexport interface A2UIRuntimeInfo {\n enabled: boolean;\n /**\n * Agent ids the runtime applies A2UI to. When omitted, A2UI applies to\n * every agent served by the runtime.\n */\n agents?: string[];\n}\n\nexport interface RuntimeInfo {\n version: string;\n agents: Record<string, AgentDescription>;\n audioFileTranscriptionEnabled: boolean;\n mode: RuntimeMode;\n intelligence?: IntelligenceRuntimeInfo;\n threadEndpoints?: ThreadEndpointRuntimeInfo;\n /** Whether this runtime exposes trusted inspector metadata. */\n inspectorMetadata?: boolean;\n /**\n * When true, the runtime exposes POST /agent/:agentId/suggest for stateless\n * suggestion generation. Absent on older runtimes; clients fall back to a\n * client-side agent run.\n */\n suggestions?: boolean;\n /**\n * @deprecated Use `a2ui` instead, which preserves per-agent scoping.\n * Kept for backward compatibility with older clients.\n */\n a2uiEnabled?: boolean;\n a2ui?: A2UIRuntimeInfo;\n openGenerativeUIEnabled?: boolean;\n /** Structured Runtime-level entitlement authority, when advertised. */\n runtimeEntitlements?: RuntimeEntitlementResponse;\n /** Legacy compatibility diagnostic retained for older Core/Inspector clients. */\n licenseStatus?: RuntimeLicenseStatus;\n telemetryDisabled?: boolean;\n}\n"],"mappings":";;AA0BA,MAAa,mBAAmB;AAChC,MAAa,4BAA4B"}
1
+ {"version":3,"file":"types.cjs","names":[],"sources":["../../src/utils/types.ts"],"sourcesContent":["import type { AgentCapabilities } from \"@ag-ui/core\";\n\nexport type MaybePromise<T> = T | PromiseLike<T>;\n\n/**\n * More specific utility for records with at least one key\n */\nexport type NonEmptyRecord<T> =\n T extends Record<string, unknown>\n ? keyof T extends never\n ? never\n : T\n : never;\n\n/**\n * Type representing an agent's basic information\n */\nexport interface AgentDescription {\n name: string;\n className: string;\n description: string;\n capabilities?: AgentCapabilities;\n}\n\nexport type RuntimeMode = \"sse\" | \"intelligence\";\n\nexport const RUNTIME_MODE_SSE = \"sse\" as const;\nexport const RUNTIME_MODE_INTELLIGENCE = \"intelligence\" as const;\n\nexport interface IntelligenceRuntimeInfo {\n wsUrl: string;\n}\n\nexport interface ThreadEndpointRuntimeInfo {\n list: boolean;\n inspect: boolean;\n mutations: boolean;\n realtimeMetadata: boolean;\n}\n\nexport type RuntimeLicenseStatus =\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"expiring\"\n | \"invalid\"\n | \"unknown\";\n\n/** Runtime entitlement authority resolved by a managed or self-hosted backend. */\ninterface RuntimeEntitlement {\n /** Whether the resolved entitlement currently grants product access. */\n active: boolean;\n /** Deployment authority that produced this entitlement. */\n source:\n | \"managedOrgSubscription\"\n | \"selfHostedDeploymentLicense\"\n | \"awsMarketplaceDeploymentLicense\";\n /** Boolean feature grants keyed by stable feature id. */\n features: Record<string, boolean>;\n /** Numeric limits keyed by stable feature id. */\n limits: Record<string, number>;\n /** Optional catalog plan code supplied by the entitlement authority. */\n planCode?: string;\n /** Optional lower-level source metadata supplied by the authority. */\n entitlementSource?: string;\n}\n\n/** Public diagnostic returned when Runtime entitlement resolution is not ready. */\ninterface RuntimeEntitlementError {\n /** Stable backend or SDK error code. */\n code: string;\n /** Safe human-readable diagnostic. */\n message: string;\n /** Whether a later resolution attempt may succeed without reconfiguration. */\n retryable: boolean;\n /** Optional originating request correlation id. */\n requestId?: string;\n /** Optional originating trace correlation id. */\n traceId?: string;\n}\n\n/** Successfully resolved Runtime entitlement response. */\ninterface RuntimeEntitlementReadyResponse {\n status: \"ready\";\n entitlement: RuntimeEntitlement;\n error?: never;\n}\n\n/** Structured non-ready Runtime entitlement response. */\ninterface RuntimeEntitlementErrorResponse {\n status: \"degraded\" | \"misconfigured\" | \"unavailable\";\n entitlement?: never;\n error: RuntimeEntitlementError;\n}\n\n/** Final structured Runtime entitlement response exposed through `/info`. */\nexport type RuntimeEntitlementResponse =\n | RuntimeEntitlementReadyResponse\n | RuntimeEntitlementErrorResponse;\n\nexport interface A2UIRuntimeInfo {\n enabled: boolean;\n /**\n * Agent ids the runtime applies A2UI to. When omitted, A2UI applies to\n * every agent served by the runtime.\n */\n agents?: string[];\n}\n\n/** Intelligence resource support available through a single runtime route. */\nexport interface SingleRouteRuntimeInfo {\n /** Whether the runtime accepts resource requests through the single route. */\n resourceOperations: boolean;\n /** Thread features available through the single-route resource bridge. */\n threadEndpoints: ThreadEndpointRuntimeInfo;\n}\n\nexport interface RuntimeInfo {\n version: string;\n agents: Record<string, AgentDescription>;\n audioFileTranscriptionEnabled: boolean;\n mode: RuntimeMode;\n intelligence?: IntelligenceRuntimeInfo;\n threadEndpoints?: ThreadEndpointRuntimeInfo;\n /** Optional capabilities exposed by runtimes that use one HTTP route. */\n singleRoute?: SingleRouteRuntimeInfo;\n /** Whether this runtime exposes trusted inspector metadata. */\n inspectorMetadata?: boolean;\n /** Whether this runtime exposes the debug-authorized Learning snapshot. */\n inspectorLearning?: boolean;\n /**\n * When true, the runtime exposes POST /agent/:agentId/suggest for stateless\n * suggestion generation. Absent on older runtimes; clients fall back to a\n * client-side agent run.\n */\n suggestions?: boolean;\n /**\n * @deprecated Use `a2ui` instead, which preserves per-agent scoping.\n * Kept for backward compatibility with older clients.\n */\n a2uiEnabled?: boolean;\n a2ui?: A2UIRuntimeInfo;\n openGenerativeUIEnabled?: boolean;\n /** Structured Runtime-level entitlement authority, when advertised. */\n runtimeEntitlements?: RuntimeEntitlementResponse;\n /** Legacy compatibility diagnostic retained for older Core/Inspector clients. */\n licenseStatus?: RuntimeLicenseStatus;\n telemetryDisabled?: boolean;\n}\n"],"mappings":";;AA0BA,MAAa,mBAAmB;AAChC,MAAa,4BAA4B"}
@@ -33,7 +33,7 @@ interface RuntimeEntitlement {
33
33
  /** Whether the resolved entitlement currently grants product access. */
34
34
  active: boolean;
35
35
  /** Deployment authority that produced this entitlement. */
36
- source: "managedOrgSubscription" | "selfHostedDeploymentLicense";
36
+ source: "managedOrgSubscription" | "selfHostedDeploymentLicense" | "awsMarketplaceDeploymentLicense";
37
37
  /** Boolean feature grants keyed by stable feature id. */
38
38
  features: Record<string, boolean>;
39
39
  /** Numeric limits keyed by stable feature id. */
@@ -78,6 +78,13 @@ interface A2UIRuntimeInfo {
78
78
  */
79
79
  agents?: string[];
80
80
  }
81
+ /** Intelligence resource support available through a single runtime route. */
82
+ interface SingleRouteRuntimeInfo {
83
+ /** Whether the runtime accepts resource requests through the single route. */
84
+ resourceOperations: boolean;
85
+ /** Thread features available through the single-route resource bridge. */
86
+ threadEndpoints: ThreadEndpointRuntimeInfo;
87
+ }
81
88
  interface RuntimeInfo {
82
89
  version: string;
83
90
  agents: Record<string, AgentDescription>;
@@ -85,8 +92,12 @@ interface RuntimeInfo {
85
92
  mode: RuntimeMode;
86
93
  intelligence?: IntelligenceRuntimeInfo;
87
94
  threadEndpoints?: ThreadEndpointRuntimeInfo;
95
+ /** Optional capabilities exposed by runtimes that use one HTTP route. */
96
+ singleRoute?: SingleRouteRuntimeInfo;
88
97
  /** Whether this runtime exposes trusted inspector metadata. */
89
98
  inspectorMetadata?: boolean;
99
+ /** Whether this runtime exposes the debug-authorized Learning snapshot. */
100
+ inspectorLearning?: boolean;
90
101
  /**
91
102
  * When true, the runtime exposes POST /agent/:agentId/suggest for stateless
92
103
  * suggestion generation. Absent on older runtimes; clients fall back to a
@@ -107,5 +118,5 @@ interface RuntimeInfo {
107
118
  telemetryDisabled?: boolean;
108
119
  }
109
120
  //#endregion
110
- export { A2UIRuntimeInfo, AgentDescription, IntelligenceRuntimeInfo, MaybePromise, NonEmptyRecord, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, RuntimeEntitlementResponse, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, ThreadEndpointRuntimeInfo };
121
+ export { A2UIRuntimeInfo, AgentDescription, IntelligenceRuntimeInfo, MaybePromise, NonEmptyRecord, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, RuntimeEntitlementResponse, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SingleRouteRuntimeInfo, ThreadEndpointRuntimeInfo };
111
122
  //# sourceMappingURL=types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/utils/types.ts"],"mappings":";;;KAEY,YAAA,MAAkB,CAAA,GAAI,WAAA,CAAY,CAAA;;AAA9C;;KAKY,cAAA,MACV,CAAA,SAAU,MAAA,0BACA,CAAA,yBAEJ,CAAA;;;;UAMS,gBAAA;EACf,IAAA;EACA,SAAA;EACA,WAAA;EACA,YAAA,GAAe,iBAAA;AAAA;AAAA,KAGL,WAAA;AAAA,cAEC,gBAAA;AAAA,cACA,yBAAA;AAAA,UAEI,uBAAA;EACf,KAAA;AAAA;AAAA,UAGe,yBAAA;EACf,IAAA;EACA,OAAA;EACA,SAAA;EACA,gBAAA;AAAA;AAAA,KAGU,oBAAA;;UASF,kBAAA;EAtCF;EAwCN,MAAA;EAxCO;EA0CP,MAAA;EApC+B;EAsC/B,QAAA,EAAU,MAAA;EAlCsB;EAoChC,MAAA,EAAQ,MAAA;EAtCR;EAwCA,QAAA;EAtCA;EAwCA,iBAAA;AAAA;;UAIQ,uBAAA;EAzCa;EA2CrB,IAAA;EA3CqB;EA6CrB,OAAA;EA3CW;EA6CX,SAAA;;EAEA,SAAA;EA/C4C;EAiD5C,OAAA;AAAA;;UAIQ,+BAAA;EACR,MAAA;EACA,WAAA,EAAa,kBAAA;EACb,KAAA;AAAA;;UAIQ,+BAAA;EACR,MAAA;EACA,WAAA;EACA,KAAA,EAAO,uBAAA;AAAA;;KAIG,0BAAA,GACR,+BAAA,GACA,+BAAA;AAAA,UAEa,eAAA;EACf,OAAA;EA7DgB;;AAGlB;;EA+DE,MAAA;AAAA;AAAA,UAGe,WAAA;EACf,OAAA;EACA,MAAA,EAAQ,MAAA,SAAe,gBAAA;EACvB,6BAAA;EACA,IAAA,EAAM,WAAA;EACN,YAAA,GAAe,uBAAA;EACf,eAAA,GAAkB,yBAAA;EAzDlB;EA2DA,iBAAA;EAzDA;;;;;EA+DA,WAAA;EAvDQ;;;;EA4DR,WAAA;EACA,IAAA,GAAO,eAAA;EACP,uBAAA;EAtDA;EAwDA,mBAAA,GAAsB,0BAAA;EAtDf;EAwDP,aAAA,GAAgB,oBAAA;EAChB,iBAAA;AAAA"}
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/utils/types.ts"],"mappings":";;;KAEY,YAAA,MAAkB,CAAA,GAAI,WAAA,CAAY,CAAA;;AAA9C;;KAKY,cAAA,MACV,CAAA,SAAU,MAAA,0BACA,CAAA,yBAEJ,CAAA;;;;UAMS,gBAAA;EACf,IAAA;EACA,SAAA;EACA,WAAA;EACA,YAAA,GAAe,iBAAA;AAAA;AAAA,KAGL,WAAA;AAAA,cAEC,gBAAA;AAAA,cACA,yBAAA;AAAA,UAEI,uBAAA;EACf,KAAA;AAAA;AAAA,UAGe,yBAAA;EACf,IAAA;EACA,OAAA;EACA,SAAA;EACA,gBAAA;AAAA;AAAA,KAGU,oBAAA;;UASF,kBAAA;EAtCF;EAwCN,MAAA;EAxCO;EA0CP,MAAA;EApC+B;EAyC/B,QAAA,EAAU,MAAA;EArCsB;EAuChC,MAAA,EAAQ,MAAA;EAzCR;EA2CA,QAAA;EAzCA;EA2CA,iBAAA;AAAA;;UAIQ,uBAAA;EA5Ca;EA8CrB,IAAA;EA9CqB;EAgDrB,OAAA;EA9CW;EAgDX,SAAA;;EAEA,SAAA;EAlD4C;EAoD5C,OAAA;AAAA;;UAIQ,+BAAA;EACR,MAAA;EACA,WAAA,EAAa,kBAAA;EACb,KAAA;AAAA;;UAIQ,+BAAA;EACR,MAAA;EACA,WAAA;EACA,KAAA,EAAO,uBAAA;AAAA;;KAIG,0BAAA,GACR,+BAAA,GACA,+BAAA;AAAA,UAEa,eAAA;EACf,OAAA;EAhEgB;;AAGlB;;EAkEE,MAAA;AAAA;;UAIe,sBAAA;EA7DW;EA+D1B,kBAAA;EApDc;EAsDd,eAAA,EAAiB,yBAAA;AAAA;AAAA,UAGF,WAAA;EACf,OAAA;EACA,MAAA,EAAQ,MAAA,SAAe,gBAAA;EACvB,6BAAA;EACA,IAAA,EAAM,WAAA;EACN,YAAA,GAAe,uBAAA;EACf,eAAA,GAAkB,yBAAA;EA3DD;EA6DjB,WAAA,GAAc,sBAAA;EAzDiB;EA2D/B,iBAAA;EA3D+B;EA6D/B,iBAAA;EAzDA;;;;;EA+DA,WAAA;EArDQ;;;;EA0DR,WAAA;EACA,IAAA,GAAO,eAAA;EACP,uBAAA;EAzDA;EA2DA,mBAAA,GAAsB,0BAAA;EA3DjB;EA6DL,aAAA,GAAgB,oBAAA;EAChB,iBAAA;AAAA"}
@@ -33,7 +33,7 @@ interface RuntimeEntitlement {
33
33
  /** Whether the resolved entitlement currently grants product access. */
34
34
  active: boolean;
35
35
  /** Deployment authority that produced this entitlement. */
36
- source: "managedOrgSubscription" | "selfHostedDeploymentLicense";
36
+ source: "managedOrgSubscription" | "selfHostedDeploymentLicense" | "awsMarketplaceDeploymentLicense";
37
37
  /** Boolean feature grants keyed by stable feature id. */
38
38
  features: Record<string, boolean>;
39
39
  /** Numeric limits keyed by stable feature id. */
@@ -78,6 +78,13 @@ interface A2UIRuntimeInfo {
78
78
  */
79
79
  agents?: string[];
80
80
  }
81
+ /** Intelligence resource support available through a single runtime route. */
82
+ interface SingleRouteRuntimeInfo {
83
+ /** Whether the runtime accepts resource requests through the single route. */
84
+ resourceOperations: boolean;
85
+ /** Thread features available through the single-route resource bridge. */
86
+ threadEndpoints: ThreadEndpointRuntimeInfo;
87
+ }
81
88
  interface RuntimeInfo {
82
89
  version: string;
83
90
  agents: Record<string, AgentDescription>;
@@ -85,8 +92,12 @@ interface RuntimeInfo {
85
92
  mode: RuntimeMode;
86
93
  intelligence?: IntelligenceRuntimeInfo;
87
94
  threadEndpoints?: ThreadEndpointRuntimeInfo;
95
+ /** Optional capabilities exposed by runtimes that use one HTTP route. */
96
+ singleRoute?: SingleRouteRuntimeInfo;
88
97
  /** Whether this runtime exposes trusted inspector metadata. */
89
98
  inspectorMetadata?: boolean;
99
+ /** Whether this runtime exposes the debug-authorized Learning snapshot. */
100
+ inspectorLearning?: boolean;
90
101
  /**
91
102
  * When true, the runtime exposes POST /agent/:agentId/suggest for stateless
92
103
  * suggestion generation. Absent on older runtimes; clients fall back to a
@@ -107,5 +118,5 @@ interface RuntimeInfo {
107
118
  telemetryDisabled?: boolean;
108
119
  }
109
120
  //#endregion
110
- export { A2UIRuntimeInfo, AgentDescription, IntelligenceRuntimeInfo, MaybePromise, NonEmptyRecord, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, RuntimeEntitlementResponse, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, ThreadEndpointRuntimeInfo };
121
+ export { A2UIRuntimeInfo, AgentDescription, IntelligenceRuntimeInfo, MaybePromise, NonEmptyRecord, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, RuntimeEntitlementResponse, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SingleRouteRuntimeInfo, ThreadEndpointRuntimeInfo };
111
122
  //# sourceMappingURL=types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/utils/types.ts"],"mappings":";;;KAEY,YAAA,MAAkB,CAAA,GAAI,WAAA,CAAY,CAAA;;AAA9C;;KAKY,cAAA,MACV,CAAA,SAAU,MAAA,0BACA,CAAA,yBAEJ,CAAA;;;;UAMS,gBAAA;EACf,IAAA;EACA,SAAA;EACA,WAAA;EACA,YAAA,GAAe,iBAAA;AAAA;AAAA,KAGL,WAAA;AAAA,cAEC,gBAAA;AAAA,cACA,yBAAA;AAAA,UAEI,uBAAA;EACf,KAAA;AAAA;AAAA,UAGe,yBAAA;EACf,IAAA;EACA,OAAA;EACA,SAAA;EACA,gBAAA;AAAA;AAAA,KAGU,oBAAA;;UASF,kBAAA;EAtCF;EAwCN,MAAA;EAxCO;EA0CP,MAAA;EApC+B;EAsC/B,QAAA,EAAU,MAAA;EAlCsB;EAoChC,MAAA,EAAQ,MAAA;EAtCR;EAwCA,QAAA;EAtCA;EAwCA,iBAAA;AAAA;;UAIQ,uBAAA;EAzCa;EA2CrB,IAAA;EA3CqB;EA6CrB,OAAA;EA3CW;EA6CX,SAAA;;EAEA,SAAA;EA/C4C;EAiD5C,OAAA;AAAA;;UAIQ,+BAAA;EACR,MAAA;EACA,WAAA,EAAa,kBAAA;EACb,KAAA;AAAA;;UAIQ,+BAAA;EACR,MAAA;EACA,WAAA;EACA,KAAA,EAAO,uBAAA;AAAA;;KAIG,0BAAA,GACR,+BAAA,GACA,+BAAA;AAAA,UAEa,eAAA;EACf,OAAA;EA7DgB;;AAGlB;;EA+DE,MAAA;AAAA;AAAA,UAGe,WAAA;EACf,OAAA;EACA,MAAA,EAAQ,MAAA,SAAe,gBAAA;EACvB,6BAAA;EACA,IAAA,EAAM,WAAA;EACN,YAAA,GAAe,uBAAA;EACf,eAAA,GAAkB,yBAAA;EAzDlB;EA2DA,iBAAA;EAzDA;;;;;EA+DA,WAAA;EAvDQ;;;;EA4DR,WAAA;EACA,IAAA,GAAO,eAAA;EACP,uBAAA;EAtDA;EAwDA,mBAAA,GAAsB,0BAAA;EAtDf;EAwDP,aAAA,GAAgB,oBAAA;EAChB,iBAAA;AAAA"}
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/utils/types.ts"],"mappings":";;;KAEY,YAAA,MAAkB,CAAA,GAAI,WAAA,CAAY,CAAA;;AAA9C;;KAKY,cAAA,MACV,CAAA,SAAU,MAAA,0BACA,CAAA,yBAEJ,CAAA;;;;UAMS,gBAAA;EACf,IAAA;EACA,SAAA;EACA,WAAA;EACA,YAAA,GAAe,iBAAA;AAAA;AAAA,KAGL,WAAA;AAAA,cAEC,gBAAA;AAAA,cACA,yBAAA;AAAA,UAEI,uBAAA;EACf,KAAA;AAAA;AAAA,UAGe,yBAAA;EACf,IAAA;EACA,OAAA;EACA,SAAA;EACA,gBAAA;AAAA;AAAA,KAGU,oBAAA;;UASF,kBAAA;EAtCF;EAwCN,MAAA;EAxCO;EA0CP,MAAA;EApC+B;EAyC/B,QAAA,EAAU,MAAA;EArCsB;EAuChC,MAAA,EAAQ,MAAA;EAzCR;EA2CA,QAAA;EAzCA;EA2CA,iBAAA;AAAA;;UAIQ,uBAAA;EA5Ca;EA8CrB,IAAA;EA9CqB;EAgDrB,OAAA;EA9CW;EAgDX,SAAA;;EAEA,SAAA;EAlD4C;EAoD5C,OAAA;AAAA;;UAIQ,+BAAA;EACR,MAAA;EACA,WAAA,EAAa,kBAAA;EACb,KAAA;AAAA;;UAIQ,+BAAA;EACR,MAAA;EACA,WAAA;EACA,KAAA,EAAO,uBAAA;AAAA;;KAIG,0BAAA,GACR,+BAAA,GACA,+BAAA;AAAA,UAEa,eAAA;EACf,OAAA;EAhEgB;;AAGlB;;EAkEE,MAAA;AAAA;;UAIe,sBAAA;EA7DW;EA+D1B,kBAAA;EApDc;EAsDd,eAAA,EAAiB,yBAAA;AAAA;AAAA,UAGF,WAAA;EACf,OAAA;EACA,MAAA,EAAQ,MAAA,SAAe,gBAAA;EACvB,6BAAA;EACA,IAAA,EAAM,WAAA;EACN,YAAA,GAAe,uBAAA;EACf,eAAA,GAAkB,yBAAA;EA3DD;EA6DjB,WAAA,GAAc,sBAAA;EAzDiB;EA2D/B,iBAAA;EA3D+B;EA6D/B,iBAAA;EAzDA;;;;;EA+DA,WAAA;EArDQ;;;;EA0DR,WAAA;EACA,IAAA,GAAO,eAAA;EACP,uBAAA;EAzDA;EA2DA,mBAAA,GAAsB,0BAAA;EA3DjB;EA6DL,aAAA,GAAgB,oBAAA;EAChB,iBAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","names":[],"sources":["../../src/utils/types.ts"],"sourcesContent":["import type { AgentCapabilities } from \"@ag-ui/core\";\n\nexport type MaybePromise<T> = T | PromiseLike<T>;\n\n/**\n * More specific utility for records with at least one key\n */\nexport type NonEmptyRecord<T> =\n T extends Record<string, unknown>\n ? keyof T extends never\n ? never\n : T\n : never;\n\n/**\n * Type representing an agent's basic information\n */\nexport interface AgentDescription {\n name: string;\n className: string;\n description: string;\n capabilities?: AgentCapabilities;\n}\n\nexport type RuntimeMode = \"sse\" | \"intelligence\";\n\nexport const RUNTIME_MODE_SSE = \"sse\" as const;\nexport const RUNTIME_MODE_INTELLIGENCE = \"intelligence\" as const;\n\nexport interface IntelligenceRuntimeInfo {\n wsUrl: string;\n}\n\nexport interface ThreadEndpointRuntimeInfo {\n list: boolean;\n inspect: boolean;\n mutations: boolean;\n realtimeMetadata: boolean;\n}\n\nexport type RuntimeLicenseStatus =\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"expiring\"\n | \"invalid\"\n | \"unknown\";\n\n/** Runtime entitlement authority resolved by a managed or self-hosted backend. */\ninterface RuntimeEntitlement {\n /** Whether the resolved entitlement currently grants product access. */\n active: boolean;\n /** Deployment authority that produced this entitlement. */\n source: \"managedOrgSubscription\" | \"selfHostedDeploymentLicense\";\n /** Boolean feature grants keyed by stable feature id. */\n features: Record<string, boolean>;\n /** Numeric limits keyed by stable feature id. */\n limits: Record<string, number>;\n /** Optional catalog plan code supplied by the entitlement authority. */\n planCode?: string;\n /** Optional lower-level source metadata supplied by the authority. */\n entitlementSource?: string;\n}\n\n/** Public diagnostic returned when Runtime entitlement resolution is not ready. */\ninterface RuntimeEntitlementError {\n /** Stable backend or SDK error code. */\n code: string;\n /** Safe human-readable diagnostic. */\n message: string;\n /** Whether a later resolution attempt may succeed without reconfiguration. */\n retryable: boolean;\n /** Optional originating request correlation id. */\n requestId?: string;\n /** Optional originating trace correlation id. */\n traceId?: string;\n}\n\n/** Successfully resolved Runtime entitlement response. */\ninterface RuntimeEntitlementReadyResponse {\n status: \"ready\";\n entitlement: RuntimeEntitlement;\n error?: never;\n}\n\n/** Structured non-ready Runtime entitlement response. */\ninterface RuntimeEntitlementErrorResponse {\n status: \"degraded\" | \"misconfigured\" | \"unavailable\";\n entitlement?: never;\n error: RuntimeEntitlementError;\n}\n\n/** Final structured Runtime entitlement response exposed through `/info`. */\nexport type RuntimeEntitlementResponse =\n | RuntimeEntitlementReadyResponse\n | RuntimeEntitlementErrorResponse;\n\nexport interface A2UIRuntimeInfo {\n enabled: boolean;\n /**\n * Agent ids the runtime applies A2UI to. When omitted, A2UI applies to\n * every agent served by the runtime.\n */\n agents?: string[];\n}\n\nexport interface RuntimeInfo {\n version: string;\n agents: Record<string, AgentDescription>;\n audioFileTranscriptionEnabled: boolean;\n mode: RuntimeMode;\n intelligence?: IntelligenceRuntimeInfo;\n threadEndpoints?: ThreadEndpointRuntimeInfo;\n /** Whether this runtime exposes trusted inspector metadata. */\n inspectorMetadata?: boolean;\n /**\n * When true, the runtime exposes POST /agent/:agentId/suggest for stateless\n * suggestion generation. Absent on older runtimes; clients fall back to a\n * client-side agent run.\n */\n suggestions?: boolean;\n /**\n * @deprecated Use `a2ui` instead, which preserves per-agent scoping.\n * Kept for backward compatibility with older clients.\n */\n a2uiEnabled?: boolean;\n a2ui?: A2UIRuntimeInfo;\n openGenerativeUIEnabled?: boolean;\n /** Structured Runtime-level entitlement authority, when advertised. */\n runtimeEntitlements?: RuntimeEntitlementResponse;\n /** Legacy compatibility diagnostic retained for older Core/Inspector clients. */\n licenseStatus?: RuntimeLicenseStatus;\n telemetryDisabled?: boolean;\n}\n"],"mappings":";AA0BA,MAAa,mBAAmB;AAChC,MAAa,4BAA4B"}
1
+ {"version":3,"file":"types.mjs","names":[],"sources":["../../src/utils/types.ts"],"sourcesContent":["import type { AgentCapabilities } from \"@ag-ui/core\";\n\nexport type MaybePromise<T> = T | PromiseLike<T>;\n\n/**\n * More specific utility for records with at least one key\n */\nexport type NonEmptyRecord<T> =\n T extends Record<string, unknown>\n ? keyof T extends never\n ? never\n : T\n : never;\n\n/**\n * Type representing an agent's basic information\n */\nexport interface AgentDescription {\n name: string;\n className: string;\n description: string;\n capabilities?: AgentCapabilities;\n}\n\nexport type RuntimeMode = \"sse\" | \"intelligence\";\n\nexport const RUNTIME_MODE_SSE = \"sse\" as const;\nexport const RUNTIME_MODE_INTELLIGENCE = \"intelligence\" as const;\n\nexport interface IntelligenceRuntimeInfo {\n wsUrl: string;\n}\n\nexport interface ThreadEndpointRuntimeInfo {\n list: boolean;\n inspect: boolean;\n mutations: boolean;\n realtimeMetadata: boolean;\n}\n\nexport type RuntimeLicenseStatus =\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"expiring\"\n | \"invalid\"\n | \"unknown\";\n\n/** Runtime entitlement authority resolved by a managed or self-hosted backend. */\ninterface RuntimeEntitlement {\n /** Whether the resolved entitlement currently grants product access. */\n active: boolean;\n /** Deployment authority that produced this entitlement. */\n source:\n | \"managedOrgSubscription\"\n | \"selfHostedDeploymentLicense\"\n | \"awsMarketplaceDeploymentLicense\";\n /** Boolean feature grants keyed by stable feature id. */\n features: Record<string, boolean>;\n /** Numeric limits keyed by stable feature id. */\n limits: Record<string, number>;\n /** Optional catalog plan code supplied by the entitlement authority. */\n planCode?: string;\n /** Optional lower-level source metadata supplied by the authority. */\n entitlementSource?: string;\n}\n\n/** Public diagnostic returned when Runtime entitlement resolution is not ready. */\ninterface RuntimeEntitlementError {\n /** Stable backend or SDK error code. */\n code: string;\n /** Safe human-readable diagnostic. */\n message: string;\n /** Whether a later resolution attempt may succeed without reconfiguration. */\n retryable: boolean;\n /** Optional originating request correlation id. */\n requestId?: string;\n /** Optional originating trace correlation id. */\n traceId?: string;\n}\n\n/** Successfully resolved Runtime entitlement response. */\ninterface RuntimeEntitlementReadyResponse {\n status: \"ready\";\n entitlement: RuntimeEntitlement;\n error?: never;\n}\n\n/** Structured non-ready Runtime entitlement response. */\ninterface RuntimeEntitlementErrorResponse {\n status: \"degraded\" | \"misconfigured\" | \"unavailable\";\n entitlement?: never;\n error: RuntimeEntitlementError;\n}\n\n/** Final structured Runtime entitlement response exposed through `/info`. */\nexport type RuntimeEntitlementResponse =\n | RuntimeEntitlementReadyResponse\n | RuntimeEntitlementErrorResponse;\n\nexport interface A2UIRuntimeInfo {\n enabled: boolean;\n /**\n * Agent ids the runtime applies A2UI to. When omitted, A2UI applies to\n * every agent served by the runtime.\n */\n agents?: string[];\n}\n\n/** Intelligence resource support available through a single runtime route. */\nexport interface SingleRouteRuntimeInfo {\n /** Whether the runtime accepts resource requests through the single route. */\n resourceOperations: boolean;\n /** Thread features available through the single-route resource bridge. */\n threadEndpoints: ThreadEndpointRuntimeInfo;\n}\n\nexport interface RuntimeInfo {\n version: string;\n agents: Record<string, AgentDescription>;\n audioFileTranscriptionEnabled: boolean;\n mode: RuntimeMode;\n intelligence?: IntelligenceRuntimeInfo;\n threadEndpoints?: ThreadEndpointRuntimeInfo;\n /** Optional capabilities exposed by runtimes that use one HTTP route. */\n singleRoute?: SingleRouteRuntimeInfo;\n /** Whether this runtime exposes trusted inspector metadata. */\n inspectorMetadata?: boolean;\n /** Whether this runtime exposes the debug-authorized Learning snapshot. */\n inspectorLearning?: boolean;\n /**\n * When true, the runtime exposes POST /agent/:agentId/suggest for stateless\n * suggestion generation. Absent on older runtimes; clients fall back to a\n * client-side agent run.\n */\n suggestions?: boolean;\n /**\n * @deprecated Use `a2ui` instead, which preserves per-agent scoping.\n * Kept for backward compatibility with older clients.\n */\n a2uiEnabled?: boolean;\n a2ui?: A2UIRuntimeInfo;\n openGenerativeUIEnabled?: boolean;\n /** Structured Runtime-level entitlement authority, when advertised. */\n runtimeEntitlements?: RuntimeEntitlementResponse;\n /** Legacy compatibility diagnostic retained for older Core/Inspector clients. */\n licenseStatus?: RuntimeLicenseStatus;\n telemetryDisabled?: boolean;\n}\n"],"mappings":";AA0BA,MAAa,mBAAmB;AAChC,MAAa,4BAA4B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copilotkit/shared",
3
- "version": "1.70.1",
3
+ "version": "1.70.3",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "ai",
@@ -32,8 +32,19 @@
32
32
  "import": "./dist/index.mjs",
33
33
  "require": "./dist/index.cjs"
34
34
  },
35
+ "./telemetry": {
36
+ "import": "./dist/telemetry/index.mjs",
37
+ "require": "./dist/telemetry/index.cjs"
38
+ },
35
39
  "./package.json": "./package.json"
36
40
  },
41
+ "typesVersions": {
42
+ "*": {
43
+ "telemetry": [
44
+ "./dist/telemetry/index.d.cts"
45
+ ]
46
+ }
47
+ },
37
48
  "publishConfig": {
38
49
  "access": "public"
39
50
  },
@@ -1,6 +1,9 @@
1
1
  import { expect, test } from "vitest";
2
2
  import { createLicenseContextValue } from "../index";
3
- import type { RuntimeLicenseStatus } from "../utils/types";
3
+ import type {
4
+ RuntimeEntitlementResponse,
5
+ RuntimeLicenseStatus,
6
+ } from "../utils/types";
4
7
 
5
8
  test("license context fails open when no status is known", () => {
6
9
  for (const status of [null, undefined] as const) {
@@ -162,6 +165,24 @@ test("license context denies features and limits for a ready inactive entitlemen
162
165
  expect(ctx.getLimit("threads")).toBeNull();
163
166
  });
164
167
 
168
+ test("license context does not fall back for an inactive AWS Marketplace entitlement", () => {
169
+ const marketplaceEntitlements = {
170
+ status: "ready",
171
+ entitlement: {
172
+ active: false,
173
+ source: "awsMarketplaceDeploymentLicense",
174
+ features: {},
175
+ limits: {},
176
+ },
177
+ } as const satisfies RuntimeEntitlementResponse;
178
+
179
+ const ctx = createLicenseContextValue("valid", marketplaceEntitlements);
180
+
181
+ expect(ctx.status).toBe("none");
182
+ expect(ctx.checkFeature("threads")).toBe(false);
183
+ expect(ctx.getLimit("threads")).toBeNull();
184
+ });
185
+
165
186
  test.each(["valid", "expiring"] as RuntimeLicenseStatus[])(
166
187
  "license context preserves a %s legacy fallback for an inactive self-hosted entitlement",
167
188
  (status) => {
@@ -0,0 +1,85 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { dirname, join, resolve } from "node:path";
3
+ import { describe, expect, it } from "vitest";
4
+
5
+ /**
6
+ * `@copilotkit/shared` is imported by browser-facing packages such as
7
+ * `@copilotkit/react-core`. Browser bundlers resolve the whole static module
8
+ * graph before they tree-shake, so a single static edge from this entry to a
9
+ * Node-only package makes every dependent browser build print "Module ... has
10
+ * been externalized for browser compatibility" warnings, even when the
11
+ * consumer never touches the offending code. That was issue #4151, caused by
12
+ * the root entry re-exporting `telemetry/telemetry-client.ts`.
13
+ *
14
+ * Deferring the import does not help: a dynamic import keeps the graph edge.
15
+ * The edge itself has to stay out of this entry. This test walks the static,
16
+ * value-level graph from `src/index.ts` and fails if it reaches a Node-only
17
+ * package. Type-only edges are erased at build time and are therefore fine.
18
+ */
19
+ const NODE_ONLY_PACKAGES = ["@segment/analytics-node", "node-fetch"];
20
+
21
+ const SRC = resolve(__dirname, "..");
22
+
23
+ function resolveRelative(fromFile: string, specifier: string): string | null {
24
+ const base = join(dirname(fromFile), specifier);
25
+ for (const candidate of [
26
+ `${base}.ts`,
27
+ `${base}.tsx`,
28
+ join(base, "index.ts"),
29
+ base,
30
+ ]) {
31
+ if (existsSync(candidate) && !candidate.endsWith("/")) {
32
+ return candidate;
33
+ }
34
+ }
35
+ return null;
36
+ }
37
+
38
+ /** Bare specifiers reachable from `entry` through value (non-type) edges. */
39
+ function collectRuntimeDependencies(entry: string): Set<string> {
40
+ const bare = new Set<string>();
41
+ const seen = new Set<string>();
42
+ const queue = [entry];
43
+
44
+ while (queue.length > 0) {
45
+ const file = queue.pop()!;
46
+ if (seen.has(file)) continue;
47
+ seen.add(file);
48
+
49
+ const source = readFileSync(file, "utf8");
50
+ // `import ... from "x"`, `export ... from "x"`, `import("x")`. The
51
+ // negative lookahead drops `import type` / `export type`, which the
52
+ // compiler erases.
53
+ const pattern =
54
+ /(?:\b(?:import|export)\b(?!\s+type\b)[\s\S]*?\bfrom\s*|\bimport\s*\(\s*)["']([^"']+)["']/g;
55
+
56
+ for (const match of source.matchAll(pattern)) {
57
+ const specifier = match[1];
58
+ if (specifier.startsWith(".")) {
59
+ const target = resolveRelative(file, specifier);
60
+ if (target) queue.push(target);
61
+ continue;
62
+ }
63
+ bare.add(specifier);
64
+ }
65
+ }
66
+
67
+ return bare;
68
+ }
69
+
70
+ describe("root entry browser safety (#4151)", () => {
71
+ it("does not reach Node-only packages through value imports", () => {
72
+ const reachable = collectRuntimeDependencies(join(SRC, "index.ts"));
73
+ const offenders = NODE_ONLY_PACKAGES.filter((pkg) => reachable.has(pkg));
74
+ expect(offenders).toEqual([]);
75
+ });
76
+
77
+ it("still reaches Node-only packages from the telemetry subpath entry", () => {
78
+ // Guards the test itself: the walker has to be able to see the edge it is
79
+ // asserting the absence of above.
80
+ const reachable = collectRuntimeDependencies(
81
+ join(SRC, "telemetry", "index.ts"),
82
+ );
83
+ expect(reachable).toContain("@segment/analytics-node");
84
+ });
85
+ });
@@ -44,6 +44,16 @@ export interface AttachmentsConfig {
44
44
  accept?: string;
45
45
  /** Maximum file size in bytes, default 20MB (20 * 1024 * 1024) */
46
46
  maxSize?: number;
47
+ /**
48
+ * How many files may upload at the same time, default 1 — `onUpload` is not
49
+ * called concurrently unless you raise this. Files past the limit wait for a
50
+ * free slot; `Infinity` lifts it. The limit covers everything in flight, so
51
+ * two selections dropped or pasted at once share the slots rather than each
52
+ * taking the full number.
53
+ * Honored by the React `useAttachments` hook — the Vue and Angular bindings
54
+ * still upload serially.
55
+ */
56
+ maxConcurrentUploads?: number;
47
57
  /** Custom upload handler. Return an InputContentSource with optional metadata. */
48
58
  onUpload?: (
49
59
  file: File,
package/src/index.ts CHANGED
@@ -1,7 +1,31 @@
1
1
  export * from "./types";
2
2
  export * from "./utils";
3
3
  export * from "./constants";
4
- export * from "./telemetry";
4
+ // Telemetry is split deliberately. `TelemetryClient` imports
5
+ // `@segment/analytics-node`, which imports `node-fetch`, which imports the
6
+ // Node built-ins `stream`, `http`, `https` and `zlib`. Browser bundlers
7
+ // resolve the whole module graph before they tree-shake, so re-exporting
8
+ // that module here made every browser build of a dependent package print
9
+ // "Module ... has been externalized for browser compatibility" warnings,
10
+ // even when the consumer never touched telemetry (#4151). Only the
11
+ // browser-safe telemetry surface is re-exported from this entry. Server
12
+ // code that needs the client imports it from `@copilotkit/shared/telemetry`.
13
+ // This mirrors the license-verifier note below.
14
+ export { isTelemetryDisabled } from "./telemetry/telemetry-disabled";
15
+ export * from "./telemetry/sampling";
16
+ export {
17
+ firstNonBlankTelemetryId,
18
+ lambdaClient,
19
+ parseTelemetryIdFromLicense,
20
+ parseAndWarnTelemetryId,
21
+ } from "./telemetry/lambda-client";
22
+ export type { LambdaSendOptions } from "./telemetry/lambda-client";
23
+ // Types only: erased at build time, so they add no runtime edge to
24
+ // `telemetry-client.ts` and therefore none to @segment/analytics-node.
25
+ export type {
26
+ TelemetryCapture,
27
+ TelemetryIdentity,
28
+ } from "./telemetry/telemetry-client";
5
29
  export * from "./debug";
6
30
  export * from "./standard-schema";
7
31
  export * from "./attachments";
@@ -106,7 +130,8 @@ export function createLicenseContextValue(
106
130
  const activeEntitlement = featureAuthority?.active ? featureAuthority : null;
107
131
  const resolvedStatus = activeEntitlement
108
132
  ? "valid"
109
- : readyEntitlement?.source === "managedOrgSubscription"
133
+ : readyEntitlement?.source === "managedOrgSubscription" ||
134
+ readyEntitlement?.source === "awsMarketplaceDeploymentLicense"
110
135
  ? "none"
111
136
  : featureAuthority
112
137
  ? (status ?? "none")
@@ -8,24 +8,9 @@ import {
8
8
  parseAndWarnTelemetryId,
9
9
  } from "./lambda-client";
10
10
  import { computeSamplingMeta, TELEMETRY_EMITTER_V1 } from "./sampling";
11
+ import { isTelemetryDisabled } from "./telemetry-disabled";
11
12
 
12
- /**
13
- * Checks if telemetry is disabled via environment variables.
14
- * Users can opt out by setting:
15
- * - COPILOTKIT_TELEMETRY_DISABLED=true or COPILOTKIT_TELEMETRY_DISABLED=1
16
- * - DO_NOT_TRACK=true or DO_NOT_TRACK=1
17
- */
18
- export function isTelemetryDisabled(): boolean {
19
- return (
20
- (process.env as Record<string, string | undefined>)
21
- .COPILOTKIT_TELEMETRY_DISABLED === "true" ||
22
- (process.env as Record<string, string | undefined>)
23
- .COPILOTKIT_TELEMETRY_DISABLED === "1" ||
24
- (process.env as Record<string, string | undefined>).DO_NOT_TRACK ===
25
- "true" ||
26
- (process.env as Record<string, string | undefined>).DO_NOT_TRACK === "1"
27
- );
28
- }
13
+ export { isTelemetryDisabled };
29
14
 
30
15
  /** Transport identity and sampling authority resolved for one runtime. */
31
16
  export interface TelemetryIdentity {
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Checks if telemetry is disabled via environment variables.
3
+ * Users can opt out by setting:
4
+ * - COPILOTKIT_TELEMETRY_DISABLED=true or COPILOTKIT_TELEMETRY_DISABLED=1
5
+ * - DO_NOT_TRACK=true or DO_NOT_TRACK=1
6
+ *
7
+ * Lives in its own module so that the browser-facing root entry can
8
+ * re-export it without pulling in `telemetry-client.ts`, whose
9
+ * `@segment/analytics-node` import drags Node built-ins into browser
10
+ * bundler module graphs. See the note in `../index.ts`.
11
+ */
12
+ export function isTelemetryDisabled(): boolean {
13
+ return (
14
+ (process.env as Record<string, string | undefined>)
15
+ .COPILOTKIT_TELEMETRY_DISABLED === "true" ||
16
+ (process.env as Record<string, string | undefined>)
17
+ .COPILOTKIT_TELEMETRY_DISABLED === "1" ||
18
+ (process.env as Record<string, string | undefined>).DO_NOT_TRACK ===
19
+ "true" ||
20
+ (process.env as Record<string, string | undefined>).DO_NOT_TRACK === "1"
21
+ );
22
+ }
@@ -4,6 +4,7 @@ export * from "./console-styling";
4
4
  export * from "./errors";
5
5
  export * from "./json-schema";
6
6
  export * from "./inspector-metadata";
7
+ export * from "./inspector-learning";
7
8
  export * from "./inspector-visibility";
8
9
  export * from "./types";
9
10
  export * from "./random-id";
@@ -0,0 +1,213 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import {
3
+ parseInspectorLearningRequestV1,
4
+ parseInspectorLearningSnapshotV1,
5
+ parseInspectorLearningUrl,
6
+ } from "./inspector-learning";
7
+
8
+ const emptySnapshot = () => ({
9
+ schemaVersion: 1,
10
+ projectKey: "project-safe-key",
11
+ snapshotVersion: "snapshot-1",
12
+ webAppOrigin: "https://app.copilotkit.ai",
13
+ configuration: { state: "not_configured" },
14
+ pendingThreadCount: 0,
15
+ run: { hasActiveRun: false, hasEverSucceeded: false, latest: null },
16
+ pendingCandidateCount: 0,
17
+ skillsPage: {
18
+ page: 1,
19
+ pageSize: 3,
20
+ total: 0,
21
+ totalPages: 0,
22
+ items: [],
23
+ },
24
+ insightsPage: {
25
+ page: 1,
26
+ pageSize: 4,
27
+ total: 0,
28
+ totalPages: 0,
29
+ items: [],
30
+ },
31
+ links: {
32
+ learning: "https://app.copilotkit.ai/learning",
33
+ candidates: null,
34
+ runs: null,
35
+ },
36
+ });
37
+
38
+ describe("Inspector Learning wire validation", () => {
39
+ it("accepts and copies a bounded V1 snapshot", () => {
40
+ const source = emptySnapshot();
41
+ const parsed = parseInspectorLearningSnapshotV1(source);
42
+
43
+ expect(parsed).toEqual(source);
44
+ expect(parsed).not.toBe(source);
45
+ });
46
+
47
+ it("copies only the supported fields from the latest Learning run", () => {
48
+ const source = {
49
+ ...emptySnapshot(),
50
+ run: {
51
+ hasActiveRun: false,
52
+ hasEverSucceeded: true,
53
+ latest: {
54
+ status: "succeeded",
55
+ completedAt: "2026-09-04T12:00:00.000Z",
56
+ internalPayload: "must-not-cross-the-boundary",
57
+ },
58
+ },
59
+ };
60
+
61
+ expect(parseInspectorLearningSnapshotV1(source)?.run.latest).toEqual({
62
+ status: "succeeded",
63
+ completedAt: "2026-09-04T12:00:00.000Z",
64
+ });
65
+ });
66
+
67
+ it("rejects unsafe links and oversized evidence", () => {
68
+ expect(
69
+ parseInspectorLearningUrl(
70
+ "javascript:alert(1)",
71
+ "https://app.copilotkit.ai",
72
+ ),
73
+ ).toBeUndefined();
74
+ expect(
75
+ parseInspectorLearningUrl(
76
+ "http://example.com/learning",
77
+ "https://app.copilotkit.ai",
78
+ ),
79
+ ).toBeUndefined();
80
+ expect(
81
+ parseInspectorLearningUrl(
82
+ "https://attacker.example/learning",
83
+ "https://app.copilotkit.ai",
84
+ ),
85
+ ).toBeUndefined();
86
+ expect(
87
+ parseInspectorLearningUrl(
88
+ "https://app.copilotkit.ai.evil.test/learning",
89
+ "https://app.copilotkit.ai",
90
+ ),
91
+ ).toBeUndefined();
92
+ expect(
93
+ parseInspectorLearningUrl(
94
+ "http://localhost:3000/learning",
95
+ "http://localhost:3000",
96
+ ),
97
+ ).toBe("http://localhost:3000/learning");
98
+ expect(
99
+ parseInspectorLearningUrl(
100
+ "https://intelligence.customer.example/learning",
101
+ "https://intelligence.customer.example",
102
+ ),
103
+ ).toBe("https://intelligence.customer.example/learning");
104
+
105
+ const snapshot = emptySnapshot();
106
+ snapshot.insightsPage = {
107
+ page: 1,
108
+ pageSize: 4,
109
+ total: 1,
110
+ totalPages: 1,
111
+ items: [
112
+ {
113
+ id: "insight-1",
114
+ statement: "A bounded pattern",
115
+ impact: "A bounded impact",
116
+ totalThreadCount: 101,
117
+ evidenceTruncated: true,
118
+ evidence: Array.from({ length: 101 }, (_, index) => ({
119
+ status: "available",
120
+ threadId: `thread-${index}`,
121
+ threadName: null,
122
+ messageIds: [],
123
+ updatedAt: "2026-09-03T00:00:00.000Z",
124
+ })),
125
+ },
126
+ ],
127
+ };
128
+ expect(parseInspectorLearningSnapshotV1(snapshot)).toBeUndefined();
129
+ });
130
+
131
+ it("rejects required actions that are absent or point at another origin", () => {
132
+ const missingRuns = emptySnapshot();
133
+ missingRuns.pendingThreadCount = 1;
134
+ expect(parseInspectorLearningSnapshotV1(missingRuns)).toBeUndefined();
135
+
136
+ const missingCandidates = emptySnapshot();
137
+ missingCandidates.pendingCandidateCount = 1;
138
+ expect(parseInspectorLearningSnapshotV1(missingCandidates)).toBeUndefined();
139
+
140
+ const arbitraryOrigin = emptySnapshot();
141
+ arbitraryOrigin.links.learning = "https://attacker.example/learning";
142
+ expect(parseInspectorLearningSnapshotV1(arbitraryOrigin)).toBeUndefined();
143
+
144
+ const configuredOrigin = emptySnapshot();
145
+ configuredOrigin.webAppOrigin = "https://intelligence.customer.example";
146
+ configuredOrigin.links.learning =
147
+ "https://intelligence.customer.example/learning";
148
+ expect(parseInspectorLearningSnapshotV1(configuredOrigin)).toBeDefined();
149
+ });
150
+
151
+ it("accepts identifier-free unavailable evidence separately from unnamed evidence", () => {
152
+ const snapshot = emptySnapshot();
153
+ snapshot.insightsPage = {
154
+ page: 1,
155
+ pageSize: 4,
156
+ total: 1,
157
+ totalPages: 1,
158
+ items: [
159
+ {
160
+ id: "insight-1",
161
+ statement: "Verify the order.",
162
+ impact: "Avoids incorrect guidance.",
163
+ totalThreadCount: 2,
164
+ evidenceTruncated: false,
165
+ evidence: [
166
+ { status: "unavailable" },
167
+ {
168
+ status: "available",
169
+ threadId: "thread-2",
170
+ threadName: null,
171
+ messageIds: ["message-2"],
172
+ updatedAt: "2026-09-03T00:00:00.000Z",
173
+ },
174
+ ],
175
+ },
176
+ ],
177
+ };
178
+
179
+ expect(parseInspectorLearningSnapshotV1(snapshot)).toBeDefined();
180
+ snapshot.insightsPage.items[0].evidence[0] = {
181
+ status: "unavailable",
182
+ threadId: "former-id",
183
+ };
184
+ expect(parseInspectorLearningSnapshotV1(snapshot)).toBeUndefined();
185
+ });
186
+
187
+ it("rejects inconsistent server pagination", () => {
188
+ const snapshot = emptySnapshot();
189
+ snapshot.insightsPage = {
190
+ page: 2,
191
+ pageSize: 4,
192
+ total: 1,
193
+ totalPages: 1,
194
+ items: [],
195
+ };
196
+
197
+ expect(parseInspectorLearningSnapshotV1(snapshot)).toBeUndefined();
198
+ });
199
+
200
+ it("accepts only the browser-owned scope and pagination fields", () => {
201
+ expect(
202
+ parseInspectorLearningRequestV1({
203
+ agentId: "support",
204
+ skillsPage: 2,
205
+ insightsPage: 3,
206
+ }),
207
+ ).toEqual({ agentId: "support", skillsPage: 2, insightsPage: 3 });
208
+ expect(
209
+ parseInspectorLearningRequestV1({ runtimeContainerId: "attacker-scope" }),
210
+ ).toBeUndefined();
211
+ expect(parseInspectorLearningRequestV1({ skillsPage: 0 })).toBeUndefined();
212
+ });
213
+ });